Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved!] Installing Gentoo: failing to boot after install
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
wolly01
n00b
n00b


Joined: 22 Jul 2017
Posts: 32

PostPosted: Fri Dec 23, 2022 2:00 pm    Post subject: [Solved!] Installing Gentoo: failing to boot after install Reply with quote

Gentoo forum people:


I am currently trying to install the amd64 version of Gentoo following the handbook and making the choices of using OpenRC, efibootmgr and GPT at the relevant stages. I have only deviated from the handbook in two ways: firstly, making a separate partition for /home, and secondly a slight difference in the layout of my efi /boot partition. In particular my efi files and ramdisk are renamed to "bootx64.efi" and "initramfsx64.img" respectively and are located in "\boot\efi\Gentoo" where \boot is the mountpoint of /dev/sda1. Furthermore the command I issued to create my boot entry was:
efibootmgr command
Code:
efibootmgr --create --disk /dev/sda --part 1 --label "Gentoo" --loader "\efi\Gentoo\bootx64.efi" initrd="\efi\Gentoo\initramfsx64.img"


However, after finalizing the install process as per the Handbook I am left in a state where the computer fails to boot properly as it can't mount the root fs properly. I can't grab the complete output of the boot process to file but I have taken a picture of the last screen of the boot before it fails and used an image reader to convert it to text given below:

Code:

VFS: Cannot root device "(null)" or unknown-block(0,0): error —6
Please append a "root=" boot option; here are the available paritions:
Kernel panic — not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
CPU: 1 PID: 1 Comm: swapper /0 Not tainted 5.15.80-gentoo-x86_64 #1
Hardware name: ASUS Susten Product Nane/ROG STRIX X678E-I GAMING WIFI, BIOS 8613 09/22/2822


I do not know how or where to append the "root=" boot option and I can't seem to locate it in the Handbook.
Below are my settings relevant to booting:


efibootmgr
Code:
BootCurrent: 0002
Timeout: 1 seconds
BootOrder: 0000,0002
Boot0000* Linux   HD(1,GPT,afd74f08-9339-9f40-9837-23c57cf88526,0x800,0x400000)/File(\efi\Gentoo\bootx64.efi)47656e746f6f00696e697472643d005c6566695c47656e746f6f5c696e697472616d66737836342e696d6700000000000000000000000000000000000000000000
Boot0002* UEFI: Generic Flash Disk 8.07, Partition 2   PciRoot(0x0)/Pci(0x8,0x1)/Pci(0x0,0x4)/USB(1,0)/HD(2,GPT,09c075d1-c0de-43f5-aeb2-7050c2575ebd,0x214,0x1680)0000424f


fdisk
Code:

Disk /dev/sda: 3.64 TiB, 4000787030016 bytes, 7814037168 sectors
Disk model: ST4000DM004-2U91
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 74F12ED9-EDC0-E446-9440-FC23785BB409

Device          Start        End    Sectors  Size Type
/dev/sda1        2048    4196351    4194304    2G EFI System
/dev/sda2     4196352  541067263  536870912  256G Linux swap
/dev/sda3   541067264 2688550911 2147483648    1T Linux filesystem
/dev/sda4  2688550912 7814037134 5125486223  2.4T Linux filesystem


fstab:

Code:
/dev/sda1 /boot vfat defaults 0 2
/dev/sda2 none swap sw 0 0
/dev/sda3 / brtfs defaults 0 1
/dev/sda4 /home brtfs defaults 0 2



Aside from the two deviations mentioned I have to my knowledge followed the handbook faithfully. Whilst when it comes to Linux in general I am a beginner, I have in the past successfully installed Gentoo completely before using the handbook albeit with GRUB and ended up with a working and complete system. Thus I am reasonably confident in my following of the Handbook. I have, nonetheless, re-gone through my steps twice and cannot find an issue.

To generate my kernel I used genkernel. I ensured that all the relevant filesystems where included directly into the kernel, but I may have left something important out by mistake. I would post my kernel .config file but I can't as of yet seem to locate it. if anyone would like to view the kernel config file please let me know where genkernel saves them and I will provide it.

Can anyone help me get my system to successfully get through the boot phase?


Last edited by wolly01 on Sat Dec 24, 2022 8:35 pm; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54300
Location: 56N 3W

