You are not logged in.

#1 2021-03-10 21:32:19

kuon
Member
Registered: 2020-07-11
Posts: 10

Jack files disappears from /dev/shm

I have a strange issue with jack2.

Everything works, but after some times (like a few hours or a few days), jacks files disappear from /dev/shm.

I opened an issue with jack: https://github.com/jackaudio/jack2/issues/676

But I suspect this is not a jack issue, but something is clearing /dev/shm.

In addition to RemoveIPC=yes in /etc/systemd/logind.conf  is there any condition where systemd or something else will delete files in /dev/shm?

Offline

#2 2021-03-11 17:16:40

paulkerry
Member
From: Sheffield, UK
Registered: 2014-10-02
Posts: 611

Re: Jack files disappears from /dev/shm

Never used jack, but have come across...

$ systemctl | grep systemd-tmpfiles 
   systemd-tmpfiles-setup-dev.service                                                        loaded active exited    Create Static Device Nodes in /dev                                           
   systemd-tmpfiles-setup.service                                                            loaded active exited    Create Volatile Files and Directories                                        
   systemd-tmpfiles-clean.timer                                                              loaded active waiting   Daily Cleanup of Temporary Directories                                       

$ systemctl status systemd-tmpfiles-clean.timer

points to...

man systemd-tmpfiles
man tmpfiles.d

Offline

#3 2021-03-11 21:57:20

Maniaxx
Member
Registered: 2014-05-14
Posts: 757

Re: Jack files disappears from /dev/shm

You could set up auditing:
https://wiki.archlinux.org/index.php/Audit_framework

I did a quick test with 'write' access. It logs 'deleted files' as well. You might want to find a rule/filter to separate 'writes' from 'deletes' though. 'Write' accesses might excessively spam the log.

Last edited by Maniaxx (2021-03-11 22:00:55)


sys2064

Offline

#4 2021-03-13 15:13:21

kuon
Member
Registered: 2020-07-11
Posts: 10

Re: Jack files disappears from /dev/shm

I have already checked those systemd services. The thing is, I can sometimes go for days without problem, so it is hard to pinpoint.

The audit framework is a really nice idea, I didn't know you could use it that way.

I'm going to turn it on and see if I can get any more info.

For reference, here are the rules I enabled:

-a always,exit -F arch=b64 -S rename,unlink,unlinkat,renameat -F dir=/dev/shm
-a always,exit -F arch=b32 -S unlink,rename,unlinkat,renameat -F dir=/dev/shm

Last edited by kuon (2021-03-13 15:51:54)

Offline

#5 2021-03-14 21:10:47

kuon
Member
Registered: 2020-07-11
Posts: 10

Re: Jack files disappears from /dev/shm

It just happened, but my audit rule did not log anything. Which is weird, because if I rm a file in `/dev/shm` with `rm` I get a log entry.

Offline

#6 2021-03-14 21:35:50

Maniaxx
Member
Registered: 2014-05-14
Posts: 757

Re: Jack files disappears from /dev/shm

Probably different syscall. Try to catch how files are created. Maybe you can derive deletion calls from that. Or try filesystem watches instead of syscalls (if there are some for deletion only).

Last edited by Maniaxx (2021-03-14 21:37:20)


sys2064

Offline

#7 2021-03-16 17:15:35

kuon
Member
Registered: 2020-07-11
Posts: 10

Re: Jack files disappears from /dev/shm

I am trying a filesystem watch on some jack specific file, I hope it will catch something when the bug occurs.

Offline

#8 2021-03-17 16:09:43

kuon
Member
Registered: 2020-07-11
Posts: 10

Re: Jack files disappears from /dev/shm

OK, I think I found the thing responsible:

