Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #228709

Re: Fixing a Grub Foul-up

From Dan Ritter <dsr@randomstring.org>
Newsgroups linux.debian.user
Subject Re: Fixing a Grub Foul-up
Date 2020-11-16 20:40 +0100
Message-ID <BbSw1-7ee-1@gated-at.bofh.it> (permalink)
References <BbRTj-6Mo-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Martin McCormick wrote: 
> 	I have a usb device that lets one mount IDE and SATA
> drives that are outside the system so I pulled the sata drive
> which is the boot drive for the now dead system and plugged it in
> to the usb converter.
> 
> 	the drive breezes through fsck and looks perfectly
> normal.
> 
> 	I looked at /boot/grub/grub.cfg which one is not supposed
> to edit as grub builds it based on /etc/default/grub which one
> does edit.
> 
> 	If I was to mount that partition on a working system, it,
> of course, will have a different device number such as /dev/sde1
> instead of /dev/sda1 which it should have when booting up the
> system it normally runs in.
> 
> 	Is there a safe way to mount this drive, possibly using
> chroot, re-run grub-config and get the drive bootable again?

Here's what you can do:

On a good system, mount your drive. Let's pretend that it's
recognized as /dev/sdg, and you have a /boot on /dev/sdg1 and
a root partition on /dev/sdg2.

ls -al /dev/disk/by-partuuid/| grep sdg

will get you the partition UUIDs for that disk. One of them will
be for /dev/sdg1 and another for /dev/sdg2.

The kernel really likes these as root filesystems identifiers.
The kernel parameter that you put in /etc/default/grub is

ROOT=PARTUUID=dddf0dd6-dd6b-d542-9eac-015a765cd6f6

although you will want to substitute in the appropriate
part-uuid for /dev/sdg2.

Finally, you can run 

grub-install /dev/sdg

to get a new copy of grub into the master boot sector of the
disk.

Hope that helps,

-dsr-

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Fixing a Grub Foul-up "Martin McCormick" <martin.m@suddenlink.net> - 2020-11-16 20:00 +0100
  Re: Fixing a Grub Foul-up Dan Ritter <dsr@randomstring.org> - 2020-11-16 20:40 +0100
    Re: Fixing a Grub Foul-up "Martin McCormick" <martin.m@suddenlink.net> - 2020-11-17 04:00 +0100
    Re: Fixing a Grub Foul-up "Martin McCormick" <martin.m@suddenlink.net> - 2020-11-30 05:00 +0100
      Re: Fixing a Grub Foul-up David <bouncingcats@gmail.com> - 2020-12-01 15:40 +0100
        Re: Fixing a Grub Foul-up Solved! "Martin McCormick" <martin.m@suddenlink.net> - 2020-12-01 21:10 +0100
  Re: Fixing a Grub Foul-up John Boxall <jboxall47@gmail.com> - 2020-11-16 20:40 +0100
    Re: Fixing a Grub Foul-up Kenneth Parker <sea7kenp@gmail.com> - 2020-11-17 03:00 +0100
  Re: Fixing a Grub Foul-up David <bouncingcats@gmail.com> - 2020-11-17 00:00 +0100
    Fixing a Grub Foul-up, Not There Yet. "Martin McCormick" <martin.m@suddenlink.net> - 2020-11-21 20:00 +0100
      Re: Fixing a Grub Foul-up, Not There Yet. Felix Miata <mrmazda@earthlink.net> - 2020-11-21 20:40 +0100
        Re: Fixing a Grub Foul-up, Not There Yet. "Martin McCormick" <martin.m@suddenlink.net> - 2020-11-22 00:10 +0100
          Re: Fixing a Grub Foul-up, Not There Yet. Felix Miata <mrmazda@earthlink.net> - 2020-11-22 01:20 +0100
          Re: Fixing a Grub Foul-up, Not There Yet. Kushal Kumaran <kushal@locationd.net> - 2020-11-22 02:10 +0100
      Re: Fixing a Grub Foul-up, Not There Yet. Dan Ritter <dsr@randomstring.org> - 2020-11-22 01:10 +0100
        Re: Fixing a Grub Foul-up, Not There Yet. "Martin McCormick" <martin.m@suddenlink.net> - 2020-11-22 04:50 +0100
      Re: Fixing a Grub Foul-up, Not There Yet. "Martin McCormick" <martin.m@suddenlink.net> - 2020-11-30 18:00 +0100

csiph-web