Skip to content

deucalion rebuild

Rebuilds this computer from a full backup, in eight steps (see What a rebuild restores). For each step it shows the plan, then asks. Nothing changes until you press Enter on a step.

$ deucalion rebuild --help
usage: deucalion rebuild [-h]
                         [--step {check,repositories,packages,home,paths,desktop,system-config,services}]
                         [--dry-run] [-y] [--target NAME]

rebuild this machine from a backup (new machine or new Ubuntu)

options:
  -h, --help            show this help message and exit
  --step {check,repositories,packages,home,paths,desktop,system-config,services}
                        run only this step (again)
  --dry-run             show every step's plan, change nothing
  -y, --yes             apply the pre-selected items without asking
  --target NAME         which registered drive to use
Option What it does
(none) Go through the steps that aren't done yet, asking at each one.
--step NAME Run only this step (again, even if it was done): check, repositories, packages, home, paths, desktop, system-config or services.
--dry-run Show every step's plan and change nothing.
-y, --yes Apply the pre-selected items of every step without asking.
--target NAME Which backup drive.

rebuild needs a terminal to ask its questions; without one, use --dry-run or --yes.

Answering a step

Each step shows its notes, then its items with a number: [x] items are selected, [ ] items are not, and lines with - are for information only. For example, step 3 of the run below:

Step 3/8: Applications and packages
  Hardware/kernel packages are left to the installer: linux-modules-extra-6.8.0-142-generic.
  Installed by hand (reinstall them yourself if you need them): /usr/local/bin/hello-tool, /usr/local/libexec, /usr/local/share/ca-certificates, /usr/local/share/fonts, /usr/local/share/sgml, /usr/local/share/xml
  [x]   1  python3-pyrsistent  — apt package
  [x]   2  python3-tz  — apt package
  [x]   3  tree  — apt package
  [x]   4  hello-world  — snap, latest/stable
  [x]   5  hello-tool  — from your downloaded file ~/Downloads/hello-tool_1.2.0_all.deb
   -    6  veracrypt  — was installed from a downloaded .deb (version 1.26.29-1~ubuntu24.04-1); download it again from its website
  Enter = apply the checked items · n = skip this step · numbers (2 5-7) = check/uncheck · all / none · d N = show the change for item N · q = stop here
  >

Then it waits at the > prompt:

You type What happens
Enter (or y) Apply the selected items.
n (or s, skip) Skip this step.
numbers, e.g. 2 or 2 5-7 Select or unselect those items (the list is shown again).
all / none Select all / none of the items.
d N, e.g. d 2 Show the changes for item N (step 7: what is different in that /etc file; + lines come from the backup, - lines from this computer).
q Stop here. Run deucalion rebuild again later to continue.

Step 1 (the check) asks Continue? [y/N] instead: answer y once you have read it.

A dry run

--dry-run shows what every step would do, and changes nothing:

The dry run on Alex's new laptop (click to open)
$ bin/deucalion rebuild --dry-run
Rebuild from backup 'Alex Backup'

Step 1/8: Check the backup and this machine
  Backup of alex@alex-laptop (Ubuntu 24.04.5 LTS), last backup 2026-10-12T09:12:51+01:00.
  This machine: alexk@alex-new-laptop (Ubuntu 26.04.1 LTS).
  Home folder in the backup: 577 files, 368.7 MB.
  Your home folder moves from /home/alex to /home/alexk; paths inside settings files will be updated.

Step 2/8: Software sources (apt repositories)
  Ubuntu's own repositories are already set up by the installer and are not changed.
  [x]   1  PPA git-core/ppa  — https://ppa.launchpadcontent.net/git-core/ppa/ubuntu/  resolute  — available
  [x]   2  google-chrome  — https://dl.google.com/linux/chrome/deb/  stable  — available

