Grub-Install for Legacy boot

So I have a secondary EOS system that I’ve had for years but I don’t use as much as I used to. Anyway about 2 weeks ago I ssh’d to it, and did a standard ‘sudo pacman -Syu’ and while I didn’t watch it fully during completion, from my memory I don’t recall seeing any big errors at the end. So I just did a reboot. When it didn’t boot, I switched over the KVM to it, and could see that no matter what kernel is selected in grub it gives an error that vmlinuz-linux could not be found.

So tonight I finally got around to creating a boot usb to access it, boot via that and arch-chroot and I can see that in the /boot directory all vmlinux-linux files were deleted, along with initramfs-linux files and the entire efi directory.

So I did a ‘sudo pacman -Syu linux linux-headers’ and it pulled down 419 new packages, and I can see that I now have the vmlinux-linux files back, and the initramfs-linux files too, but the efi directory was not there.

So I’ve tried using grub-install

grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=endeavouros

but I get the error

Installing for x86_64-efi platform.
grub-install: error: /boot/efi doesn't look like an EFI partition.

I’ve tried manually creating the folder via mkdir, but I still get the same error. I didn’t have a separate boot partition previously so I’m not sure how to progress past this

[root@EndeavourOS boot]# efibootmgr
BootCurrent: 000A
Timeout: 1 seconds
BootOrder: 0001,0007,0006,0009,0008,000A
Boot0001* Diskette Drive        BBS(Floppy,Diskette Drive,0x0)0000424f
Boot0006* USB Storage Device    BBS(USB,SanDisk Cruzer Blade 1.26,0x0)0000424f
Boot0007* CD/DVD/CD-RW Drive    BBS(CDROM,P1: HL-DT-ST DVD+/-RW GU90N,0x0)0000424f
Boot0008* Onboard NIC   BBS(Network,IBA CL Slot 00FE v0106,0x0)0000424f
Boot0009* P0: SanDisk SSD PLUS 1000GB   BBS(HD,P0: SanDisk SSD PLUS 1000GB,0x0)0000424f
Boot000A* UEFI: SanDisk Cruzer Blade 1.26       PciRoot(0x0)/Pci(0x14,0x0)/USB(0,0)/HD(1,MBR,0xea64eddc,0x5853c0,0x56000)0000424f
[root@EndeavourOS boot]# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0    7:0    0   2.6G  1 loop 
sda      8:0    0 931.5G  0 disk 
├─sda1   8:1    0 897.3G  0 part /
└─sda2   8:2    0  34.2G  0 part 
sdb      8:16   1   3.7G  0 disk 
├─sdb1   8:17   1   2.8G  0 part 
└─sdb2   8:18   1   172M  0 part 
sr0     11:0    1  1024M  0 rom  
[root@EndeavourOS boot]# fdisk -l
Disk /dev/sda: 931.52 GiB, 1000207286272 bytes, 1953529856 sectors
Disk model: SanDisk SSD PLUS
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x7797dddd

Device     Boot      Start        End    Sectors   Size Id Type
/dev/sda1  *          2048 1881759179 1881757132 897.3G 83 Linux
/dev/sda2       1881759180 1953520064   71760885  34.2G 82 Linux swap / Solaris


Disk /dev/sdb: 3.73 GiB, 4004511744 bytes, 7821312 sectors
Disk model: Cruzer Blade    
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xea64eddc

Device     Boot   Start     End Sectors  Size Id Type
/dev/sdb1  *         64 5788607 5788544  2.8G  0 Empty
/dev/sdb2       5788608 6140863  352256  172M ef EFI (FAT-12/16/32)


Disk /dev/loop0: 2.6 GiB, 2788671488 bytes, 5446624 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
[root@EndeavourOS boot]# ls -al /boot/
total 195952
drwxr-xr-x  4 root root     4096 Apr 11 22:56 .
drwxr-xr-x 18 root root     4096 Jan 26 20:30 ..
drwxr-xr-x  2 root root     4096 Apr 11 22:56 efi
drwxr-xr-x  6 root root     4096 Jul 31  2023 grub
-rw-------  1 root root 61914979 Apr 11 22:49 initramfs-linux-fallback.img
-rw-------  1 root root 17124612 Apr 11 22:49 initramfs-linux.img
-rw-------  1 root root 62861061 Apr 11 22:50 initramfs-linux-zen-fallback.img
-rw-------  1 root root 17236310 Apr 11 22:50 initramfs-linux-zen.img
-rw-r--r--  1 root root  9683968 Feb 11 11:09 intel-ucode.img
-rw-r--r--  1 root root 15368704 Apr 11 22:49 vmlinuz-linux
-rw-r--r--  1 root root 16433664 Apr 11 22:49 vmlinuz-linux-zen
[root@EndeavourOS boot]# ^C

So how do I get grub-install to work here?

I think you should change the title of the topic. Keep reading and you’ll see why :wink:

Only one partition mounted at /. No partition mounted at /boot/efi.

A disk with dos partition table. This is legacy boot. No UEFI boot. Therefore no second EFI partition and no efi directory as mount point.

The update didn’t delete your /boot/efi partition.

The grub-install command you used is for installing the bootloader for UEFI boot.

The grub-install you need to use should be for installing the boot loader in Bios mode.

grub-install --target=i386-pc /dev/sda

https://wiki.archlinux.org/title/GRUB#BIOS_systems

I think you should change the title of the topic :wink:

2 Likes

Ok, its been on the go that long I hadn’t realized it had been installed as a Legacy boot, but it makes sense. Used that grub-install command, did a reboot and its back working again. Still no idea what caused the other /boot files to be deleted, but I’ll chalk it down to experience. Title edited as suggested.

Danke muchly for the assist..

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.