Salta al contenuto principale

Running glibc programs

Gentoo Linux: use doas instead of sudo

← Older revision Revision as of 16:39, 15 August 2023
(3 intermediate revisions by the same user not shown)
Line 36: Line 36:
After setting up a chroot using any of the methods described below, the loader can be set up in Alpine like so (these instructions are for a Debian chroot in /var/chroots/debian, on x86_64, but can be adapted to other systems by using the appropriate paths):
After setting up a chroot using any of the methods described below, the loader can be set up in Alpine like so (these instructions are for a Debian chroot in /var/chroots/debian, on x86_64, but can be adapted to other systems by using the appropriate paths):


mkdir -p /lib64
{{cmd|mkdir -p /lib64
ln -s /var/chroots/debian/lib/x86_64-linux-gnu/ld-2.33.so /lib64
ln -s /var/chroots/debian/lib/x86_64-linux-gnu/ld-2.33.so /lib64
printf '/var/chroots/debian/lib/x86_64-linux/gnu\n/var/chroots/debian/usr/lib/x86_64-linux-gnu\n' > /etc/ld.so.conf
printf '/var/chroots/debian/lib/x86_64-linux/gnu\n/var/chroots/debian/usr/lib/x86_64-linux-gnu\n' > /etc/ld.so.conf
/var/chroots/debian/sbin/ldconfig
/var/chroots/debian/sbin/ldconfig}}


=== Gentoo Linux ===
=== Gentoo Linux ===
Line 47: Line 47:
First,
First,


sudo apk add xz
{{cmd|doas apk add {{pkg|xz}}}}


Enter the chroot:
Enter the chroot:
mkdir ~/chroot
{{cmd|mkdir ~/chroot
cd ~/chroot
cd ~/chroot
tar -xvf stage3-*.tar.xz
tar -xvf stage3-*.tar.xz
tar -xvf portage-latest.tar.xz
tar -xvf portage-latest.tar.xz
mv portage usr
mv portage usr
sudo mount --bind /dev dev
doas mount --bind /dev dev
sudo mount --bind /sys sys
doas mount --bind /sys sys
sudo mount -t proc proc proc
doas mount -t proc proc proc
cp /etc/resolv.conf etc
cp /etc/resolv.conf etc
sudo chroot . /bin/bash
doas chroot . /bin/bash}}


And voilà, you have your working Gentoo chroot!<br>
And voilà, you have your working Gentoo chroot!<br>
Line 72: Line 72:
CHROOT_PATH="/home/$USER/chroot"
CHROOT_PATH="/home/$USER/chroot"
cd $CHROOT_PATH
cd $CHROOT_PATH
mount | grep $CHROOT_PATH/dev || sudo mount --bind /dev dev
mount | grep $CHROOT_PATH/dev || doas mount --bind /dev dev
mount | grep $CHROOT_PATH/sys || sudo mount --bind /sys sys
mount | grep $CHROOT_PATH/sys || doas mount --bind /sys sys
mount | grep $CHROOT_PATH/proc || sudo mount -t proc proc proc
mount | grep $CHROOT_PATH/proc || doas mount -t proc proc proc
cp /etc/resolv.conf etc
cp /etc/resolv.conf etc
sudo chroot --userspec=$USER:users . /bin/bash
doas chroot --userspec=$USER:users . /bin/bash
echo "You must manually unmount $CHROOT_PATH/dev, $CHROOT_PATH/sys, $CHROOT_PATH/proc."
echo "You must manually unmount $CHROOT_PATH/dev, $CHROOT_PATH/sys, $CHROOT_PATH/proc."
</nowiki>
</nowiki>
Line 87: Line 87:
Either use '''pacstrap''' (included with the arch-install-scripts package) or an Arch bootstrap image:
Either use '''pacstrap''' (included with the arch-install-scripts package) or an Arch bootstrap image:


{{cmd|sudo apk add arch-install-scripts
{{cmd|doas apk add {{pkg|arch-install-scripts}}
mkdir ~/chroot && cd ~/chroot
mkdir ~/chroot && cd ~/chroot
sudo tar xzf archlinux-bootstrap-x86_64.tar.gz && rm archlinux-bootstrap-x86_64.tar.gz
doas tar xzf archlinux-bootstrap-x86_64.tar.gz && rm archlinux-bootstrap-x86_64.tar.gz
sudo sed -i '/evowise/s/^#//' root.x86_64/etc/pacman.d/mirrorlist
doas sed -i '/evowise/s/^#//' root.x86_64/etc/pacman.d/mirrorlist
sudo sed -i '/CheckSpace/s/^/#/' root.x86_64/etc/pacman.conf
doas sed -i '/CheckSpace/s/^/#/' root.x86_64/etc/pacman.conf
sudo arch-chroot root.x86_64
doas arch-chroot root.x86_64
[chroot]# pacman-key --init
[chroot]# pacman-key --init
[chroot]# pacman-key --populate archlinux}}
[chroot]# pacman-key --populate archlinux}}
Distro