Replace truncate with tee to avoid overlayfs issues with big files
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
LTSP5 |
Fix Released
|
Low
|
Alkis Georgopoulos |
Bug Description
The script /usr/share/
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://
Both of those problems are solved by replacing the aforementioned line with:
find /var/log/ -type f -exec tee {} + </dev/null
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.