[oe] [PATCH] syslog-ng: fix syslog-ng startup problem with systemd

Changqing Li changqing.li at windriver.com
Tue Jun 19 01:21:19 UTC 2018



On 06/15/2018 06:41 PM, Peter Kjellerstedt wrote:
>> -----Original Message-----
>> From: openembedded-devel-bounces at lists.openembedded.org
>> [mailto:openembedded-devel-bounces at lists.openembedded.org] On Behalf Of
>> Changqing Li
>> Sent: den 15 juni 2018 10:08
>> To: Khem Raj <raj.khem at gmail.com>
>> Cc: openembeded-devel <openembedded-devel at lists.openembedded.org>
>> Subject: Re: [oe] [PATCH] syslog-ng: fix syslog-ng startup problem with
>> systemd
>>
>> On 06/15/2018 02:29 PM, Khem Raj wrote:
>>> On Thu, Jun 14, 2018 at 10:12 PM Changqing Li
>>> <changqing.li at windriver.com> wrote:
>>>> By the way,  I notice that there is no difference between master and
>>>> master-next  for "meta-oe/recipes-support/syslog-ng"
>>>>
>>> pwclient fails to cherry-pick this patch. and me solving conflicts
>>> here can be error prone.
>>>
>>>> Can I know why we need a patch based on master-next? Seems the patch
>>>> will same for master and master-next.
>>>>
>>> since master-next is where the queue for upcoming patches is and
>> sometimes there
>>> are related patches which should be sequenced. Look at my email sent
>>> about master-next
>>        Thanks.  I can see this conflicts commit now.  I use local mirror
>> just now,  so don't see the commit
>>        timely.  Now I got your mean. And I will resend a patch based on
>> master-next later.
>>
>>        //changqing li
>>>> Thanks.
>>>>
>>>> On 06/15/2018 12:48 PM, Khem Raj wrote:
>>>>> Can you rebase and resend it on top of master-next please
>>>>>
>>>>> On Thu, Jun 14, 2018 at 9:23 PM Changqing Li <changqing.li at windriver.com> wrote:
>>>>>> There are one error and one fail when run "systemctl status syslog-ng"
> A general recommendation for Git commits is to keep the line
> lengths within 72 characters. I do not know if OE has some
> actual requirements on this, but I've personally found it to be
> a good recommendation to make Git logs more readable.

Thanks, I will follow this next time.

>
>>>>>> Error opening control socket, bind() failed; socket='/var/run/syslog-ng/syslog-ng.ctl', error='No such file or directory (2)'
>>>>>> Failed to acquire /run/systemd/journal/syslog socket, disabling systemd-syslog source;
>>>>>>
>>>>>> 1. To fix the error info:
>>>>>>       if config with "--with-pidfile-dir=${localstatedir}/run/${BPN}", according to syslog-ng code
>>>>>>       (define PATH_CONTROL_SOCKET    SYSLOG_NG_PATH_PIDFILEDIR "/syslog-ng.ctl"), path of control socket also
>>>>>>       will be /var/run/syslog-ng, but after boot, there is no directory syslog-ng under /var/run,  so this
>>>>>>       will not work for systemd. here change initscript to /var/lib/syslog-ng, and remove --with-pidfile,
>>>>>>       so that sysVinit and systemd all use /var/lib/syslog-ng,  and also remove pid config in the syslog-ng service
>>>>>>       patch to align the pid file path. so both systemd and sysvinit can work.
> I don't think switching to /var/lib is the right thing to do.
> /var/run is tmpfs, but /var/lib may be persistent if the rootfs
> is writable.
>
> The non-existing directory is easily fixed by adding an ExecStartPre
> to the service file. We use this local patch to fix the problem:
>
>  From e4860d18a4e2811a5970a5ff8e66af993882172f Mon Sep 17 00:00:00 2001
> From: Yang Lyu <yangl at axis.com>
> Date: Mon, 15 May 2017 14:36:20 +0200
> Subject: [PATCH] syslog-ng: change path for persist file and pid file
>
> ---
>   contrib/systemd/syslog-ng.service | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/contrib/systemd/syslog-ng.service b/contrib/systemd/syslog-ng.service
> index 3e7a881..ecdca28 100644
> --- a/contrib/systemd/syslog-ng.service
> +++ b/contrib/systemd/syslog-ng.service
> @@ -4,7 +4,8 @@ Documentation=man:syslog-ng(8)
>   
>   [Service]
>   Type=notify
> -ExecStart=@SBINDIR@/syslog-ng -F $SYSLOGNG_OPTS -p @LOCALSTATEDIR@/run/syslogd.pid
> +ExecStartPre=@BASEBINDIR@/mkdir -p @LOCALSTATEDIR@/run/syslog-ng
> +ExecStart=@SBINDIR@/syslog-ng -F $SYSLOGNG_OPTS -p @LOCALSTATEDIR@/run/syslog-ng/syslogd.pid -R @LOCALSTATEDIR@/run/syslog-ng/syslog-ng.persist
>   ExecReload=@BASEBINDIR@/kill -HUP $MAINPID
>   EnvironmentFile=-/etc/default/syslog-ng
>   EnvironmentFile=-/etc/sysconfig/syslog-ng

Thanks. I will change like this if newly upgrade syslog-ng_3.15.1.bb 
still need this.
Also,  for the hard review part, I will make a new patch follow your 
suggestion.

//changqing





-- 
BRs

Sandy(Li Changqing)
+861084778653




More information about the Openembedded-devel mailing list