[systemd-devel] systemd user instance and raising limits

Jeff Solomon jsolomon8080 at gmail.com
Sun Nov 19 19:52:40 UTC 2017


Hi,

Two questions.

I want to raise the "number of files" limits for the user instance.

First, I set DefaultLimitNOFILE to something higher than the global system
default in /etc/systemd/user.conf and I rebooted.

Then I confirmed that the setting has taken effect:

"systemctl --user show" showed the new DefaultLimitNOFILE and the unit
itself showed the higher setting of LimitNOFILE when I ran "systemctl
--user show foo".

So far everything worked as expected.

However, when I checked "cat /proc/<pid>/limits" on the ExecStart process
of foo.service, I don't see the "number of files" limit has changed.

What did I do wrong?

Second question: if I want to raise the limit just for a single user, how
would I go about it?

Making a change in user.conf would make it apply in all user instances
(assuming I could get it to work).

I have found that if I create /etc/systemd/system/user@<uid>.service and
add LimitNOFILE to the [Service] section of that file, then it will do two
things. First, it actually works whereas editing user.conf did not. Second,
the change only applies to user <uid> and not all users.

I assume I'm not getting how systemd is supposed to work. So please
enlighten me.

Thanks,

Jeff

Machine stats (although I see the same behavior on Ubuntu and on Centos7.3):

$ systemctl --version
systemd 229
+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP
+GCRYPT +GNUTLS +ACL +XZ -LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN

$ uname -a
Linux foo-ubuntu-vm1 4.4.0-98-generic #121-Ubuntu SMP Tue Oct 10 14:24:03
UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

$ lsb_release -a
LSB Version:
core-9.20160110ubuntu0.2-amd64:core-9.20160110ubuntu0.2-noarch:security-9.20160110ubuntu0.2-amd64:security-9.20160110ubuntu0.2-noarch
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.3 LTS
Release:        16.04
Codename:       xenial
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20171119/5641f05f/attachment.html>


More information about the systemd-devel mailing list