Fix Arch Linux boot issues

Introduction

If you are a long time Arch Linux user, you probably have collected huge number of packages. Most of them you probably don’t need. May be you thought about cleaning up the packages by removing the core GUI packages E.g., gnome or xorg-server.  If you use -Rsc argument then most of its dependent packages are also removed. After the packages are uninstalled you will start from the basics and install the core packages, so that you can pick and choose the ones you require as you need them later. You might forget to install some of the packages that is needed for boot (E.g., The kernel itself linuxsystemd or grub or may be mkinitcpio). These packages are core for Arch to work. If you forget to install these packages you might end up with an empty grub prompt.

grub >

Live Image

Always, I mean always keep a Linux live image (USB stick) with you. It is going to very useful for fixing the errors when you mess up your installation. You don’t need an Arch live Image. I prefer using Ubuntu live image. If you are prompted with above message, its time to boot using the image (use the boot menu of your laptop/computer to boot into the image).

Chroot

To fix the issue, we need to be able to run arch commands inside a terminal that understands our installation. For that, we need to mount the Arch installation partition to some directory, copy some environment settings (like DNS information and others) and chroot into it.

mkdir /media/arch
mount /dev/sda6 /media/arch
cp -L /etc/resolv.conf /media/arch/etc/
mount -t proc none /media/arch/proc
mount --rbind /sys /media/arch/sys
mount --rbind /dev /media/arch/dev
chroot /media/gentoo /bin/bash

After executing above commands you will be inside your Arch installation. Here you should be able to install packages and run other Arch commands. Make sure you can ping to some web URL before running pacman. If you cannot connect, make sure /etc/resolv.conf is just like in your host (Live Image). You can use nano to edit inside chroot environment. Make sure you install base packages mentioned above (like the kernel (linux), systemd, systemd-sysvcompat, mkinitcpio, grub etc). Once you install these packages you can run following commands to fix the grub.

mkinitcpio -p linux
pacman -S grub-bios
grub-install --target=i386-pc --recheck /dev/sda
pacman -S os-prober
grub-mkconfig -o /boot/grub/grub.cfg

Make sure grub-mkconfig command output lists your linux installation. You can cat /boot/grub/grub.cfg to make sure it does.

 

These commands should fix most of the boot issues that could happen because of the missing base packages. If you still get “root device mounted successfully, but /sbin/init does not exist” or systemd related error, above setup commands may not have executed properly. If you get this error, during boot in grub, in the kernel line (the line that has linux on it) add one of these and try to boot.

init=/sbin/init
init=/bin/systemd
init=/lib/systemd/systemd

If it boots, you can again run above commands from the installation (not Live Image) to fix the issue for next boot.

Hope this helps !!

Leave a comment

Filed under Uncategorized

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s