Menu

Help! Stuck at "GRUB _" with a blinking cursor after restoring parts

Help
MMT
2023-07-31
2023-08-01
  • MMT

    MMT - 2023-07-31

    In short:

    1. I backed up disk partitions using Clonezilla
    2. then wiped my disks completely, partition tables included
    3. then restored partition tables back with sfdisk /dev/sdX < sdX-pt.sf using Clonezilla's data
    4. and then restored the partitions back on the disks via Clonezilla

    The restored data seems to be correct and intact - partitions are manually mountable inside Clonezilla live CD, disk IDs, UUIDs, lvmids, etc. seem to match, but when I try to boot the system, I get "GRUB _" message with _ blinking cursor and no input allowed. I don't even get to the grub console. The grub config in /boot/grub.cfg of sdb3/lvm/ext4 seems to be correct, it mentions the sdb3 disk UUID and the correct lvmid. How do I fix this issue?


    In more detail:

    I have an HDD (sda) and an SSD (sdb). sda is a disk with NTFS sda1 partition on it I use for data storage. sdb is an OS disk with Windows 7 and Debian Linux on it in dualboot, with Debian Linux's GRUB being used to select which one to boot. sdb has sdb1 (100M NTFS Windows partition), sdb2 (NTFS Windows 7) and sdb3 (LVM ext4 Debian Linux).

    I have made 3 saveparts backups:

    1. HDD: sda1
    2. SSD Windows: sdb1 sdb2
    3. SSD Debian Linux: sdb1 sdb3

    I then wiped the drives: filled HDD with random data and used ATA secure erase command on the SSD.

    I then tried restoring the disks, but Clonezilla couldn't restore sda1 as sda1 partition didn't exist anymore after sda got wiped, so sda1 didn't appear in restoreparts as a target. I tried selecting the "device and partition" option, which made sda appear, but restoring sda1 to sda didn't create sda1 on the target disk. So I did sfdisk /dev/sda < sda-pt.sf and sfdisk /dev/sdb < sdb-pt.sf to re-create partitions on the disks, so that Clonezilla would list them when restoring parts.

    With the partition table re-created, I restored sda1, sdb1, sdb2 and sdb3 parts. It all went well, I managed to mount sda1, sdb1, sdb2 and sdb3/lvm inside Clonezilla live CD. However, when I rebooted the system, I was greeted not with the usual GRUB menu asking me to select between Debian Linux and Windows 7, but with a black screen saying "GRUB _" with "_" blinking cursor, not being able to type anything. The CPU fan seems to ramp up after a minute, so it would seem like the system is doing something? But after waiting for 60 minutes with nothing new appearing on the screen I powered the system off as it's clearly not going to fix itself. I have tried playing with many different Expert options of restoreparts, including the grub restore option, all of the MBR options, etc. and I don't seem to get the system to boot past "GRUB _". How can I get get GRUB to work again?

    Here is the layout of my disks, I have edited Model and label-id fields:

    $ cat sda-pt.sf
    label: dos
    label-id: 0x<sda-disk-id>
    device: /dev/sda
    unit: sectors
    sector-size: 512
    
    /dev/sda1 : start=        2048, size=  1465147120, type=7, bootable
    
    $ cat sda-pt.parted
    Model: ATA SDA Disk Name (scsi)
    Disk /dev/sda: 1465149168s
    Sector size (logical/physical): 512B/4096B
    Partition Table: msdos
    Disk Flags: 
    
    Number  Start  End          Size         Type     File system  Flags
     1      2048s  1465149167s  1465147120s  primary  ntfs         boot
    
    $ cat sdb-pt.sf
    label: dos
    label-id: 0x<sdb-disk-id>
    device: /dev/sdb
    unit: sectors
    sector-size: 512
    
    /dev/sdb1 : start=        2048, size=      204800, type=7, bootable
    /dev/sdb2 : start=      206848, size=  2103271424, type=7
    /dev/sdb3 : start=  2103478272, size=  1803550896, type=8e
    
    $ cat sdb-pt.parted
    Model: ATA SDB Disk Name (scsi)
    Disk /dev/sdb: 3907029168s
    Sector size (logical/physical): 512B/512B
    Partition Table: msdos
    Disk Flags: 
    
    Number  Start        End          Size         Type     File system  Flags
     1      2048s        206847s      204800s      primary  ntfs         boot
     2      206848s      2103478271s  2103271424s  primary  ntfs
     3      2103478272s  3907029167s  1803550896s  primary               lvm
    
     
  • MMT

    MMT - 2023-08-01

    When restoring sdb1 sdb3 and selecting -g auto option, Clonezilla says:

    Running: ocs-install-grub -p "sdb1 sdb3 " auto
    The grub directory is NOT found. Maybe it does not exist (so other boot manager exists) or the file system is not supported in the kernel. Skip running grub-install.

    But the grub directory exists, sdb3 has a LVM on it containing ext4 with /boot/grub directory. No idea why Clonezilla doesn't find it.

    vgchange -ay my-vg
    udisksctl mount -b /dev/mapper/my*
    ls /media/root/<id>/boot/grub/
    fonts  grub.cfg  grubenv  i386-pc  locale  unicode.pf2
    
     

    Last edit: MMT 2023-08-01
  • MMT

    MMT - 2023-08-01

    After some research, I learned that GRUB can't be on LVM, it must be written to /dev/sdb. You should not delete /media/root/<id>/boot/grub/ though!

    So what I did is follow https://www.bleepingcomputer.com/forums/t/740193/how-to-repair-or-re-install-grub-using-the-chroot-command/

    # activate LVM
    vgchange -ay my-vg
    # mount it
    mkdir /mnt/lvm
    mount /dev/mapper/my* /mnt/lvm
    # prepare to chroot into it
    for i in /dev /dev/pts /proc /sys /run; do mount --bind "$i" "/mnt/lvm$i"; done
    chroot /mnt/lvm
    # be careful, your disk might have different name, adjust as needed!
    grub-install /dev/sdb
    update-grub
    # exit chroot
    exit
    # unmount
    for i in /run /sys /proc /dev/pts /dev; do umount "/mnt/lvm$i"; done
    umount /mnt/lvm
    vgchange -an my-vg
    reboot
    

    Now I'm able to boot into GRUB and from there into Windows 7 and Debian Linux.

    Note that this is for MBR/BIOS. If your system is UEFI then I'm not sure if this will work for you so do your own research! The linked bleepingcomputer forum thread explicitly says not to do this on UEFI and provides a different UEFI method.

     

    Last edit: MMT 2023-08-01
  • MMT

    MMT - 2023-08-01

    Just to repeat the last message, I have solved the issue and no longer need the help. The solution I used is provided above.

     
    👍
    1

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.