Repair a Damaged Package System after Ubuntu Dist-Upgrade

Happy new year.

My blog runs on a VM at Hetzner with an Ubuntu LTS system. That means 5 years of support… I was running trusty from 2014, so there should be support until 2019. But not every open source software has given you this promise, just the Ubuntanians. So, support for Owncloud run out last year and I thought that the days between years are a good time to switch to a new version.

Hence, I did two dist-upgrades after another from trusty to xenial and from xenial to the current LTS version bionic (every 2 years a new LTS version is coming out). The first upgrade was “successful” with a lot of need for adaption in the configurations afterwards. Then after everything worked again, I did another upgrade, which failed because of this issue.

You do not want your system showing you such a message during do-release-update.

That is, I had to fix a distro upgrade that failed in between… challenge accepted 🤓.

Read More

Change c-time on Unix-Based Systems Based on Filenames

For quite some time I have a paper-free office (at home). I still physically file the papers I get, but in addition I scan all the paper documents, tag them and put them in a folder. I use a very easy system. For the very recent documents (and the ones work in progress) I have a draft folder. Furthermore, there is exactly one document folder per year and I store everything in there (incoming and outgoing documents, scanned ones and ones that I get mailed, even some printed to PDF emails for document-like emails). Each file has a common naming scheme. There is one part that is relevant for this post: at the beginning of each file I put the date of the document in the format YYYYMMDD. This way, the documents are ordered chronologically in a year, if I sort them by name. There is a lot more to my filing system and if someone is interested, please leave a comment, but for this post, this should be enough about my way of filing documents (digitally).

The issue I would like to address here is, that the date when I scanned a file and the “real” date of the document diverges. Sometimes it even happens, that the creation time of two scanned files are in “the real world” in one order, but the scan-/creation time is the other way around. I do not like this situation. Therefore, each year when I “finish the year”, I run a script (on macOS), which adapts the ctimeto the date-part in the name of the file (a one-liner, which I put on 5 lines, for better readability):

find . -name "2017*" | while read file; \
  do thedate=$(echo "$file" | \
  sed -E 's/^[^0-9]*([0-9]+).*$/\1/'); \
  touch -t ${thedate}0000 $file; \
  done

If you have another unix-based System with sed you can use -r instead of -E. I am unsure why this option behaves differently on macOS although I installed (and use) GNU sed installed via home brew.

Exciting 🤓.

Backup Rotation with Date

Again (see ring buffer), this is a post, which shows an approach I will not need, since my backup script will change encore un fois.

I began to write a backup script using hard links and rsync in order to have incremental backups inspired by incremental backups with rsync. But after a little bit of hassle with bash script a friend gave me the hint that rsnapshot is out there and this little perl tool is either enlightened by Mike Rubels approach. So I will have to change my backup strategy from ‘push’ to ‘pull’ and make some other subtle changes, but don’t have to bother with ring buffers and backup rotation, because rsnapshot has already worked that out for me.
Read More

Ring Buffers with Bash Script

This post is a little bit infantile, since it does present a really, really simple thing, but I wrote the shell code yesterday for a backup script and it seems as I will not need it. So I write it down here so either I do not forget it (who knows when it will come in handy?) or perhaps someone else says: “Hey my script could be much easier using this”. In the next days I will post the code that replaces the code shown in this post, so stay tuned.
Read More

Generate HTML from Colored Terminal for Sharing Diffs

The version control system git has the nice feature git diff --color-words which shows on a word by word basis the changes, coloring new words green and deleted ones red. The script ansi2html.sh converts a colored xterm output to html. This way you are able to share your diffs with others: hello world example. For \LaTeX you may use latexdiff, which highlights the changes in the generated PDF/DVI-output.