How to use mount and chroot to fix a broken OM Lx system

Tags: #<Tag:0x00007fe45d1d6f20> #<Tag:0x00007fe45d1d6e30>

Important notice: You will be working as root (aka: superuser or administrator) so please for you own benefit know what you are doing or in you are unsure ask for advice before doing anything.

We boot the OM Lx installation media like you use to install OM Lx. Open Konsole, yes you have to do this from command line. Open a browser and navigate to this page so you can copy and paste the commands. And you have to do things exactly right. Let’s get started.

First we mount and chroot in to an OM system from ‘Live’ ISO to repair something broken:

You have to know where your root partition is, that is the root partition of the system you wish to repair. Using ‘/dev/sdxx’ as an example. Substitute your partition location for ‘/dev/sdxx’. You also need to know the file system type. You should remember this from when you installed your system. Usually that’s ext4 on OMV systems but could be something else. Running ‘df -Th’ as regular user will list partitions with their file system type. Running as root user ‘fdisk -l’ will list all available partitions.

To become root type ‘su -’ and enter your administrator password at the prompt. You are root aka superuser so be careful and know what you are doing or ask for advice before you do it.

  1. First we are going to mount the root or / partition of the system we wish to repair to the /mnt directory in ‘Live’ ISO system. If you have a nvme drive you need to just copy and paste the partition name from output of ‘fdisk -l’.

    # mount -t ext4 /dev/sdxx /mnt

    Substitute your file system type for ext4 if different. Substitute you partition location for /dev/sdxx.

  2. Now we’re going to mount some directories from the host system to the system to be repaired so we can run commands and do common tasks. Run these one at a time:

    # mount -o bind /sys /mnt/sys
    # mount -o bind /run /mnt/run
    # mount -o bind /dev /mnt/dev
    # mount -o bind /proc /mnt/proc

  3. This is what makes it all work. Now we chroot in to the system to be repaired to do repair work:

    # chroot /mnt

    You will see the location in Konsole change slightly reflecting that we have changed directories
    and you are now in the system to be repaired.

    You’ll see once you do this a few times that this takes more time to read than it does to do it.
    Especially if you copy and paste the commands.

Now that we have chrooted in to the installed system you can run most commonly used commands to repair a whole lot of things. Hope this helps get your OM Lx system working again.


Copied to wiki.

@ben79 I did not catch very clear the meaning of: “(2 not 1)” “(3 not 1)” “(4 not 1)” :blush:

1 Like

That is because the Discourse rules would not allow me to use numbers it changes every number to 1. Discourse posting rules seem not to have been written with technical dialog in mind I find them to be a pain at times. Inhibiting at other times.

It seems like Discourse was written to be more like social media and writing like social media is not good for technical discussions.


1 Like

Oh, ok :grin:
But it seems that you have found the way to put the right numbers anyway :wink: :thumbsup:

Will edit the wiki then.

Should you need to find the file system type for a partition you can use parted command on the device that contains that partition. Say I want to fine file system type for the partition /dev/nvme1n1p5 you would do this as root:

# parted /dev/nvme1n1
GNU Parted 3.3
Using /dev/nvme1n1
Welcome to GNU Parted! Type 'help' to view a list of commands.

Then type print and parted will print a list including file system type of each partition on the designated drive. So the whole shebang looks like this:

You type ‘q’ to quit or exit parted.