Skip to content

Commit 2f59540

Browse files
committed
installation/guides: simplify chroot/fde guides with xgenfstab
1 parent e5a1e83 commit 2f59540

File tree

2 files changed

+47
-95
lines changed

2 files changed

+47
-95
lines changed

src/installation/guides/chroot.md

Lines changed: 26 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ System Partition:
7373
```
7474

7575
Initialize swap space, if desired, using
76-
[mkswap(8)](https://man.voidlinux.org/mkswap.8).
76+
[mkswap(8)](https://man.voidlinux.org/mkswap.8), and enable it with
77+
[swapon(8)](https://man.voidlinux.org/swapon.8).
7778

7879
## Base Installation
7980

@@ -133,33 +134,40 @@ Unpack the tarball into the newly configured filesystems:
133134
# tar xvf void-<...>-ROOTFS.tar.xz -C /mnt
134135
```
135136

137+
ROOTFS images generally contain out of date software, due to being a snapshot of
138+
the time when they were built, and do not come with a complete `base-system`.
139+
Update the package manager and install `base-system`:
140+
141+
```
142+
# xbps-install -r /mnt -Su xbps
143+
# xbps-install -r /mnt -u
144+
# xbps-install -r /mnt base-system
145+
# xbps-remove -r /mnt -R base-container-full
146+
```
147+
136148
## Configuration
137149

138-
With the exception of the section "Install base-system (ROOTFS method only)",
139-
the remainder of this guide is common to both the XBPS and ROOTFS installation
150+
The remainder of this guide is common to both the XBPS and ROOTFS installation
140151
methods.
141152

