Dropping to initramfs shell. Yikes! Help!?

Kernels & Hardware, configuring network, installing services

Dropping to initramfs shell. Yikes! Help!?

Postby nerdy princess » 2021-01-27 20:24

For many years now I've been an avid windows & mac user. Most recently, the growing love-affair between tech corporatists and government bureaucrats has convinced me to take the plunge into the world of open-source. My transition was going smoothly up until I F'd the boot process. For days now I've been trying to resolve this problem :x. I figure--before I completely start cry running back into Tim Cook's arms--I should ask the smart folks on here for help.

Background
I have Debian Buster setup on a single partition with encrypted LVM (sda5_crypt). There are two kernel images (4.19 & 5.9) available on the boot partition. I may have messed up my initrd image while doing a sudo apt-get purge --auto-remove lvm2 or possibly while monkeying around with the crypttab and/or fstab files followed by a sudo update-initramfs -u.

The Big Problem
Now after GRUB loads kernel 5.9 into memory, I am dropped into the initramfs shell, the kernel is searching in /dev/sdd and so forth. Also, the vgscan and pvscan show "no medium found" on /dev/sdd and so forth. Of course! This is strange since the distro is setup on sda5. I'm also unable to exit out of the shell.

Attempted Solutions
I've tried--without real success--temporarily changing the root= parameter in the GRUB Bootloader, duplicating initrd image (4.19) for initrd image (5.9), etc. Perhaps one silver lining here is that, when selecting kernel 4.19 image from the GRUB boot menu, I am able to successfully decrypt the disk and boot into debian's terminal shell. But how the heck then am I supposed to update-initramfs for kernel 5.9 when I have kernel 4.19 loaded!?! It feels like the twilight zone.

Any suggestions from you linux veterans is very much appreciated! :D
Last edited by nerdy princess on 2021-01-28 23:45, edited 1 time in total.
nerdy princess
 
Posts: 2
Joined: 2021-01-27 20:09

Re: Dropping to initramfs shell. Yikes! Help!?

Postby reinob » 2021-01-28 07:14

How did you get kernel 5.9? it is not, AFAIK, on debian buster.

If you manage to boot with 4.19, as you report, you could then "update-initramfs -k all", which will update all initramfs images.
(or you use "-k 5.9xyz" whatever the exact "uname -r" name is).

Good luck!
reinob
 
Posts: 900
Joined: 2014-06-30 11:42

Re: Dropping to initramfs shell. Yikes! Help!?

Postby nerdy princess » 2021-01-28 22:26

I got it working! Here are the steps that got the problem resolved. Hopefully this will help a future someone that's in the same pickle:

  • If you have some other way to access your system--such as another kernel installed (as was my case)--then you do not need to chroot. Just select that kernel from the GRUB menu and log-in to your system. I was able to get into the terminal shell.

  • Get the UUID of all your block devices using sudo blkid. Open-up your /etc/fstab file and replace the kernel name descriptors (i.e. /dev/sda1) with UUID. This is important because kernel name descriptors are not persistent. Take note also that there's an issue with MBR/GPT partition types (reference). After all is said and done, you should have something like this:

Code: Select all
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
UUID=XXXXXX-XXXXXX-XXXXX-XXXX-XXXXXX /               ext4    errors=remount-ro 0  $
UUID=XXXXXX-XXXXXX-XXXXX-XXXX-XXXXXX /boot           ext2    defaults        0    $
UUID=XXXXXX-XXXXXX-XXXXX-XXXX-XXXXXX none            swap    sw              0    $


  • Now open-up your /etc/crypttab file. There should only be one entry here per encrypted device. The first column is the device mapper's name (reference) and should not be the UUID (as was in the fstab file). You can find the device mapper's name in the blkid print-out. It usually is listed as /dev/mapper/sda5_crypt. Note, however, that the UUID in the crypttab file is NOT THE SAME as the one found on the blkid line for dev/mapper/sda5_crypt. Instead the correct UUID that must be used in the crypttab file can be found on the blkid line for /dev/sda5. In the end you will have something like this:

Code: Select all
sda5_crypt UUID=XXXXXX-XXXXXX-XXXXX-XXXX-XXXXXX none luks,discard


  • Then go to your boot directory (i.e. /boot). Make a backup of your vmlinuz file (i.e.vmlinuz-5.9.0-0.bpo.5-amd64).

  • Now you need to run the command to update your vmlinuz file for the specific kernel (reference). The u is for "update." The v is for "verbose" (live print-out of everything). The k is for the specific "kernel" version that you will be generating the initramfs image. The command:

Code: Select all
sudo update-initramfs -uvk 5.9.0-0.bpo.5-amd64


  • Now search through the verbose noise. Make sure there are no errors when generating the image. If none, reboot your system and voila! :D
nerdy princess
 
Posts: 2
Joined: 2021-01-27 20:09


Return to System configuration

Who is online

Users browsing this forum: No registered users and 12 guests

fashionable