Bug 5066

Summary: LSB systemd inconsistency between busybox-syslogd and sysklogd
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Peter A. Bigot <pab>
Component: coreAssignee: Chen Qi <Qi.Chen>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: jessica.zhang, liezhi.yang, meta.mr.watcher, meta.watcher, Qi.Chen, ross.burton, yi.zhao
Version: 1.5   
Target Milestone: 1.5   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know

Description Peter A. Bigot 2013-08-28 20:33:07 UTC
busybox is installed by packagegroup-core-boot and sysklogd by packagegroup-core-basic.  Both end up in core-image-lsb.  Both provide /sbin/syslogd under update-alternatives, with the sysklogd version having higher priority.

systemd starts syslogd using busybox-syslog.service, but that service references /sbin/syslogd regardless of that referring to sysklogd.  The command-line arguments between the two versions are incompatible.

The net result is that, if VIRTUAL-RUNTIME_init_manager = "systemd", core-image-lsb will fail to start syslogd.

root@beagleboard:~# ls -l /sbin/syslogd
lrwxrwxrwx 1 root root 22 Aug 28  2013 /sbin/syslogd -> /sbin/syslogd.sysklogd
root@beagleboard:~# ls -l /lib/systemd/system/*syslog*
-rw-r--r-- 1 root root  270 Aug 28  2013 /lib/systemd/system/busybox-syslog.service
lrwxrwxrwx 1 root root    9 Aug 28  2013 /lib/systemd/system/syslog.service -> /dev/null
-rw-r--r-- 1 root root 1235 Aug 28  2013 /lib/systemd/system/syslog.socket
root@beagleboard:~# systemctl status busybox-syslog.service
busybox-syslog.service - System Logging Service
   Loaded: loaded (/lib/systemd/system/busybox-syslog.service; enabled)
   Active: failed (Result: start-limit) since Sat 2000-01-01 00:04:29 UTC; 51s ago
  Process: 307 ExecStart=/sbin/syslogd -n $OPTIONS (code=exited, status=1/FAILURE)
 Main PID: 307 (code=exited, status=1/FAILURE)
   CGroup: /system.slice/busybox-syslog.service
Jan 01 00:04:29 beagleboard systemd[1]: Starting System Logging Service...
Jan 01 00:04:29 beagleboard systemd[1]: Started System Logging Service.
Jan 01 00:04:29 beagleboard systemd[1]: busybox-syslog.service: main process exited, code=exited, status=1/FAILURE
Jan 01 00:04:29 beagleboard systemd[1]: Unit busybox-syslog.service entered failed state.
Comment 1 Chen Qi 2013-08-29 06:30:58 UTC
As the service is named as 'busybox-sylog.service', I think we should explicitly use busybox in that service file.

So, instead of using
ExecStart=@base_sbindir@/syslogd -n $OPTIONS
maybe we should use
ExecStart=@busybox_exec_syslogd@ -n $OPTIONS

And at do_install, we replace the @busybox_exec_syslogd@ with '/bin/busybox.nosuid syslogd' or '/bin/busybox syslod' according to whether we're splitting the busybox binary.

//Chen Qi
Comment 2 Peter A. Bigot 2013-08-29 11:46:17 UTC
(In reply to comment #1)
> As the service is named as 'busybox-sylog.service', I think we should
> explicitly use busybox in that service file.
> 
> So, instead of using
> ExecStart=@base_sbindir@/syslogd -n $OPTIONS
> maybe we should use
> ExecStart=@busybox_exec_syslogd@ -n $OPTIONS
> 
> And at do_install, we replace the @busybox_exec_syslogd@ with
> '/bin/busybox.nosuid syslogd' or '/bin/busybox syslod' according to whether
> we're splitting the busybox binary.
> 
> //Chen Qi

I agree this would be less confusing and might be worth doing, but it doesn't address the underlying issue: if update-alternatives selects sysklogd as the source for /sbin/syslogd, busybox's syslogd should not be started by systemd.  I think the real fix requires adding syslogd systemd service management to the ua rules for syslogd.  I also think this is going to require pretty advanced recipe-fu and I'm not there yet.
Comment 3 Chen Qi 2013-08-30 01:59:04 UTC
Hi Ross,

Are we going to use different syslog service providers in systemd according to which one provides the /sbin/syslogd, just as Peter suggested? Or we only use busybox's syslogd service?

Best Regards,
Chen Qi
Comment 4 Chen Qi 2013-09-02 11:01:38 UTC
sysklogd package hasn't got systemd support. So I think in case of a systemd based system, we should weigh busybox's syslog and klogd utilities over the sysklogd package. Because by default, busybox has CONFIG_FEATURE_SYSTEMD enabled.

Besides, as busybox has CONFIG_FEATURE_SYSLOGD_CFG enabled, it should have a configuration file '/etc/syslog.conf' in busybox-syslog package.

//Chen Qi