Skip to content

Commit 0076c42

Browse files
classabbyampthe-maldridge
authored andcommitted
installation/guides/chroot: use xchroot for chroot install
1 parent b7adcd5 commit 0076c42

File tree

1 file changed

+20
-32
lines changed

1 file changed

+20
-32
lines changed

src/installation/guides/chroot.md

Lines changed: 20 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -141,25 +141,12 @@ methods.
141141

142142
### Entering the Chroot
143143

144-
Mount the pseudo-filesystems needed for a chroot:
144+
[xchroot(1)](https://man.voidlinux.org/xchroot.1) (from `xtools`) can be used to
145+
set up and enter the chroot. Alternatively, this can be [done
146+
manually](../../config/containers-and-vms/chroot.md#manual-method).
145147

146148
```
147-
# mount --rbind /sys /mnt/sys && mount --make-rslave /mnt/sys
148-
# mount --rbind /dev /mnt/dev && mount --make-rslave /mnt/dev
149-
# mount --rbind /proc /mnt/proc && mount --make-rslave /mnt/proc
150-
```
151-
152-
Copy the DNS configuration into the new root so that XBPS can still download new
153-
packages inside the chroot:
154-
155-
```
156-
# cp /etc/resolv.conf /mnt/etc/
157-
```
158-
159-
Chroot into the new installation:
160-
161-
```
162-
# PS1='(chroot) # ' chroot /mnt/ /bin/bash
149+
# xchroot /mnt /bin/bash
163150
```
164151

165152
### Install base-system (ROOTFS method only)
@@ -169,10 +156,10 @@ the time when they were built, and do not come with a complete `base-system`.
169156
Update the package manager and install `base-system`:
170157

171158
```
172-
# xbps-install -Su xbps
173-
# xbps-install -u
174-
# xbps-install base-system
175-
# xbps-remove base-voidstrap
159+
[xchroot /mnt] # xbps-install -Su xbps
160+
[xchroot /mnt] # xbps-install -u
161+
[xchroot /mnt] # xbps-install base-system
162+
[xchroot /mnt] # xbps-remove base-voidstrap
176163
```
177164

178165
### Installation Configuration
@@ -188,7 +175,7 @@ may wish to install your preferred text editor at this time.
188175
For glibc builds, generate locale files with:
189176

190177
```
191-
(chroot) # xbps-reconfigure -f glibc-locales
178+
[xchroot /mnt] # xbps-reconfigure -f glibc-locales
192179
```
193180

194181
### Set a Root Password
@@ -201,7 +188,7 @@ privileges.
201188
To set a root password, run:
202189

203190
```
204-
(chroot) # passwd
191+
[xchroot /mnt] # passwd
205192
```
206193

207194
### Configure fstab
@@ -210,7 +197,7 @@ The [fstab(5)](https://man.voidlinux.org/fstab.5) file can be automatically
210197
generated from currently mounted filesystems by copying the file `/proc/mounts`:
211198

212199
```
213-
(chroot) # cp /proc/mounts /etc/fstab
200+
[xchroot /mnt] # cp /proc/mounts /etc/fstab
214201
```
215202

216203
Remove lines in `/etc/fstab` that refer to `proc`, `sys`, `devtmpfs` and `pts`.
@@ -269,8 +256,8 @@ to install GRUB onto your boot disk.
269256
install GRUB to. For example:
270257

271258
```
272-
(chroot) # xbps-install grub
273-
(chroot) # grub-install /dev/sda
259+
[xchroot /mnt] # xbps-install grub
260+
[xchroot /mnt] # grub-install /dev/sda
274261
```
275262

276263
**On a UEFI computer**, install either `grub-x86_64-efi`, `grub-i386-efi` or
@@ -279,8 +266,8 @@ optionally specifying a bootloader label (this label may be used by your
279266
computer's firmware when manually selecting a boot device):
280267

281268
```
282-
(chroot) # xbps-install grub-x86_64-efi
283-
(chroot) # grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id="Void"
269+
[xchroot /mnt] # xbps-install grub-x86_64-efi
270+
[xchroot /mnt] # grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id="Void"
284271
```
285272

286273
### Troubleshooting GRUB installation
@@ -302,8 +289,8 @@ located in `/boot/efi/EFI/Void/grubx64.efi` (its location can be found using
302289
[efibootmgr(8)](https://man.voidlinux.org/efibootmgr.8)), into the new folder:
303290

304291
```
305-
(chroot) # mkdir -p /boot/efi/EFI/boot
306-
(chroot) # cp /boot/efi/EFI/Void/grubx64.efi /boot/efi/EFI/boot/bootx64.efi
292+
[xchroot /mnt] # mkdir -p /boot/efi/EFI/boot
293+
[xchroot /mnt] # cp /boot/efi/EFI/Void/grubx64.efi /boot/efi/EFI/boot/bootx64.efi
307294
```
308295

309296
## Finalization
@@ -312,7 +299,7 @@ Use [xbps-reconfigure(1)](https://man.voidlinux.org/xbps-reconfigure.1) to
312299
ensure all installed packages are configured properly:
313300

314301
```
315-
(chroot) # xbps-reconfigure -fa
302+
[xchroot /mnt] # xbps-reconfigure -fa
316303
```
317304

318305
This will make [dracut(8)](https://man.voidlinux.org/dracut.8) generate an
@@ -322,7 +309,8 @@ At this point, the installation is complete. Exit the chroot and reboot your
322309
computer:
323310

324311
```
325-
(chroot) # exit
312+
[xchroot /mnt] # exit
313+
# umount -R /mnt
326314
# shutdown -r now
327315
```
328316

0 commit comments

Comments
 (0)