How to Recover Arch Linux Install via chroot

3 min


This quick guide explains some of the steps which may come in handy to recover an Arch Linux Install.

Being a rolling release, sometimes things break in Arch Linux. Not because of your own actions but hundreds of other reasons, such as a new Kernel vs your hardware or software compatibility. But still, Arch Linux is still better and provides the latest packages and applications.

But sometimes, it gives you trouble, and you end up with a blinking cursor and nothing else.

So, in those scenarios, instead of re-formatting or reinstalling, you may want to try to recover the installation, including the data, before giving up your hope. This guide outlines some steps in that direction.

Recover Arch Linux Installation

  • The first step is to create a bootable LIVE USB with Arch Linux. Download the .ISO from this link and create a bootable .ISO. You can check out this guide on how to create bootable .ISO using Etcher. Remember this step requires another working stable system, obviously, as your current system is not usable.
  • You need to know on which partition your Arch Linux is installed. This is a crucial step. If you don’t know, you can use GParted to find out. Or check in your Grub menu, Or you can run the below command to find out. This will list all your disk partitions, size, and labels.
sudo lsblk -o name,mountpoint,label,size,uuid
  • Once done, plug in the USB stick and boot from it. And you should see the Arch Linux prompt in the LIVE medium.
  • Now, mount to the Arch Linux partition using the below. Change the /dev/sda3 to your respective partition.
mount /dev/sda3 /mnt
arch-chroot /mnt
  • The arch-chroot command will mount your Arch Linux partition in the terminal, so log in using your Arch credentials. Now, you have the following options based on what you want at this stage.
  • You can take backups of your data by going through /home folders. In case the troubleshooter doesn’t work. You may copy the files to an external USB or another partition.
  • Verify the log files, especially the pacman logs, because an unstable system may be caused by upgrading some packages, such as graphics driver or any other driver. Based on the log, you may want to downgrade any specific package if you want.
  • You may use the below command to view the last 200 lines of the pacman log file to find out any failing items or dependency removal.
tail -n 200 /var/log/pacman.log | less
  • The above command gives you 200 lines from the end of the pacman.log file to verify. Now, carefully check which of the packages were updated since your successful boot.
  • And note down the package name and version somewhere. And you may try to downgrade packages one-by-one or if you think a specific package created a problem. Use the -U switch of pacman command to downgrade.
pacman -U <package name>
  • You can run the following to start your Arch system after downgrading if any.
exec /sbin/init
  • Check the status of your display manager and whether if there are any errors. Sometimes, the display manager creates a problem which can’t communicate with X Server. For example, if you are using lightdm, then you can check its status via the below.
systemctl status lightdm
  • Or, you may want to start it via the below command and check the error.
lightdm --test-mode --debug
  • Here is an example of lightdm failure, which caused an unstable Arch system.
lightdm - test mode
lightdm – test mode
  • Or check via kicking off the X server using startx.
  • In my experience, if you see errors in the above command, try to install another display manager, such as sddm and enable it. It may eliminate the error.
  • Try the above steps based on the state of your system, and troubleshoot. For errors specific to display manager lightdm, we have a guide which you may want to check out.
  • If you are using sddm, then check out these troubleshooting steps if something works.

Closing Notes

Every installation is different. And above steps may/may not work for you. But it is worth a try, and as per my experience, it works. If it works, well, good for you. Either way, let me know how it goes in the comment box below.


Arindam

Creator and author of debugpoint.com. Connect with me via Telegram, 𝕏 (Twitter), or send us an email.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments