OwnCloud Sync Client "No keychain service available" Error

I recently installed the Ubuntu 17.10.1 (Artful Aardvark) flavour named Xubuntu. For those of you that are unaware, besides the default Ubuntu release there are several flavours that are built with alternative desktop environments. Amongst these are Budgie, KDE, LXDE, MATE and Xfce.

I host my own OwnCloud server on a Raspberry Pi 3 and installing the OwnCloud desktop sync client is usually one of the first things I do on a fresh installation. This time I ran into a problem, but managed to figure it out after trawling through a lot of posts on the internet about similar problems. I figured I'd post something up for fellow Xubuntu users that might run into the same problem. This solution will likely work for other Ubuntu flavours and quite possibly on other distros too.

Like most people using Ubuntu, I installed the OwnCloud desktop sync client using the built in software installer in Ubuntu. On Xubuntu this is simply named Software in the menu and you just search for owncloud and click the install button. Once it's installed, launch the application and it will ask a few configuration questions as well as your logon detail for the OwnCloud server you want to connect to. I went into the OwnCloud client's settings and ticked the box that configures it to launch at startup so that it will automatically start the next time I logon. At this point everything appears to work, I left it to synchronise my files and it finished that without a hitch.

The problem started after a restart. Once I logged on the OwnCloud client started, but it popped up a message box with an error reading No keychain service available. It asked me to type in my password for the OwnCloud server again. It would also do this if I quit the OwnCloud client and started it from the menu again. I previously had Linux Mint 18.3 with Xfce installed, it is based on Ubuntu 16.04 LTS. I knew this worked without asking me the password at each logon on Mint so I did a bit of googling, as you do. There were quite a lot of results that showed other people had similar problems over a large number of distro and with lots of different versions of the OwnCloud client. Fixes ranged from custom scripts to delay OwnCloud client startup until after the keyring service has started to installing additional library packages and a few weird ones thrown in to catch the unwary. After trawling through a bunch of these it seemed only one solution was the real fix: I had to install a library called libgnome-keyring.

Naturally, I opened a terminal window and typed:
sudo apt-get install libgnome-keyring

I entered my password for the sudo and apt promptly spat out an error:
E: Unable to locate package libgnome-keyring

A few minutes of digging around and I found a launchpad page that showed that the package name is actually libgnome-keyring0 on Ubuntu.

After this it was a simple task of typing:
sudo apt-get install libgnome-keyring0

Followed by entering my password for the sudo and answering Yes to installing the libgnome-keyring-common package as a dependency along with the libgnome-keyring0 package.

When the installation finished I quit the OwnCloud client and started it again from the menu. It still popped up a message box asking me for my password, but it no longer contained the No keychain service available error. I typed in my password for the OwnCloud server and it happily connected as before. I promptly restarted and now it's working as expected: the OwnCloud client launches after I logon, gets the stored password from the keychain service and connects to the OwnCloud server all by itself.

It is worth noting that I previously installed Seahorse and set it to unlock the keyring when I logon. If you have a password on your keyring and you don't have it set to unlock when you logon then you will get a prompt to unlock the keyring when OwnCloud tries to access it. If you're not extremely quick at unlocking your keyring then OwnCloud's password retrieval could time out and you will end up seeing the same error message as before. I recommend installing Seahorse from the software installer in Ubuntu and then setting it up to unlock your keyring on logon.