# Genkernel doesn't accept 'root=</dev>' value

## sixtysixtysix

Hi all,

it's perfectly possible I may still be misunderstanding something but as new to Gentoo I particularly want to get things right as I proceed.

Machine boots and runs, but I've been compiling the kernel over and again as I try to figure out why I'm getting a few errors.

Every time it finishes the build process it tells me

```
Kernel compiled successfully!

* 

* --no-bootloader set; Skipping bootloader update ...

* 

* Required kernel parameter:

* 

*    root=/dev/$ROOT

* 

* Where $ROOT is the device node for your root partition as the

* one specified in /etc/fstab

* If you require Genkernel's hardware detection features, you MUST

* tell your bootloader to use the provided initramfs file '/boot/initramfs-5.12.14-gentoo-x86_64.img'.

```

I read the wiki and used the newer keyword root= but however I specify that "device node" nothing changes.

Here's my fstab 

```
# <fs>         <mountpoint>   <type>      <opts>      <dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.

#

# NOTE: Even though we list ext4 as the type here, it will work with ext2/ext3

#       filesystems.  This just tells the kernel to use the ext4 driver.

#

# NOTE: You can use full paths to devices like /dev/sda3, but it is often

#       more reliable to use filesystem labels or UUIDs. See your filesystem

#       documentation for details on setting a label. To obtain the UUID, use

#       the blkid(8) command.

PARTUUID=d84b4f6e-d456-f249-ba7a-2b20d874130c      /boot      vfat      defaults,noatime   0 2

PARTUUID=206eafe6-6171-004a-b50b-493c64fc6ee1      /      ext4      defaults,noatime,x-gvfs-hide   0 1

PARTUUID=fb82c6bd-7f92-a142-ad40-0e379bfa0224      none      swap      sw      0 0

/dev/sr0      /mnt/cdrom   auto      noauto,user   0 0

PARTUUID=b7fab0df-c038-4f41-91f2-98dd8ecf847b      /home/alan/Music   ext4   defaults,noatime,x-gvfs-hide   0 0

PARTUUID=b948d754-9f04-834b-b047-db29ae9c54d7      /home/alan/Data      ext4   defaults,noatime,x-gvfs-hide   0 0
```

I must be doing something wrong? Do I need to use 

```
/dev/disk/by/PARTUUID=
```

 ?

Whether I simply write 

```
root="/dev/sda3"
```

 or 

```
 root="PARTUUID=206eafe6-6171-004a-b50b-493c64fc6ee1"
```

 it still comes back with the same error.

While the machine boots fine, I'm guessing that the kernel won't load any of the modules or options I set up during genkernal config unless it knows about the root partition?

Can someone advise please? Thanks.

p.s. not sure I need to post my emerge --info for this one do I? Will do so if needed.

----------

## Jaglover

sixtysixtysix,

when kernel boots then the root filesystem is not mounted yet and not accessible. Since fstab resides in root filesystem it cannot be read at this time. Therefore, for kernel to know where root filesystem is the root=<device> must be passed directly to the kernel, in its command line. Usually the booloader you are using is responsible for passing options to kernel. The command line can be also set in kernel configuration, useful with EFI stub kernel. As for genkernel setup - can't help here, never used it myself.

----------

## sixtysixtysix

bing! (sound of light going on!)

Thank you!

Okay so... I'm loading via an EFI stub entry. I write all my additional boot parameters with efibootmgr - which as you may know is pretty unfriendly i.e. you can't edit an entry, simply redo the whole thing.

It's a bit confusing... I define this root partition directly inside this stub entry when I write the entry using efibootmgr[/b] and that exact definition via PARTUUID. Does this mean I've already acheived what was required?

One further question: I have Arch on a separate drive, but obviously with all boot entries in my UEFI interface. I boot Arch using Systemd - which obviously I'm not using here (I prefer to try out the rcinit ideas). I can boot Arch by means of using text files inside the /boot/efi partitions. Is there a similar method available for Gentoo, or do I have to keep writing out  these long EFI stub entries?

