kalu: Keeping Arch Linux Up-to-date

One thing you (should) do quite often, as a good Arch Linux user, is upgrade your system. Arch is, after all, a rolling-release distribution. As a result something one ends up doing often is sudo pacman -Syu (in fact, if you're like me, lazy, you probably have an alias set, e.g. syu)

There are already a few "update notifier" out there, which will run in the background and let you know as soon as a package has been updated, but I couldn't find one that would fit my needs (granted I didn't search too hard, I was also interested in making my own as a fun exercice...) so I decided to make a new one.

Introducing kalu

IMPORTANT: this is version 0.0.1 because it is still in beta stage. It works, but there's probably bugs crawling in there, and it's not quite finished yet. But I figured I might as well share it now, and see what happens. Whatever happens though, I'm not responsible. :-)

kalu (which could stand for "Keeping Arch Linux Up-to-date") is a small application that will add an icon to your systray and sit there, regularly checking if there's anything new for you to upgrade. As soon as it finds something, it'll show a notification to let you know about it. Very classic stuff.

kalu: example of notification

You can know whether kalu found something or not during its last check simply by looking at its icon: if all gray, nothing was found. If blue, move your pointer over it to see (in the tooltip) what was found. If the icon happens to "blink" from gray to blue, it simply means kalu is currently busy.

So what makes kalu any different?

For starter, it doesn't need root privileges to do its checking. Not because it doesn't synchronize databases, since that would make it mostly useless, but because it will create a temporary copy of your sync databases, sync those, and then remove them of course.

The idea is not only not to require root privileges, but more importantly to avoid putting you in a situation where you'd risk messing up your system, as you might unknowingly end up basically doing a pacman -Sy foobar (which is pretty generally understood to be a bad idea).

Because if kalu did sync your dbs, and there were upgrades available, but you did not apply them right away (for one reason or another, e.g. you're busy, or were AFK when the notification poped up and didn't see it...) then your next -S operation would really by a -Sy, event though you might not even realize it.

Checking more packages than are installed

kalu also includes a feature where it can check for other packages than the ones installed, called "watched packages." The idea is that you might wanna keep an eye on some packages, and know whenever they're updated, even though they are not installed. (E.g. because you recompile said packages or something, but didn't subscribe to upstream's mailing list.)

kalu can maintain a list of packages (name & version) and check whether or not an upgrade is available. If so, a notification will let you know about it, and you can very easilly decide to mark it seen (i.e. update the version number tracked) or not.

Checking for AUR upgrades as well

kalu can also compile the list of foreign packages (i.e. not found in any repo, aka -Qm) and check to see if they are available on the AUR. If so, versions are compared and if any upgrades if available in the AUR, as you probably guessed, a notification will let you know about it.

And just like for "regular" packages, you can also have a list of "watched AUR packages" which works exactly the same as watched packages, only with packages in the AUR.

Finally, the news!

kalu can also check the news from the website, and - surprise - show a notification when a new item has been posted. The notification will only include the title, but you can click the action button to show the full news.

kalu: Showing Unread News

Note that links are not (yet?) supported.

Checking is good. Upgrading too.

When a notification is shown, it will feature an action button. This button can be used to simply trigger a process of your choosing, e.g. you could have it start pacman with something like urxvt -e sudo pacman -Syu

However, kalu comes with an integrated system upgrader, which does exactly the same, only in a GTK GUI. Before being able to synchronize your databases (and possibly upgrade the system) the updater needs root privileges, obviously.

The way it works is: kalu itself only contains the GUI, and the part that does interact with libalpm (to actually upgrade your system) is in a secondary binary (kalu-dbus). This binary only will require root privileges, and will rely on PolicyKit to ensure you are authorized before doing anything.

Obviously this requires you to have PolicyKit installed, but also (assuming default configuration) a PolicyKit agent, which is the one in charge of asking for your/root password and making sure you don't just press random keys and whatnot.

kalu's updater: listing packages to upgrade

The updater does what a pacman -Syu would, and nothing more (well, there's PostSysUpgrade in the options below). It shouldn't be any faster or slower than pacman (especially since most of the work comes from libalpm either way), and it will also update your log (pacman.log that is, as defined in pacman.conf).

Log entries coming from libalpm itself (e.g. any warning during a package upgrade, etc) will obviously be as with pacman, anything from kalu (e.g. indication after a database has been synchronized, or package has been upgraded...) will have a kalu: prefix. When you start an upgrade, kalu first adds an entry ("upgrading system..."), and adds one ("sysupgrade completed") once the operation is complete.

During the process, another log (as in: it's not exactly what's going in pacman.log but something slightly more verbose) is avalaible, any warning, error or scriptlet output will obviously be featured there as well. (The log will be made visible automatically if any such thing occur.)

Updater Screenshots

Because people love screenshots, right? :-)

kalu's updater: downloading packages

kalu's updater: asking to import a key

kalu's updater: upgrading system

Preferences

Right now kalu does not include a Preferences window, but you can of course set things manually. To do so, simply edit ~/.config/kalu/kalu.conf where all settings are stored. For the record, the lists of watched (AUR) packages are stored in that same folder, as watched{,-aur}.conf

String values can be quoted, which might be useful - and required - if you want to include a space at the beginning or end of something. (Mostly useful for templates, e.g. to do Sep = ", " -- see below). You can use # to comment lines, and yes, it is all very case-sensitive

The main options must be set in section [options] :

  • PacmanConf : path/name to your pacman.conf -- defaults to /etc/pacman.conf

  • Interval : the number of minutes between each auto-check -- defaults to 60

  • SkipPeriod : this is e.g. in case you keep your computer on 24/7, yet go to sleep at some point. It would then make sense that you don't want kalu to do its checks while you're sleeping. Specify here this "skip period" during which no (automatic) checks will be performed (Of course, you can always ask for one manually) The value must be formatted as "HH:MM-HH:MM" using 24h format, e.g. "23:00-08:00" to disable auto-checks from 11 p.m. to 8 a.m.

  • UpgradeAction : By default, the action button on the notification of upgraded packages will trigger kalu's updater (1). However, you can decide that you'd rather start something else (2) or that you simply don't want such a button (0).

  • CmdLine : With UpgradeAction=2 the action button will start whatever you specify here. (Note: kalu never checks the validy of what you specify here or anything, instead it assumes you have a functionning brain.)

  • CmdLineAur : Same as above, only for the notification of upgraded AUR packages. However, here there's no Action setting: either you define CmdLineAur and there's a button, or you don't and there isn't.

  • PostSysUpgrade : When using kalu's updater, once the system upgrade has completed you can have kalu start some extra process. This could be useful if you have some cleaning process you wanna start (e.g. localepurge or something). Simply specify it here, and after an upgrade kalu will ask you whether it should start it or not. Note: You can specify this setting more than once. Then, the question will include the list and you'll be able to decide which one(s) to start, if any.

  • AurIgnore : You might have some foreign packages that do not come from the AUR, and therefore checking the AUR for such upgrades is useless. Specify here such packages and kalu will ignore them/not check the AUR for them. Use space as separator between packages. (You can also specify this option multiple times.)

  • ManualChecks : Define what checks will be done when right-clicking on kalu's systray icon and using "Check for Updates" This should be a list containing one or more of the following values (using space as separator) : UPGRADES, WATCHED, AUR, WATCHED_AUR, NEWS

  • AutoChecks : Same as above, but for automatic checks.

  • Verbose : The notifications can either be verbose or not. By default ("auto"), kalu checks if option VerbosePkgLists was enabled or not in your pacman.conf to determine what to do. You can also force it off ("off") or on ("on") using this option. It will apply for notifications of upgrades.

  • VerboseWatched : Same as above, but for notifications of watched packages.

  • VerboseAur : Same as above, but for notifications of upgraded AUR packages.

  • VerboseWatchedAur : Same as above, but for notifications of watched AUR packages.

As hinted before, the notifications can either be verbose or not. You can also tweak the templates that will be used. This is done by defining options in the following sections :

  • [template]
  • [template-verbose]
  • [template-watched]
  • [template-watched-verbose]
  • [template-aur]
  • [template-aur-verbose]
  • [template-watched-aur]
  • [template-watched-aur-verbose]
  • [template-news]

I'll let you figure out which refers to what. In those, the following options are supported:

  • Title : The title of the notification. Variables available are $NB for the number of packages (or news items), $DL the total download size, and $NET the total net (difference after installation) size. I just now realized the total installation size isn't there, that's odd. Where's my to do list?

  • Package : The package (or, for news, the news item). Repeated as needed, and separated using the separator as defined with Sep (below). Variables available are $PKG for the package name, $OLD for the old version number, $NEW the new version number, $DL the download size, $INS the install size, and $NET the net size. For news items, only one variable is available: $NEWS for the item's title.

  • Sep : The separator used between packages (news items)

Download

Also, this is (obviously) still in beta, so beware. It should all work just fine, in fact I've been using it for some weeks now, even doing all my system upgrades using kalu's updater, and I'm still alive.

Anyhow, that's about it. Hopefully this might be useful to some. As hinted above, DBus and PolicyKit are required for kalu to work. It also requires libalpm 7 (pacman 4), cURL, libnotify (and a notify daemon if you wanna see something, obviously) as well as GTK3.

Thanks to the Pacman development team for their great work and nice code; Thanks to Dave Gamble for his JSON parser; And thanks to Painless Rob for his great icon.

kalu is released under GNU GPL v3+ The source code is available on this BitBucket repository.

You can also find a PKGBUILD in the AUR.

And of course bug reports, suggestions or any other form of constructive criticism is very much welcome.

Top of Page