You are not logged in.

#1 2021-01-04 16:32:04

tepo4ka
Member
Registered: 2021-01-04
Posts: 6

[SOLVED] Cannot boot with custom kernel - root drive not found

I am trying to build my own custom kernel for daily driver and currently I'm stucking with (initramfs, I suppose) mounting root drive. It says:

 running early hook [udev]
Warning: /lib/modules/5.10.4-dach/modules.devname not found -ignoring
Starting version 247.2-1-arch
:: running hook [udev]
:: Triggering uevents...
Waiting 10 seconds for device /dev/disk/by-uuid/...
ERROR: device 'UUID=...' not found. Skipping fsck.
:: mounting 'UUID=...' on real root
mount: /new_root: can't find UUID=...
You are now being dropped into an emergency shell.
sh: can't access tty; job control turned of
[rootfs ]# _

Here's what I got:
I use vanila linux kernel 5.10.4. Kernel config;
Grub as bootloader Grub config;
Mkinitcpio for initramfs Mkinitcpio configuration and Preset

Also here's 'ls -la' of /boot:

drwxr-xr-x root root    4 KB Mon Jan  4 18:11:48 2021 .                                
drwxr-xr-x root root    4 KB Sat Dec 12 17:29:32 2020 ..                               
drwxr-xr-x root root    4 KB Mon Jan  4 16:54:04 2021 grub                             
.rw-r--r-- root root 27.7 MB Mon Jan  4 15:19:02 2021 initramfs-linux-fallback.img     
.rw-r--r-- root root  7.2 MB Mon Jan  4 16:52:46 2021 initramfs-linux.img              
.rw-r--r-- root root  8.5 MB Mon Jan  4 19:09:06 2021 initramfs-linux510-fallback.img  
.rw-r--r-- root root  6.5 MB Mon Jan  4 19:09:04 2021 initramfs-linux510.img           
lrwxrwxrwx root root   20 B  Mon Jan  4 17:28:29 2021 System.map ⇒ /boot/System.map-510
.rw-r--r-- root root  4.4 MB Mon Jan  4 17:28:28 2021 System.map-510                   
.rw-r--r-- root root  7.5 MB Sat Jan  2 19:31:17 2021 vmlinuz                          
.rw-r--r-- root root  8.8 MB Thu Dec 31 23:01:19 2020 vmlinuz-linux                    
.rw-r--r-- root root  7.8 MB Mon Jan  4 17:28:26 2021 vmlinuz-linux510                 

Output of 'uname -a':

Linux dach 5.10.3-arch1-1 #1 SMP PREEMPT Sun, 27 Dec 2020 10:50:46 +0000 x86_64 GNU/Linux

After I compile kernel I do this:

sudo make modules_install && cp -v arch/x86_64/boot/bzImage /boot/vmlinuz-linux510 && cp -v System.map /boot/System.map-510 && ln -sf /boot/System.map-510 /boot/System.map && mkinitcpio -p linux510 && grub-mkconfig -o /boot/grub/grub.cfg

Also, if I run

mkinitcpio -k 5.10.4-dach -g /boot/initramfs-linux510.img

, result doesn't change.

And one interesting detail -- in rootfs I cannot find any drives, either 'sda' or uuid and etc.

Last edited by tepo4ka (2021-01-06 07:11:02)

Offline

#2 2021-01-04 16:35:21

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,729

Re: [SOLVED] Cannot boot with custom kernel - root drive not found

It looks like you're loading the wrong initramfs

Edit: or the ones you have are just bad. See the sizes, they're much smaller than the initramfs's for the other kernel.

Last edited by Scimmia (2021-01-04 16:38:56)

Offline

#3 2021-01-04 16:43:40

tepo4ka
Member
Registered: 2021-01-04
Posts: 6

Re: [SOLVED] Cannot boot with custom kernel - root drive not found

Scimmia wrote:

It looks like you're loading the wrong initramfs

Edit: or the ones you have are just bad. See the sizes, they're much smaller than the initramfs's for the other kernel.