PostPosted: Fri Dec 23, 2022 3:11 pm    Post subject: Reply with quote

wolly01,

Code:
VFS: Cannot root device "(null)" or unknown-block(0,0): error —6
Please append a "root=" boot option; here are the available paritions:
Kernel panic — not syncing: VFS: Unable to mount root fs on unknown-block(0,0) ,


Tells that the kernel failed to mount root.

Code:
efibootmgr --create --disk /dev/sda --part 1 --label "Gentoo" --loader "\efi\Gentoo\bootx64.efi" initrd="\efi\Gentoo\initramfsx64.img"

Make it appear that you want the EFI firmware to load your initramfs.
As that would have been mounted as root, it looks like that''s not happening.

Code:
Please append a "root=" boot option; here are the available paritions:

In a list of all the block devices the kernel can see. It's not obvious but the list is empty, so none at all.

How do you pass the kernel command line?

Gentoo works best when you make it work first and make it better later.
Use the grub boot loader to get you going, then play with EFI does it all later, once you have a set of bits that work.
There should be no change to the kernel or initrd to use grub.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
wolly01
n00b
n00b


Joined: 22 Jul 2017
Posts: 32

PostPosted: Fri Dec 23, 2022 3:49 pm    Post subject: Reply with quote

NeddySeagoon, thanks for the response!


Quote:
How do you pass the kernel command line?


that is something which I don't can't gleam full understanding of from the Handbook. I think I have done it by setting:

Code:
[*] Built-in kernel command line
    (root=/dev/sda3)


in my kernel configurations. However, if this is not the appropriate setting then I do not know what to do here.

In terms of GRUB, I will try falling back to that this evening and let you know how I get on. If I do get that working I may still require some assistance in switching back to using the uefi boot.

cheers!
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4236
Location: Bavaria

PostPosted: Fri Dec 23, 2022 3:57 pm    Post subject: Reply with quote

wolly01 wrote:
Code:
[*] Built-in kernel command line
    (root=/dev/sda3)


in my kernel configurations. However, if this is not the appropriate setting then I do not know what to do here.

This is correct. maybe your UEFI entry is wrong (you will need parameter -u for options; also no "" for initrd=...). Try this one:
Code:
efibootmgr --create --disk /dev/sda --part 1 --label "Gentoo" --loader "\efi\Gentoo\bootx64.efi" -u "root=/dev/sda3 initrd=\efi\Gentoo\initramfsx64.img"

(See more here: https://wiki.gentoo.org/wiki/Efibootmgr )

Check with "efibootmgr -u"


P.S.: I wrote Gentoo in above command with "g" ... :oops:


Last edited by pietinger on Fri Dec 23, 2022 4:57 pm; edited 1 time in total
Back to top
View user's profile Send private message
wolly01
n00b
n00b


Joined: 22 Jul 2017
Posts: 32

PostPosted: Fri Dec 23, 2022 4:02 pm    Post subject: Reply with quote

Thanks, I will try this fix and then attempt Grub if it does not work!
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54300
Location: 56N 3W

PostPosted: Fri Dec 23, 2022 4:08 pm    Post subject: Reply with quote

wolly01,

There is an overview of the PC Boot Process which mak help understanding what's going on.
If your root is /dev/sda3, then the built in kernel command line is correct.

Its going wrong before the kernel attempts to mount root though.
It appears that one or more of the modules you need to mount root are in the initramfs.
The initramfs also has a control script with error handing, so you get a 'rescue shell' when things go wrong.

The initramfs is a root ffilesystem in a file that is used to mount the real root filesystem.
As you get a kernel panic, not a rescue shell, it looks like the initramfs is not being used. It may not even be loaded.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4236
Location: Bavaria

PostPosted: Fri Dec 23, 2022 4:49 pm    Post subject: Reply with quote

NeddySeagoon wrote:
As you get a kernel panic, not a rescue shell, it looks like the initramfs is not being used. It may not even be loaded.

Yes, the initramfs was not loaded (because of wrong UEFI entry), THEN kernel tries to mount root partition by itself (like kernel would do if built without an initramfs) (information in built-in kernel comman line is correct) ... but fails presumably because of missing module (which is in initramfs ;-) ).
Back to top
View user's profile Send private message
wolly01
n00b
n00b


Joined: 22 Jul 2017
Posts: 32

