Skip to content

Commit 6c1298c

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

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

src/installation/guides/fde.md

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ Next, setup the chroot and install the base system.
123123

124124
```
125125
# mount /dev/voidvm/root /mnt
126-
# for dir in dev proc sys run; do mkdir -p /mnt/$dir ; mount --rbind /$dir /mnt/$dir ; mount --make-rslave /mnt/$dir ; done
127126
# mkdir -p /mnt/home
128127
# mount /dev/voidvm/home /mnt/home
129128
```
@@ -163,22 +162,25 @@ command for a UEFI system will be as follows.
163162
# xbps-install -Sy -R https://repo-default.voidlinux.org/current -r /mnt base-system cryptsetup grub-x86_64-efi lvm2
164163
```
165164

166-
When it's done, we can enter the `chroot` and finish up the configuration.
165+
When it's done, we can enter the chroot with
166+
[`xchroot(1)`](https://man.voidlinux.org/xchroot.1) (from `xtools`) and finish
167+
up the configuration. Alternatively, entering the chroot can be [done
168+
manually](../../config/containers-and-vms/chroot.md#manual-method).
167169

168170
```
169-
# chroot /mnt
170-
# chown root:root /
171-
# chmod 755 /
172-
# passwd root
173-
# echo voidvm > /etc/hostname
171+
# xchroot /mnt
172+
[xchroot /mnt] # chown root:root /
173+
[xchroot /mnt] # chmod 755 /
174+
[xchroot /mnt] # passwd root
175+
[xchroot /mnt] # echo voidvm > /etc/hostname
174176
```
175177

176178
and, for glibc systems only:
177179

178180
```
179-
# echo "LANG=en_US.UTF-8" > /etc/locale.conf
180-
# echo "en_US.UTF-8 UTF-8" >> /etc/default/libc-locales
181-
# xbps-reconfigure -f glibc-locales
181+
[xchroot /mnt] # echo "LANG=en_US.UTF-8" > /etc/locale.conf
182+
[xchroot /mnt] # echo "en_US.UTF-8 UTF-8" >> /etc/default/libc-locales
183+
[xchroot /mnt] # xbps-reconfigure -f glibc-locales
182184
```
183185

184186
### Filesystem configuration
@@ -187,7 +189,7 @@ The next step is editing `/etc/fstab`, which will depend on how you configured
187189
and named your filesystems. For this example, the file should look like this:
188190

189191
```
190-
# <file system> <dir> <type> <options> <dump> <pass>
192+
# <file system> <dir> <type> <options> <dump> <pass>
191193
tmpfs /tmp tmpfs defaults,nosuid,nodev 0 0
192194
/dev/voidvm/root / xfs defaults 0 0
193195
/dev/voidvm/home /home xfs defaults 0 0
@@ -213,7 +215,7 @@ Next, the kernel needs to be configured to find the encrypted device. First,
213215
find the UUID of the device.
214216

215217
```
216-
# blkid -o value -s UUID /dev/sda1
218+
[xchroot /mnt] # blkid -o value -s UUID /dev/sda1
217219
135f3c06-26a0-437f-a05e-287b036440a4
218220
```
219221

@@ -229,7 +231,7 @@ configured to automatically unlock the encrypted volume on boot. First, generate
229231
a random key.
230232

231233
```
232-
# dd bs=1 count=64 if=/dev/urandom of=/boot/volume.key
234+
[xchroot /mnt] # dd bs=1 count=64 if=/dev/urandom of=/boot/volume.key
233235
64+0 records in
234236
64+0 records out
235237
64 bytes copied, 0.000662757 s, 96.6 kB/s
@@ -238,15 +240,15 @@ a random key.
238240
Next, add the key to the encrypted volume.
239241

240242
```
241-
# cryptsetup luksAddKey /dev/sda1 /boot/volume.key
243+
[xchroot /mnt] # cryptsetup luksAddKey /dev/sda1 /boot/volume.key
242244
Enter any existing passphrase:
243245
```
244246

245247
Change the permissions to protect the generated key.
246248

247249
```
248-
# chmod 000 /boot/volume.key
249-
# chmod -R g-rwx,o-rwx /boot
250+
[xchroot /mnt] # chmod 000 /boot/volume.key
251+
[xchroot /mnt] # chmod -R g-rwx,o-rwx /boot
250252
```
251253

252254
This keyfile also needs to be added to `/etc/crypttab`. Again, this will be
@@ -268,19 +270,19 @@ install_items+=" /boot/volume.key /etc/crypttab "
268270
Next, install the boot loader to the disk.
269271

270272
```
271-
# grub-install /dev/sda
273+
[xchroot /mnt] # grub-install /dev/sda
272274
```
273275

274276
Ensure an initramfs is generated:
275277

276278
```
277-
# xbps-reconfigure -fa
279+
[xchroot /mnt] # xbps-reconfigure -fa
278280
```
279281

280282
Exit the `chroot`, unmount the filesystems, and reboot the system.
281283

282284
```
283-
# exit
285+
[xchroot /mnt] # exit
284286
# umount -R /mnt
285287
# reboot
286288
```

0 commit comments

Comments
 (0)