2020-07-22 Restore from backup

Today I attempted to start Bitlbee and it didn’t work. I checked with “sudo journalctl -u bitlbee” and it wasn’t running. I started it up with “sudo systemctl start bitlbee” and noticed a message saying that the directory “/var/lib/bitlbee” didn’t exist. That’s the directory where all the Bitlbee accounts are stored. Oops!

How did this happen? I suspect it’s because I recently ran “sudo apt purge bitlbee-common”. I checked whether I had installed Bitlbee via Apt and I did not. This is correct, since I compile it myself. It also said that I had “residual config” for “bitlbee-common” and I decided to delete it. I did not know that Bitlbee installed via apt and Bitlbee self-installed shared the same config directory – and now it’s gone.

Time to see how my backup is doing?

Here’s the plan: prevent Borg from making a new backup as soon as I plug my backup disk, switch on the external backup disk, find the directory in the backups.

My Borg backup setup

Enter the passphrase… and I get lots of stuff listed:

2018-02-16T13:22:33-melanobombus     Fri, 2018-02-16 14:22:34 […]
2018-03-21T17:32:42-melanobombus     Wed, 2018-03-21 18:32:45 […]
2018-04-26T17:23:46-melanobombus     Thu, 2018-04-26 19:23:49 […]
2018-05-27T11:29:37-melanobombus     Sun, 2018-05-27 13:29:40 […]
2018-08-29T07:11:56-melanobombus     Wed, 2018-08-29 09:12:03 […]
2018-09-18T20:06:10-melanobombus     Tue, 2018-09-18 22:06:14 […]
2018-11-18T16:26:42-melanobombus     Sun, 2018-11-18 17:26:46 […]
2019-02-20T20:17:56-melanobombus     Wed, 2019-02-20 21:18:02 […]
2019-06-20T11:40:52-melanobombus     Thu, 2019-06-20 13:41:01 […]
2019-07-22T19:53:28-melanobombus     Mon, 2019-07-22 21:53:31 […]
2019-09-30T20:29:55-melanobombus     Mon, 2019-09-30 22:29:58 […]
2019-10-16T05:21:49-melanobombus     Wed, 2019-10-16 07:21:55 […]
2019-10-30T20:57:55-melanobombus     Wed, 2019-10-30 21:58:02 […]
2019-11-01T10:37:07-melanobombus     Fri, 2019-11-01 11:37:10 […]
2019-11-24T10:34:13-melanobombus     Sun, 2019-11-24 11:34:20 […]
2020-01-24T08:33:06-melanobombus     Fri, 2020-01-24 09:33:12 […]

All right, those timestamps aren’t great. The problem is that this disk is from before the epidemic and when I went to the office to exchange backup disks, I didn’t immediately make a new backup. So the latest backup is actually at the office. Then again, in this case I might not actually need a newer copy of my bitlbee config.

cd /tmp
sudo borg extract --list /mnt/backup/borg-backups/backup.borg::\
2020-01-24T08:33:06-melanobombus var/lib/bitlbee

Notice how I had to extract “var/lib/bitlbee” instead of “/var/lib/bitlbee”. I may have skipped a heartbeat when I read “Include pattern ’/var/lib/bitlbee’ never matched.” But then I looked at the examples in the Borg manual and noticed that they don’t use a leading slash. Phew! 😅

var/lib/bitlbee/crash.log
var/lib/bitlbee/bitlbee.conf
var/lib/bitlbee/kensanata1.xml
var/lib/bitlbee/kensanata.xml.39kIWQ
var/lib/bitlbee/kensanata.xml.BiAm95
var/lib/bitlbee/kensanata.xml.G3bE8t
var/lib/bitlbee/kensanata.xml.I8CXLC
var/lib/bitlbee/kensanata.xml.old
var/lib/bitlbee/kensanata.xml.P1rpzU
var/lib/bitlbee/kensanata.xml.PeP2zg
…

I think this is good to go!

cd /
sudo borg extract /mnt/backup/borg-backups/backup.borg::\
2020-01-24T08:33:06-melanobombus var/lib/bitlbee

Restore done!

sudo systemctl restart bitlbee
sudo journalctl -u bitlbee

I noticed that message again which tells me that the running Bitlbee has not been killed: “bitlbee.service: Found left-over process 4670 (bitlbee) in control group while starting unit. Ignoring.”

sudo kill 4670

Connected my Bitlbee and everything is back and running. Restore success! 😀

sudo umount /mnt/backup
sudo ln -s /etc/backups/automatic-backup.service /etc/systemd/system/
sudo systemctl start --no-block automatic-backup
sleep 3 # 😴
sudo journalctl -u automatic-backup

And after a few seconds I think we’re good! A new backup is being made.

Jul 22 08:26:40 melanobombus systemd[1]: Starting automatic-backup.service...
Jul 22 08:26:45 melanobombus run.sh[5760]: Disk 156cf4df-aa58-421e-b3d0-583fe6fdff4a is a backup disk
Jul 22 08:26:45 melanobombus run.sh[5760]: Drive path: /dev/sdb1
Jul 22 08:26:45 melanobombus run.sh[5760]: borgbackup version 1.1.9

​#Backup