Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: Please help a stupid guy to chroot (Read 13375 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Please help a stupid guy to chroot

Hi, please explain to explain like if it were a 5 year old boy
my arch root partition is sda2
my boot is sda1
and my home is sda7
i did this:

mkdir /mnt/arch
mount /dev/sda2 /mnt/arch
mount /dev/sda1 /mnt/arch/boot
mount /dev/sda7 /mnt/arch/home
cd /mnt/arch

if i do
arch-chroot /mnt/arch /usr/bin/bash
or
arch-chroot /mnt/arch /bin/bash
it say :
mount : /mnt/arch/proc proc already mounted in /proc failed to setup chroot /mnt/arch

if i do:
mkdir /mnt/arch
mount /dev/sda2 /mnt/arch
mount /dev/sda1 /mnt/arch/boot
mount /dev/sda7 /mnt/arch/home
cd /mnt/arch
mount -t proc proc proc/
mount --rbind /sys sys/
mount --rbind /dev dev/
mount --rbinf /run run/
cp /etc/resolv.conf etc/resolv.conf
chroot /mnt/arch /bin/bash
it say:
chroot failed to run command bin/bash no such file or directory

what im doing wrong?

 

Re: Please help a stupid guy to chroot

Reply #1
mount /dev/sda2 /mnt/
mount /dev/sda1 /mnt/boot
mount /dev/sda7 /mnt/home

Re: Please help a stupid guy to chroot

Reply #2
And use the 'artools-chroot' command if you're using the Artix ISO

Re: Please help a stupid guy to chroot

Reply #3
This reminds me of something funny, last week I was trying to chroot to my broken artix from other installations and it wasn't functional.
Someone mentioned artix-chroot, so I booted the iso.  It wasn't installed so I tried to install it.  Nothing.
Finally, I think it was @mandog, pointed me to the arch-wiki for proper chroot procedure.  After I did everything and worked great, I saw a mention of "artools-chroot" which I assume incorporates the wiki procedure.  When I get some time I will investigate on the differences between arch-chroot and artools-chroot.

Re: Please help a stupid guy to chroot

Reply #4
It wasn't installed so I tried to install it.  Nothing.
artools-chroot is provided by artools-base :
Code: [Select]
~ >>> pacman -Ql artools-base | grep bin
artools-base /usr/bin/
artools-base /usr/bin/artools-chroot
artools-base /usr/bin/basestrap
artools-base /usr/bin/chroot-run
artools-base /usr/bin/fstabgen
artools-base /usr/bin/mkchroot
artools-base /usr/bin/signfile

If I can hit that bullseye, the rest of the dominoes will fall like a house of cards. Checkmate!

Re: Please help a stupid guy to chroot

Reply #5
I know but artix-chroot doesn't exist yet :)
Not in the fashion of manjaro-chroot or arch-chroot

 

Re: Please help a stupid guy to chroot

Reply #6
@fungalnet, 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.

Re: Please help a stupid guy to chroot

Reply #7
Thanks a lot!!!! im able to boot now


Re: Please help a stupid guy to chroot

Reply #9
Have not found found anything more current on the subject of artix-chroot, so will ask here...

Are the instructions in the above post still valid, as of March 2023?

Are the below instructions from Arch wiki required in their exact content when using artix-chroot?
Quote
If you are running a UEFI system, you will also need access to EFI variables. Otherwise, when installing GRUB, you will receive a message similar to: UEFI variables not supported on this machine:

# mount --rbind /sys/firmware/efi/efivars sys/firmware/efi/efivars/
Next, in order to use an internet connection in the chroot environment, copy over the DNS details:

# cp /etc/resolv.conf etc/resolv.conf
Finally, to change root into /path/to/new/root using a bash shell:

# chroot /path/to/new/root /bin/bash
Operating System: Artix Linux x86_64