Step 3/8: Applications and packages
  Hardware/kernel packages are left to the installer: linux-modules-extra-6.8.0-142-generic.
  Installed by hand (reinstall them yourself if you need them): /usr/local/bin/hello-tool, /usr/local/libexec, /usr/local/share/ca-certificates, /usr/local/share/fonts, /usr/local/share/sgml, /usr/local/share/xml
  [x]   1  python3-pyrsistent  — apt package
  [x]   2  python3-tz  — apt package
  [x]   3  tree  — apt package
  [x]   4  hello-world  — snap, latest/stable
  [x]   5  hello-tool  — from your downloaded file ~/Downloads/hello-tool_1.2.0_all.deb
   -    6  veracrypt  — was installed from a downloaded .deb (version 1.26.29-1~ubuntu24.04-1); download it again from its website

Step 4/8: Your home folder
  Restores into /home/alexk. Files that would be overwritten are first moved to ~/Deucalion-before-restore/. Close other apps before you continue.
  [x]   1  Files directly in your home folder  — 6 files, 4.8 KB
  [x]   2  .config/  — 5 files, 2.1 KB
  [x]   3  .local/  — 63 files, 875.1 KB
  [x]   4  .ssh/  — 4 files, 305 B
  [x]   5  Desktop/  — 11 files, 21.4 MB
  [x]   6  Deucalion/  — 371 files, 5.8 MB
  [x]   7  Documents/  — 12 files, 191.2 MB
  [x]   8  Downloads/  — 1 files, 572 B
  [x]   9  Music/  — 3 files, 63.4 MB
  [x]  10  Pictures/  — 34 files, 86.0 MB
  [x]  11  Projects/  — 67 files, 120.3 KB

Step 5/8: Update paths in your settings (new home folder)
  No settings files mention /home/alex.

Step 6/8: Desktop settings (GNOME)
  [x]   1  Load all desktop settings  — 2 groups: wallpaper, dock, keyboard shortcuts, app settings…

Step 7/8: System settings (/etc)
  55 more files are kept in the backup for reference only (system identity, disks, login, repositories and network are handled separately or by the installer).
  [ ]   1  /etc/hosts  — added, differs from this machine
  [ ]   2  /etc/nanorc  — modified (nano), differs from this machine
  [x]   3  /etc/sysctl.d/99-swappiness.conf  — added, new file
  [x]   4  /etc/udev/rules.d/99-usb-serial.rules  — added, new file

Step 8/8: Groups, scheduled tasks, services and network connections
  [x]   1  Add you to the 'dialout' group  — serial ports and USB debug probes
  [x]   2  Your scheduled tasks (crontab)  — 1 lines
  [x]   3  Network connection Home Wi-Fi  — Wi-Fi/VPN/wired

Dry run: nothing was changed.

A complete run

