Restoring backups and effect on GRUB
Rashkae
ubuntu at tigershaunt.com
Mon Aug 5 23:19:47 UTC 2019
On 2019-08-05 6:00 p.m., Rashkae wrote:
> From there, manually restoring the system from such a backup can be a
> bit of a technical thing. Sorry, I just don't have a tutorial I can
> whip out. But I would suggest you just try to do it... Put in a fresh
> HDD, (or use a second computer, linux can be pretty good about that,)
> and restore from your backup
So, a bit more detail....
First, it's worth noting that Ubuntu CD has some great boot repair
utilities built in. I am, sadly, not familiar with their use, abilities
or limitations, but you should probably try that first.
It's worth noting that I'm rattling all this from memory, but I've never
successfully done this on the first try without correcting some
oversight or looking up one of the commands. This should be used as a
guide for a trial,, fix whatever mistakes I've made from experience.
But, if all else fails and you have to repair grub the hard way, booting
into a linux system from any kind of Linux live media.
As I said last post, if you intend your system to boot EFI, the live
media must also be booted through EFI. That will depend on your system
firmware, (typically called BIOS, but technically, BIOS only applies to
the legacy, pre-EFI systems.) Some make it very easy to figure out if
you're booting EFI or Legacy, others make it impossible.
I do not know how to adapt this to a system with root drive on LVM, I
never tried.
Once booted into a working linux environment, mount your intended root
device somewhere easy to reach, like /mnt/root. If applicable also
mount /boot and /boot/efi under that.
Most people probably don't have a separate /boot any more, as it is
rarely necessary, but in a worst case scenario, where /, /boot and
/boot/efi are needed
mount /dev/sda3 /mnt/root
mount /dev/sda2 /mnt/root/boot
mount /dev/sda1 /mnt/root/boot/efi
Edit the /mnt/root/etc/fstab file, change any of the UUID's that need to
be updated.
Next, you have to mount the /dev, /proc and /sys from the Live system
under the new root with --rbind option
mount --rbind /proc /mnt/root/proc
mount --rbind /dev /mnt/root/dev
mount --rbind /sys /mnt/root/sys
Now that it's ready, chroot into the new target root
chroot /mnt/root /bin/bash -i
Now that you are chrooted into the target filesystem, you can run
grub-install
For a legacy boot sytem.
grub-install /dev/sda
Or for an EFI system.
grub-install --efi-directory /boot/efi
I don't remember if you have to run update-grub, or if that happens as
part of grub-install
Reboot, and if this actually worked, run update-grub again, just to be sure.
More information about the ubuntu-users
mailing list