PostPosted: Fri Dec 23, 2022 5:30 pm    Post subject: Reply with quote

Thanks for the Help you two.

I was just doing some tests along the side and It looks like My PC failed memtest so I'm going to have to start an RMA process before I can resume setting up my OS!


:cry:
Back to top
View user's profile Send private message
wolly01
n00b
n00b


Joined: 22 Jul 2017
Posts: 32

PostPosted: Sat Dec 24, 2022 8:22 am    Post subject: Reply with quote

Great News!

So I originally ran memtest on the Gentoo live-cd which failed. However I set up a memtest usb using the latest image from passmark and ran all the tests for 4 passes without a single error which took about 8hrs. I'm thus willing at the moment to chalk the failure down to the version of memtest on the livecd (though I will run more extensive tests and check with Kingstone soon just to be doubly-sure!).

I followed pietingers advice and retried my UEFI entry using -u. Initially this caused the same kernel panic as before but failed worse as it also somehow caused the PC to decide to remove boot entry from the UEFI list every time I tried it, where before the entry would stay.

So, I did some more digging and double checks. I emerged pciutils and used lspci -kk to determine that the driver for my SATA HDD used by the kernel was ahci. After checking my kernel config I discovered that the associated drivers where still being compiled as modules by accident. Without knowing which specific ahci driver was being used I simply added them all and re-genned my kernel before moving and renaming the stub and ramfs as in my original post and re-adding the boot entry.

On restarting the system I no-longer get a Kernel panic! however, all is not right as the PC fails to mount the root partition and asks me to give a partition or drop into the rescue shell. If I give /dev/sda3/ then the system successfully loads into Gentoo (but fails to mount /home) and I can log in as root (I am yet to make myself a user account). After logging in I can successfully mount /home.

Conversely if I choose the recovery shell I am, unsurprisingly, dropped into a shell. Whilst the shell is responsive and I can use fdisk to locate drives, I cannot for some reason mount any partitions so cannot carry the log files onto a usb stick to paste here. Furthermore it looks like there is no text editor on the rescue shell so I cannot open them to look inside either. What I can access however is the init.log when I manually mount root instead of dropping into the shell. I give one such log below:

Code:
[ 2022-12-24 15:19:29.628810 ] Executed: 'busybox --install -s'
[ 2022-12-24 15:19:29.629489 ] [OK] Genkernel 4.2.6 (2022-12-24 11:15:30 UTC). Linux kernel 5.15.80-gentoo-x86_64
[ 2022-12-24 15:19:29.658580 ] Executed: 'mount -t devtmpfs -o exec,nosuid,mode=0755,size=10M udev /dev'
[ 2022-12-24 15:19:29.659408 ] Executed: 'mkdir -m 0755 /dev/pts'
[ 2022-12-24 15:19:29.659883 ] Executed: 'mount -t devpts -o gid=5,mode=0620 devpts /dev/pts'
[ 2022-12-24 15:19:29.660286 ] Executed: 'mkdir -m 1777 /dev/shm'
[ 2022-12-24 15:19:29.660679 ] Executed: 'mount -t tmpfs -o mode=1777,nosuid,nodev,strictatime tmpfs /dev/shm'
[ 2022-12-24 15:19:29.661076 ] Executed: 'mount -t sysfs sysfs /sys -o noexec,nosuid,nodev'
[ 2022-12-24 15:19:29.661350 ] [OK] Loading first modules ...
[ 2022-12-24 15:19:29.662599 ] NOTE: Due to how genkernel auto-detects your hardware you will now see a lot of failed modprobe attempts which you can ignore:
[ 2022-12-24 15:19:29.662976 ] Loading modules of module group 'firstmods' (smart loading: yes) ...
[ 2022-12-24 15:19:29.665138 ] Failed (1): 'modprobe btrfs'
[ 2022-12-24 15:19:29.666177 ] [OK] Activating udev ...
[ 2022-12-24 15:19:29.667793 ] Executed: 'udevd --resolve-names=never --daemon'
[ 2022-12-24 15:19:29.676908 ] Executed: 'udevadm trigger --action=add'
[ 2022-12-24 15:19:30.276726 ] Executed: 'udevadm settle --timeout=120'
[ 2022-12-24 15:19:30.283351 ] Executed: 'udevadm settle --timeout=120'
[ 2022-12-24 15:19:30.284282 ] Executed: 'mkdir -p /newroot'
[ 2022-12-24 15:19:30.285287 ] [OK] Determining root device (trying ) ...
[ 2022-12-24 15:19:36.068985 ] [!!] Block device  is not a valid root device ...
[ 2022-12-24 15:19:36.070606 ] [!!] Could not find the root block device in .
[ 2022-12-24 15:19:36.071906 ] [!!] Please specify another value or:
[ 2022-12-24 15:19:36.073089 ] [!!] - press Enter for the same
[ 2022-12-24 15:19:36.074323 ] [!!] - type "shell" for a shell
[ 2022-12-24 15:19:36.075465 ] [!!] - type "q" to skip ...
[ 2022-12-24 15:20:04.309176 ] [OK] Determining root device (trying /dev/sda3) ...
[ 2022-12-24 15:20:04.311124 ] [OK] Root device detected as /dev/sda3!
[ 2022-12-24 15:20:04.312986 ] [OK] Mounting /dev/sda3 as root ...
[ 2022-12-24 15:20:04.315647 ] [OK] Using mount -t btrfs -o ro /dev/sda3 /newroot
[ 2022-12-24 15:20:04.507264 ] Executed: 'mount -t btrfs -o ro /dev/sda3 /newroot'
[ 2022-12-24 15:20:04.533437 ] Failed (1): 'mountpoint -q /newroot/usr'
[ 2022-12-24 15:20:04.559429 ] Failed (1): 'mountpoint -q /newroot/usr'
[ 2022-12-24 15:20:04.576734 ] Executed: 'udevadm settle --timeout=120'
[ 2022-12-24 15:20:04.590283 ] Executed: 'udevadm control --exit'
[ 2022-12-24 15:20:04.696748 ] [OK] Restoring console log level (7) ...
[ 2022-12-24 15:20:04.698249 ] COMMAND: 'echo "7" > /proc/sys/kernel/printk'
[ 2022-12-24 15:20:04.698575 ] [OK] Switching to real root: switch_root /newroot /sbin/init



