Skip to main content
Topic: Couple of service fixes (Read 736 times) previous topic - next topic
0 Members and 3 Guests are viewing this topic.

Couple of service fixes

mount-tmpfs
Adding an entry for /tmp to fstab results in it being over-mounted because mount-tmpfs unconditionally sets up a tmpfs on it before mount-filesystems is run.
Code: [Select]
$ findmnt /tmp
TARGET SOURCE                  FSTYPE OPTIONS
/tmp   tmpfs                   tmpfs  rw,relatime,inode64
/tmp   /dev/mapper/vg0-tmp     ext4   rw,relatime

Fix is to patch mount-tmpfs/up to first check if an entry for /tmp exists in /etc/fstab. There's no nice way to silence findmnt so some redirfd ugliness is employed here:
Code: [Select]
#!/bin/execlineb -P
foreground {
    if -n { redirfd -w 1 /dev/null redirfd -w 2 /dev/null findmnt --fstab --mountpoint /tmp }
    mount -t tmpfs tmpfs /tmp
}

On a related note, there's presently nothing that seems to clear /tmp during boot unlike when using OpenRC. One simple solution (if desired) could be to add the --clean flag to tmpfiles-setup which would cause anything older than 10 days under /tmp to be removed by default, but additionally also from /var/tmp and /var/cache/man, which might be less wanted.

gpm
The gpm service is started with the -D flag to produce logs to stdin rather than to syslog. This has the unfortunate side effect of also enabling debug messages which come at such a rate the log file gets filled to multiple megabytes very quickly, causing log rotates to take place unnecessarily often and making the logs themselves rather unreadable. This can be remedied by adding a directive to filter them out in /etc/s6/config/gpm.conf so it's brought in line with its normal syslog output:
Code: [Select]
DIRECTIVES="n3 s2000000 T -^\\*{3}\\sdebug"

dmesg-log
dmesg-log/run contains a line to test if /var/log/dmesg is a file rather than a directory and tries to remove it if so. It's placed before the test block for a writable /var/log so it's bound to fail during boot if it isn't. I don't know why exactly that piece of code exists or when it's meant to run, but I assume it can come into play when e.g. having switched inits, so how necessary it is to change depends on how crucial its existence is in the first place or if it could simply be removed altogether. In any case, moving the piece of code from line 2 to inside the ifelse block takes care of it. Additionally, it's required to add remount-root or another later service to its dependencies, as otherwise the log-service-reload.sh script would still cause issues.

Re: Couple of service fixes

Reply #1
Just in order here:

If you aren't satisfied with the default mount-tmpfs, you can easily just add a one shot to unmount it before mount-filesystems is run (that's why it comes first). Just make the new oneshot have a dependency on mount-tmpfs, and then also add the oneshot as a dependency of mount-filesystems. Oh and as for clearing /tmp during boot, that's covered by using a tmpfs in the first place (which is why it's the default). If you don't want to mount a tmpfs on /tmp, then you'll have to write some script to clean it yourself.

I guess I'll have to look into gpm. I could just change the default directives argument to allow for bigger files. udevd is like this.

For dmesg-log, there are some things out there that create a /var/log/dmesg file which will always conflict with that service which is why that line is there. You're right that it should be within the block that test if /var/log is writeable otherwise it could fail and exit 1. Alternatively using rm -f would also work. Nothing depends on dmesg though so no need to worry about that.

Re: Couple of service fixes

Reply #2
On second thought, I can just make the mount-tmpfs optional. I.e. add a mount-tmpfs.conf where you can turn off mounting it if you want. In general you usually want a tmpfs on /tmp, but there's no harm in making this part configurable.

Re: Couple of service fixes

Reply #3
I'm curious, why the preference for a configuration option over an automated test?

Quote
I guess I'll have to look into gpm. I could just change the default directives argument to allow for bigger files. udevd is like this.

Increasing the log size doesn't really improve legibility here. The debug output includes every single mouse position and action when normally you would just want to check if any errors or warnings were spat out, and not what anybody used to its syslog-based logs would expect to see.


Re: Couple of service fixes

Reply #5
I'm curious, why the preference for a configuration option over an automated test?

It's easier and gives more control to users.

Quote
Increasing the log size doesn't really improve legibility here. The debug output includes every single mouse position and action when normally you would just want to check if any errors or warnings were spat out, and not what anybody used to its syslog-based logs would expect to see.

This sounds like I should just make it log to syslog if it's that bad (again, I haven't looked at this part yet).

P.S. s6-scripts updated so the everything should be good now except the gpm thing.