But is smaller size bad? I though it's good because I configured my kernel only for my pc which means I have no ethernet, touchscreens and etc. and also minimum of modules (only wifi and other small modules), all other is built-in.

Edit: If it needed, size of /usr/lib/modules/5.10.3-arch1-1 is 94 MB vs /usr/lib/modules/5.10.4-dach which is 12 MB

Last edited by tepo4ka (2021-01-04 16:45:12)

Offline

#4 2021-01-04 16:46:23

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,729

Re: [SOLVED] Cannot boot with custom kernel - root drive not found

The *initramfs* is smaller. That's just early userspace and the modules necessary to access your root filesystem. Unless you built those in, the size shouldn't change that much. See what's in it for yourself with lsinitcpio or extract it with bsdtar.

Offline

#5 2021-01-04 16:50:48

tepo4ka
Member
Registered: 2021-01-04
Posts: 6

Re: [SOLVED] Cannot boot with custom kernel - root drive not found

Here's output of 'diff <(lsinicpio /boot/initramfs-linux510.img) <(lsinitcpio /boot/initramfs-linux.img)':

218,219c218,244
< usr/lib/modules/5.10.4-dach/
< usr/lib/modules/5.10.4-dach/kernel/
---
> usr/lib/modules/5.10.3-arch1-1/
> usr/lib/modules/5.10.3-arch1-1/kernel/
> usr/lib/modules/5.10.3-arch1-1/kernel/cdrom.ko
> usr/lib/modules/5.10.3-arch1-1/kernel/crc16.ko
> usr/lib/modules/5.10.3-arch1-1/kernel/crc32c_generic.ko
> usr/lib/modules/5.10.3-arch1-1/kernel/crc32c-intel.ko
> usr/lib/modules/5.10.3-arch1-1/kernel/crc-itu-t.ko
> usr/lib/modules/5.10.3-arch1-1/kernel/ext4.ko
> usr/lib/modules/5.10.3-arch1-1/kernel/firewire-core.ko
> usr/lib/modules/5.10.3-arch1-1/kernel/firewire-sbp2.ko
> usr/lib/modules/5.10.3-arch1-1/kernel/jbd2.ko
> usr/lib/modules/5.10.3-arch1-1/kernel/mbcache.ko
> usr/lib/modules/5.10.3-arch1-1/kernel/mmc_block.ko
> usr/lib/modules/5.10.3-arch1-1/kernel/mmc_core.ko
> usr/lib/modules/5.10.3-arch1-1/kernel/sr_mod.ko
> usr/lib/modules/5.10.3-arch1-1/kernel/usbhid.ko
> usr/lib/modules/5.10.3-arch1-1/kernel/usb-storage.ko
> usr/lib/modules/5.10.3-arch1-1/kernel/virtio_blk.ko
> usr/lib/modules/5.10.3-arch1-1/kernel/xhci-pci.ko
> usr/lib/modules/5.10.3-arch1-1/kernel/xhci-pci-renesas.ko
> usr/lib/modules/5.10.3-arch1-1/modules.alias.bin
> usr/lib/modules/5.10.3-arch1-1/modules.builtin.alias.bin
> usr/lib/modules/5.10.3-arch1-1/modules.builtin.bin
> usr/lib/modules/5.10.3-arch1-1/modules.dep.bin
> usr/lib/modules/5.10.3-arch1-1/modules.devname
> usr/lib/modules/5.10.3-arch1-1/modules.softdep
> usr/lib/modules/5.10.3-arch1-1/modules.symbols.bin

Also while trying fix it by myself I by hands inserted modules.* in initrafms for my kernel, but in result I got that he a) couldn't mount /proc, /dev and etc wihtout root and b) drive changed from UUID=... to "".

Last edited by tepo4ka (2021-01-04 16:51:43)

Offline

#6 2021-01-04 16:55:01

tepo4ka
Member
Registered: 2021-01-04
Posts: 6

