There is a bug in systemd-240 that is affecting jackdbus, which breaks my whole audio setup. The bug was fixed in systemd-241. Is there a way to upgrade to systemd-241?
Another option would be to recompile systemd-240 with the patch applied, assuming it cleanly applies to systemd-240.
If it is spossible, it is indeed simple. You just have to add your patch to the list of patch already used by ubuntu.
I am not advocating this method as a good fix to the problem. Try it at your own risk.
Moreover, Ubuntu 19.10 ships with systemd 242, so, if you plan to upgrade to Ubuntu 19.10, there's no reason to try this.
A fix “over” the current installation
Basically it's the idea which is in solsTiCe's answer: patch the distro's source. But then: do not reinstall the whole
systemd system. Replace just the
systemd executable — it can be done because the patch affects just the code of
systemd. This way I am sure not to mess up widely with the current installation.
My path to the solution wasn't as “linear” as I am going to describe it because at first I wanted to patch the original system v240 (using the right bits from the v241), build it and custom install it. Then I diverted to the use of pbuilder.
The following description is written as if I got it straightforwardly. I hope I haven't forgot details in the process of cleaning up the steps.
Follow this howto to install pbuilder, prepare the environment for the build (
sudo pbuilder create --distribution disco --debootstrapopts --variant=buildd), download the source (
apt-get source systemd). You obtain three files (two archives and a
.dsc) and a directory. So, likely you want to execute the apt-get command in a brand new folder, to avoid files pollution in your current directory.
Then, clone the systemd github repository and check-out the tag v241 (
git checkout tags/v241).
diff -u between the Ubuntu's
src/core/main.c and the one of the tag v241 to obtain a patch, say
my.patch. I have edited it to remove things that may affect more than just the memlock limit (a similar fix was done also for the number of open file descriptors, and I kept this, too), and also to get the headers right in the form of:
--- a/src/core/main.c .... +++ b/src/core/main.c ....
b you can have other names, of course.
Inside the folder
systemd-240 (obtained by running
apt-get source systemd) there's
my.patch there and add the file name at the end of
Try to build the package (
sudo pbuilder build systemd_240-6ubuntu5.dsc); this should also get the dependencies, and if everything's alright, you have the
/var/cache/pbuilder/result/; but it is the “original”.
Change directory in
systemd-240 and run
After a while… in
/var/cache/pbuilder/result there's a new
.deb (same name as before…) but this time it's the patched one. You should see a line if you do
tar -tJf /var/cache/pbuilder/result/systemd_240-6ubuntu5.debian.tar.xz |grep my.patch
provided that you named your patch
my.patch and that the
tar.xz is named so.
Now, unpack the
dpkg-deb -R systemd_240-6ubuntu5_amd64.deb a-folder), and as root copy
/lib/systemd/. Do not forget to backup the original
/lib/systemd/systemd (I've renamed it as
__systemd). If something goes wrong, you can replace the new one with the old one, likely from a recovery shell.
ulimit -l should say
unlimited (depending on your configuration, but I suppose you have read so far because it's what you expect for your user in the audio group).
- system v240 patched; I haven't compiled and tried this one — if you can and want to upgrade
systemdfrom its original releases, then I suggest to use the latest version picking the latest tag, e.g. today is v243.
- the patch as gist on github, this one applied on the Ubuntu's
systemdsource, version 240-6ubuntu5.7.
This patch isn't generated as explained in the previous section, because I've diffed the Ubuntu's source with the already patched
main.c you can find in the aforelinked branch. The final result shouldn't differ very much.
When I first noticed this issue, sometimes ago, after checking that the configuration was ok, I decided to wait for Ubuntu to fix it (I wasn't able to trace it back to a bug of systemd).
But today it prevented me to do stuffs I really wanted to, thus I decided it was time to do something about it.
Few hours later I've seen also a two-days-old announcement of 19.10.
There's no need to point out that replacing an executable in a “package-controlled system” isn't necessarily a very good idea. In this case, however, it's fine by me.