One observation of my current set-up is that even after adding the extra flags to the boot entry, when using efibootmgr to view the boot entry it does not show the strings of the extra flags root and initrd and instead looks much the same as the entry I originally gave. It is entirely possible that the strings are contained within the hex-data or simply omitted by efibootmgr. However as it stands I have no confirmation that those extra flags have successfully been imprinted onto the boot-entry.

Another observation is that the efi-stub as it currently stands is seeming to be having trouble with the btfs file system, despite the file-system support being added directly into the kernel. I should mention that genkernel states at the end of its process that because there are multiple files systems being supported that one should add a flag of the form 'rootfstype=...'. However, it does not tell me where to add this flag: should I try it as another flag for efibootmgr? additionally, in the boot process Linux complains literally of unknown filesystem type `brtfs` (when trying to mount /home), but will mount such a filesystem (/dev/sda3) when manually instructed to. This is a little confusing!


It seems that my system is struggling to deal with the brtfs file-system but I'm not entirely sure how to rectify this problem. Can anyone advise?


Note I have not yet tried GRUB still. I am still open to doing this, however as I can now get my system to boot from uefi (after giving it a little prod in the right direction), I am unsure of the utility of ding so.
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4236
Location: Bavaria

PostPosted: Sat Dec 24, 2022 12:12 pm    Post subject: Reply with quote

wolly01 wrote:
One observation of my current set-up is that even after adding the extra flags to the boot entry, when using efibootmgr to view the boot entry it does not show the strings of the extra flags root and initrd and instead looks much the same as the entry I originally gave.

If "efibootmgr -u" (the u is important) doesnt show you the kernel parameter, THEN your UEFI is not capable of it (there exists some UEFIs). In this case you must put ALL kernel command line paramter into your kernel directly. See more here: https://wiki.gentoo.org/wiki/User:Pietinger/Tutorials/Kernel_Commandline_Parameter

wolly01 wrote:
Another observation is that the efi-stub as it currently stands is seeming to be having trouble with the btfs file system, despite the file-system support being added directly into the kernel. I should mention that genkernel states at the end of its process that because there are multiple files systems being supported that one should add a flag of the form 'rootfstype=...'. However, it does not tell me where to add this flag:

