|
| 1 | +--- |
| 2 | +layout: default |
| 3 | +title: Configuring Boot Options |
| 4 | +permalink: /BootOptions/ |
| 5 | +parent: Installing and configuring |
| 6 | +nav_order: 85 |
| 7 | +--- |
| 8 | + |
| 9 | +<!-- markdownlint-disable MD033 --> |
| 10 | +<details open markdown="block"> |
| 11 | + <summary> |
| 12 | + Table of contents |
| 13 | + </summary> |
| 14 | + {: .text-delta } |
| 15 | +1. TOC |
| 16 | +{:toc} |
| 17 | +</details> |
| 18 | +<!-- markdownlint-enable MD033 --> |
| 19 | + |
| 20 | + |
| 21 | +Boot config files |
| 22 | +=== |
| 23 | + |
| 24 | +A user has the option to make persistent modifications to the non-Qubes boot |
| 25 | + process by creating one or more of the following files: |
| 26 | + |
| 27 | +| file | description | |
| 28 | +| ---- | ---- | |
| 29 | +| kexec_menu.txt | contains multiple options for parameters to the kexec command| |
| 30 | +| kexec_hashes.txt | a sha256sum file from within the respective boot directory | |
| 31 | +| kexec_iso_add.txt | a sh variable to override the standard ISO kernel argument additions | |
| 32 | +| kexec_iso_remove.txt | a sh variable to override the standard ISO kernel argument removals | |
| 33 | +| kexec_default.$N.txt | specifies the default kexec parameters corresponding to the Nth menu option | |
| 34 | +| kexec_default_hashes.txt | a sha256sum file for the default entry kexec file parameters | |
| 35 | +| kexec_rollback.txt | a sha256sum of the TPM counter contents in the tmp directory | |
| 36 | +| kexec_key_devices.txt | contains a list of "device uuid" combos for all LUKS devices to unlock | |
| 37 | +| kexec_key_lvm.txt | contains the name of an LVM group to activate on boot | |
| 38 | + |
| 39 | +These can be placed in any of the following locations: |
| 40 | + |
| 41 | +| location | description | |
| 42 | +| ---- | ---- | |
| 43 | +| /boot/ | used during internal HD boot | |
| 44 | +| /media/ | used during standard USB boot | |
| 45 | +| /media/kexec_iso/$ISO_FILENAME/ | used during USB boot from a particular ISO file | |
| 46 | + |
| 47 | +These files are only used if there is an appropriate signature for them in `kexec.sig` covering all `kexec*.txt` in that location. This can be generated from the user interface from the `Update checksums and sign all files` in /boot menu option, or manually from the recovery shell by running `kexec-sign-config -p /boot/`, etc. These files are only copied by `kexec-check-config` to `/tmp/kexec/` if there is a valid signature. From there the boot routines reference only the configs in `/tmp/kexec`. |
| 48 | + |
| 49 | +Dynamic vs Persistent Boot Options |
| 50 | +==== |
| 51 | + |
| 52 | +There are two ways for heads to boot Operating systems from /boot. |
| 53 | + |
| 54 | +* Dynamic (no kexec_menu.txt) |
| 55 | +* Persistent |
| 56 | + |
| 57 | +`kexec_menu.txt` is generated from GUI menu option `Default boot` while /boot contents detached signed digest is verified as valid. If there is no persistent `kexec_menu.txt` the boot directory will be searched for grub/syslinux-like configurations and it will be generated dynamically (for any of the HD/USB/USB-ISO locations). Creating a persistent `kexec_menu.txt` can be useful to limit the options displayed or to make persistent alterations to xen or kernel params. |
| 58 | + |
| 59 | + |
| 60 | +Persistent Boot Options |
| 61 | +---- |
| 62 | + |
| 63 | +To customize the boot options and ignore the default OS boot configurations you may create a |
| 64 | +`kexec_menu.txt` which has a simple layout of a single line per boot option: |
| 65 | + |
| 66 | +```text |
| 67 | +description 1|elf|kernel /vmlinuz... |initrd /initramfs... |append ... |
| 68 | +description 2|multiboot|kernel ... |module ... |module ... |
| 69 | +description 3|xen|kernel /xen... |module /vmlinuz... | module /initramfs... |
| 70 | +``` |
| 71 | + |
| 72 | +Here is a sample `kexec_menu.txt` derived from grub.cfg: |
| 73 | + |
| 74 | +<!-- markdownlint-disable MD013 --> |
| 75 | + |
| 76 | +```text |
| 77 | +Ubuntu|elf|kernel /vmlinuz-4.8.0-58-generic|initrd /initrd.img-4.8.0-58-generic|append root=/dev/mapper/ubuntu--vg-root ro quiet splash crashkernel=384M-:128M crashkernel=384M-:128M |
| 78 | +Memory test (memtest86+, serial console 115200)|elf|kernel /memtest86+.bin|append console=ttyS0,115200n8 |
| 79 | +Qubes, with Xen hypervisor|multiboot|kernel /xen-4.6.5.gz placeholder |module /vmlinuz-4.4.67-13.pvops.qubes.x86_64 placeholder root=/dev/mapper/luks-UUID ro rd.qubes.hide_all_usb|module /initramfs-4.4.67-13.pvops.qubes.x86_64.img |
| 80 | +``` |
| 81 | + |
| 82 | +<!-- markdownlint-enable MD013 --> |
| 83 | + |
| 84 | +### Securing Persistent Boot Options |
| 85 | + |
| 86 | +By default, no file hash checks are made for default boot since this was done during configuration. A non-default boot will fail when the file hashes don't match the expected values. |
| 87 | + |
| 88 | +### require hash checks |
| 89 | + |
| 90 | +If a user wishes to require that file hashes be checked for a succesful |
| 91 | + non-recovery boot, they may set the `CONFIG_BOOT_REQ_HASH=y` in their |
| 92 | + respective Heads config file (/etc/config.user). |
| 93 | + |
| 94 | +### default boot |
| 95 | + |
| 96 | +As as convenience mechanism, a user may select a boot option to always be used |
| 97 | + in the future, assuming that the boot parameters and file hashes have not |
| 98 | + changed. This can be done by running `kexec-save-default` manually or directly |
| 99 | + from the boot menu. This works for any boot location (HD/USB/USB ISO) but does |
| 100 | + modify the respective `/boot/` or `/media/` filesystems. |
| 101 | + |
| 102 | + In the case of dynamicly derived boot options from `grub.cfg` (i.e. no persistent kexec_menu.txt) an entry index is cached so that the boot will fail when there is a change to the underlying grub parameters. This will require the user to resign/revalidate the settings. This is useful to detect changes to the primary kernel/initramfs (for example in the Qubes case when the primary entry is first). |
| 103 | + |
| 104 | +### multiboot |
| 105 | + |
| 106 | +Note that currently, any multiboot entry is interpreted as a Xen-variant and |
| 107 | + `kexec-boot` overrides the arguments to the multiboot kernel with custom |
| 108 | + arguments. A user can manually specify `multiboot` entries to override the |
| 109 | + default behavior by creating a custom `kexec_menu.txt`. |
| 110 | + |
| 111 | +### rollback counter |
| 112 | + |
| 113 | +If a user wishes to require that a TPM counter be set for rollback prevention, |
| 114 | + they may set the `CONFIG_BOOT_REQ_ROLLBACK=y` in their respective Heads config |
| 115 | + file. When this is true, standard boot will only succeed in these two cases: |
| 116 | + |
| 117 | + * Booting from an verified ISO |
| 118 | + * Booting from a mount point that has a valid `kexec_rollback.txt` in its |
| 119 | + parameter directory |
| 120 | + |
| 121 | +The simplest way to achieve this is to set a default boot option as this updates |
| 122 | + the rollback counter by default. |
| 123 | + |
0 commit comments