Skip to main content

How to update -grub from live-CD

 In order to update the grub configuration of the machine that you might be misconfigured and unable to boot up properly you could use live CD to boot into the machine, however, even if you are able to update the /etc/default/grub file, you will need to perform the "sudo update-grub" command to effect the change. if you are using Live CD to login, you need to perform the following steps:


First mount the root directory in question for my case it is my /dev/sda so it is it will be /dev/sda2 as mostly sda1 is for the /boot/efi partition.

You will mount the root partition as follow:

sudo mount /dev/sda2 /mnt

Then mount a few more directories that are needed:

sudo mount --bind /dev /mnt/dev
sudo mount --bind /sys /mnt/sys
sudo mount --bind /proc /mnt/proc
How can you tell if you have a boot partition?

Once you have your Ubuntu partition mounted, open /mnt/etc/fstab. If you see an entry for /boot, note which device it is pointing to (/dev/sda4 maybe?). This is the one you have to mount.

Once these are mounted, do chroot to start using the mounted directory as the root partition:

sudo chroot /mnt

You'll get a #/ prompt. First thing to do is confirm that you're using the correct /boot directory. Go to /boot/grub and look at the files there. There should be a bunch of .mod files and a grub.cfg file. If the directory is empty, don't continue, because it means this is NOT your actual boot directory. Look above to see how to determine if you need to mount an additional boot directory.

Once you've confirmed that /boot/ contains the correct files, meaning that it is the correct location, type:

sudo update-grub

This should rebuild your /boot/grub/grub.cfg file with the menu entries.

Then exit the chroot:

exit

At this point you may want to check that things were correctly updated. For this, cd /mnt/boot/grub and check that grub's files are there, there should be a bunch of .mod files and grub.cfg, the latter should have entries for your Ubuntu kernels. If you only see grub.cfg and no .mod files, it means that this is NOT the correct boot directory, look above for how to mount a separate boot partition.

Unmount the filesystems:

sudo umount /mnt/dev
sudo umount /mnt/sys
sudo umount /mnt/proc
sudo umount /mnt/

And then reboot, hopefully your Grub menu will be restored.


Comments

Popular posts from this blog

Install Google Playstore on Pendo Pad 4.0 and rooting the device.

Coles selling the Pendo 7" Android Pad running Ice Cream Sandwich 4.03, however by default it does not come with Google Play Store. Rather it has the China "store" GetJar, which only have limited Apps available. In order to get the  Google Play store install on device. Firstly you have to root the device to gain root access. 1. Download unlockroot from : www.unlockroot.com/ 2. Connect the device to a windows PC, install and run the program. Make sure window machine has the necessary driver to access android pad.  If device driver is not available. Download and install the driver from: http://developer.android.com/tools/extras/oem-usb.html Make sure set the android device to USB Debugging mode to allow the unlockroot to root the device: Enable the USB debugging mode from : Setting -> Developer Options -> USB debugging Click on Root to root the device. After that, install the google play store by downloading it and transfer it to

Linux command to install software for various Distro

Ubuntu (*buntu, Mint linux) Apt-get install apt-get update apt-get remove apt-get dist-upgrade apt-get purge Fedora/RHEL/CentOS yum install yum update yum remove Opensuse yast2 --install yast2 --remove zypper update Freebsd  pkg_add pkg_delete Gentoo emerge package # Install emerge -C package # Remove a package emerge -s keyword # Search for packages (package names only) emerge -u package # update the package Arch pacman -U package.pkg.tar.xz # Local package install pacman -Syy # Refresh package databases pacman -Syu # Update installed packages pacman -S package # Install package pacman -R package # Remove package