Bug 804332

Summary: Don`t erase /tmp on boot
Product: [Fedora] Fedora Reporter: Pavlo Rudyi <paulcarroty>
Component: systemdAssignee: systemd-maint
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 17CC: johannbg, metherid, mschmidt, notting, plautrba, systemd-maint
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-03-20 14:09:40 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
boot.log none

Description Pavlo Rudyi 2012-03-17 21:01:08 UTC
Created attachment 570835 [details]
boot.log

Description of problem:
systemd-tmpfiles-clean.service not erase /tmp

Version-Release number of selected component (if applicable):
Fedora 17


How reproducible:
 /bin/systemd-tmpfiles --clean

Steps to Reproduce:
1. Install Fedora 17 alpha from LiveCD
  
Actual results:


Expected results:


Additional info:
# systemctl status systemd-tmpfiles-clean.service
systemd-tmpfiles-clean.service - Cleanup of Temporary Directories
	  Loaded: loaded (/usr/lib/systemd/system/systemd-tmpfiles-clean.service; static)
	  Active: inactive (dead) since Sat, 17 Mar 2012 22:30:50 +0200; 17min ago
	 Process: 1206 ExecStart=/usr/bin/systemd-tmpfiles --clean (code=exited, status=0/SUCCESS)
	  CGroup: name=systemd:/system/systemd-tmpfiles-clean.service


Boot with systemd.log_level=debug:
Mar 17 22:16:13 fedora systemd-readahe[269]: Bumped block_nr parameter of 8:0 to 16384. This is a temporary hack and should be removed one day.
Mar 17 22:16:13 fedora kernel: [    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-3.3.0-0.rc7.git0.3.fc17.x86_64 root=UUID=074f9308-77d5-43e6-ad94-74ab0b4cb81c ro rd.md=0 rd.lvm=0 rd.dm=0 SYSFONT=latarcyrheb-sun16 rd.luks=0 KEYTABLE=us LANG=uk_UA.UTF-8 systemd.log_level=debug
Mar 17 22:16:13 fedora kernel: [    0.000000] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-3.3.0-0.rc7.git0.3.fc17.x86_64 root=UUID=074f9308-77d5-43e6-ad94-74ab0b4cb81c ro rd.md=0 rd.lvm=0 rd.dm=0 SYSFONT=latarcyrheb-sun16 rd.luks=0 KEYTABLE=us LANG=uk_UA.UTF-8 systemd.log_level=debug
Mar 17 22:16:35 fedora systemd-logind[432]: New session c1 of user paul.
Mar 17 22:16:35 fedora systemd-logind[432]: Linked /tmp/.X11-unix/X0 to /run/user/paul/X11-display.
Mar 17 22:16:39 fedora dbus-daemon[450]: dbus[450]: [system] Activating via systemd: service name='org.freedesktop.UDisks2' unit='udisks2.service'
Mar 17 22:16:39 fedora dbus[450]: [system] Activating via systemd: service name='org.freedesktop.UDisks2' unit='udisks2.service'
Mar 17 22:16:40 fedora systemd[1]: Cannot add dependency job for unit mdmonitor-takeover.service, ignoring: Unit mdmonitor-takeover.service failed to load: No such file or directory. See system logs and 'systemctl status mdmonitor-takeover.service' for details.
Mar 17 22:17:33 fedora systemd-logind[432]: New session 1 of user paul.

Comment 1 Michal Schmidt 2012-03-19 14:05:30 UTC
/usr/lib/tmpfiles.d/tmp.conf says:
d /tmp 1777 root root 10d

which tells systemd-tmpfiles to delete files older than 10 days.

Since you did not write anything to "Actual results" and "Expected results", I don't know what exactly you are reporting. Are you seeing files older than 10 days preserved in /tmp?

Comment 2 Pavlo Rudyi 2012-03-19 18:24:44 UTC
No, my OS is younger 10 days. And I change 10d to 1d; 0d; 2d - /tmp is not erased.

Comment 3 Michal Schmidt 2012-03-20 10:43:06 UTC
Please provide an example of a file in /tmp that you believe should have been deleted, and what does "stat /tmp/the_file" say about the file.

Comment 4 Pavlo Rudyi 2012-03-20 13:18:18 UTC
LANG=EN stat /tmp/.xsession-errors 
  File: `/tmp/.xsession-errors'
  Size: 748       	Blocks: 8          IO Block: 4096   regular file
Device: 801h/2049d	Inode: 3623        Links: 1
Access: (0600/-rw-------)  Uid: ( 1000/    paul)   Gid: ( 1000/    paul)
Access: 2012-03-20 15:05:45.347314022 +0200
Modify: 2012-03-12 14:43:18.000000000 +0200
Change: 2012-03-19 20:07:00.479356237 +0200


d /tmp 1777 root root 0d

Comment 5 Michal Schmidt 2012-03-20 14:09:40 UTC
(In reply to comment #4)
> d /tmp 1777 root root 0d

Zero Age field actually disables aging entirely.
For experimenting, you may want to try using hours "h" or minutes "m" instead of days "d".

Also note that by default "systemd-tmpfiles --clean" (which processes the aging directives) is run 15 minutes after booting and then once per day.

If you really can't stand files in /tmp surviving a reboot, use a different Type:
D /tmp 1777 root root 10d

See "man tmpfiles.d" for details.

Save your modifications in /etc/tmpfiles.d/, otherwise they'll be overwritten with package updates.

Or you can just list /tmp as a tmpfs in /etc/fstab.

I see no bug here, just a misunderstanding of what default behaviour is expected. Closing.