Arch Linux does not boot: how to fix it
If your Arch Linux does not boot or boot into a black screen, start by switching to another terminal with the keyboard shortcuts Ctrl+Alt+F1, Ctrl+Alt+F2, Ctrl+Alt+F3, and so on. If you succeeded and you saw a command prompt to enter your login credentials, then everything is easy – log in and roll back the changes that prevent the system from starting.
But there are more difficult cases, for example, due to the installation of a video driver, bbswitch or similar programs, and it may be impossible to switch to other terminals due to a complete system freeze.
Another example of a difficult situation is completely removing the boot disk (this has happened to me).
Manjaro and other Arch Linux based distributions offer GUI installers for installing the operating system. But if you installed Arch Linux manually (as described in the Arch Linux Installation Guide), you may have noticed that we install packages and configure the system by booting from a Live image. This same trick can be used to fix problems of any complexity – even if your system is completely inoperative and won't boot, it can still be fixed!
Boot into another operating system – for this you can install Linux on a USB flash drive and keep this USB flash drive for such cases. By the way, you can use an old flash drive, less than 1 gigabyte in size, to always keep the Arch Linux Live image on it – especially in case of such a problem.
Start by downloading the Arch Linux image from the official site: https://www.archlinux.org/download/
For burning, use the Etcher program (site https://www.balena.io/etcher/), which works great on any operating system.
How to repair an Arch Linux boot disk
If your boot partition is damaged or deleted, boot the Arch Linux Live image from the USB stick and run the following commands.
Note that instead of nvme0n1p1 you need to specify the name of your boot partition, for example /dev/sdb1. To see a list of all disks, run the command:
sudo fdisk -l
We format the boot partition to FAT32:
mkfs.fat -F32 /dev/nvme0n1p1
We mount partitions:
mount /dev/nvme0n1p2 /mnt mkdir /mnt/boot mount /dev/nvme0n1p1 /mnt/boot
Change the root directory to a new one:
arch-chroot /mnt
Installing the bootloader:
bootctl install
Edit the content of the file:
vim /boot/loader/loader.conf
Delete what is there and write there:
default arch
Create a config file to add an Arch Linux item to the systemd-boot manager:
vim /boot/loader/entries/arch.conf
The content of the file should be as follows:
title BlackArch linux /vmlinuz-linux initrd /initramfs-linux.img options root=/dev/nvme0n1p2 rw
Pay attention to /dev/nvme0n1p2 – this is the path to my system disk, replace it with your own.
You also need to create the following files in the /boot partition:
- vmlinuz-linux
- initramfs-linux.img
- initramfs-linux-fallback.img
The easiest way to do this is to run the kernel installation:
pacman -S linux
Exit the chroot, unmount the mounted partitions and reboot:
exit umount -R /mnt/boot umount -R /mnt reboot
You can remove the installer disc.
How to remove a program that prevents Arch Linux from booting
Sometimes the booting fails due to an installed program, or vice versa, due to the removal of a required package.
Boot the Arch Linux Live image from a USB stick and run the following commands. Note that instead of nvme0n1p1 and nvme0n1p2, you need to specify the names of your disk's partitions, for example /dev/sdb1 and /dev/sdb2. To see a list of all disks, run the command:
sudo fdisk -l
We mount partitions:
mount /dev/nvme0n1p2 /mnt mkdir /mnt/boot mount /dev/nvme0n1p1 /mnt/boot
Change the root directory to a new one:
arch-chroot /mnt
By default, you are the root user, but you can change the user existing on the system we are restoring. This can be useful, since the history of commands of this user will be available to us, and we can easily remember which configuration files we edited and which packages were installed/removed just before the inability to boot.
For example, on a non-working system, the last commands were executed from the user mial, let's log in as this user:
sudo su mial
Now, to install packages, use a command like:
sudo pacman -S PACKAGE
And to remove packages, use a command like:
sudo pacman -R PACKAGE
Related articles:
- Live USB flash drive with Linux does not boot, error ‘A start job is running for live-config contains the components that configure a live system during the boot process (late userspace)’ (SOLVED) (94%)
- What to do if Linux does not boot (94%)
- How to recover USB drive/flash drive after flashing an ISO image or installing OS (SOLVED) (72%)
- testssl.sh: No cipher mapping file found and No TLS data file found (SOLVED) (61.4%)
- How to install NVIDIA drivers, CUDA and Bumblebee on Arch Linux / BlackArch (61.4%)
- How to test email sending in PHP on Windows (RANDOM - 50%)