Replace truncate with tee to avoid overlayfs issues with big files

Bug #1494660 reported by Alkis Georgopoulos
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
LTSP5
Fix Released
Low
Alkis Georgopoulos

Bug Description

The script /usr/share/ltsp/cleanup.d/50-var-log tries to empty the logs using truncate:
find /var/log/ -type f -exec truncate -s 0 {} +

This happens while on an overlayfs filesystem. It's causing two problems:

First, overlayfs copies-up the log files before emptying them, which is very insufficient, e.g. if someone has 10 GB log files, his RAM (tmpfs) won't even suffice for cleanup.d to run, and even if it does, it will take a lot of time to copy-up 10 GB just to delete them afterwards.

Second, currently overlayfs fails while truncating files over 2 GB:
http://permalink.gmane.org/gmane.linux.file-systems.union/408

Both of those problems are solved by replacing the aforementioned line with:
find /var/log/ -type f -exec tee {} + </dev/null

Revision history for this message
Alkis Georgopoulos (alkisg) wrote :

Fix committed in http://bazaar.launchpad.net/~ltsp-upstream/ltsp/ltsp-trunk/revision/2667.

But the "truncate fails on overlayfs with files > 2GB" issue still remains. This may affect other programs, crashing LTSP clients.
For example, if a client joins LDAP, then /var/log/lastlog may become very large, e.g. 3 GB.
It's a sparse file that contains entries for all the users in the LDAP database.

In X01-localapps, we're using useradd. This command tries to truncate lastlog, and fails when it's 3 GB, so the client won't log in.

This particular example won't happen in LTSP currently because we're not supporting LDAP in clients, but other similar issues might still exist until overlayfs is fixed upstream.

Changed in ltsp:
importance: Undecided → Low
status: In Progress → Fix Committed
Revision history for this message
Alkis Georgopoulos (alkisg) wrote :

Fix released in LTSP 5.5.5.

Changed in ltsp:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.