Boot issue / initramfs display error

Lee -  
 drom -
Hello,

I wanted to dive into the deep end of Linux about a month ago. And I installed Zorin OS on my hard drive. Everything was fine until this morning.
Since this morning, my screen displays the following message:

BusyBox v1.27.2 (Ubuntu 1:1.27.2-2ubuntu3.2) built-in shell a(ash)
Enter 'help' for a list of built-in commands.

(initramfs)


So wanting to find my solution myself and not wanting to lose my data, I read a bit on the topic and found that the problem is that

1/I shouldn't have forced a shutdown (3s+ press) (but what to do when my computer freezes? And also why is it freezing suddenly?)

2/ it's a boot problem if I can express it that way. However, I read that I could try the command
fsck
. Except that it doesn't appear when I type
help
at startup.

Fortunately, I have my bootable USB stick that allows me to try Zorin OS before installing it/installing it.

I also read that from my USB stick I could repair my OS with the command
fsck -y /dev/sdb1
(I concluded that it was
sdb
because
sda
seems to be the bootable USB stick)

Except that to do things properly, I had encrypted my hard drive (an option that Zorin offers / I don't know if all Linux OS offer it) and I think (I'm not sure since I'm new to Linux) that this may be blocking among other things.

I tried this command
sudo fdisk -l mount
to try a repair or even a reinstallation without losing data if possible, but it yields nothing.

I also tried the command
sudo fsck /dev/sdb1
, again with no success.

So I finally opted for boot repair by following the commands to install and update it // I ran it and it gave me a report which is here. http://paste.ubuntu.com/p/8x3pSzjQSj/

So two questions: according to the boot repair report, is my problem resolved? If not, what else can I do please, knowing that I would like to avoid losing my data?
Configuration: Linux / Firefox 73.0

2 answers

  1. mamiemando Posted messages 33228 Registration date   Status Moderator Last intervention   7 943
     
    Hello,

    Several elements of response.

    Explanation of the error

    Regarding the busybox error: grub is the menu that allows you to choose which system (and for Linux, with which kernels and what options) to start. When grub fails, you typically see a "busybox" terminal. It can fail for multiple reasons (typically, a missing hard drive, a kernel not found, partitions inconsistent with its configuration, etc).

    In practice, busybox doesn't allow for much. Most of the time, you need to go through a repair using a bootable USB stick. From there, you need to launch a Linux that allows you to start a "real" terminal from which you can perform the repair. Basically, a Linux installation disk (USB or CD) is sufficient. But this is not straightforward for beginners.

    That's why boot-repair was created. It's a bootable Linux on a USB stick, but it has been customized for beginners to perform repairs. So you're on the right track :)

    Next, I don't know who told you to run a
    fsck
    (filesystem check), but I seriously doubt that it will solve your issue. In Windows terminology, this corresponds to a scandisk, but that's not what will fix your grub configuration to make it consistent with your hard drives. Commands like
    sudo update-grub
    , run from your "chrooted" Linux, make much more sense.

    Some prerequisites


    So what is a
    chroot
    .

    In Linux, there is no concept of drives like in Windows. No C: or anything else. There is a filesystem tree, with the root at
    /
    that contains everything. The closest notion is what is called "devices" in Linux (see /dev). In modern Linux systems, disks typically follow this naming convention:
    • /dev/sda
      identifies the first disk (USB, hard drive, etc.)
    • /dev/sdb
      identifies the second disk (USB, hard drive, etc.)
    • /dev/sda1
      identifies the first partition of disk sda.
    • /dev/md0
      designates a RAID disk


    The devices themselves are not directly readable. You need to mount a device to see the contents of the partition it represents. This is what the
    mount
    command does.

    In particular, some of these devices will be mounted (like Russian dolls) to form the content exposed in the
    /
    hierarchy. Typically:
    • /
      contains (if we omit the following elements) the partition of the Linux system you have booted into
    • /home
      contains the Linux partition housing your documents
    • any peripherals, Windows partitions, remote shares, etc., are generally mounted in a subfolder of
      /media
      or
      /mnt
      .


    In short, since
    /
    corresponds to the Linux system you have booted into, it does not hold the same meaning when booting from a Linux USB or from the Linux on your hard drive.
    /
    corresponds to the system from which you booted. However, if you boot into your Linux USB, you can mount the hard disk Linux partition into a directory (let's say
    /media/linux
    ).

    Thus, if you boot from your Linux USB and mount your hard disk Linux into
    /media/linux
    , the grub configuration at that point will be in
    /media/linux/etc/default/grub
    and not
    /etc/default/grub
    .

    On the other hand, Linux allows for "moving"
    /
    (under certain conditions), in my example, at
    /media/linux
    . This is called doing a
    chroot
    . So if you ensure that everything necessary is present in this directory and you chroot into it, then everything will take place in this terminal "as if" you had booted into the hard drive's Linux. And from there, in particular, you can reinstall/reconfigure whatever is broken.

    Repairing grub (under normal circumstances)

    The main part of the procedure indicated in boot-repair consists of performing this
    chroot
    . Since you managed to create a boot repair report, it means you got it right.

    Ideally, you then just need to run
    sudo update-grub
    in the chrooted environment, which should look something like this:

    (mando@aldur) (~) $ sudo update-grub
    [sudo] mando's password:
    Generating grub configuration file ...
    Found background image: /usr/share/images/desktop-base/desktop-grub.png
    Found linux image: /boot/vmlinuz-5.4.0-4-amd64
    Found initrd image: /boot/initrd.img-5.4.0-4-amd64
    Found linux image: /boot/vmlinuz-5.4.0-3-amd64
    Found initrd image: /boot/initrd.img-5.4.0-3-amd64
    Found linux image: /boot/vmlinuz-5.3.0-3-amd64
    Found initrd image: /boot/initrd.img-5.3.0-3-amd64
    Found linux image: /boot/vmlinuz-4.19.0-6-amd64
    Found initrd image: /boot/initrd.img-4.19.0-6-amd64
    Found Windows Boot Manager on /dev/nvme0n1p1@/EFI/Microsoft/Boot/bootmgfw.efi
    Adding boot menu entry for EFI firmware configuration
    done


    First question, what happens in your case? (copy and paste the result)

    In your case

    Looking at your boot repair report, you have some strange errors:

    ERROR: pdc: reading /dev/dm-0[Input/output error]
    ERROR: pdc: reading /dev/dm-0[Input/output error]
    ERROR: pdc: reading /dev/dm-0[Input/output error]
    ERROR: pdc: reading /dev/dm-0[Input/output error]
    ERROR: pdc: reading /dev/dm-0[Input/output error]
    ERROR: pdc: reading /dev/dm-0[Input/output error]


    That's not good, it means that a RAID (software?) disk is unstable. I don't know if you have played around with RAID configurations, but this kind of error is a bad sign.

    Furthermore, you mentioned that you encrypted your disk. This means that
    mount
    alone is not enough, you first need to decrypt the partition. The idea remains the same but it complicates things slightly because there are LVM and LUKS involved, and probably RAID on top of it...

    Method 1: the simplest

    You reinstall, you forget about encryption and RAID unless you know what you're doing.

    Method 2: if you have the courage

    Assumed partitioning (to adapt in your case)
    • /dev/sda1
      is
      /boot
    • /dev/sda5
      is an encrypted with LUKS containing a LVM partition, where reside
      /
      and the swap.


    Step 1: Mount the system

    sudo -s mkdir -p /mnt/linux cryptsetup luksOpen /dev/sda5 sda5_crypt # This creates /dev/mapper/sda5_crypt # Enter the LUKS password apt-get install lvm2 modprobe dm-mod vgchange -ay lvscan # At this point we should see /dev/Ubuntu/{root, swap_1} ACTIVE


    Now we will mount everything.

    mount /dev/mapper/Ubuntu-root /mnt/linux mount /dev/sda1 /mnt/linux/boot mount --bind /dev /mnt/linux/dev chroot /mnt/linux mount -t proc proc /proc mount -t sysfs sys /sys mount -t devpts devpts /dev/pts /etc/init.d/lvm2 start /etc/init.d/lvm2-lvmetad start /etc/init.d/lvm2-lvmpolld start


    From there we can run
    update-grub
    (phew).

    Step 2: Repair
    grub


    We check the
    cryptsetup
    settings based on this tutorial.

    1) Verify that the line regarding
    sda5
    is present in
    /etc/crypttab
    (you can open this file with
    nano /etc/crypttab
    , ctrl x to save and exit).

    Example: (note that these values depend on your system):

    sda5_crypt UUID=8af9859f-9922-4ed3-9f9b-bc31f0c9aeb4 none luks,retry=1,lvm=Ubuntu
    storage_crypt UUID=f4e689ec-fda1-450e-8787-61c081c0bee7 none luks


    2) Also check
    /etc/initramfs-tools/conf.d/cryptroot
    .

    Example: (note that these values depend on your system):

    CRYPTROOT=target=sda5_crypt,source=/dev/disk/by-uuid/8af9859f-9922-4ed3-9f9b-bc31f0c9aeb4


    3) If everything is referenced, then you can run:

    update-initramfs -k all -c


    4) Now, check
    /etc/default/grub
    .

    Example: (note that these values depend on your system):

    GRUB_CMDLINE_LINUX="cryptopts=target=sda5_crypt,source=/dev/disk/by-uuid/8af9859f-9922-4ed3-9f9b-bc31f0c9aeb4,lvm=Ubuntu"

    5) Finally, reinstall grub

    update-grub


    6) ... and exit properly

    /etc/init.d/lvm2 stop
    /etc/init.d/lvm2-lvmetad stop
    /etc/init.d/lvm2-lvmpolld stop
    umount /sys
    umount /proc
    umount /dev/pts
    exit
    umount /mnt/linux/boot
    umount /mnt/linux/dev
    umount /mnt/linux
    reboot


    Good luck :-)
    0