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.

Exeleration-G
  • 303
  • 1
  • 3
  • 10

2 Answers2

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!

Biniou180
  • 31
  • 3
2

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

Chetan Bhargava
  • 1,252
  • 3
  • 15
  • 29