Difference between revisions of "How to fix GRUB initramdisk"

From HyperSecurity Wiki
Jump to: navigation, search
Line 11: Line 11:
  
 
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.
 
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:
 +
[https://ubuntuforums.org/showthread.php?t=1127779 Source]
 +
 +
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:
 
RedHat:
  
 
https://wiki.centos.org/TipsAndTricks/CreateNewInitrd
 
https://wiki.centos.org/TipsAndTricks/CreateNewInitrd

Revision as of 06:17, 19 January 2017

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:

System Rescue CD Download

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: Source

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:

https://wiki.centos.org/TipsAndTricks/CreateNewInitrd