GRUB Recovery
source link: https://legends2k.github.io/note/grub2_recovery/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
GRUB Recovery
after a Windows boot loader overwrite
Published Jan 20, 2019 by Sundaram Ramaswamy Updated Oct 1, 2020
I tried upgrading the firmware of my old iOmega 1 TB HDD. Internally it’s a Barracuda LP family, ST31000520AS model Segate HDD. Seagate had released a firmware upgrade for this drive in 2010. I’m around 9 years late to the party!
My laptop doesn’t have a CD-ROM drive, also I prefer burning the ISO to a USB stick — why waste a CD, eh? Rufus kindly refused as the supplied Seagate update ISO’s boot format was unrecognizable. In the process, I’d tried using another tool – RMPrepUsb – in vain. It’d done something, owing to some option I chose of course, to overwrite GRUB2 with Windows boot loader — some BCDedit
command I guess. My meddling with BIOS didn’t help either as GRUB wasn’t even listed in EFI order, so I reverted to orignial settings1:
Setting | Value |
---|---|
Boot Mode | UEFI |
USB Boot | Enabled |
EFI order | GRUB, Windows Boot Manager, EFI PXE Network |
Secure Boot | Disabled |
Fast Boot | Enabled |
Thanks to Debian’s GrubEFIReinstall guide; it made me recall that the Boot Mode should be UEFI; it also gave the way to verify it. I’d to use a UEFI-bootable2 USB stick with Arch Linux ISO. Things were smooth thereon!
root@archiso / # [ -d /sys/firmware/efi ] && echo "EFI boot on HDD" || echo "Legacy boot on HDD"
EFI boot on HDD
root@archiso / # mount /dev/lvmg1/root /mnt
root@archiso / # mount /dev/nvme0n1p5 /mnt/boot
root@archiso / # mount /dev/lvmg1/home /mnt/home
root@archiso / # mount /dev/sda5 /mnt/var
root@archiso / # swapon /dev/sda6
root@archiso / # arch-chroot /mnt
Once chrooted3, I’d to reinstall GRUB to fix the issue!
> mount /dev/nvme0n1p1 /boot/efi
> grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB
All is well now 😀
See Also
- Debian’s GrubEFIReinstall guide – like most Debian documents, thorough!
- GRUB2 & EFI Recovery Tutorial seems to be a detailed guide with multiple methods; I only glanced it.
- Firmware update Seagate HDD using Linux uses
hdparm
to do it on Linux; something the OEM doesn’t support. I didn’t have to resort to it. I dunno if this would’ve worked if the HDD was connected via USB.
HDD Upgrade Story
Those still reading to know about the poor ’ol HDD’s fate, read on! It ends well :)
I created a plain Free DOS bootable USB with Rufus; extracted the IMA floppy image to root; this worked since the update ISO was also using Free DOS. The tool, booted with Free DOS, still couldn’t do the deed! It couldn’t detect the drive that was connected via USB; I realised that it expects BIOS to be set to ATA; neither AHCI nor RAID – the only options mine has.
Luckily my 2006 desktop (AMD Phenom X4 machine) had the SATA option (in addition to the other two)! I didn’t even have to resort to a force firmware write, the tool did it straight-forward. I didn’t connect it via USB though; I opened the iOmega case, connected the internal HDD directly to the motherboard’s SATA power and data connectors.
Before firmware upgrade smartctl
warned about an older firmware.
> smartctl -i /dev/sdb
smartctl 7.0 2018-12-30 r4883 [x86_64-linux-4.20.3-arch1-1-ARCH] (local build)
Copyright (C) 2002-18, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Model Family: Seagate Barracuda LP
Device Model: ST31000520AS
Serial Number: XXXXXXXX
LU WWN Device Id: X XXXXXX XXXXXXXXX
Firmware Version: CC32
User Capacity: 1,000,204,886,016 bytes [1.00 TB]
Sector Size: 512 bytes logical/physical
Rotation Rate: 5900 rpm
Device is: In smartctl database [for details use: -P show]
ATA Version is: ATA8-ACS T13/1699-D revision 4
SATA Version is: SATA 2.6, 3.0 Gb/s
Local Time is: Mon Jan 21 09:08:22 2019 IST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
==> WARNING: A firmware update for this drive may be available,
see the following Seagate web pages:
http://knowledge.seagate.com/articles/en_US/FAQ/207931en
http://knowledge.seagate.com/articles/en_US/FAQ/213915en
After the upgrade, the warning vanished and Firmware Version reads CC35
😇
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK