Using apt-cacher-ng with openHAB repo (JFrog)

If you use apt-cacher-ng together with openHAB there are couple of things to be aware of. I just thought I would post in case anyone else runs into these.

  1. Since the repo uses HTTPS you need to set it up like this in your sources.list

deb http://HTTPS///openhab.jfrog.io/artifactory/openhab-linuxpkg stable main

(compare with the default deb https://openhab.jfrog.io/artifactory/openhab-linuxpkg stable main)

This tells apt to connect to apt-cacher-ng with http and then use HTTPS to connect to JFrog (since JFrog requires HTTPS).

Keep an eye on /etc/apt/sources.list.d/ . Sometimes when you upgrade openHAB it will put a sources.list file for itself in there using https:// which will throw errors the next time you try to update using apt if you use apt-cacher-ng. Just delete it.

  1. JFrog sometimes will block you from updating based on your user agent. apt-cacher-ng’s user agent is set in /etc/apt-cacher-ng/acng.conf . The default UserAgent: Yet Another HTTP Client/1.2.3p4 is a bit hit and miss, sometimes JFrog will block it and sometimes they won’t. I’ve found UserAgent: Debian APT-HTTP/1.3 (1.6.10) to work well and it hasn’t been blocked yet. apt-cacher-ng does warn you in the config not to modify the user agent unless you absolutely have to, but I haven’t seen any side effects. Don’t forget to restart apt-cacher-ng after you modify its config (sudo systemctl restart apt-cacher-ng.service)
1 Like