Re: [SOLVED] Cannot boot with custom kernel - root drive not found

And one more comment: While creating initramfs with mkinitcpio either with preset or by hands I got this:

==> Building image from preset: /etc/mkinitcpio.d/linux510.preset: 'default'
  -> -k /boot/vmlinuz-linux510 -c /etc/mkinitcpio.conf -g /boot/initramfs-linux510.img
==> Starting build: 5.10.4-dach
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [autodetect]
  -> Running build hook: [modconf]
  -> Running build hook: [block]
  -> Running build hook: [filesystems]
  -> Running build hook: [keyboard]
  -> Running build hook: [fsck]
==> WARNING: No modules were added to the image. This is probably not what you want.
==> Creating gzip-compressed initcpio image: /boot/initramfs-linux510.img
==> Image generation successful
==> Building image from preset: /etc/mkinitcpio.d/linux510.preset: 'fallback'
  -> -k /boot/vmlinuz-linux510 -c /etc/mkinitcpio.conf -g /boot/initramfs-linux510-fallback.img -S autodetect
==> Starting build: 5.10.4-dach
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [modconf]
  -> Running build hook: [block]
  -> Running build hook: [filesystems]
  -> Running build hook: [keyboard]
  -> Running build hook: [fsck]
==> Generating module dependencies
==> WARNING: No modules were added to the image. This is probably not what you want.
==> Creating gzip-compressed initcpio image: /boot/initramfs-linux510-fallback.img
==> Image generation successful

(this it 'mkinitcpio -p linux510)

I tried to fix it by deleting 'autodetect' option from mkinitcpio.conf, but size of rezulting initramfs increased to ~8.2 MB and system didn't load as with enabled autodetect

Last edited by tepo4ka (2021-01-04 16:57:20)

Offline

#7 2021-01-04 16:57:25

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,729

Re: [SOLVED] Cannot boot with custom kernel - root drive not found

So you probably disabled too much in your kernel config.

Offline

#8 2021-01-04 17:10:55

loqs
Member
Registered: 2014-03-06
Posts: 19,027

Re: [SOLVED] Cannot boot with custom kernel - root drive not found

No ATA or NVME or MMC enabled in the config.  What device type is the root filesystem on?
Edit:
USB storage is also disabled.

Last edited by loqs (2021-01-04 17:13:17)

Offline

#9 2021-01-04 17:11:49

tepo4ka
Member
Registered: 2021-01-04
Posts: 6

Re: [SOLVED] Cannot boot with custom kernel - root drive not found

loqs wrote:

No ATA or NVME or MMC enabled in the config.  What device type is the root filesystem on?

I'm not sure what does device type mean, but I have HDD and root is ext4

Edit: can you please say what option misses? I looked through config and didn't see that I disabled usb storage

Last edited by tepo4ka (2021-01-04 17:18:31)

Offline

#10 2021-01-04 17:18:04

loqs
Member
Registered: 2014-03-06
Posts: 19,027

Re: [SOLVED] Cannot boot with custom kernel - root drive not found

You probably want CONFIG_ATA https://cateee.net/lkddb/web-lkddb/ATA.html and CONFIG_SATA_AHCI https://cateee.net/lkddb/web-lkddb/SATA_AHCI.html
The latter depends on if the HDD controller is provided by the motherboard chipset or a discrete chip.  If it is a custom chip you would need to find the option supporting that chip.
Edit:
From the config

#
# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
#
 
#
# also be needed; see USB_STORAGE Help for more info
#
# CONFIG_USB_STORAGE is not set

....

# CONFIG_BLK_DEV_SD

Last edited by loqs (2021-01-04 17:23:15)

Offline

#11 2021-01-06 07:10:44

tepo4ka
Member
Registered: 2021-01-04
Posts: 6

Re: [SOLVED] Cannot boot with custom kernel - root drive not found

You were right, problem was in kernel config. Now all works fine with CONFIG_BLK_DEV_SD=y.

Thank you all.

Offline

Board footer

Powered by FluxBB