Installation

If your distribution provides pibootctl then you should either find the utility is installed by default, or it should be installable via your package manager. For example:

$ sudo apt install pibootctl

It is strongly recommended to use a provided package rather than installing from PyPI as this will include configuration specific to your distribution. The utility can be removed via the usual mechanism for your package manager. For instance:

$ sudo apt purge pibootctl

Configuration

pibootctl looks for its configuration in three locations:

  1. /lib/pibootctl/pibootctl.conf
  2. /etc/pibootctl.conf
  3. ~/.config/pibootctl.conf

The last location is only intended for use by people developing pibootctl; for the vast majority of users the configuration should be provided by their distribution in one of the first two locations.

The configuration file is a straight-forward INI-style containing a single section titled “defaults”. A typical configuration file might look like this:

pibootctl.conf
[defaults]
boot_path = /boot
store_path = pibootctl
package_name = pibootctl
comment_lines = on
backup = on

The configuration specifies several settings, but the most important are:

boot_path
The mount-point of the boot partition (defaults to /boot).
store_path
The path under which to store saved boot configurations, relative to boot_path (defaults to pibootctl).
config_root
The “root” configuration file which is read first, relative to boot_path (defaults to config.txt). This is also the primary file that gets re-written when settings are changed.
mutable_files
The set of files within a configuration that may be modified by the utility (defaults to config.txt). List multiple files on separate lines. Currently, this must include config.txt.
comment_lines

If this is on, when lines in configuration files are no longer required, they will be commented out with a “#” prefix instead of being deleted. Defaults to off.

Note that, regardless of this setting, the utility will always search for commented lines to uncomment before writing new ones.

reboot_required
The file which should be created in the event that the active boot configuration is changed.
reboot_required_pkgs
The file to which the value of package_name should be appended in the event that the active boot configuration is changed.
package_name
The name of the package which contains the utility. Used by reboot_required_pkgs.
backup
If this is on (the default), any attempt to change the active boot configuration will automatically create a backup of that configuration if one does not already exist.

Line comments can be included in the configuration file with a # prefix. Another example configuration, typical for Ubuntu on the Raspberry Pi, is shown below:

pibootctl.conf
[defaults]
boot_path = /boot
store_path = pibootctl
mutable_files =
  config.txt
  syscfg.txt

reboot_required = /var/run/reboot-required
reboot_required_pkgs = /var/run/reboot-required.pkgs
package_name = pibootctl
backup = on