If you use btrfs then you CAN put 'rootfstype=...' also into your built-in kernel command line.

wolly01 wrote:
It seems that my system is struggling to deal with the brtfs file-system but I'm not entirely sure how to rectify this problem. Can anyone advise?

Maybe it was only your missing rootfstype=. But maybe you only miss some modules in your kernel config. We can have a look onto your config if you give it us (best with wgetpaste).
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54300
Location: 56N 3W

PostPosted: Sat Dec 24, 2022 4:50 pm    Post subject: Reply with quote

wolly01,

rootfstype is a kernel parameter and goes on the kernel command line.

It won't fix anything. When its missing, the kernel tries all the filesystems it knows to mount root.

Quote:
... there is no text editor on the rescue shell ...
Use
Code:
more /path/to/file
to read text files in a pager.
cat will print the file to the screen.

At
Code:
[ 2022-12-24 15:19:30.285287 ] [OK] Determining root device (trying ) ...
[ 2022-12-24 15:19:36.068985 ] [!!] Block device  is not a valid root device ...
[ 2022-12-24 15:19:36.070606 ] [!!] Could not find the root block device in .
the kernel cannot see any block devices.
That's an empty list of all the block devices known to the kernel.

but 40 seconds later ...
Code:
[ 2022-12-24 15:20:04.309176 ] [OK] Determining root device (trying /dev/sda3) ...
[ 2022-12-24 15:20:04.311124 ] [OK] Root device detected as /dev/sda3!
[ 2022-12-24 15:20:04.312986 ] [OK] Mounting /dev/sda3 as root ...
[ 2022-12-24 15:20:04.315647 ] [OK] Using mount -t btrfs -o ro /dev/sda3 /newroot


That points to a race condition. You can try making brtfs built into the kernel, no a loadable module.
It can be any piece of the SCSI stack not being ready in time. The filesystem driver can't work without the rest of it.
Personally, I like to not need an initramfs for kernel modules.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
wolly01
n00b
n00b


Joined: 22 Jul 2017
Posts: 32

PostPosted: Sat Dec 24, 2022 8:01 pm    Post subject: Reply with quote

Thanks for the continued help.


I retried using efiboormgr -u a few times just to make certain that it was not working for my device, and then tried altering the kernel command line parameter. I found out that I had forgot to prefix my parameter with root= originally and just had /dev/sda3 set, which may have been causing problems. I updated the parameter to:


Code:

root=/dev/sda3 rootfstype=btrfs initrd=\efi\Gentoo\initramfsx64.img



Upon recompiling and moving the files around in /boot to the appropriate places I now successfully boot without having to input /dev/sda3 as the boot device. However, the system still fails to mount /home as it initiates and when attempting to do so it still complains of unknown filesystem type `brtfs`. I double checked my krnel config and I definitely have btrfs in the kernel and not as a module. Here is my config: https://dpaste.com/5EKSJJn6w.

Other than that, everything seems to be running fine. NeddySeagoon thanks for the info on more. I now no-longer hit the rescue-shell. I think the 40 second time difference is due to me manually instructing the system to try and mount /dev/sda3 via the terminal, so it may not be a race condition. My new init log file is given here: https://dpaste.com/2E3HA4NU3. I would give the log of the boot after the system switches root but I do not know where the log is stored and my google fu isn't strong enough to figure it out.

In essence my problem is reduced to getting my btrfs /dev/sda4/ partition to successfully mount to /home at boot. (I can manually mount it just fine once I log in). any advice? I can give other config files if you need and my fstab remains unchanged.
Back to top
View user's profile Send private message
wolly01
n00b
n00b


Joined: 22 Jul 2017
Posts: 32

PostPosted: Sat Dec 24, 2022 8:35 pm    Post subject: Reply with quote

Oh my goodness I am an idiot. I misspelled btrfs as brtfs in my fstab twice and haven't noticed this entire time. I have made the correction and all now works.

Many thanks for the help, especially with regards to the efi bootmanger/kernel command line parameters!

Issue is now solved yay!
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54300
Location: 56N 3W

PostPosted: Sat Dec 24, 2022 8:38 pm    Post subject: Reply with quote

wolly01,

You are looking for dmesg.
Use wgetpaste to share it. It won't be installed yet.

Also share your /etc/fstab. That will go into a post though.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum