Sharing updates with opensuse
I have opensuse on my main desktop, on my laptop and on a test machine.
When there’s an update, the update has to be downloaded for each machine. That raises the question of whether they can be downloaded just once, and then used on multiple systems.
There was a discussion of this question on the opensuse mailing list last May (beginning May 21, 2015). I liked the suggestion offered by Carlos. So I decided to give it a try. I didn’t do it exactly as Carlos suggested, so this post will describe what I actually did.
I have been using this method for around two months now, and it has been working well.
The basic outline of the method is to share the place where “zypper” (the main update software) downloads packages. I’m using NFS to share that across the home network. Another possibility would be to put that on an external hard drive, and plug in and mount that hard drive when doing updates. However, the use of NFS is more convenient, since it is always available.
Home network shares
I had already setup NFS on my main desktop. I have a partition of around 500G in size, mounted as “/shared”. And I already had my laptop setup to be able to mount that. I use automount for mounting, so that it only mounted on my laptop when needed. A permanent mount would cause problems when travelling with laptop. My original purpose for using NFS sharing, was to share multi-media among home machines. I also share that same directory with Samba, to make the multimedia files available to Windows systems.
I plan on doing a future post on setting up an NFS server and an NFS client. For the present, I’ll just describe how I used the existing NFS shares.
I created a directory “/shared/repostuff” for sharing downloaded packages. I used a separate subdirectory “repostuff” because I want to be able to easily exclude that from normal backups.
Under that “repostuff” directory, I created two subdirectories. One of those is “twpkg” where I share downloaded packages for Tumbleweed. The other is “13_2pkg” where I share downloaded packages form opensuse 13.2.
My Tumbleweed setup
I’ll only describe the Tumbleweed setup here. The setup for 13.2 is similar.
Under that directory “/shared/repostuff/twpkg”, I have three directories. Those are “repo-oss”, “repo-non-oss” and “packman”. Those directories were initially empty. They are filled up by “zypper”.
Normally, “zypper” downloads packages to “/var/cache/zypp/packages”. So the plan was to use symbolic links in that directory, to the NFS shared package download directory.
In “/var/cache/zypp/packages”, I removed existing directories for the repo-oss, repo-non-oss and packman subdirectories.
A note here. The actual names may vary, depending on how the repos where configured. I looked in “/etc/zypp/repos.d” to find the actual names used. Here, look for files of the form “*.repo”. The part of the name before the “.repo” is the directory name that is used in “/var/cache/zypp/packages”.
So, for example, I used:
ln -s /shared/repostuff/twpkg/repo-oss repo-oss
ln -s /shared/repostuff/twpkg/packman ftp.gwdg.de-suse
to handle the repo-oss and packman repos. Note that the system was using the name “ftp.gwdg.de-suse” for the packman repo.
The next step is to configure those repos to retain all downloaded rpm files. That’s actually a setting for each repo that can be made using “Yast Software Repositories”. Alternatively, you can edit the setting in the repo definition file in “/etc/zypp/repos.d”
Completing the setup
The same setup is now needed for all Tumbleweed systems that will share the downloaded packages. It is only necessary to create symlinks for the repos that you share. I decided not to share the debug repos or the update repo, since those are infrequently used.
Only update one system at a time. Otherwise packages downloaded on one system might collide with those downloaded concurrently on another system, perhaps resulting in a corrupted package.
The Gnome update software wants to download updates in the background. To avoid concurrent downloads, it is best to disable that, or uninstall the update client for Gnome if you cannot work out how to disable. I rarely use Gnome, and am unlikely to use on two computers at the same time, so I did not worry about this problem.
This works very well. The first system to be updated will download the packages from the repos. Updating other systems then goes a lot faster, because most of the package have already been downloaded.
I did run into problems on my laptop, with NetworkManager. The problem was that during shutdown or reboot, NetworkManager is shutdown before the NFS client is shutdown. So the system hangs, and I needed to power off.
I could avoid that if I remembered to manually umount the NFS share before shutdown. But I sometimes forgot. So I switched to using “wicked” to manage networks. I’ll switch back to NetworkManager when travelling with my laptop. And I’ll avoid doing any updates while travelling, since the shared NFS file system won’t be available.