# bootvine
A live tree of systemd jobs on the boot console, in the spirit of
nix-output-monitor. It replaces the scrolling kernel and systemd lines with the
units still pending and, in the room the tree leaves, a timeline of the slowest
ones that ran.
It needs systemd ≥ 246 as PID 1, libdbus and a virtual terminal (it draws on
tty12). With a systemd initrd it starts about a second after the kernel and
follows the boot through the switch to the real root; without one it starts in
stage 2. While it runs it quiets the kernel console and systemd's status
output, and restores both when it hands the console back. Kernel messages from
before it starts still reach the screen; boot with `quiet`, or set
`boot.consoleLogLevel = 3` on NixOS, to keep those to errors.
It also follows shutdowns and reboots: the units being stopped, nested under
the units that have to stop first, until systemd hands over to
`systemd-shutdown`.
Passphrase prompts, such as a LUKS unlock in the initrd, are answered in place
over the tree.
## Try it without installing
Neither of these touches your system's boot.
### Scripted boots in your terminal
From a clone, with Rust installed (see step 1 of the Ubuntu install below):
```sh
git clone https://codeberg.org/wvhulle/bootvine.git
cd bootvine
cargo run --example boot
cargo run --example shutdown
cargo run --example luks
```
These play a scripted boot, a poweroff and a boot from an encrypted root, with
no systemd involved. `q` quits. The encrypted root unlocks with the passphrase
`demo`; `Esc` quits while it asks.
### A sample machine in a VM
With Nix, and no clone needed:
```sh
nix run git+https://codeberg.org/wvhulle/bootvine#sample-machine-vm
```
This boots a NixOS machine with bootvine and a set of slow and failing sample
units in a QEMU window, from the initrd through stage 2. It logs in as root;
`poweroff` shows the shutdown. Its disk image is kept in
`~/.cache/bootvine-sample-machine.qcow2`.
## Install
### NixOS
1. Add the flake to your system flake's inputs and pass its module in:
```nix
{
inputs.bootvine = {
url = "git+https://codeberg.org/wvhulle/bootvine";
inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { nixpkgs, bootvine, ... }: {
nixosConfigurations.my-host = nixpkgs.lib.nixosSystem {
modules = [
bootvine.nixosModules.default
./configuration.nix
];
};
};
}
```
2. Enable it in `configuration.nix`:
```nix
{
services.bootvine.enable = true;
}
```
3. Optionally, follow the boot from the initrd and keep early kernel messages
to errors:
```nix
{
boot.initrd.systemd.enable = true;
boot.consoleLogLevel = 3;
}
```
4. Rebuild and reboot:
```sh
sudo nixos-rebuild switch --flake .#my-host
```
### Ubuntu
1. Install the build dependencies and Rust. The repository pins a nightly
toolchain in `rust-toolchain.toml`, which rustup fetches on the first
build:
```sh
sudo apt install build-essential pkg-config libdbus-1-dev git curl
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```
2. Clone, build and install the binary and the systemd units, and enable
them. `cargo xtask install` builds as you and asks `sudo` only for the
copying and `systemctl enable`:
```sh
git clone https://codeberg.org/wvhulle/bootvine.git
cd bootvine
cargo xtask install
```
This is enough for bootvine to show stage 2 and shutdown. It installs
`/usr/bin/bootvine` and `bootvine.service` and `bootvine-shutdown.service`
in `/usr/lib/systemd/system`.
3. Optionally, follow the boot from the initrd. This needs a dracut initramfs
with systemd in it; initramfs-tools has no systemd, so on releases that use
it bootvine starts in stage 2 only.
```sh
cargo xtask install --initrd dracut
sudo dracut --force
```
This adds the dracut module in `/usr/lib/dracut/modules.d/90bootvine` and
enables it in `/etc/dracut.conf.d/bootvine.conf`.
4. Reboot.
`cargo xtask uninstall` removes all of it again.
### Other distributions
Install as in the Ubuntu steps. For the initrd, use the dracut module as above,
or on mkinitcpio run `cargo xtask install --initrd mkinitcpio`, which installs
`/usr/lib/initcpio/install/sd-bootvine`, then add `sd-bootvine` after `systemd`
in `HOOKS` in `/etc/mkinitcpio.conf` and run `sudo mkinitcpio -P`.
`--destdir