[How To] Save your Manjaro installation when it breaks

Difficulty: ★☆☆☆☆

Post original authored by Heart-Of-A-Lion

Some of you might have had it happen, a Linux installation on your computer that breaks after installing certain software, after installing updates or after editing a configuration file.

Sometimes you mess up so bad, that the entire system doesn’t boot past Grub or doesn’t even boot Grub itself if you messed around with its configuration files.

So what can you do when you really messed up big time?

What if you didn’t make that Clonezilla backup of your system that you should have made in case of emergencies?

Here is a solution that has saved my system on a number of occasions, when it was so broken, that Manjaro or even Grub didn’t load and all that you could see was a black screen at bootup.

  1. Start the Manjaro live installation media from a usb-stick (or from a CD/DVD for example).

  2. Now you need to find out the name of the disk or partition on which your actual Manjaro installation resides. You do this by opening a terminal and typing:

    lsblk
    

    This now lists all your disks and partitions in the terminal window in a tree structure. Now you can determine on which partition you have Manjaro installed.
    The name of the partition on which Manjaro is installed can look like this for example: sda2

  3. Now you need to mount the entire tree of your file system of your installed version of Manjaro into the live environment. This is very powerful stuff when you think about it. You will be able to access the file system of your Manjaro installation in the live environment!
    To do this, you need to choose a mount point in the file system of the live environment first. Typically, people use /mnt as the location to do this. So to accomplish this step, execute the following command in a terminal:

    sudo mount /dev/sda2 /mnt
    

    Now you’ve mounted the filesystem of sda2 into the /mnt mount-point. Powerful stuff!

  4. So now you have access to the files of your Manjaro installation, even in a graphical file manager like Thunar (at /mnt ). However that’s not always enough to save your Manjaro installation. Sure you can edit configuration files now or even delete files that caused issues, but what you really want is full control. You want to be able to execute commands as if your were inside your actual Manjaro installation.
    This means that you need to change root to the new mount-point that you just created. And typically this is done with the chroot command, however the chroot command often doesn’t allow you to run the commands that are needed to repair a broken Linux installation.
    What you need, is a more powerful version of chroot. It’s called mhwd-chroot .
    You need to download and install it in your Live media from the Manjaro repositories:

    sudo pacman -S manjaro-chroot
    
  5. Once installed, you can now change root to the new mount point. You do that from the menu (chroot) or by typing the following command in a terminal:

    manjaro-chroot
    

    This will present you the available system partitions you can change root to.

  6. Now a new terminal window will open. In this terminal window you can execute commands as if you were inside your actual Manjaro installation.

    You can now uninstall software that caused your system to break or you can roll back updates or you can uninstall drivers like video-drivers that made your screen go black.
    It’s powerful stuff, because you now have both access to your files and to a terminal which can control your Manjaro installation. The possibilities to repair things, fix issues and backup files are now endless. This and much more. All due to these few simple commands.
    In short, here are the steps and commands in a nutshell:

  7. Boot into the Manjaro live installation media

  8. Open a terminal and type: lsblk

  9. Mount your disk into the live environment: sudo mount /dev/sda2 /mnt

  10. Download and install manjaro-chroot

  11. Change root into the new mount-point: manjaro-chroot

  12. Save your Manjaro installation using the chrooted terminal

One more thing I can add to this is that people who use PCIe storage devices, they need to download and install mhwd-chroot-extended (from the AUR), so that they can mount file systems from NVMe storage devices.

10 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.