2

This has happened to me multiple times, using either nginx or lighttpd as a webserver. Nginx and lighttpd create certain directories and files for logging errors and visitors. These are located in /var/log/.

When I reboot my Raspberry Pi, for some reason, these directories and files get removed. It looks like files and directories in /etc/ stay untouched.

How can I stop Raspbmc from removing these directories and files? I'm interested in the cause as well.

2
  • As it turns out the log directory is in tmp. So for a quick solution change nginx config to save the log to another place instead. There might also be some help in raspiconfig command – Piotr Kula Jun 4 '13 at 11:08
  • @Sam Nazarko: Thanks a lot, i didn't know about this option, it solves a lot of headaches i had on my Raspbmc! Have a nice day sir ;-) – Biniou180 Jun 9 '13 at 7:57
2

If you add "persistent-logs" to cmdline.txt then the /tmp and /var directories will be persistent

1
  • Sam, thanks for answering my question here. It's pretty awesome to get an answer from the actual developer himself. I saw this in Raspbmc's updates in June: /tmp and /var/log no longer stored in ZRAM tmpfs Does this mean that I can just update to fix my problem? – Exeleration-G Jun 17 '13 at 11:47
3

I have the same problem on my side (I use nginx), and i found a clue to understand the issue: In fact /var/log/ is not a real folder but a symbolic link, as can be seen with ls -all:

pi@raspbmc:~$ ls -all  /var
total 44
drwxr-xr-x 11 root     root     4096 Jun  2 20:12 .
drwxr-xr-x 24 root     root     4096 Jun  2 20:09 ..
[...]
lrwxrwxrwx  1 root     root        4 Jun  2 20:12 log -> /tmp

All the logs are put on the temporary folder, which seems to be purged at every reboot.

...However I tried to remove the symbolic link, then create a real folder /var/log/, and reboot the RPi and it changes nothing. After the reboot, the symbolic link is back again and everything has been cleaned.

A solution would be to recreate nginx/lighttpd folder at boot with a script... but it does not explain the root cause. Another clue; it seems some files are removed because Raspbmc is considered as a "live" system, as mentionned here: http://forum.stmlabs.com/showthread.php?tid=8729&pid=70667 ...however I have not much more information about this.

Has somebody has an idea to prevent the log files to be wiped without doing a dirty script? Thanks a lot!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.