A Useful Git Tip.

Last night a work tool received an update that my team wasn’t ready for. I was able to run git log and git checkout to go back to a working state.

I’ve since found a quicker way, which just goes back one commit, without looking at the log. (We check for updates once a day, and on average seems to be an update or two a week. So even the most detailed changelog wouldn’t have helped too much here.)

git reset HEAD~1

Maybe someone else can use this tidbit too!

New Years Resolution Month 2

We’re finally getting some snow to stay for a week here. We had freezing rain yesterday and it’s still below freezing. Hopefully I can get some ice skates and take advantage of this soon.

Surprisingly it looks like Texas is having more winter weather than we are, even Mexico is having some cold days. I can’t say I was expecting that.
I’m hoping my friends in the affected areas are staying warm and safe.

I’ve got a few Amateur Radio parts I’m still waiting on, so I’ve not been able to start writing those posts yet. I at least am able to study for upcoming exams to upgrade my license class.

I’m a little over halfway through my current work permit in Canada, admittedly this is making me very nervous for what’s next. It’s truly too soon to say, so I’m trying to remind myself to have patience.

This past weekend My girlfriend and I volunteered to help with a Pop-Up Covid-19 Rapid Testing centre, I didn’t expect to be putting on all that PPE and actually running the tests myself. I also took a swab to the nose, it’s discomforting but not really painful.

Backing Up My Laptop With Exoscale Object Storage

So I somehow filled my laptop’s M.2 SSD, my external USB drives are full and possibly failing too, this is a wake up call that I need to do better with my backup plans.

First I had to free up some space just to be able to work on it. I was lucky that I technically did have about 4 GB of free space. (It might have been less, unfortunately I didn’t make a note of it) So the first thing I did was find files I could replace from elsewhere or otherwise no longer needed (for me this was all the Linux ISO’s I keep in ~/ISO/ I just had to make sure I didn’t delete my Windows one too)

Now I booted up a USB Drive with Ubuntu 20.10 on it and then proceeded to mount my drive. (This might be as simple as a mouse click for some, I use disk encryption so for me it was a little more involved.)
I mounted it to /tmp/laptop for the purposes of this post. You may need to change this to reflect your setup.

Now I need to install some tools for all this, along with my GPG public key

sudo apt install s3cmd duplicity python3-boto python3-azure-storage pcscd scdaemon gnupg2 pv

gpg --keyserver keyserver.ubuntu.com --recv-keys FC5BFC514D82D7B443C2DCD4A068289733EAAA5F

sudo gpg --keyserver keyserver.ubuntu.com --recv-keys FC5BFC514D82D7B443C2DCD4A068289733EAAA5F

I also need to set the trust level for this key, in order to avoid issues later on.
Since I know this is my own key, I’m going to tell it 5 = I trust ultimately.

gpg --edit-key FC5BFC514D82D7B443C2DCD4A068289733EAAA5F
gpg> trust
Please decide how far you trust this user to correctly verify other users' keys
(by looking at passports, checking fingerprints from different sources, etc.)

  1 = I don't know or won't say
  2 = I do NOT trust
  3 = I trust marginally
  4 = I trust fully
  5 = I trust ultimately
  m = back to the main menu

Your decision? 
5

I need to do this again as root (using sudo) for duplicity too.

Now I didn’t start with duplicity, which was likely a mistake on my part.
I started with trying to make a tarball file but storing the file on the same disk, deleting files as I went couldn’t help some large files I had (server backups, virtual machine images and such) I piped it thru pv to give me some idea of progress & then compressed it with xz & encrypted it with GPG (setting it to encrypt it to the key on my yubikey)

sudo tar --remove-files -c /tmp/laptop/ |pv| xz -9 | gpg -r FC5BFC514D82D7B443C2DCD4A068289733EAAA5F -e | s3cmd put - s3://bucket-id/2020-01-25_Laptop.tar.xz.gpg

If we need to decrypt this later on, we’d run.

s3cmd get s3://bucket-id/2020-01-25_Laptop.tar.xz.gpg - | gpg -d | xz -d | tar -xv

At this stage I had everything backed up and I decided to also reinstall Ubuntu 20.10 onto my laptop. I bought a new external drive as well so I’d have a local copy and a remote one. I also installed the same dependencies listed above. I copy the whole system minus some directories we don’t need if we’re doing a recovery. (If you choose to alter this, know that duplicity tends to freak out over the weirdness in /proc )
First is the command to Exoscale & second is to the new external drive.

sudo duplicity --s3-use-new-style --encrypt-key FC5BFC514D82D7B443C2DCD4A068289733EAAA5F --exclude /media --exclude /run --exclude /mnt --exclude /tmp --exclude /proc --exclude /dev --exclude /sys / s3://sos-ch-dk-2.exo.io/bucket-id/MSI-Laptop

sudo duplicity --encrypt-key FC5BFC514D82D7B443C2DCD4A068289733EAAA5F --exclude /media --exclude /run --exclude /mnt --exclude /tmp --exclude /proc --exclude /dev --exclude /sys / file:///path/to/external/drive/MSI-Laptop

The best part of doing this right after a re-installation is duplicity supports incremental backups, so as I add my music collection back & configure my vpn & dns settings and work my way to filling my drive again (I hope not) duplicity will make incremental backups every few hours.

Now all that remains is trying to backup the old external drives before they fail and cause data loss (I might already be too late, unfortunately)

Update: Something I overlooked in the decryption section. My GPG keys are on the Yubikey, but when I plugged the yubikey into the live cd to decrypt one of the backups it appeared the private keys were missing. I spent a bit trying to make sense of this, and stumbled into the answer.

gpg --card-status

I ran this to get some output for debugging, and it happened to also wake up the yubikey and show GPG that it had the private keys we need.

New Years Resolution Month 1

I was hoping to have a little more to share for this week’s post. This week I got a little distracted with some major happenings in the news cycle and I’m also waiting for a few packages to arrive in order to write a few how-to articles.

I originally said that I would write once a week, I’m beginning to think that might have been either too ambitious or putting quantity over quality. I’m waiting for some parts to come in before I start working on some how-to articles. I’ve decided once a month is a better minimum, I can always go beyond that but my track record is barely twice a year right now.

I’m working on upgrading my ham license in order to get some privileges on HF. I’m not sure when I will be able to get on the air though, between the small apartment space and the cost of HF gear. It is slowly getting easier however with radios like the icom ic-7100 and the KX2 on the market. I hope that I can by Field Day, we’ll see. There’s too many goals already, I don’t need to add more for my hobbies too.

Look forward to a new style on the site in the coming months too!

Happy New Year 2021!

Since my last post I’ve been working, learning more about Splunk and starting on some plans for after Covid-19 and my current IEC permit. I’ve got some drafts that need more work before I can post them, I’m hoping to have new content weekly as one of my new years resolutions.

As I try to really reflect on this year, I notice all the changes I’ve gone through. I Went from working two jobs to just one and somehow being better off due to that. My visa application was accepted, then all the fun of figuring out how best to get a job and move started, a pandemic making that even more challenging. I feel for the LDR couples that are still separated during this crisis.

I’ve been working in my current role for four months now, which is starting to feel like stability again. I’d been nervous and not wanting to believe that anything could really be stable right now so this really is a major milestone.

See you all next year!