Thanks for the help so far  :Smile: 

----------

## Jaglover

You need to specify root=<> in just one place, if it is set in kernel configuration then that's it. You can use PARTUUID in kernel if you wish, instead of /dev/sdXX.

Your text files in /boot/efi belong to systemd bootlader, the booloader itself is an EFI executable. As seen below my Gentoo kernel is such an EFI executable.

```
file /boot/EFI/Boot/gentoo.efi 

/boot/EFI/Boot/gentoo.efi: Linux kernel x86 boot executable bzImage, version 5.12.12-gentoo (root@zeus) #1 SMP Sat Jun 19 10:36:59 CDT 2021, RO-rootFS, swap_dev 0x4, Normal VGA

```

In my example the kernel image is named gentoo.efi, every time I upgrade I copy it to oldgentoo.efi and the new kernel will be gentoo.efi. This way I never need to write new entries with efibootmgr.

----------

## sixtysixtysix

again VERY helpful. Thanks!

You managed to touch on the last part of this slight trawl through the intricacies of kernel building (for the novice)...

I set the key for SYMLINK="yes" after having set the correct USE keys for gentoo-sources etc. (in package.use, in my case). However the build always fails (in Genkernel) when it says it has no directory permissions to write to /boot.

I'd like to have the symlink in place for those obvious reasons, so another question is: to create the symlink in the first place, do I need to boot into the LiveCD and build[/b] from "outside" the system? I'm not aware I have any other permission conflicts... I've tried building both with Sudo perms from user, and as Root, but it still falls at failing to write a symlink.

----------

## Jaglover

Sorry, I have no clue how genkernel builds and installs. All I can say is there is a common mistake made by novice users, they forget to mount /boot when attempting to install kernel and as a result the kernel does not install properly. I suspect genkernel install process is not compatible with EFI stub kernel. I may be wrong.

You can build and install kernels from running system, there is no need to boot from external media. Once kernel is booted it resides in RAM and you can delete the image from your hard drive, your Linux keeps running, until you shut it down. Meaning you can replace the kernel image with newer version in a running system and it will be loaded next reboot.

If genkernel install is trying to create symlinks in /boot then it is not going to work, the FAT filesystem you must use for ESP partition does not support symlinks.

----------

## Hu

If you get root= wrong, the kernel will not mount the root partition, and will most likely panic.  You say the machine boots fine, so you must have set root= to a reasonable value or you would not have gotten this far.  Modules are probably fine, unless you do something exotic like have two distinct root filesystems (say, one Gentoo and one Arch), and you managed to install the modules to one root and then point the kernel to the other root.  At worst, this should result in the modules not loading, which would mean you have reduced functionality until you fix that.  It should not break anything, although depending on how much functionality is reduced, the system could be difficult to use.  (For example, if your network or video drivers are modules that cannot be found.)

The genkernel output in the first post looks to me like advice to ensure you configure your bootloader properly, not an error. *sixtysixtysix wrote:*   

> I'd like to have the symlink in place for those obvious reasons, so another question is: to create the symlink in the first place, do I need to boot into the LiveCD

 The symlink is not special.  Root can create it with a simple ln -s, assuming the filesystem supports it.  You can do this from any environment where you have root: Gentoo, Arch, LiveCD, etc.  Since you are using UEFI, I would not be surprised if the filesystem used for /boot does not support it.  EFI firmware is terribly limited in what it understands, so your boot filesystem is almost certainly FAT.  FAT is too primitive to support symlinks.  You cannot change from FAT if you want the firmware to interact properly with that filesystem.Last edited by Hu on Mon Jul 05, 2021 5:12 pm; edited 1 time in total

----------

## sixtysixtysix

thank you for this. Indeed it is good to be clear and precise.

To help explain: this machine has three physical drives in it. My Arch is on an Nvme M.2 drive. I've installed Gentoo on an old Western Digital HDD. From fdisk -l I can see the physically separate drives, and have used these distinctions in each boot entry, thus there's zero possibility of my pointing things the wrong way.

