lrhorer
Posts: 54
Joined: Sun Feb 22, 2015 6:35 pm

Startup quit working with tmpfs /var/log

Sat Apr 27, 2019 5:19 am

Prior to making this change, I had this working:

I placed the line

Code: Select all

@/usr/bin/chromium-browser --kiosk http://localhost/cgi-bin/index.cgi
in both /etc/xdg/lxsession/LXDE/autostart and /etc/xdg/lxsession/LXDE-pi/autostart (I am not certain which one is not required). As expected, the index.cgi script launched shortly after the desktop appeared. I had it working on two different machines.

As the next step toward production of this application, I want to eliminate as much as possible all writes to the SD card. With that in mind, on one of the machines I added the following to /etc/fstab:

Code: Select all

tmpfs           /var/log        tmpfs   size=10M        0       0
and then updated the logrotate configurations in order to limit the size and number of log files. This broke apache, because it won't automatically create the apache2 directory in /var/log. To fix this issue, I created a service named varlog.service:

Code: Select all

[Unit]
Description=Create directories in /var/log
Before=apache2.service

[Service]
Type=oneshot
ExecStart=/usr/local/sbin/varlog

[Install]
RequiredBy=apache2.service
which references the script varlog:

Code: Select all

#! /bin/bash

# Create log file directories
/bin/mkdir -p /var/log/apache2
/bin/mkdir -p /var/log/lightdm
So now at this point, apache is loading properly, but chromium-browser still will not launch automatically at startup. I can bring up an xterm and launch it manually, and it works just fine.

I don't see any errors in the logs, but notably /var/log/apache2/access.log is empty on the newer machine right after boot. The moment I launch the web page manually, either from the xterm or from an external browser, an entry gets entered into access.log. I don't spot anything in /var/log on the machine where the startup is still working that is not on the one where it is not. I'm stumped.


lrhorer
Posts: 54
Joined: Sun Feb 22, 2015 6:35 pm

Re: Startup quit working with tmpfs /var/log

Sat Apr 27, 2019 8:39 am

I don't think that will help. Other than utilizing a RAM disk rather than tmpfs, it isn't much different than what I did. It's true it does keep the contents of /var/log between boots, but I don't see how that will make a difference. I will give it a try, though. I suppose it can't hurt.

lrhorer
Posts: 54
Joined: Sun Feb 22, 2015 6:35 pm

Re: Startup quit working with tmpfs /var/log

Sat Apr 27, 2019 9:53 pm

I got it working by putting the target in /home/pi/.config/lxsession/LXDE-pi/autostart. Why it quit working in the global configuration, I don't know.

Return to “Advanced users”