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.
Start the Manjaro live installation media from a usb-stick (or from a CD/DVD for example).
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:
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:
- 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!
- 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
chrootcommand, 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
You need to download and install it in your Live media from the Manjaro repositories:
sudo pacman -S mhwd-chroot
- 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:
This will present you the available system partitions you can change root to.
- 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:
- Boot into the Manjaro live installation media
- Open a terminal and type: lsblk
- Mount your disk into the live environment: sudo mount /dev/sda2 /mnt
- Download and install mhwd-chroot
- Change root into the new mount-point: mhwd-chroot
- 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.