On a new laptop with Ubuntu 26.04 and the user name alexk, from a backup of alex on Ubuntu 24.04 (run from the backup drive's Deucalion-Tool folder):

$ bin/deucalion rebuild
Rebuild from backup 'Alex Backup'

Step 1/8: Check the backup and this machine
  Backup of alex@alex-laptop (Ubuntu 24.04.5 LTS), last backup 2026-10-12T09:12:51+01:00.
  This machine: alexk@alex-new-laptop (Ubuntu 26.04.1 LTS).
  Home folder in the backup: 577 files, 368.7 MB.
  Your home folder moves from /home/alex to /home/alexk; paths inside settings files will be updated.
  Continue? [y/N] y

Step 2/8: Software sources (apt repositories)
  Ubuntu's own repositories are already set up by the installer and are not changed.
  [x]   1  PPA git-core/ppa  — https://ppa.launchpadcontent.net/git-core/ppa/ubuntu/  resolute  — available
  [x]   2  google-chrome  — https://dl.google.com/linux/chrome/deb/  stable  — available
  Enter = apply the checked items · n = skip this step · numbers (2 5-7) = check/uncheck · all / none · d N = show the change for item N · q = stop here
  >
    Added PPA git-core/ppa
    Added google-chrome
    Refreshing package lists (apt update)…
    …

Step 3/8: Applications and packages
  Hardware/kernel packages are left to the installer: linux-modules-extra-6.8.0-142-generic.
  Installed by hand (reinstall them yourself if you need them): /usr/local/bin/hello-tool, /usr/local/libexec, /usr/local/share/ca-certificates, /usr/local/share/fonts, /usr/local/share/sgml, /usr/local/share/xml
  [x]   1  python3-pyrsistent  — apt package
  [x]   2  python3-tz  — apt package
  [x]   3  tree  — apt package
  [x]   4  hello-world  — snap, latest/stable
  [x]   5  hello-tool  — from your downloaded file ~/Downloads/hello-tool_1.2.0_all.deb
   -    6  veracrypt  — was installed from a downloaded .deb (version 1.26.29-1~ubuntu24.04-1); download it again from its website
  Enter = apply the checked items · n = skip this step · numbers (2 5-7) = check/uncheck · all / none · d N = show the change for item N · q = stop here
  >
    Refreshing package lists (apt update)…
    …
    Installing 3 apt packages…
    …
    Installing snap hello-world…
    …
    hello-world 6.4 from Canonical** installed
    Installing hello-tool from /media/alexk/Alex Backup/Deucalion-Backup/home/Downloads/hello-tool_1.2.0_all.deb…
    …

Step 4/8: Your home folder
  Restores into /home/alexk. Files that would be overwritten are first moved to ~/Deucalion-before-restore/. Close other apps before you continue.
  [x]   1  Files directly in your home folder  — 6 files, 4.8 KB
  [x]   2  .config/  — 5 files, 2.1 KB
  [x]   3  .local/  — 63 files, 875.1 KB
  [x]   4  .ssh/  — 4 files, 305 B
  [x]   5  Desktop/  — 11 files, 21.4 MB
  [x]   6  Deucalion/  — 371 files, 5.8 MB
  [x]   7  Documents/  — 12 files, 191.2 MB
  [x]   8  Downloads/  — 1 files, 572 B
  [x]   9  Music/  — 3 files, 63.4 MB
  [x]  10  Pictures/  — 34 files, 86.0 MB
  [x]  11  Projects/  — 67 files, 120.3 KB
  Enter = apply the checked items · n = skip this step · numbers (2 5-7) = check/uncheck · all / none · d N = show the change for item N · q = stop here
  >
    Restoring 572 files (368.7 MB); 1 existing files will be moved aside first…
    Replaced files are kept in /home/alexk/Deucalion-before-restore/2026-10-12_100913
    Restored 572 files.

Step 5/8: Update paths in your settings (new home folder)
  [x]   1  ~/.config/deucalion/config.json  — 2 mention(s) of /home/alex
  [x]   2  ~/.config/myapp/settings.json  — 1 mention(s) of /home/alex
  [x]   3  ~/.config/systemd/user/default.target.wants/notes-sync.service  — link → /home/alex/.config/systemd/user/notes-sync.service
  [x]   4  ~/.gitconfig  — 1 mention(s) of /home/alex
  [x]   5  ~/.local/bin/deucalion  — link → /home/alex/.local/share/deucalion/bin/deucalion
  [x]   6  ~/.local/bin/tool  — link → /home/alex/Projects/scripts/tool.sh
  [x]   7  ~/.local/share/applications/io.github.DimitriosKafetzis.Deucalion.desktop  — 1 mention(s) of /home/alex
  Enter = apply the checked items · n = skip this step · numbers (2 5-7) = check/uncheck · all / none · d N = show the change for item N · q = stop here
  >
    Updated 7 files (originals in /home/alexk/Deucalion-before-restore/2026-10-12_100917-paths).

Step 6/8: Desktop settings (GNOME)
  [x]   1  Load all desktop settings  — 2 groups: wallpaper, dock, keyboard shortcuts, app settings…
  Enter = apply the checked items · n = skip this step · numbers (2 5-7) = check/uncheck · all / none · d N = show the change for item N · q = stop here
  >
    Your current desktop settings are saved in /home/alexk/Deucalion-before-restore/2026-10-12_100918-desktop/dconf-before.ini (to go back: dconf reset -f / && dconf load / < /home/alexk/Deucalion-before-restore/2026-10-12_100918-desktop/dconf-before.ini)
    Desktop settings loaded. Log out and back in to see all of them.

Step 7/8: System settings (/etc)
  55 more files are kept in the backup for reference only (system identity, disks, login, repositories and network are handled separately or by the installer).
  [ ]   1  /etc/hosts  — added, differs from this machine
  [ ]   2  /etc/nanorc  — modified (nano), differs from this machine
  [x]   3  /etc/sysctl.d/99-swappiness.conf  — added, new file
  [x]   4  /etc/udev/rules.d/99-usb-serial.rules  — added, new file
  Enter = apply the checked items · n = skip this step · numbers (2 5-7) = check/uncheck · all / none · d N = show the change for item N · q = stop here
  > d 1
--- /etc/hosts (this machine)
+++ /etc/hosts (backup)
@@ -7,3 +7,4 @@
 ff02::1 ip6-allnodes
 ff02::2 ip6-allrouters
 ff02::3 ip6-allhosts
+192.168.1.20  nas
  >
    Restored /etc/sysctl.d/99-swappiness.conf
    Restored /etc/udev/rules.d/99-usb-serial.rules
    …
    Previous versions of replaced files are in /var/backups/deucalion/2026-10-12_100919

Step 8/8: Groups, scheduled tasks, services and network connections
  [x]   1  Add you to the 'dialout' group  — serial ports and USB debug probes
  [x]   2  Your scheduled tasks (crontab)  — 1 lines
  [x]   3  Network connection Home Wi-Fi  — Wi-Fi/VPN/wired
  Enter = apply the checked items · n = skip this step · numbers (2 5-7) = check/uncheck · all / none · d N = show the change for item N · q = stop here
  >
    Added you to: dialout (takes effect after you log in again)
    Restored your crontab
    Imported 1 network connections

Summary
  done       Software sources (apt repositories)
  done       Applications and packages
  done       Your home folder
  done       Update paths in your settings (new home folder)
  done       Desktop settings (GNOME)
  done       System settings (/etc)
  done       Groups, scheduled tasks, services and network connections
Log out and back in to finish (new groups and desktop settings take effect then).

Running it again

Finished steps are skipped (with how to run them again); a second run changes nothing that is already right:

$ bin/deucalion rebuild
Rebuild from backup 'Alex Backup'

✓ Check the backup and this machine: done 2026-10-12T10:08:30+01:00 (run again with --step check)

✓ Software sources (apt repositories): done 2026-10-12T10:08:38+01:00 (run again with --step repositories)

✓ Applications and packages: done 2026-10-12T10:09:12+01:00 (run again with --step packages)

✓ Your home folder: done 2026-10-12T10:09:17+01:00 (run again with --step home)

✓ Update paths in your settings (new home folder): done 2026-10-12T10:09:17+01:00 (run again with --step paths)

✓ Desktop settings (GNOME): done 2026-10-12T10:09:18+01:00 (run again with --step desktop)

✓ System settings (/etc): done 2026-10-12T10:09:19+01:00 (run again with --step system-config)

✓ Groups, scheduled tasks, services and network connections: done 2026-10-12T10:09:21+01:00 (run again with --step services)

Progress is kept in ~/.local/state/deucalion/rebuild.json, for the backup drive in use. To redo one step, use --step:

$ bin/deucalion rebuild --step paths --dry-run
Rebuild from backup 'Alex Backup'

Step 1/1: Update paths in your settings (new home folder)
  No settings files mention /home/alex.

Dry run: nothing was changed.

Exit codes

0 done, stopped with q, or --dry-run; 1 you didn't continue after step 1, or an error; 130 stopped with Ctrl+C.

A step that fails is reported (failed) and the rebuild moves on to the next step; run that step again with --step once the problem is fixed. At the end a Summary lists each step (done, skipped or failed, with its number of warnings) and reminds you to log out and back in.