time->Wed Mar 17 15:20:41 2021
type=PROCTITLE msg=audit(1615990841.460:36210): proctitle=2F7573722F62696E2F616E796465736B002D2D74726179
type=PATH msg=audit(1615990841.460:36210): item=1 name="/dev/shm/jack-shm-registry" inode=47423 dev=00:1a mode=0100666 ouid=1000 ogid=1000 rdev=00:00 nametype=DELETE cap_fp=0 cap_fi=0 cap_fe=0 cap_fver=0 cap_frootid=0
type=PATH msg=audit(1615990841.460:36210): item=0 name="/dev/shm/" inode=1 dev=00:1a mode=041777 ouid=0 ogid=0 rdev=00:00 nametype=PARENT cap_fp=0 cap_fi=0 cap_fe=0 cap_fver=0 cap_frootid=0
type=CWD msg=audit(1615990841.460:36210): cwd="/home/kuon"
type=SYSCALL msg=audit(1615990841.460:36210): arch=c000003e syscall=87 success=yes exit=0 a0=7ffdcd1e0000 a1=ba63ad a2=0 a3=7f8731710fc0 items=2 ppid=1 pid=306912 auid=1000 uid=1000 gid=1000 euid=1000 suid=1000 fsuid=1000 egid=1000 sgid=1000 fsgid=1000 tty=(none) ses=1 comm="anydesk" exe="/usr/bin/anydesk" key=(null)

It seems like anydesk-bin (AUR) is causing the issue.

Offline

#9 2021-03-17 16:15:50

kuon
Member
Registered: 2020-07-11
Posts: 10

Re: Jack files disappears from /dev/shm

Thie leads me to another question: how should I run anydesk so it doesn't fiddle with this? Should I run as another user? Is there any better sandboxing mechanism?

Offline

#10 2021-03-17 16:20:37

Maniaxx
Member
Registered: 2014-05-14
Posts: 757

Re: Jack files disappears from /dev/shm

Nice catch. What rules did you choose to get 'deletes'?

Not sure but shouldn't tmp files have a special flag for not getting deleted by other users?

Last edited by Maniaxx (2021-03-17 16:24:34)


sys2064

Offline

#11 2021-03-17 16:23:23

kuon
Member
Registered: 2020-07-11
Posts: 10

Re: Jack files disappears from /dev/shm

That one worked:

-w /dev/shm/jack-shm-registry -p rwxa

Offline

#12 2021-03-17 16:27:46

Maniaxx
Member
Registered: 2014-05-14
Posts: 757

Re: Jack files disappears from /dev/shm

Maybe try setting 'sticky bit' on /dev/shm. Not sure if that works.


sys2064

Offline

#13 2021-03-17 16:30:30

kuon
Member
Registered: 2020-07-11
Posts: 10

Re: Jack files disappears from /dev/shm

The sticky bit is set, but I run anydesk as my regular user it can delete the other files, and it seems that anydesk obliterates everything in /dev/shm.

I am trying to use a different user, but I'm under wayland and I need to find the equivalent of xhost + under wayland.

Last edited by kuon (2021-03-17 16:31:22)

Offline

#14 2021-03-17 17:00:26

Maniaxx
Member
Registered: 2014-05-14
Posts: 757

Re: Jack files disappears from /dev/shm

Maybe let jackd run as 'audio' user.


sys2064

Offline

#15 2021-03-17 17:02:30

kuon
Member
Registered: 2020-07-11
Posts: 10

Re: Jack files disappears from /dev/shm

The thing is that with jackdbus, jack now runs automatically as dbus user. Also, I have other things in /dev/shm I don't want anydesk to obliterate, that's why I want to isolate anydesk.

Offline

#16 2021-03-17 18:23:16

Maniaxx
Member
Registered: 2014-05-14
Posts: 757

Re: Jack files disappears from /dev/shm

What about running anydesk as different user within its own wayland session (ctrl+alt+F2)? Edit: I mean a standard logged-in multiuser with own desktop environment.
How do you start Jack that it runs as dbus user? Neither QJackCtl nor 'jack_control' start it as such here.

Last edited by Maniaxx (2021-03-17 18:25:48)


sys2064

Offline

#17 2021-03-17 21:06:48

kuon
Member
Registered: 2020-07-11
Posts: 10

Re: Jack files disappears from /dev/shm

What I mean is that jack is started as the user running the current dbus session (and not the user named dbus). So if I am logged as kuon, jack is running as kuon via

/usr/bin/jackdbus auto

.

Well, running a whole session is a possibility, but I'd like to switch between windows. Actually I use sway, and sway can run within sway. If I open a terminal and run sway as the anydesk user, I get a window with a full sway session in it. My only problem is that as it is not running from login, I have no $XDG_RUNTIME_DIR and other similar variables (what is provided by https://man.archlinux.org/man/pam_systemd.8.en).

Is there a command similar to dbus-run-session that simulate a systemd login?

Offline

Board footer

Powered by FluxBB