janus-gateway-snap icon indicating copy to clipboard operation
janus-gateway-snap copied to clipboard

How to alter ulimit for snap ?

Open ujjwal18 opened this issue 4 years ago • 2 comments

unable to alter ulimit event installing with --classic any other way to tweak this setting ?

ujjwal18 avatar Jun 20 '20 07:06 ujjwal18

https://github.com/RSATom/janus-gateway-snap/issues/4 I've already investigated this question, and didn't find any way to do it.

RSATom avatar Jun 20 '20 08:06 RSATom

I solved it by systemctl edit snap.janus-gateway.janus-gateway.service

[Service]
LimitNOFILE=65536

vterdunov avatar Mar 20 '21 15:03 vterdunov

I solved it by systemctl edit snap.janus-gateway.janus-gateway.service

[Service]
LimitNOFILE=65536

This helped.... maybe add into the Snap ?

Si-Richards avatar May 24 '23 15:05 Si-Richards

there is no access to .service file from snap itself...

RSATom avatar May 24 '23 15:05 RSATom

Some maybe useful hints I've found https://forum.snapcraft.io/t/how-to-customize-systemd-service-created-by-snapd/18397/3

RSATom avatar May 24 '23 16:05 RSATom

Some maybe useful hints I've found https://forum.snapcraft.io/t/how-to-customize-systemd-service-created-by-snapd/18397/3

Command above just do it the same thing.

vterdunov avatar May 24 '23 16:05 vterdunov

no, update snap package to new version can overwrite .service file. So it worth try solution with .d dir.

If you are running into problems with a hard limit or don’t control the snap’s source, you might be best off adding a drop-in file to augment the service file snapd wrote out. You’re correct that editing the service file produced by snapd is likely to be undone next time the snap upgrades.

If the service is called snap.snapname.servicename.service, create a directory /etc/systemd/system/snap.snapname.servicename.service.d, and create a file in that directory named set-file-limit.conf` with content like:

[Service] LimitNOFILE=...

This allows you to override the limit in a way that will survive upgrades, and won’t leave a zombie unit behind if you uninstall the snap.

RSATom avatar May 24 '23 16:05 RSATom

systemctl edit creates drop-in file.

/etc/systemd/system/snap.janus-gateway.janus-gateway.service.d/override.conf

man systemctl

this command creates a drop-in file for each unit either for the system, for the calling user, or for all futures logins of all users.

vterdunov avatar May 24 '23 17:05 vterdunov

@vterdunov good to know. :+1:

RSATom avatar May 25 '23 03:05 RSATom

@vterdunov if you have any other performance tweaks please let me know ;-) I'm guessing nothing needs to be overridden outside the snap in the OS for limits.conf or systmctl.conf ?

Si-Richards avatar May 25 '23 09:05 Si-Richards

Added hint to Readme. @vterdunov thanks!

RSATom avatar Jun 08 '23 03:06 RSATom