Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
26 changes: 26 additions & 0 deletions src/config/chroot-rootfs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Creating a chroot rootfs

As root, create a directory that will contain the chroot, and install a base
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is not necessary that the chroot dir is owned by root.

$ XBPS_ARCH=x86_64-musl xbps-install -MS --rootdir=/tmp/rootfs.void.x86_64-musl --repository=https://alpha.de.repo.voidlinux.org/current/musl base-voidstrap
$ proot -R /tmp/rootfs.void.x86_64-musl/

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 <chroot_dir>/proc
# mount -t sysfs none <chroot_dir>/sys
# mount --rbind /dev <chroot_dir>/dev
# mount --rbind /run <chroot_dir>/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.
27 changes: 2 additions & 25 deletions src/installation/musl.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <chroot_dir>/proc
# mount -t sysfs none <chroot_dir>/sys
# mount --rbind /dev <chroot_dir>/dev
# mount --rbind /run <chroot_dir>/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].