Un-fucking my Linux Macbook Pro

Today, I needed to build a bootable USB for something, so I used my Linux-powered MacBook Pro to do so. In the process, I needed wget, so I did pacman -Syu wget and it took longer than I’d appreciate because I had about a week’s worth of package upgrades to get through.

After making the bootable USB though, I decided to reboot, because quite often X crashes after a lot of upgrades, so better to preemptively strike… and when I rebooted, it wouldn’t boot - init failed to launch!

I figured I’d accidentally misfired at some step and blown away my filesystem or something… it wouldn’t be the first time I’d done that, though normally it’s with dd and not newfs, but hey, shit happens.

After a while of fucking about, I managed to get Alpine linux loaded from a USB and take a look at the filesystem. All my stuff was intact! It looked like the initramfs image was corrupted somehow, most likely due to the package upgrades and not my ham-fisted filesystem twiddling (a cursory Google search suggests this isn’t unheard of).

But how to fix? I found suggestions to use mkinitcpio, but doing it from a USB live-device wasn’t going to work, until I stumbled upon the missing ingredient: arch-chroot. I’d already tried a regular chroot to get into my main root filesystem, but it complained about /proc (easily solved) and /dev (not so easily solved) not being mounted. arch-chroot takes care of all this for you.

So the solution was:

  • Boot from arch installer USB.
  • mount /dev/sda3 /mnt
  • arch-chroot /mnt
  • mkinitcpio -p linux
  • exit, unmount /mnt, reboot.

I thought I was going to have to rsync everything off and reinstall!

Horsham, VIC, Australia fwaggle

Published:


Modified:


Filed under:


Location:

Horsham, VIC, Australia

Navigation: Older Entry Newer Entry