You are not logged in.

#1 2014-04-08 01:28:14

Registered: 2014-04-08
Posts: 1

Modifying limits on systemd services

What is the preferred way to modify the limits on a service that runs under systemd?

In my case, I'm running btsync@username as a service, wherein the service will run as the user account, and I'm reaching the open file limit on multiple bittorrent shares when they attempt to sync.

I have tried temporarily changing the limits of the running process:

sudo sh -c "echo -n 'Max open files=8192:16384' > /proc/${pid_of_btsync}/limits"

    This results in

sh: line 0: echo: write error: Invalid argument

I have tried adding this to /etc/sysctl.d/99-max-files.conf

fs.file-max = 100000

I have tried adding the following two lines to /etc/security/limits.conf:

*          soft        nofile      8192
*          hard        nofile      16384

Regardless of what I do, the proc limits file reflects the following:

Max open files            1024                 4096                 files

    I'm going to guess that this is getting inherited from systemd since it's launching the service.

I don't need a permanent solution, as I only need enough file descriptors to get the initial sync across.  Even then, I seem to be having problems implementing ANY solution, and if I ever were to launch a process that used a lot of descriptors, it would be good to know what the best way to go about this is.


#2 2014-04-08 02:57:27

From: Buenos Aires - Argentina
Registered: 2008-12-24
Posts: 723

Re: Modifying limits on systemd services

Look at systemd.exec(5) LimitNOFILE= wink


Board footer

Powered by FluxBB