Own compiled linux kernel does not recognize partitions

Posted on

Problem :

I have compiled a linux kernel 5.4.81 as monolytic kernel.
I added drivers to access the disks and I added drivers to access msdos partitions and ext4 filesystem.
I installed it on /dev/sdb6 by copying it to /dev/sdb6/boot and configured grub with:

menuentry "Teddix" {
    echo 'Loading Teddix'
    insmod gzio
    insmod part_msdos
    insmod ext2
    set root=(hd1,msdos6)
    search --no-floppy --fs-uuid --set=root 5312030c-4457-4ad0-88cb-bf3488886e90
    linux (hd1,msdos6)/boot/linux-5.4.81 root=UUID=5312030c-4457-4ad0-88cb-bf3488886e90 ro
}

I can boot this kernel but then I get the following error:

ata5.00: supports DRM functions and may not be fully accessible
ata1.00: supports DRM functions and may not be fully accessible
ata5.00: configured for UDMA/133
ata1.00: configured for UDMA/133
scsi 0:0:0:0: Direct-Access     ATA       Samsung SSD 860   3B6Q PQ: 0 ANSI: 5
scsi 4:0:0:0: Direct-Access     ATA       Samsung SSD 860   3B6Q PQ: 0 ANSI: 5
VFS: Cannot open root device "UUID=5312030c-4457-4ad0-88cb-bf3488886e90" or unknown-block(0,0): error -6
Please append a correct "root=" boot option; here are the available partitions:
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
Kernel Offset: disabled
---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) ]---

I also tried with /dev/sdb6 as root partition, but there is no difference.
Did I miss some drivers or modules?

Edit: What I do not understand too is: Why does this kernel not list all possible root partitions? I would expect a list there before the kernel panic.

Solution :

You will need an initramfs if you want to use UUID=, LABEL=, or /dev/disk/by-* device names.

The Linux kernel natively supports only three types of root device names: PARTUUID= (using the GPT partition GUID, not the filesystem UUID), PARTLABEL= (again using the GPT partition label, not the filesystem label) and the traditional /dev/sdX. Anything else has to be handled by initramfs.

(For msdos disks, as long as they have a non-empty “NT disk signature”, you can still use a pseudo-PARTUUID which you can find out from lsblk -o +partuuid or blkid. You can use fdisk expert-mode command i to set the disk identifier to some random number if it’s currently blank.)

One has to activate the following drivers:

  1. SCSI-hardware-driver (hardware dependent, correct here)
  2. SCSI-disk-driver (CONFIG_BLK_DEV_SD=y, missing)
  3. Partitiontable-driver (CONFIG_MSDOS_PARTITION=y)
  4. Filesystem-driver (CONFIG_EXT4_FS=y)

Recompile and reinstall linux kernel.

Leave a Reply

Your email address will not be published. Required fields are marked *