142-
### Entering the Chroot
153+
### Configure Filesystems
143154

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).
155+
The [fstab(5)](https://man.voidlinux.org/fstab.5) file can be automatically
156+
generated from currently mounted filesystems using
157+
[xgenfstab(1)](https://man.voidlinux.org/xgenfstab.1) (from `xtools`).
147158

148159
```
149-
# xchroot /mnt /bin/bash
160+
# xgenfstab -U /mnt > /mnt/etc/fstab
150161
```
151162

152-
### Install base-system (ROOTFS method only)
163+
### Entering the Chroot
153164

154-
ROOTFS images generally contain out of date software, due to being a snapshot of
155-
the time when they were built, and do not come with a complete `base-system`.
156-
Update the package manager and install `base-system`:
165+
[xchroot(1)](https://man.voidlinux.org/xchroot.1) (from `xtools`) can be used to
166+
set up and enter the chroot. Alternatively, this can be [done
167+
manually](../../config/containers-and-vms/chroot.md#manual-method).
157168

158169
```
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-container-full
170+
# xchroot /mnt /bin/bash
163171
```
164172

165173
### Installation Configuration
@@ -191,60 +199,6 @@ To set a root password, run:
191199
[xchroot /mnt] # passwd
192200
```
193201

194-
### Configure fstab
195-
196-
The [fstab(5)](https://man.voidlinux.org/fstab.5) file can be automatically
197-
generated from currently mounted filesystems by copying the file `/proc/mounts`:
198-
199-
```
200-
[xchroot /mnt] # cp /proc/mounts /etc/fstab
201-
```
202-
203-
Remove lines in `/etc/fstab` that refer to `proc`, `sys`, `devtmpfs` and `pts`.
204-
205-
Replace references to `/dev/sdXX`, `/dev/nvmeXnYpZ`, etc. with their respective
206-
UUID, which can be found by running
207-
[blkid(8)](https://man.voidlinux.org/blkid.8). Referring to filesystems by their
208-
UUID guarantees they will be found even if they are assigned a different name at
209-
a later time. In some situations, such as booting from USB, this is absolutely
210-
essential. In other situations, disks will always have the same name unless
211-
drives are physically added or removed. Therefore, this step may not be strictly
212-
necessary, but is almost always recommended.
213-
214-
Change the last zero of the entry for `/` to `1`, and the last zero of every
215-
other line to `2`. These values configure the behaviour of
216-
[fsck(8)](https://man.voidlinux.org/fsck.8).
217-
218-
For example, the partition scheme used throughout previous examples yields the
219-
following `fstab`:
220-
221-
```
222-
/dev/sda1 /boot/efi vfat rw,relatime,[...] 0 0
223-
/dev/sda2 / ext4 rw,relatime 0 0
224-
```
225-
226-
The information from `blkid` results in the following `/etc/fstab`:
227-
228-
```
229-
UUID=6914[...] /boot/efi vfat rw,relatime,[...] 0 2
230-
UUID=dc1b[...] / ext4 rw,relatime 0 1
231-
```
232-
233-
Note: The output of `/proc/mounts` will have a single space between each field.
234-
The columns are aligned here for readability.
235-
236-
Add an entry to mount `/tmp` in RAM:
237-
238-
```
239-
tmpfs /tmp tmpfs defaults,nosuid,nodev 0 0
240-
```
241-
242-
If using swap space, add an entry for any swap partitions:
243-
244-
```
245-
UUID=1cb4[...] swap swap rw,noatime,discard 0 0
246-
```
247-
248202
### Enable services
249203

250204
Services can be [enabled](../../config/services/index.md#enabling-services)
@@ -262,7 +216,7 @@ to install GRUB onto your boot disk.
262216
install GRUB to. For example:
263217

264218
```
265-
[xchroot /mnt] # xbps-install grub
219+
[xchroot /mnt] # xbps-install -S grub
266220
[xchroot /mnt] # grub-install /dev/sda
267221
```
268222

@@ -272,7 +226,7 @@ optionally specifying a bootloader label (this label may be used by your
272226
computer's firmware when manually selecting a boot device):
273227

274228
```
275-
[xchroot /mnt] # xbps-install grub-x86_64-efi
229+
[xchroot /mnt] # xbps-install -S grub-x86_64-efi
276230
[xchroot /mnt] # grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id="Void"
277231
```
278232

src/installation/guides/fde.md

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ meta-data=/dev/voidvm/home isize=512 agcount=4, agsize=2359040 blks
115115
...
116116
# mkswap /dev/voidvm/swap
117117
Setting up swapspace version 1, size = 2 GiB (2147479552 bytes)
118+
# swapon /dev/voidvm/swap
118119
```
119120

120121
## System installation
@@ -162,9 +163,23 @@ command for a UEFI system will be as follows.
162163
# xbps-install -Sy -R https://repo-default.voidlinux.org/current -r /mnt base-system cryptsetup grub-x86_64-efi lvm2
163164
```
164165

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
166+
## Configuration
167+
168+
### Filesystem Configuration
169+
170+
The [fstab(5)](https://man.voidlinux.org/fstab.5) file can be automatically
171+
generated from currently mounted filesystems using
172+
[xgenfstab(1)](https://man.voidlinux.org/xgenfstab.1) (from `xtools`).
173+
174+
```
175+
# xgenfstab /mnt > /mnt/etc/fstab
176+
```
177+
178+
### Entering the Chroot
179+
180+
We can enter the chroot with [`xchroot(1)`](https://man.voidlinux.org/xchroot.1)
181+
(from `xtools`) and finish up the configuration. Alternatively, entering the
182+
chroot can be [done
168183
manually](../../config/containers-and-vms/chroot.md#manual-method).
169184

170185
```
@@ -175,33 +190,16 @@ manually](../../config/containers-and-vms/chroot.md#manual-method).
175190
[xchroot /mnt] # echo voidvm > /etc/hostname
176191
```
177192

178-
and, for glibc systems only:
193+
### System Locale (glibc only)
194+
195+
For glibc systems only, generate locale files with:
179196

180197
```
181198
[xchroot /mnt] # echo "LANG=en_US.UTF-8" > /etc/locale.conf
182199
[xchroot /mnt] # echo "en_US.UTF-8 UTF-8" >> /etc/default/libc-locales
183200
[xchroot /mnt] # xbps-reconfigure -f glibc-locales
184201
```
185202

186-
### Filesystem configuration
187-
188-
The next step is editing `/etc/fstab`, which will depend on how you configured
189-
and named your filesystems. For this example, the file should look like this:
190-
191-
```
192-
# <file system> <dir> <type> <options> <dump> <pass>
193-
tmpfs /tmp tmpfs defaults,nosuid,nodev 0 0
194-
/dev/voidvm/root / xfs defaults 0 0
195-
/dev/voidvm/home /home xfs defaults 0 0
196-
/dev/voidvm/swap swap swap defaults 0 0
197-
```
198-
199-
UEFI systems will also have an entry for the EFI system partition.
200-
201-
```
202-
/dev/sda1 /boot/efi vfat defaults 0 0
203-
```
204-
205203
### GRUB configuration
206204

207205
Next, configure GRUB to be able to unlock the filesystem. Add the following line

0 commit comments

Comments
 (0)