You are not logged in.

#1 2015-04-03 13:39:38

awes
Member
Registered: 2015-03-13
Posts: 20

/tmp tmpfs permissions problem

Hello!

I have a /tmp permissions problem, that appeared out of nowhere. After reboot permissions are 755 instead of 777.
fstab entry:

tmpfs            /tmp             tmpfs       size=3G,mode=777,exec

"df -h | grep /tmp" - to check if options match fstab (and you can see that size is correct):

tmpfs                   3,0G  196M  2,9G   7% /tmp

tmpfiles.d config? I have none:

awes:~$ stat /etc/tmpfiles.d/tmp.conf
stat: cannot stat ‘/etc/tmpfiles.d/tmp.conf’: No such file or directory

And now the strangest thing - after:

umount /tmp
mount /tmp

Permissions are ok (777)!

Latest updates (don't see anything that could cause such problem...):

[2015-04-03 09:12] [ALPM] upgraded llvm-libs (3.6.0-3 -> 3.6.0-4)
[2015-04-03 09:12] [ALPM] upgraded lz4 (127-1 -> 128-1)
[2015-04-03 10:57] [ALPM] upgraded libtasn1 (4.3-1 -> 4.4-1)
[2015-04-03 10:57] [ALPM] upgraded gnutls (3.3.13-1 -> 3.3.14-2)
[2015-04-03 10:57] [ALPM] upgraded ghostscript (9.15-2 -> 9.16-1)
[2015-04-03 10:57] [ALPM] upgraded groff (1.22.3-2 -> 1.22.3-3)
[2015-04-03 10:57] [ALPM] upgraded man-pages (3.81-1 -> 3.82-1)

journalctl says nothing about /tmp, I don't know where to look.

Any suggestions?
Thanks!

Offline

#2 2015-04-03 14:04:30

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: /tmp tmpfs permissions problem

How do you know permissions are 755 instead of 777 before remounting?

Anyway, your fstab entry WFM:

$ grep tmpfs /etc/fstab
tmpfs		/tmp		tmpfs		size=3G,mode=777,exec		0 0
$ mount |grep "/tmp"
tmpfs on /tmp type tmpfs (rw,relatime,size=3145728k,mode=777)
$ ls -ld /tmp
drwxrwxrwt 10 root root 260 Apr  3 09:58 /tmp

Edit: maybe the mount unit would be informative:

$ systemctl status tmp.mount
● tmp.mount - /tmp
   Loaded: loaded (/etc/fstab; static; vendor preset: disabled)
   Active: active (mounted) since Fri 2015-04-03 09:54:22 EDT; 8min ago
    Where: /tmp
     What: tmpfs
     Docs: man:fstab(5)
           man:systemd-fstab-generator(8)
  Process: 271 ExecMount=/bin/mount -n tmpfs /tmp -t tmpfs -o size=3G,mode=777,exec (code=exited, status=0/SUCCESS)

Last edited by alphaniner (2015-04-03 14:07:00)


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#3 2015-04-03 14:22:16

awes
Member
Registered: 2015-03-13
Posts: 20

Re: /tmp tmpfs permissions problem

Thanks for the quick reply.
Checked just after a reboot:

# ls -ld /tmp
drwxr-xr-x 10 root root 220 04-03 16:10 /tmp/

# mount | grep /tmp
tmpfs on /tmp type tmpfs (rw,relatime,size=3145728k,mode=777)

# systemctl status tmp.mount
● tmp.mount - /tmp
   Loaded: loaded (/etc/fstab; static; vendor preset: disabled)
   Active: active (mounted) since pią 2015-04-03 16:10:23 CEST; 2min 13s ago
    Where: /tmp
     What: tmpfs
     Docs: man:fstab(5)
           man:systemd-fstab-generator(8)
  Process: 209 ExecMount=/bin/mount -n tmpfs /tmp -t tmpfs -o size=3G,mode=777,exec (code=exited, status=0/SUCCESS)

The logs look inconsistent with reality sad
According to `mount`, /tmp should have 777 permissions.

After remount (umount /tmp; mount /tmp) permissions are OK, so I presume that fstab entry is correct.
I see two options:
- initial mount fails to set correct permissions,
- something (?!) changes permissions just after initial mount after boot.

Last edited by awes (2015-04-03 14:27:49)

Offline

#4 2015-04-03 15:24:06

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: /tmp tmpfs permissions problem

I use: (busybox init, not systemd)

mount -t tmpfs tmpfs /tmp -o mode=1777,nosuid,nodev,exec

Note that it's 1777, with a ONE at the start.

Offline

#5 2015-04-03 16:24:19

awes
Member
Registered: 2015-03-13
Posts: 20

Re: /tmp tmpfs permissions problem

Thanks, tried that - still no luck. Maybe it's systemd related somehow?
Anyway, I've added a workaround that to .bashrc, that corrects permissions at login. It doesn't solve the problem, but I don't have a better solution at the moment hmm

Offline

#6 2015-04-08 14:35:38

awes
Member
Registered: 2015-03-13
Posts: 20

Re: /tmp tmpfs permissions problem

I was curious what are the /tmp permissions just before and after mount, so I replaced /usr/bin/mount and /usb/bin/chmod with scripts that logs permissions to a file and calls the actual mount and chmod.
Here are the results (only interesting part):

before: mount -n tmpfs /tmp -t tmpfs -o mode=777,size=3G
	drwxrwxrwx 2 root root 4096 04-03 17:42 /tmp
after: mount -n tmpfs /tmp -t tmpfs -o mode=777,size=3G
	drwxrwxrwx 2 root root 40 04-08 08:55 /tmp

Looks like permissions are OK just after the /tmp is mounted, there are no "chmod" calls (from scripts of course, since I'm unable to track system calls from <sys/stat.h>).
... but when I login, permissions are 0755...

Offline

#7 2015-04-08 19:55:32

Leonid.I
Member
From: Aethyr
Registered: 2009-03-22
Posts: 999

Re: /tmp tmpfs permissions problem

Your problem seems to be somehow related to a umask setting (I don't really understand how/why)...

But why do you even need a mode=... option in fstab? AFAIU, /usr/lib/tmpfiles.d/tmp.conf is supposed to instruct systemd to set right perms.


Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd

Offline

Board footer

Powered by FluxBB