Use Deucalion without a desktop¶
What you'll do: back up, restore or rebuild a computer you reach over SSH, or a server without a
desktop.
What you need: a terminal on that computer; sudo rights there.
How long it takes: as on a desktop.
Everything works from the command line. A few things behave differently when there is no desktop session.
What is different¶
The app doesn't open. Plain deucalion prints the list of commands:
$ bin/deucalion
usage: deucalion [-h] [--version] COMMAND ...
Back up your Ubuntu machine to an external drive, and restore or rebuild from it.
positional arguments:
COMMAND
gui open the app (also what plain 'deucalion' does)
deps check (and install) what Deucalion needs, including VeraCrypt
drives list connected drives
register use a drive (or a folder on it) for backups
targets list registered backup drives
setup-drive prepare a drive for backups (format, encrypt)
open unlock an encrypted backup drive
close lock/unmount the backup drive so it can be unplugged
backup back up everything, or only some folders
status show the state of the backup
ls list what is in the backup (with original names)
restore restore files or folders from the backup
rebuild rebuild this machine from a backup (new machine or new Ubuntu)
verify check the backup on the drive is complete and undamaged
removed list or empty _removed/ (old versions and deleted files)
exclude manage what is left out of your home backup
folder manage extra folders outside your home (e.g. /srv)
profile manage saved selections for partial backups
config show or edit the configuration
options:
-h, --help show this help message and exit
--version show program's version number and exit
Administrator access goes through sudo. Without a desktop, Deucalion uses sudo for the
administrator helper:
- if
sudoworks without a password for you (sudo -n truesucceeds, as on many cloud machines), Deucalion uses it and asks nothing; - otherwise it asks for your password in the terminal:
[Deucalion] administrator password for …:.
Mounting drives needs administrator rights. On a desktop, Ubuntu's disk service (UDisks) lets the
person at the computer mount and unlock external drives. Over SSH it asks for an administrator
password instead: udisksctl mount asks for it in the terminal, and without a way to ask it refuses:
$ udisksctl mount --no-user-interaction -b /dev/sda1
Error mounting /dev/sda1: GDBus.Error:org.freedesktop.UDisks2.Error.NotAuthorizedCanObtain: Not authorized to perform operation
Deucalion's own disk-service calls can't ask either, so over SSH they fail with "Not authorized to perform operation".
So mount the drive (or its normal part) yourself with sudo, owned by you:
$ sudo mkdir -p /mnt/backup-drive && sudo mount -o uid=$(id -u),gid=$(id -g) /dev/sda1 /mnt/backup-drive && ls /mnt/backup-drive
Deucalion-Tool READ-ME-FIRST.txt
Then Deucalion finds the backup as usual. A VeraCrypt backup is unlocked through the administrator helper, so it works the same as on a desktop:
$ bin/deucalion open
Backup password:
Unlocking (you will be asked for your administrator password)…
Unlocking (VeraCrypt volumes can take up to a minute)…
Registered backup drive 'Alex Backup' on this machine.
Backup drive 'Alex Backup' is open: /media/alexk/Alex Backup/Deucalion-Backup
This affects LUKS drives and LUKS encrypted folders, and setting up drives (setup-drive):
Deucalion does these through the disk service, so over SSH they fail with "Not authorized to perform
operation". Set up drives on a desktop, or unlock LUKS by hand
(sudo cryptsetup open /dev/sdX2 backup then sudo mount -o uid=$(id -u) /dev/mapper/backup /mnt/x)
and register the folder.
A rebuild restores ~/.ssh. Your home folder's .ssh folder comes back from the backup,
including authorized_keys, which lists the keys allowed to log in over SSH. If you reach the new
computer over SSH with a key that isn't in the old computer's authorized_keys, you will be locked out
after step 4. Before the rebuild, add your key to the old computer's ~/.ssh/authorized_keys and back
up, or untick .ssh/ in step 4.
No desktop settings. On a server without GNOME, the desktop settings step of a rebuild says there
is nothing to do; desktop settings are not saved when dconf isn't installed.
VeraCrypt may need libsm6. VeraCrypt's official package needs the libsm6 library without
declaring it; every desktop has it, a minimal server may not. Install it with sudo apt install libsm6
if VeraCrypt fails with "libSM.so.6: cannot open shared object file".
Questions need a terminal. Commands that ask something need a terminal (an interactive SSH
session). In scripts, answer in advance: --yes for questions, --yes-erase sdX to erase a drive;
rebuild needs --yes (apply the pre-selected items) or --dry-run. Passwords can be given on
standard input with DEUCALION_PASSWORD_STDIN=1 (one line per password asked):
printf '%s\n' "$BACKUP_PASSWORD" | DEUCALION_PASSWORD_STDIN=1 deucalion open
Warning
Anything that stores the password in a file or in your shell history is a risk. Prefer typing it in an interactive session.
A rebuild over SSH¶
- Mount the drive's normal part with
sudo(above), andcdinto itsDeucalion-Toolfolder. bin/deucalion open(password; administrator password ifsudoasks).bin/deucalion rebuild, answering each step (seerebuild).- Log out and back in.
What you have now: Deucalion working on a computer without a desktop.