Use 'Live' OMLx iso to repair broken OMLx system

This tutorial will simply show how to use chroot to get to your broken system. What you may need to do to repair your system obviously depends on your circumstances and there are to many possibilities to discuss here. You can do this from any OMLx iso booted ‘Live’ or if you have multiple operating systems on the same computer from one of the other operating systems. You can usually do this with any other Linux distros ‘Live’ iso or a system rescue CD/DVD/Flash drive.

Note: This is easier and faster to do than it will be to read the tutorial. After you do this once or twice you will get the gist of things. A lot of this is just copy and paste. Of course you need to know what to copy and paste. :thinking:

Let’s get to it:

  1. Boot a OMLx iso ‘Live’ or boot to one of your other operating systems if you have one. For the examples here I booted ROME iso # 1602.

  2. Open Konsole (terminal)

  3. To become root type:

$ su -

  1. Type:

# fdisk -l

to list your partitions. Find your root partition. Mine is highlighted:

The part we will need in a few minutes is listed under ‘Device’ in my case /dev/nvme1n1p4. For a lot of users it may be something like /dev/sdax where x is the partition number.

  1. Next we mount the root partition to existing directory /mnt. In my case like this:

# mount /dev/nvme1n1p4 /mnt

  1. Now we need to mount some directories from the working system we are booted in to to /mnt so we can execute some commands on the remote (broken) system like this:

# for i in /proc /sys /sys/firmware/efi/efivars /run /dev /dev/pts; do mount --bind $i /mnt$i; done

  1. Now we use chroot command to change the root directory to the remote system we mounted earlier with mount command like this:

# chroot /mnt

Notice the change in the shell identifier from:

[root@omv-1602 ~]#

To:

[root@omv-1602 /]#

I am now in the remote system as root. I can verify this with the command:

# df -T

We can see the root partition we mounted with the mount command in step 4:

Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/nvme1n1p4 ext4       49G   11G   36G  23% /

You are root in your remote operating system, you are the boss, be careful. You should be able to edit any files that need editing. You may be able to reset a lost or missing root password. If the operating system you are booted in to and the remote system use the same package manager like dnf you should be able to install or remove packages or upgrade or dsync the system. You can copy, move, remove, ect. There may be situations where you will want to have a file or files copied to a usb flash drive to use on the remote system. There is a lot one can do.

  1. Optional if you need to repair broken boot-loader on UEFI boot system we need to:

# mount /boot/efi:

Now you can run the grub2-install command if needed.

  1. When you are done and it is time to go we need to;

# exit


And:

# umount -l /dev/nvme1n1p4 /mnt

  1. Now your are done. Reboot.

Anyone with problems or questions about this please post in English/Support forum or reach out to us on OpenMandriva Chat. If you spot any errors or have suggestions let us know.

:grinning:

(Tested 2022-12-31 on ROME iso # 1602 booted ‘Live’ and on an installed ROME system.)

1 Like