Kuhbs arguments

To show an example of all possible arguments, simply run kuhbs without arguments:

kuhbs
## Arguments related to a specific kuhb ##

# Show the state of each kuh defined in all kuhbs
kuhbs ls

# Show the state of a specific kuh
kuhbs show tool/firefox

# Create a kuhb
kuhbs create tool/firefox

# Remove a kuhb
kuhbs remove tool/firefox

# Backup a kuhb
kuhbs backup tool/firefox

# Backup all defined and created kuhb's
kuhbs backup-all

# Restore the backup of a kuhb
kuhbs restore tool/firefox

# Upgrade the software of each kuh that is used as a template within a kuhb
kuhbs upgrade tool/firefox

# Upgrade all defined and created kuhbs
kuhbs upgrade-all


## Arguments related to a specific kuh (VM) ##

# Open a graphical terminal on a kuh
kuhbs terminal <qube> [user]
kuhbs terminal app-tool-firefox root
kuhbs terminal app-tool-firefox user
kuhbs terminal app-tool-firefox

# xl stop a kuh and dump its memory and disks to dom0:/home/user/kuhbs/dumps
kuhbs dump app-tool-firefox


## Debugging

# Enable verbose output
kuhbs -v <action> <arg>
kuhbs -v create tool/firefox

# Enable debug mode (implies verbose mode as well)
kuhbs -d <action> <arg>
kuhbs -d create tool/firefox

Relevant BASH Function Files

Each kuhbs argument triggers its own function below functions/arguments/. For example kuhbs backup firefox runs (some of, depending on the case) the functions in functions/arguments/backup.sh.

Backups

kuhbs backup my-kuhb
kuhbs restore my-kuhb

You can trigger the creation of a backup with kuhbs backup my-kuhb and the restore with kuhbs restore my-kuhb. To backup all defined kuhb’s, run kuhbs backup-all.

Configuration

Each kuhb can configure a list of files and directories to be backed up for each individual VM type:

# TemplateVM
declare -r TPL_BACKUP_PATHS=(
    "/etc/wireguard"
)
# AppVM
declare -r APP_BACKUP_PATHS=(
    "/home/user/.config/mozilla"
)
# StandaloneVM
declare -r STA_BACKUP_PATHS=(
    "/home/user/code"
)

The kuhbs/defaults.sh file contains variables relevant to the storage device that is used to store backups (commonly a USB device).

Backup Hooks

During creation of a kuhb, backups are restored (if present) just before the scripts defined in kuhbs/my-kuhb/<vm-type>/scripts/*.sh are executed.

Technical Information

The backup is created by running tar czf /rw/backup.tar.gz /path /path2. Do not include /rw/ itself in the BACKUP_PATHS.

kuhbs upgrade

kuhbs upgrade my-kuhb
kuhbs upgrade-all

To upgrade a kuhb, run kuhbs upgrade my-kuhb. To upgrade all kuhb’s, run kuhbs upgrade-all. When a kuhb is upgraded, sta, tpl and then app type kuh’s (VMs) are upgraded in that order.

When a kuh is upgraded:

  1. the script kuh-setup-scripts/apt-update.sh is executed on the kuh

  2. An upgrade.sh script located in kuhbs/my-kuhb/{tpl,app,sta}/hooks/upgrade.sh is executed on the kuh, for example to run flatpak update in an AppVM

  3. The kuh is shutdown if it was not running before

When you upgrade a kuhb while it one of its kuh’s is running, the kuh will automatically be restarted after the upgrade is completed - if you have applications running in that kuh they will not be started again, only the kuh (VM) will be started with qvm-start.
This is a TODO.

kuhbs terminal

Open a terminal in a kuh:

kuhbs terminal app-firefox

Root terminal:

kuhbs terminal app-firefox root

kuhbs dump

If you suspect a VM is doing something fishy. kuhbs dump app-firefox will run xl stop app-firefox, which freezes the VM in xen, and then dump its memory and disks to dom0:/home/user/kuhbs/dumps.

You can run xl resume app-firefox to “resume” the VM.