[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Boot Repair. Still Going Round and Round.



I placed the ailing drive back on a good Linux system and mounted
it as /dev/sdd1 /mnt
and ran the following commands on it:

#!/bin/sh
#mount the drive being repaired.  Uncomment lines as needed.
  sudo mount /dev/sdd1 /mnt
cd /mnt/boot
#installing to the mounted disk
  sudo grub-install \
--boot-directory=/mnt/boot/ /dev/sda

Installing for i386-pc platform.
Installation finished. No error reported.
root@wb5agz:/#

But wait.  There's more.

root@wb5agz:/# update-grub --boot-directory=/dev/sda
Unrecognized option `--boot-directory=/dev/sda'

Not good.


Continuing on to update initramfs.

#Isolate the disk.


     sudo mount --bind /dev /mnt/dev
     sudo mount --bind /dev/pts /mnt/dev/pts
     sudo mount --bind /proc /mnt/proc
     sudo mount --bind /sys /mnt/sys

That all worked.

     sudo chroot /mnt
root@wb5agz:/# 
update-initramfs -c -k 4.19.0-5-686-pae

That appears to work.


root@wb5agz:/# update-grub
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.19.0-5-686-pae
Found initrd image: /boot/initrd.img-4.19.0-5-686-pae
Found linux image: /boot/vmlinuz-4.9.0-9-686-pae
Found initrd image: /boot/initrd.img-4.9.0-9-686-pae

Now this ruins everything.

Found Debian GNU/Linux 10 (buster) on /dev/sdc1
done

This was a chroot environment but it appears that /dev/sdc1 was
recognized as the boot source for this external drive.  /dev is
part of the system.


	The external drive normally lives in another system and
is the only boot source which is why it should be /dev/sda1.

	Is there any way to run update-grub from grub itself?

	The system this external drive is meant for normally only
has 1 boot drive which is the one that is currently confusing
grub.  If I could run install-grub and update-grub from the dead
system, there would not be any other bootable drives and the only
game in town would be /dev/sda for the boot record and
/dev/sda1-5 for the boot drive.

	Understanding what is supposed to happen isn't
particularly difficult but getting grub to think simple and easy
	Putting the drive on another system and hoping for no
contamination seems to be a lot easier said than done.

Martin


Reply to: