Closed 17twenty closed 7 years ago
It looks like /var/log is a symlink to /var/volatile/log. I tried deleting the directory and recreating it manually: $ rm -rf /var/log $ mkdir -p /var/log/journal
The FHS [1] notes that this directory should be cleaned out with a cron job once in a while (I'm guessing this is the reason for the volatile tmpfs mount). [1] http://www.tldp.org/LDP/Linux-Filesystem-Hierarchy/html/var.html
It is a symlink and it's managed by the systemd-tmpfiles service but I'm just wondering if that's a sane default. I wanted to create it to be a symlink to a location on the sdcard so ended up doing the following in my var.conf:
D /var/log 0755 - - - f /var/log/wtmp 0664 root utmp - f /var/log/btmp 0600 root utmp - L+ /var/log/journal 0666 root root - /media/sdcard/log
Hopefully that should help any one else with similar weirdness. It keeps /var/log as a tmp location for scrubbing but ensure the journal is persistent.
On 31 July 2015 at 11:41, Ash Charles notifications@github.com wrote:
It looks like /var/log is a symlink to /var/volatile/log. I tried deleting the directory and recreating it manually: $ rm -rf /var/log $ mkdir -p /var/log/journal
The FHS [1] notes that this directory should be cleaned out with a cron job once in a while (I'm guessing this is the reason for the volatile tmpfs mount). [1] http://www.tldp.org/LDP/Linux-Filesystem-Hierarchy/html/var.html
— Reply to this email directly or view it on GitHub https://github.com/gumstix/yocto-manifest/issues/62#issuecomment-126522273 .
Clever. FWIW, it looks like there has been some discussion [1, 2, 3] about how best to permit either a volatile or persistent log directory that works well with sysvinit and systemd. [1] http://patches.openembedded.org/patch/89883/ [2] http://patchwork.openembedded.org/patch/90151/ [3] http://lists.openembedded.org/pipermail/openembedded-core/2015-April/103369.html
Just trying to get to the bottom of this as I don't get the same issue on a beaglebone system I'm using so it might be a Gumstix specific thing.
I'm trying to create some logging to an external location and after looking at systemd/journald you can create /var/log/journal and sure enough, restarting the systemd-journald service starts logging to that location.
This is what I want but I need it to persist - the first thing I did was to remove /var/log and recreate it as previously it's a link to /var/volatile which is a tmpfs. Fair enough.
The problem is that the /var/log directory seems to get scrubbed every reboot - for example $ touch /var/log/FRED $ reboot .... $ ls /var/log/FRED ls: cannot access /var/log/FRED: No such file or directory
I thought there was something clever happening with /etc/default/volatiles/* but that doesn't seem to be the case so could someone advise me on how to prevent /var/log/* getting scrubbed such that I can create /var/log/journal and not have to recreate it at boot.