diff --git a/src/SUMMARY.md b/src/SUMMARY.md index 07b7c8169..ce0417108 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -58,6 +58,7 @@ - [External Applications](./config/external-applications.md) - [Printing](./config/print/index.md) - [Manual Pages](./config/man.md) + - [chroot rootfs](./config/chroot-rootfs.md) - [XBPS Package Manager](./xbps/index.md) - [Advanced Usage](./xbps/advanced-usage.md) - [Repositories](./xbps/repositories/index.md) diff --git a/src/config/chroot-rootfs.md b/src/config/chroot-rootfs.md new file mode 100644 index 000000000..07510e394 --- /dev/null +++ b/src/config/chroot-rootfs.md @@ -0,0 +1,26 @@ +# Creating a chroot rootfs + +As root, create a directory that will contain the chroot, and install a base +system in it via the `base-voidstrap` package. If network access is required, +copy `/etc/resolv.conf` into the chroot; `/etc/hosts` may need to be copied as +well. + +Several directories then need to be mounted as follows: + +``` +# mount -t proc none /proc +# mount -t sysfs none /sys +# mount --rbind /dev /dev +# mount --rbind /run /run +``` + +Use [chroot(1)](https://man.voidlinux.org/chroot.1) to change to the new root, +then run programs as usual. Once you've finished using it, unmount the chroot +using [umount(8)](https://man.voidlinux.org/umount.8). + +## PRoot + +An alternative to the above is [proot(1)](https://man.voidlinux.org/proot.1), a +user-space implementation of chroot, mount --bind, and binfmt_misc. By +installing the `proot` package, unprivileged users can utilize a chroot +environment. diff --git a/src/installation/musl.md b/src/installation/musl.md index 1ca0636ed..ea4abe1f2 100644 --- a/src/installation/musl.md +++ b/src/installation/musl.md @@ -25,28 +25,5 @@ which provide their own libc in the image. ### glibc chroot -Software requiring glibc can be run in a glibc chroot. - -Create a directory that will contain the chroot, and install a base system in it -via the `base-voidstrap` package. If network access is required, copy -`/etc/resolv.conf` into the chroot; `/etc/hosts` may need to be copied as well. - -Several directories then need to be mounted as follows: - -``` -# mount -t proc none /proc -# mount -t sysfs none /sys -# mount --rbind /dev /dev -# mount --rbind /run /run -``` - -Use [chroot(1)](https://man.voidlinux.org/chroot.1) to change to the new root, -then run glibc programs as usual. Once you've finished using it, unmount the -chroot using [umount(8)](https://man.voidlinux.org/umount.8). - -#### PRoot - -An alternative to the above is [proot(1)](https://man.voidlinux.org/proot.1), a -user-space implementation of chroot, mount --bind, and binfmt_misc. By -installing the `proot` package, unprivileged users can utilize a chroot -environment. +Software requiring glibc can be run in a glibc +[chroot](../config/chroot-rootfs.md].