Difference between revisions of "How to fix GRUB initramdisk"
(→Debian/Ubuntu broken init) |
|||
Line 19: | Line 19: | ||
== Debian/Ubuntu broken init == | == Debian/Ubuntu broken init == | ||
[https://ubuntuforums.org/showthread.php?t=1127779 Source] | [https://ubuntuforums.org/showthread.php?t=1127779 Source] | ||
+ | [http://linoxide.com/linux-how-to/fixing-broken-initrd-image-linux/ Initrd Source] | ||
First boot with Debian Live CD/DVD. Once booted, become root: | First boot with Debian Live CD/DVD. Once booted, become root: |
Latest revision as of 16:56, 24 January 2017
Contents
How to use the initramfs shell to save the day
https://we.riseup.net/debian/using-the-initramfs-to-save-the-day
Using System Rescue CD/DVD
When converting a physical live machine to vmware using vmware converter, there can be issues with booting due to how vmware recreates the initrd and grub.cfg. To fix this, do the following:
Boot the live CD and press option "E" to boot the / (root) parition
Once booted to a full OS, login to the OS as root and run the following in order:
update-initramfs -t -k all -u update-grub
This will update the initramfs as well as the grub.cfg file to match the new initrd. Reboot to confirm grub and booting is fixed.
Debian/Ubuntu broken init
First boot with Debian Live CD/DVD. Once booted, become root:
sudo su -
Once root, mount the root partion to mnt. sdaX for non software RAID. mdX for software RAID.
mount /dev/sdaX /mnt
Next mount the boot partion to /mnt/boot if you multi partions
mount /dev/sdaX /mnt/boot
Copy over the /boot dir contents to /mnt/boot for a working kernel and initrd:
copy /boot/* /mnt/boot
Then bind mount the following partitions:
mount --bind /dev /mnt/dev mount --bind /proc /mnt/proc mount --bind /sys /mnt/sys
Chroot the /mnt directory:
chroot /mnt /bin/bash
Update the Grub:
update-initramfs -t -k all -u update-grub
Exit Chroot and reboot:
exit && reboot && eject
Redhat Systems
https://wiki.centos.org/TipsAndTricks/CreateNewInitrd
Helpful commands
- List UUID of all disks:
ls /dev/disk/by-uuid -lt
- Add CDROM to apt:
apt-cdrom add
- Rebuild software RAID
mdadm --assemble --scan
- List Software RAID details
mdadm -D /dev/md0
Grub2 Boot Example
Top half:
set root='mduuid/{md2UUID}' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint='mduuid/{md2UUID}' {MD2} else search --no-floppy --fs-uuid --set=root {MD2}
Bottom half:
set linux_gfx_mode= export linux_gfx_mode menuentry 'Debian GNU/Linux' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-{MD2}' { load_video insmod gzio if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi insmod part_msdos insmod part_msdos insmod diskfilter insmod mdraid1x insmod ext2 set root='mduuid/{md0UUID}' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint='mduuid/{md0UUID}' {MD0} else search --no-floppy --fs-uuid --set=root {MD0} fi echo 'Loading Linux 3.16.0-4-686-pae ...' linux /vmlinuz-3.16.0-4-686-pae root=UUID={MD2} ro ipv6.disable=1 quiet echo 'Loading initial ramdisk ...' initrd /initrd.img-3.16.0-4-686-pae }