(Solved) Bootloader borked after system swap

Gave away my i5 2500k and Asrock z68 motherboard in exchange for a Asus Sabertooth 990FX and an 8350. Not thinking or caring what could go wrong with just exchanging motherboards without bothering to back up our not so precious data, we simply changed it all over in an afternoon.

To my ignorant surprise Windows 10 from the other PC's HDD booted just fine on an i5 and GTX 680 pushing to an a399u @ 4k after living in a sterile AMD environment its whole life.

I was prepared to do some swearing at the bootloader after changing every aspect of the system sans the GPU and storage, but I have reached the end of my rope on this one.

It is running Arch/Antegros with kernel 4.3, Gnome 3.18, and lightdm.

How can I restore a bootloader to my arch install?

Update: I've been at this all day. I have a grub console but vmlinuz-linux is nowhere to be found.

grub> halt

(╯°□°)╯︵ ┻━┻)

Can you boot from a live CD and check if your /etc/fstab is using UUID to identify the drives?
I suspect that the UUIDs have changed and thus /boot is not found where the vmlinuz-linux image is (as far as I know).

I had that problem when I had to clone a server remotely, and forgot about that... had to pay for a KVMoverIP to be hooked up to the damn machine to fix that :(

boot up a live CD.

mount your root / and boot /boot partitions onto /mnt/os for example
your system may or may not be EFI and may or may not have a separate EFI partition (check with fdisk -l, if you only have one small partition, the boot and EFI partition are one and the same, if you have two, one will be /boot and the EFI will be /boot/efi and should be mounted there also.

chroot into your system

root # mount -t proc proc /mnt/os/proc
root # mount --rbind /sys /mnt/os/sys
root # mount --make-rslave /mnt/os/sys
root # mount --rbind /dev /mnt/os/dev
root # mount --make-rslave /mnt/os/dev

chroot into the OS

root # chroot /mnt/gentoo /bin/bash
root # source /etc/profile

from there reinstall grub.

If your using BIOS

root # grub2-install /dev/sda

If your using a EFI system

root # grub2-install --target=x86_64-efi --efi-directory=/boot

You might also need to do a new grub.cfg but this is unlikely, do this next step if it installed grub but it still didnt give you the right options to boot.

root # grub2-mkconfig -o /boot/grub/grub.cfg

exit and unmount and reboot

root # exit
cdimage ~# cd
cdimage ~# umount -lR /mnt/os/
cdimage ~# reboot

Source:
https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Base
https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Bootloader

Unplugged all drives sans the SSD with $esp, root and swap (Other 3 HDD's weren't even formatted).

# UUID=817e6c19-e515-4c37-b48e-610d23f8c5bc LABEL=AntegrosRoot
/dev/sdc2      /     ext4      rw,realtime,data=ordered 0 1
# UUID=51B0-0DF2 LABEL=AntegrosBoot 
/dev/sdc1     /boot     vfat      rw,realtime,fmsak=022,dmask=0022,codepage=437,iocharset=iso8859-1, shortname=mixed,errors-remount-ro    0 2
#UUID=f4342b49-fade-465c-9cc6-684c4f940627 LABEL=AntegrosSwap
/dev/sdc3    none     swap     defaults     0 0

I've tried a couple different grub-install configs, tried adding a separate /boot and $esp partitions.

Is grub-install deprecated to grub2-install?

It might be the fact that your using device paths rather than UUID. switch your /etc/fstab to using UUID, and run the grub2-mkconfig as I suggest above (skip the installing grub part) and see if that works.

Arch may have renamed it, i cant remember off the top of my head. which ever is installed is the one to use, the command options are the same.

Also dont make a new esp/efi partition if one isnt there, /boot will be your efi partition and it will automatically look for /boot/efi once mounted.

genfstab -U /mnt > /mnt/etc/fstab
grub-mkconfig -o /boot/grub/grub.cfg

Still booting to a grub console and can't find a kernel.

# /dev/sda2 LABEL=AntegrosRoot
UUID=817e6c19-e515-4c37-b48e-610d23f8c5bc     /    ext4    rw,relatime,data-ordered    0 1
# /dev/sda1
UUID=5379-2560     /boot    vfat    rw,realtime,fmsak=022,dmask=0022,codepage=437,iocharset=iso8859-1, shortname=mixed,errors-remount-ro    0 2

Would it be easier to nuke grub and use systemd-boot or syslinux?

It might be worth trying, if found gummiboot/systemd-boot easier to use. Youll likely need to the the chroot I mentioned above to get into the system, if you have the arch install cd you can just use .. whats it called..arch-chroot? the one used during install. remember to mount your partitions first.

Okay I'll see how gummiboot will work.

mkinitcpio -p linux

said it couldn't find vmlinuz-linux either.

arch-chroot /mnt /bin/bash
cd boot

Wow vmlinuz-linux isn't there at all, just /EFI and /grub

did you mount everything properly first?

mount /dev/sda2 /mnt
mount /dev/sda1 /mnt/boot

Would I need to mount /proc and /dev separate like you did above?

arch-chroot takes care of sys and dev

the mkinitcpio -p linux should reinstall the kernel on /boot..

pacman -S base base-devel

Restored the vmlinuz-linux and initramfs images.

mkinitcpio -p linux

Worked once the images were back where they should be.

grub-mkconfig -o /boot/grub/grub.cfg

Detected the images and finished successfully.

Does that mean we have boot... :D

Imgur
Honey I'm home.

1 Like

Thanks for all the help, glad I didn't have to nuke everything in frustration.

1 Like