I think the more likely thing - something I'm directly addressing now - is that somehow with all this messing about, the .config I used for my last kernel compile doesn't match the kernel source.

So I've abandoned Genkernel for now and am manually building from within /usr/src/linux to ensure everything matches.

Why? Because despite having thoroughly checked the config used for the build, I note I have no sound card... and there are NO unloaded modules, it simply isn't there. So clearly something was still a bit wrong.

Live long and prosper, and all that  :Wink: 

----------

## NeddySeagoon

sixtysixtysix,

Are you actually booting the kernel you think you are?

Look at the time and date in 

```
$ uname -a

Linux NeddySeagoon_Static 5.12.13-gentoo #1 SMP PREEMPT Fri Jun 25 14:53:48 BST 2021 x86_64 AMD Phenom(tm) II X6 1090T Processor AuthenticAMD GNU/Linux
```

That Fri Jun 25 14:53:48 BST 2021 is the build time of my running kernel. That's right, as I recall updating the kernel about then.

When you look at the build time in your 

```
uname -a
```

does it tie in with your memory.

```
Kernel compiled successfully!

*

* --no-bootloader set; Skipping bootloader update ...

*

* Required kernel parameter:

*

*    root=/dev/$ROOT

*

* Where $ROOT is the device node for your root partition as the

* one specified in /etc/fstab 
```

Thats not an error to you, so feel free to ignore it. Its a warning to everyone else that uses a bootloader.

----------

## sixtysixtysix

yes, thank you. I have checked this (I saw you kindly helping another on the forum with this), so I ran the same checks myself.

Three things I've discovered:

1: building via # make menuconfig and the following steps does not create an initramfs. I may try without one - after all, it's a UEFI mainboard, all my partitions are GPT, and I read somewhere that an initramfs is not completely necessary. No worries because if it is, I'll just do this all again  :Wink: 

2: reading through the manual build led me to a page which shows me that I have to edit a .conf in /etc/modprobe.d/ - however I've never had to do this previously. So, I'll just keep trying and see what works (despite of course I AM reading everything, this isn't simple trial and error).

3: in my last pass through the menuconfig, I actually omitted the very first option on the HD Audio section - the module which loads PCI snd on HD!! I think this may have something to do with my problem!

So again... all lovely to have all this help, and although in truth I appear to have done NOTHING ELSE AT ALL in my life for the past four days... I am learning a lot, and I do think Gentoo is going to be my new daily driver, so it's worth all the effort  :Smile: 

----------

## NeddySeagoon

sixtysixtysix,

The initrd is optional provided the kernel has all the code it need to mount the root filesystem configured as <*>

When your boot loader whatever it is, loads the kernel and exits, the kernel is all alone in RAM.

You either provide a kernel that can mount root unaided or an initrd to help out, or you get a kernel panic. :)

The initrd is a temporary root filesystem used to mount the real root filesystem.

It can be build into the kernel too, so need not be a separate file.

Don't get too hung up an the kernel. As long as the kernel you have boots, you can learn about kernel later.

----------

## pietinger

sixtysixtysix,

I dont know what is your knowledge about linux, so please be patient when I describe something you already know.

UEFI is fine (I like it because only with UEFI you can have SecureBoot; I have it). You can always talk with UEFI and set new boot-entries with "efibootmgr". "efibootmgr" install nothing; it only talks to your UEFI and tell it to create a new boot-entry (or delete some). "efibootmgr -v" shows your current entries (the same you will see when you go into your BIOS). Important: efibootmgr talks via efivarfs; so this is needed (therefore it will be enabled in the kernel in the AMD64-handbook). See more here: https://wiki.gentoo.org/wiki/Efibootmgr and here: https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Kernel

UEFI needs an ESP (efi system partition). It must be fat32. You will probably have one. See more here: https://wiki.gentoo.org/wiki/EFI_System_Partition

