hi5ato / transientlog

A transient /var/log for raspberry pi or other SD card linux.
5 stars 1 forks source link

Some services will not start correctly with transientlog (bind9, isc-dhcp-server...) #3

Open ymettier opened 7 years ago

ymettier commented 7 years ago

Hello,

Some services start too early (bind9, isc-dhcp-server...) They should wait that transientlog is up and running.

I added some files like this (for bind9 for example) :

$ cat /etc/systemd/system/bind9.service.d/transientlog_dependancy.conf 
[Unit]
Wants=var-log.mount var-permanentlog.mount transientlog.service

(I disabled, reenabled bind9 of course, to reconfigure the service with those new dependencies)

However, my services (bind9, isc-dhcp-server...) are still broken at boot time : they start too early. When they start too early, they use /var/log before it is remounted. When transientlog remounted the directory, my services will not find their files and will hang or fail.

azlux commented 7 years ago

Look at the Before parameter of "log2ram.service" of log2ram. This is the solution to implement it.

ymettier commented 7 years ago

Hello again

1 month ago, I played with this again. And I tries to use the idea of Before that looks good. But...

Here is my /etc/init.d/transientlog beginning :

#!/bin/sh
### BEGIN INIT INFO
# Provides: transientlog
# Required-Start:
# Required-Stop: 
# X-Start-Before:   $syslog bind9 console-setup cron cups dhcpcd exim4 isc-dhcp-server ntp rsyslog
# X-Stop-After:     $syslog
# X-Interactive:    yes
# Default-Start:    2 3 4 5
# Default-Stop:     0 1 6
# Short-Description:    Keeps /var/log in RAM
# Description: Moves the contents of /var/log to RAM during boot
#              and keeps it there until shutdown/reboot, when it
#              copies the contents back to permanent storage.
### END INIT INFO

Notice thte X-Start-Before that is supposed to follow the idea of Before of systemd.

But... It does not work. I still need to restart the services myself after a reboot.

Did I miss something ? Have I done something wrong ?

Would a native systemd script work better than /etc/init.d/transientlog ?

azlux commented 7 years ago

Use log2ram, and test if the issue appear again. I have add a lot of improvement. May be it will be better than programming it again.