Linux::initrd

From www.deloptes.org
Revision as of 22:30, 20 September 2019 by Admin (talk | contribs) (Created page with "= Repair Boot in initramfs = Problem: Grub failed to install Usually when software was copied from hard disk to hard disk or partition or to USB-stick. After this run updat...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Repair Boot in initramfs

Problem: Grub failed to install

Usually when software was copied from hard disk to hard disk or partition or to USB-stick.

After this run update-grub, but it destroyed the configuration. Now the system can not find the boot or root partition

In the initramfs emergency shell you can for example decrypt the partition and start lvm.

Do not forget to mount /proc /sys if not mounted

 mount -t proc none /proc
 mount -t sysfs sysfs /sys

then mount the partition

 cryptsetup luksOpen /dev/sdXY   sdxy_crypt
 
 # X=drive, Y=partition
 mount -t ext3 /dev/mapper/sdxy_crypt /root
 
 mount -o bind -t proc none /root/proc
 mount -o bind -t sysfs sysfs /root/sys
 
 exec /usr/sbin/chroot /root /bin/sh <<- EOF >dev/console 2>&1
 exec /sbin/init ${CMDLINE}
 EOF