Pro tip: How to repair an Ubuntu system with a Live CD

Few days I ago, I had a funny situation. Colleague of mine accidentally executed:

so instead for current directory  ./*  he changed owner for entire root file system. Sure, he tried to change back owner to the root:root , but root did not have any permissions anymore, since  /bin  is owned by another user.

Fortunately, this kind of  mess on Linux systems we can fix very quickly using Live CD. So reboot your system and run Live CD.

Mounting a File System

First you need to mount the partition your Ubuntu installation is on. It will be something like  sda1  or sda6 , if you are not sure about drive letter or partition number you can check it using GParted which is included in the Live CD. You mount partition simply by execution mount command:

Chrooting

Now you need to bind these directories to the chroot:

And finally you can enter in using chroot:

Now you can fix whatever you want in your system, in this case I restored root as owner.

 

Follow me

Mirza Pasic

Full Stack Developer at OLX
Web Developer. Geek. Systematic. Dreamer
Follow me

Published by

Mirza Pasic

Web Developer. Geek. Systematic. Dreamer