How to chroot properly in Artix and repair your installation

I recently had a problem with all my Artix installations, as I had been away for a few days, I came back and decided to update them all. I had blind faith in Artix and its testing repositories and learned my lesson. It seems as I got caught within that period where updates were uploaded and mirrors were not fully synced. So all my upgrades seem to have been half done, even though it showed “all up to date nothing to do”. Glibc mkinitcpio, elongid, etc. were not all of the same edition and the kernel images produced were unbootable. As tired as I was I did not reboot to see what was done, but next day no artix was working. Although I had chrooted before to modify things on Artix (Arch/Manjaro is the same) it is different than Devuan/Debian. You have to mount things from your running installation one at a time before you chroot so you have what is necessary for network, for grub, for initramfs/mkinitcpio to work.  Alternatively you can use artools-chroot as described in this tutorial https://artixlinux.org/forum/index.php?topic=41.0

So here it is: (where /media/Artix is whatever directory you use to mount the remote installation)

$ cd /media/Artix
 $ sudo mount -t proc proc proc/
 $ sudo mount --rbind /sys sys/
 $ sudo mount --rbind /dev dev/
 $ sudo cp /etc/resolv.conf etc/resolv.conf
 5 Artix]$ sudo chroot /media/Artix


After this you proceed with what you like to do to modify the installation.
I hope this helps, it helped me.

One thought on “How to chroot properly in Artix and repair your installation

  1. https://artixlinux.org/forum/index.php?topic=103.msg762#msg762

    below the chroot procedure for both standard and encrypted partition. I prefer the standard chroot approach (usable for ALL the platforms) than the personalized version, that I can never fully control 🙂

    #——————————-#
    # Standard chroot #
    #——————————-#

    This command manually Identify and Prepare the Installed Partition(s)

    1. Open your terminal and start a root session: su

    2. List all your partitions: lsblk -f

    3. Mount your system partition. The syntax to mount the system partition is: mount /dev/[partition_to_mount] /mnt

    Example: if the system partition is /dev/sda3, this will be mounted using the following command: mount /dev/sda3 /mnt if a separate partition /dev/sda1 has been used for the GRUB, mount it with the following command: mount /dev/sda1 /mnt/boot

    4. Change to the root directory of your mounted partitions: cd /mnt

    To complete the operation, and to mount completely the file system, it will be necessary to enter a series of commands in the following order:

    mount -t proc proc /mnt/proc
    mount -t sysfs sys /mnt/sys
    mount -o bind /dev /mnt/dev
    mount -o bind /run /mnt/run
    mount -t devpts pts /mnt/dev/pts/

    cp /etc/resolv.conf /mnt/etc/resolv.conf

    chroot /mnt

    DONE and now you are positioned on the chroot-ed file system, where all your command will act.

    #———————————#
    # LUKS Partition chroot #
    #———————————#

    1) Boot with a liveUSB

    2) Open a Terminal session

    3) Identify the hd partition: lsblk

    In this example I suppose that:
    /dev/sda1 is the /boot partition
    /dev/sda2 is the LUKS encrypted partition

    NOTE: replace sda1 or sda2 with the partition name that you get with the lsblk command

    $ su
    $ cryptsetup open –type luks /dev/sda2 root # where sda2 is the encrypted device
    $ mount /dev/mapper/root /mnt
    $ mount /dev/sda1 /mnt/boot # mount here the boot partition
    $ mount -t proc proc /mnt/proc
    $ mount -t sysfs sys /mnt/sys
    $ mount -o bind /dev /mnt/dev
    $ mount -o bind /run /mnt/run
    $ mount -t devpts pts /mnt/dev/pts

    $ cp /etc/resolv.conf /mnt/etc/resolv.conf

    $ chroot /mnt

    DONE also for an encrypted partition.

    I hope this can help you.

    Like

If your comment is considered off-topic a new topic will be created with your comment to continue a different discussion. This community is based on open and free communication, meaning we must all respect all in minimizing the exercise of freedom to disrupt such communication. Feel free to post what you think but keep in mind the subject matter discussed. It is just as easy to start a new topic as it is to dilute the content of an existing discussion.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.