You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add documentation for generate-zbm, its config and initramfs options
Master documents reside in the `pod` subdirectory (except for
`generate-zbm.8`, which is inlined in `bin/generate-zbm` and may be
converted to man pages by running, from the repository root, the helper
`releng/pod2man.sh`. The `releng/tag-release.sh` helper will convert the
docs as part of the release process.
Co-authored-by: Zach Dykstra <[email protected]>
Co-authored-by: Andrew J. Hesford <[email protected]>
Co-authored-by: Érico Rolim <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+15-80Lines changed: 15 additions & 80 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@
6
6
7
7
zfsbootmenu is implemented as a Dracut module to provide an experience similar to FreeBSD's bootloader, for Linux distributions. In broad strokes, it works as follows:
8
8
9
-
* Via GRUB, direct EFI booting, etc, boot a Linux kernel along with an initramfs containing ZFS Boot Menu
9
+
* Via GRUB, direct EFI booting, etc, boot a Linux kernel along with an initramfs containing ZFSBootMenu
10
10
* Look for `zfsbootmenu` on the kernel command line
11
11
* Optionally specify a default pool (if multiple are present)
12
12
* Find all healthy pools and then import them
@@ -30,7 +30,7 @@ This tool makes uses of the following additional software:
ZFSBootMenu has been tested successfully with Kernel 5.7.13, Dracut 050 and ZFS On Linux 0.8.4.
35
35
36
36
# System prereqs
@@ -53,7 +53,7 @@ NAME PROPERTY VALUE SOURCE
53
53
zroot bootfs zroot/ROOT/void.2019.11.01 local
54
54
```
55
55
56
-
On start, ZFS Boot Menu will find the highest versioned kernel in `zroot/ROOT/void.2019.11.01/boot`, confirm that a matching initramfs is present, and default to booting the OS with that.
56
+
On start, ZFSBootMenu will find the highest versioned kernel in `zroot/ROOT/void.2019.11.01/boot`, confirm that a matching initramfs is present, and default to booting the OS with that.
57
57
58
58
# Installation
59
59
@@ -69,7 +69,7 @@ Because ZFS properties are inherited by default, it is possible to set the `org.
69
69
70
70
## EFI
71
71
72
-
ZFS Boot Menu integrates nicely with an EFI system. There will be two key things to configure here.
72
+
ZFSBootMenu integrates nicely with an EFI system. There will be two key things to configure here.
73
73
74
74
* The mountpoint of the EFI partition and it's contents
75
75
* The mountpoint of the boot environment `/boot` and it's contents
@@ -90,7 +90,7 @@ vmlinuz-5.4.6_1
90
90
```
91
91
92
92
93
-
Once `/boot` is backed by ZFS in a boot environment, you'll need to install the boot menu files. Typically, EFI partitions are mounted to `/boot/efi`, and contain a number of sub-directories. In this example, `/boot/efi/EFI/void` holds the ZFS Boot Menu kernel and initramfs.
93
+
Once `/boot` is backed by ZFS in a boot environment, you'll need to install the boot menu files. Typically, EFI partitions are mounted to `/boot/efi`, and contain a number of sub-directories. In this example, `/boot/efi/EFI/void` holds the ZFSBootMenu kernel and initramfs.
94
94
95
95
```
96
96
# lsblk -f /dev/sda
@@ -122,7 +122,7 @@ If you are using a pre-built kernel and initramfs downloaded from the releases p
@@ -134,7 +134,7 @@ Each time the bootmenu is updated, a new EFI entry will need to be manually adde
134
134
135
135
### rEFInd
136
136
137
-
`rEFInd` is considerably easier to install and manage. Refer to your distributions packages for installation. Once rEFInd has been installed, you can create `refind_linux.conf` in the directory holding the ZFS Boot Menu files (`/boot/efi/EFI/void` in our example):
137
+
`rEFInd` is considerably easier to install and manage. Refer to your distributions packages for installation. Once rEFInd has been installed, you can create `refind_linux.conf` in the directory holding the ZFSBootMenu files (`/boot/efi/EFI/void` in our example):
@@ -144,32 +144,15 @@ Each time the bootmenu is updated, a new EFI entry will need to be manually adde
144
144
145
145
As with the efibootmgr section, the `zfsbootmenu:POOL=` and `spl_hostid=` options need to be configured to match your environment.
146
146
147
-
This file will configure `rEFInd` to create two entries for each kernel and initrams pair it finds. The first will directly boot into the environment set via the `bootfs` pool property. The second will force ZFS Boot Menu to display an environment / kernel / snapshot selection menu, allowing you to boot alternate environments, kernels and snapshots.
148
-
149
-
# Command line options
147
+
This file will configure `rEFInd` to create two entries for each kernel and initrams pair it finds. The first will directly boot into the environment set via the `bootfs` pool property. The second will force ZFSBootMenu to display an environment / kernel / snapshot selection menu, allowing you to boot alternate environments, kernels and snapshots.
150
148
151
-
ZFS Boot Menu currently understands the following options:
149
+
# Kernel command-line options
152
150
153
-
*`spl_hostid=` used to set the system hostid if you are using a pre-built initramfs from the release page.
154
-
*`force_import=0|1` set to `1` to attempt to force import all pools on the system. Use with caution!
155
-
*`read_write=0|1` set to `1` to enable writes to pools when importing. Pools are imported read-only by default as a safety precaution.
156
-
*`timeout=`
157
-
* A value of `0` will result in the system immediately booting from the pool configured in the `bootfs` pool property
158
-
* A value of `-1` will result in the system displaying a boot menu.
159
-
* Any other positive value will show a countdown timer to boot the environment configured under `bootfs`, otherwise it will default to a boot menu.
160
-
*`""|zfsbootmenu|zfsbootmenu:|zfsbootmenu:POOL=zroot` The first three values are functionally identical. The fourth can be used to prefer a pool if multiple are present in the system.
151
+
The [zfsbootmenu(7)](pod/zfsbootmenu.7.pod#cli-parameters) manual page describes command-line options for ZFSBootMenu kernels in detail.
161
152
162
153
# ZFS properties
163
154
164
-
The following properties can be set at whatever level of the pool you'd prefer to control the boot behavior.
165
-
166
-
*`org.zfsbootmenu:kernel` this can be a partial kernel name `(5.4)` or an explicit name `(vmlinuz-5.6.11_1)`.
167
-
*`org.zfsbootmenu:commandline` set the list of kernel commandline options to be passed to the final OS. Do not set `root=`, this is set for you.
168
-
*`org.zfsbootmenu:active` controls whether boot environments appear in or are hidden from ZFS Boot Menu:
169
-
- If a boot environment has the property `mountpoint=/`, set `org.zfsbootmenu:active=off` to *hide* the environment. For any other value, including not set, the boot environment will be shown.
170
-
- If a boot environment has the property `mountpoint=legacy`, set `org.zfsbootmenu:active=on` to *show* the environment. For any other value, including not set, the boot environment will be hidden. **Note**: Not all Linux distributions support booting from filesystems with `mountpoint=legacy`.
171
-
*`org.zfsbootmenu:rootprefix` controls the prefix added to the ZFS filesystem provided as the root to kernels booted by ZFSBootMenu. For example, the command-line argument `root=zfs:zroot/ROOT/void` has the root prefix `root=zfs:`, which is the default value unless the boot environment appears to be Arch Linux; for Arch, the default root prefix is `zfs=`. Set `org.zfsbootmenu:rootprefix` on any boot environment or its parent to override this default. Remember to include the `root=` component if necessary and any delimiters like `:` or `=` that separate the prefix from the root filesystem.
172
-
155
+
The [zfsbootmenu(7)](pod/zfsbootmenu.7.pod#zfs-properties) manual page describes ZFS properties interpreted by ZFSBootMenu.
173
156
174
157
# initramfs creation
175
158
@@ -189,59 +172,11 @@ Your distribution should have packages for these already.
189
172
190
173
## config.yaml
191
174
192
-
The YAML file `/etc/zfsbootmenu/config.yaml` is used to control the behavior of `generate-zbm`. An example YAML configuration file follows:
193
-
194
-
```
195
-
Global:
196
-
ManageImages: false
197
-
BootMountPoint: /boot/efi
198
-
DracutConfDir: /etc/zfsbootmenu/dracut.conf.d
199
-
Components:
200
-
ImageDir: /boot/efi/EFI/void
201
-
Versions: false
202
-
Enabled: false
203
-
syslinux:
204
-
Config: /boot/syslinux/syslinux.cfg
205
-
Enabled: false
206
-
EFI:
207
-
ImageDir: /boot/efi/EFI/void
208
-
Versions: 2
209
-
Enabled: false
210
-
Kernel:
211
-
CommandLine: ro quiet loglevel=0
212
-
```
213
-
214
-
### Global
215
-
*`ManageImages` Set this to 1 to allow `generate-zbm` to perform any actions (creation, removal of old files, etc)
216
-
*`DracutConfDir` Set this to the location of the dracut configuration director for ZFS Boot Menu. This *CAN NOT* be the same location as the system `dracut.conf.d`, as the configuration files there directly conflict with the creation of the bootmenu initramfs.
217
-
*`BootMountPoint` Generally, set this to the location of your ESP. `generate-zbm` will ensure that this is mounted when images are created and, if `generate-zbm` does the mounting, will unmount this filesystem on exit. If you wish to avoid the mount checks, remove this parameter.
218
-
*`Version` A specific ZFS Boot Menu version string to use in producing images. In the string, the value `%{current}` will be replaced with the release version of ZFS Boot Menu. The default value is simply the current release version.
219
-
220
-
### Kernel
221
-
*`CommandLine` If you're making a unified EFI file or a syslinux configuration, this is the command line passed to the boot image. Refer to [Command line options](README.md#command-line-options).
222
-
*`Path` The full path to a specific kernel to use when making the boot images. If not specified, `generate-zbm` will try to pick a reasonable kernel.
223
-
*`Version` A specific kernel version to use. The value "%{current}" will be replaced with the output of `uname -r`; the braces can be omitted if `%current` ends on a word bounary. If not set, `generate-zbm` will try to parse the path of the selected kernel for a version.
224
-
*`Prefix` The prefix to use for the names of ZFS Boot Menu images. By default, the prefix is extracted from the input kernel name.
225
-
226
-
### Components
227
-
*`ImageDir` This is the destination directory for the initramfs and kernel.
228
-
*`Enabled` Set to `true` to enable creation of separate ZFS Boot Menu kernel and initramfs images. The default value is `false`.
229
-
*`Versions` Set to `false` or `0` to disable image versioning; `generate-zbm` will not use its `Global.Version` parameter to name outputs, and will keep exactly one backup copy of every image it produces. Set to `true` (which behaves as `1`) or a positive integer to enable image versioning; `generate-zbm` will append the value of `Global.Version` to every image it produces, followed by a revision as `_$revision`. `generate-zbm` will save `Config.Versions`*revisions* of all images that match the current value of `Global.Versions`. In addition, `generate-zbm` will save the *highest* revision of the most recent `Config.Versions` other image versions found.
230
-
231
-
### Components.syslinux
232
-
*`Enabled` Set to `true` to enable syslinux configuration generation. The default value is `false`.
233
-
*`Config` Set to the path of the syslinux configuration file to produce.
234
-
235
-
### EFI
236
-
*`ImageDir` This is the destination directory for the unified EFI file.
237
-
*`Enabled` Set to `true` to enable creation of unified UEFI bundles. The default value is `false`.
238
-
*`Versions` Behaves similarly to `Components.Versions`, but acts on files matching the UEFI bundle naming scheme.
239
-
*`Stub` This is the path to the stub loader used to boot the unified EFI image. If not set, a default of `/usr/lib/gummiboot/linuxx64.efi.stub` is assumed.
240
-
175
+
[config.yaml](pod/generate-zbm.5.pod) is used to control the operation of [generate-zbm](bin/generate-zbm).
241
176
242
177
## Conversion of legacy configurations
243
178
244
-
In prior versions of ZFS Boot Menu, an INI format was used for configuration. In general, migration to the new format is not automatic, but `generate-zbm` can perform the migration if your distribution package has not done it for you. To migrate an existing configuration, just run
179
+
In prior versions of ZFSBootMenu, an INI format was used for configuration. In general, migration to the new format is not automatic, but `generate-zbm` can perform the migration if your distribution package has not done it for you. To migrate an existing configuration, just run
@@ -257,7 +192,7 @@ Whenever `generate-zbm` attempts to migrate configuraton files, it will exit imm
257
192
258
193
# Native encryption
259
194
260
-
ZFS Boot Menu can import pools or filesystems with native encryption enabled. If your boot environments are not encrypted but say /home is, you will not receive a decryption prompt. To ensure that you can decrypt your pool to load the kernel and initramfs, you'll need to you have the filesystem parameters configured correctly.
195
+
ZFSBootMenu can import pools or filesystems with native encryption enabled. If your boot environments are not encrypted but say /home is, you will not receive a decryption prompt. To ensure that you can decrypt your pool to load the kernel and initramfs, you'll need to you have the filesystem parameters configured correctly.
261
196
262
197
```
263
198
zfs get all zroot | egrep '(encryption|keylocation|keyformat)'
@@ -274,4 +209,4 @@ For Dracut-based systems, this can be done by creating `/etc/dracut.conf.d/zol.c
274
209
install_items+=" /etc/zfs/zroot.key "
275
210
```
276
211
277
-
It's critical that you do not put this key file into the ZFS Boot Menu initramfs, since that file exists on an unencrypted volume - leaving your pool essentially wide-open.
212
+
It's critical that you do not put this key file into the ZFSBootMenu initramfs, since that file exists on an unencrypted volume - leaving your pool essentially wide-open.
printf"Creating ZFS Boot Menu%s from kernel %s\n", $runConf{version}, $runConf{kernel};
258
+
printf"Creating ZFSBootMenu%s from kernel %s\n", $runConf{version}, $runConf{kernel};
270
259
271
260
# Create a unified kernel/initramfs/command line EFI file
272
261
if ( enabled $config{EFI} ) {
@@ -399,7 +388,7 @@ EOF
399
388
my$kernel = basename($entry);
400
389
my ( undef, $version ) = split( '-', $kernel );
401
390
my$label = "ZFSBootMenu-$version";
402
-
my$menu_label = "ZFS Boot Menu$version";
391
+
my$menu_label = "ZFSBootMenu$version";
403
392
404
393
if ($add_default) {
405
394
print CFG "DEFAULT $label\n\n";
@@ -705,3 +694,68 @@ sub convertImageConfig {
705
694
delete$section->{Versioned};
706
695
delete$section->{Copies};
707
696
}
697
+
698
+
699
+
__END__
700
+
701
+
=head1NAME
702
+
703
+
B<generate-zbm> - ZFSBootMenu initramfs generator
704
+
705
+
=head1SYNOPSIS
706
+
707
+
B<generate-zbm> [options]
708
+
709
+
=head1OPTIONS
710
+
711
+
Where noted, command-line options supersede options in the B<generate-zbm>(5) configuration file.
712
+
713
+
=over4
714
+
715
+
=itemB<--version|-v>I<zbm-version>
716
+
717
+
Override the ZFSBootMenu version; supersedes I<Global.Version>
718
+
719
+
=itemB<--kernel|-k>I<kernel-path>
720
+
721
+
Manually specify a specific kernel; supersedes I<Kernel.Path>
722
+
723
+
=itemB<--kver|-K>I<kernel-version>
724
+
725
+
Manually specify a specific kernel version; supersedes I<Kernel.Version>
726
+
727
+
=itemB<--prefix|-p>I<image-prefix>
728
+
729
+
Manually specify the output image prefix; supersedes I<Kernel.Prefix>
730
+
731
+
=itemB<--confd|-C>I<confd-path>
732
+
733
+
Specify the dracut configuration directory; supersedes I<Global.DracutConfDir>
734
+
735
+
=itemB<--cmdline|-l>I<options>
736
+
737
+
Override the kernel command line; supersedes I<Kernel.CommandLine>
738
+
739
+
=itemB<--bootdir|-b>I<boot-path>
740
+
741
+
Specify the path to search for kernel files; default: I</boot>
742
+
743
+
=itemB<--config|-c>I<conf-file>
744
+
745
+
Specify the path to a configuration file; default: I</etc/zfsbootmenu/config.yaml>
746
+
747
+
=itemB<--migrate|-m> [I<ini-config>]
748
+
749
+
Migrate a legacy INI file to the new YAML format, writing the converted file to the path specified by B<--config>. If I<ini-config> is not specified, a default path is chosen by removing any I<.yaml> suffix in the B<--config> path and appending a I<.ini> suffix.
750
+
751
+
=back
752
+
753
+
=head1SEE ALSO
754
+
755
+
B<generate-zbm>(5) B<zfsbootmenu>(7)
756
+
757
+
=head1AUTHOR
758
+
759
+
ZFSBootMenu Team L<https://github.com/zdykstra/zfsbootmenu>
0 commit comments