I encourage you to configure your own kernel. You will learn very much about linux. I wrote a german guide for doing this (you can use only the links I gave here; or you can use google translator): https://forums.gentoo.org/viewtopic-t-1112778.html

Forget initrd for now. And dont do anything with /etc/modprobe.d/ Your kernel is able to load all needed modules by itself

(I like people who loves gentoo; because I love it to  :Smile:  )

----------

## sixtysixtysix

thank you, pietinger.

I am reasonably familiar with general setting in efibootmgr, but am very happy to know that I can leave /etc/modprobde.d alone  :Smile: 

Currently just going through processes one step at a time, finding out how to fix things if they occur. I will again say though that based on current experience of less than a week, it's really VERY good this emerge/build system  :Smile: 

I'm only dealing with kernel issues now - otherwise I'm very satisfied with how all the user space stuff is going  :Smile: 

----------

## Jaglover

sixtysixtysix,

for full kernel experience instead of trimming it down you can start with 'make allnoconfig', you will start with minimal config and you need to add everything you need. Warning: don't send your coffee bill to me (or whatever keeps you going). You'll need to go thru all menus and then again and then again, new options become available as you turn them on.   :Razz: 

----------

## pietinger

 *Jaglover wrote:*   

> for full kernel experience instead of trimming it down you can start with 'make allnoconfig',  [...]

 

I dont recommend this. The default configuration (you get with emerging the gentoo-sources) is very pretty to start. I recommend to do a "lspci -k" and a "lsmod" (write down all used modules) after booting with the minimal-CD and before starting the configuration. With all Gentoo-WiKi-Pages we have it is then easy going (only work).

----------

## Jaglover

pietinger,

 :Razz:   I do recommend this. Now what?   :Razz:  It depends on what you want. If you want a quick kernel then don't do it. For lasting fun and lots of new knowledge make allnoconfig is just what doctor ordered. Or this is not allowed in your world? Everyone must do default configuration and if they do something else then they are doing it wrong?

----------

## pietinger

Jaglover,

I think you have much experience in configuring a kernel (maybe more than me), but when giving a recommendation it should be done carefully. Your recommendation is great for an expert, but not for a beginner. We should not frustrate a new user of gentoo with this. We both know, getting a "perfect" kernel needs many, many configuration steps. Too much at the beginning is something I cant recommend.

 *Jaglover wrote:*   

> [...] and if they do something else then they are doing it wrong?

 

I never said it is wrong; I gave a recommendation ... like you.

----------

## Jaglover

I said do it "for full experience", I didn't say it is universally right way.

You, on the other hand, said it is not recommended, not specifying any conditions like I did, implying it is never good.

See the difference? People are different, they have different goals and interests. You can't decide for someone else what is good for them.

----------

## pietinger

 *Jaglover wrote:*   

> You, on the other hand, said it is not recommended, [...]

 

I said: I dont recommend it ... and yes this was a decision and I am responsible for it

 *Jaglover wrote:*   

> [...] not specifying any conditions like I did, implying it is never good.

 

There is an - invisible - condition: I answered in a thread ... opened by a new gentoo user.

On the other side: If I tell you: "For full fun do a "rm -rf /" ... do I have than no responsibility ? ... because I specified it ...

 *Jaglover wrote:*   

> You can't decide for someone else what is good for them.

 

Let us agree to disagree here: I learned to think for myself and decide for myself and I always think any other people doing the same. And yes, I like it to hear many different meanings ... before I do my decision. A recommendation is not an order to do something.

----------

## pietinger

I knew I am not the only one which recommends the default configuration. I have read it in some gentoo documentation also. So I searched for it ... and found it again in:

https://wiki.gentoo.org/wiki/Kernel/Gentoo_Kernel_Configuration_Guide

(I recommend to read this guide also)

 *Quote:*   

> The kernel includes a default configuration, [...] The defaults are generally broad and sensible, which means that the majority of users will only have to make a small number of changes to the base configuration. [...]

 

----------

