Repairing with chroot when Manjaro just won't boot.
Welcome, Guest.
“Theory and practice sometimes clash. And when that happens, theory loses. Every single time.” ― Linus Torvalds

Author Topic: Repairing with chroot when Manjaro just won't boot.  (Read 9875 times)

Offline bubbadoobop

  • Newbie
  • **
  • Posts: 19
  • Free software for a free world.
Repairing with chroot when Manjaro just won't boot.
« on: June 11, 2016, 08:25:49 PM »
I assume that if you've used Manjaro for a while that you've had some headache with it's booting process after a buggy update. If you are a newbie with Manjaro and it won't boot after an update, and you're unsure if you have to reinstall or not, I would suggest reading this. Before we begin, I would like to mention that we will be using chroot for this. Most of the commands listed will be used for chrooting into the system. 
  • First thing's first. Boot up with the live image of your choice. It doesn't matter what you use. As long as it's usable live, it's fine.
  • Open up your terminal as root. To become root, type in one of two commands... 

Code: [Select]
[user@hostname ~]$ sudo -s          Or
Code: [Select]
[user@hostname ~]$ su
      3. Make a directory in /mnt/. It can be called whatever you like. But for this tutorial, we'll call it Manjaro. So in order to do this, type in the command,
Code: [Select]
[root@hostname ~]# mkdir /mnt/Manjaro/
     4. Next, I would suggest changing your directory to the one you had just created with the Change Directory command (cd).
Code: [Select]
[root@hostname ~]# cd /mnt/Manjaro
which will end up making the terminal look like this...
Code: [Select]
[root@hostname /mnt/Manjaro]#
    5. The next thing you will need to do is to mount the OS into /mnt/Manjaro. Before we can mount it, we need to know what partition Manjaro is located in. Simply type in this command.

Code: [Select]
[root@hostname /mnt/Manjaro]# os-prober 
It should result in you getting this exacxt output or something similar (if Manjaro is your only OS).
Code: [Select]
[root@hostname /mnt/Manjaro]# os-prober
*note: though I use /dev/sdXY, the X is denoting a variable for the drive name, and Y denoting the partition number, such as 1 or 4.*

    6. Next, mount the partition to /mnt/Manjaro. 
Code: [Select]
[root@hostname /mnt/Manjaro]# mount /dev/sdXY /mnt/Manjaro
    7. Next, you need to mount processes (proc), the partitions (dev), and the file system (sys). In order to do that, run these commands in no particular order. 
Code: [Select]
[root@hostname /mnt/Manjaro]# mount -t proc proc proc/
[root@hostname /mnt/Manjaro]# mount --rbind /sys sys/
[root@hostname /mnt/Manjaro]# mount --rbind /dev dev/

    8. Now that you have successfully mounted everything into the directory, you need to actually chroot into the directory. In order to do this, run 
Code: [Select]
[root@hostname /mnt/Manjaro]# chroot /mnt/Manjaro
    9. If this works, you should get this output (if you don't have screenfetch installed and running in bash.bashrc, if you do, it will be the regular screenfetch output along with the cursor and such).
Code: [Select]
[root@hostname /]# *Feel free to indulge in a satisfied grin and an either self given, or externally received pat on the back.
   10. Next, all you need to do is run

Code: [Select]
[root@hostname /]# pacman -Syyu or
Code: [Select]
[root@hostname /]# pacman -Syu
   11. Once it finishes, I usually just log out using.
Code: [Select]
[root@hostname /]# reboot
   12. If it works, feel free to brag to your friends about how you can fix operating systems. 

1.If you want more about chroot, I would read the article on the Arch Linux Wiki.
2. If this does not work, I'm afraid I cannot help. I'm not a guru or anything. I just wanted to share this as a basic system repair tutorial. 
"A computer is like air conditioning, it becomes useless when you open up windows."
-Linus Torvalds