[3/7] sysklogd: Use update-alternatives

Message ID fae07991f994982404930e78c225db460bd14ae6.1535601148.git.raj.khem@gmail.com
State New
Headers show
Series
  • postinst and clang fixes
Related show

Commit Message

Khem Raj Aug. 30, 2018, 3:55 a.m.
busybox also provides klogd and syslogd, this change makes it coexist
peacefully. Currently rootfs fails in situations where both of them are
providing these binaries and busybox postinsts fail

update-alternatives: Error: not linking
/mnt/a/oe/build/tmp/work/qemuriscv64-bec-linux/core-image-full-cmdline/1.0-r0/rootfs/sbin/klogd
to /bin/busybox.nosuid since
/mnt/a/oe/build/tmp/work/qemuriscv64-bec-linux/core-image-full-cmdline/1.0-r0/rootfs/sbin/klogd
exists and is not a link

Signed-off-by: Khem Raj <raj.khem@gmail.com>

---
 meta/recipes-extended/sysklogd/sysklogd.inc | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

-- 
2.18.0

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Comments

Peter Kjellerstedt Aug. 30, 2018, 7:44 a.m. | #1
> -----Original Message-----

> From: openembedded-core-bounces@lists.openembedded.org <openembedded-

> core-bounces@lists.openembedded.org> On Behalf Of Khem Raj

> Sent: den 30 augusti 2018 05:56

> To: openembedded-core@lists.openembedded.org

> Subject: [OE-core] [PATCH 3/7] sysklogd: Use update-alternatives

> 

> busybox also provides klogd and syslogd, this change makes it coexist

> peacefully. Currently rootfs fails in situations where both of them are

> providing these binaries and busybox postinsts fail

> 

> update-alternatives: Error: not linking

> /mnt/a/oe/build/tmp/work/qemuriscv64-bec-linux/core-image-full-

> cmdline/1.0-r0/rootfs/sbin/klogd

> to /bin/busybox.nosuid since

> /mnt/a/oe/build/tmp/work/qemuriscv64-bec-linux/core-image-full-

> cmdline/1.0-r0/rootfs/sbin/klogd

> exists and is not a link

> 

> Signed-off-by: Khem Raj <raj.khem@gmail.com>

> ---

>  meta/recipes-extended/sysklogd/sysklogd.inc | 8 +++++++-

>  1 file changed, 7 insertions(+), 1 deletion(-)

> 

> diff --git a/meta/recipes-extended/sysklogd/sysklogd.inc

> b/meta/recipes-extended/sysklogd/sysklogd.inc

> index fc4e67c18e..2a8bed00f3 100644

> --- a/meta/recipes-extended/sysklogd/sysklogd.inc

> +++ b/meta/recipes-extended/sysklogd/sysklogd.inc

> @@ -11,7 +11,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=8ca43cbc842c2336e835926c2166c28b \

>                      file://klogd.c;beginline=2;endline=19;md5=7e87ed0ae6142de079bce738c10c899d \

>                     "

> 

> -inherit update-rc.d systemd

> +inherit update-rc.d systemd update-alternatives

> 

>  SRC_URI = "http://www.infodrom.org/projects/sysklogd/download/sysklogd-${PV}.tar.gz \

>             file://no-strip-install.patch \

> @@ -70,3 +70,9 @@ python () {

>      if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):

>          d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")

>  }

> +

> +ALTERNATIVE_PRIORITY = "100"

> +ALTERNATIVE_${PN} = "klogd syslogd"

> +ALTERNATIVE_LINK_NAME[klogd] = "${base_sbindir}/klogd"

> +ALTERNATIVE_LINK_NAME[syslogd] = "${base_sbindir}/syslogd"

> +

> --

> 2.18.0


This is a (partial) revert of commit 988aad01b2 (sysklogd: don't use 
update-alternatives). Can you come to an agreement regarding which is 
the correct solution?

//Peter

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
ChenQi Aug. 30, 2018, 9:45 a.m. | #2
On 08/30/2018 03:44 PM, Peter Kjellerstedt wrote:
>> -----Original Message-----

>> From: openembedded-core-bounces@lists.openembedded.org <openembedded-

>> core-bounces@lists.openembedded.org> On Behalf Of Khem Raj

>> Sent: den 30 augusti 2018 05:56

>> To: openembedded-core@lists.openembedded.org

>> Subject: [OE-core] [PATCH 3/7] sysklogd: Use update-alternatives

>>

>> busybox also provides klogd and syslogd, this change makes it coexist

>> peacefully. Currently rootfs fails in situations where both of them are

>> providing these binaries and busybox postinsts fail

>>

>> update-alternatives: Error: not linking

>> /mnt/a/oe/build/tmp/work/qemuriscv64-bec-linux/core-image-full-

>> cmdline/1.0-r0/rootfs/sbin/klogd

>> to /bin/busybox.nosuid since

>> /mnt/a/oe/build/tmp/work/qemuriscv64-bec-linux/core-image-full-

>> cmdline/1.0-r0/rootfs/sbin/klogd

>> exists and is not a link

>>

>> Signed-off-by: Khem Raj <raj.khem@gmail.com>

>> ---

>>   meta/recipes-extended/sysklogd/sysklogd.inc | 8 +++++++-

>>   1 file changed, 7 insertions(+), 1 deletion(-)

>>

>> diff --git a/meta/recipes-extended/sysklogd/sysklogd.inc

>> b/meta/recipes-extended/sysklogd/sysklogd.inc

>> index fc4e67c18e..2a8bed00f3 100644

>> --- a/meta/recipes-extended/sysklogd/sysklogd.inc

>> +++ b/meta/recipes-extended/sysklogd/sysklogd.inc

>> @@ -11,7 +11,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=8ca43cbc842c2336e835926c2166c28b \

>>                       file://klogd.c;beginline=2;endline=19;md5=7e87ed0ae6142de079bce738c10c899d \

>>                      "

>>

>> -inherit update-rc.d systemd

>> +inherit update-rc.d systemd update-alternatives

>>

>>   SRC_URI = "http://www.infodrom.org/projects/sysklogd/download/sysklogd-${PV}.tar.gz \

>>              file://no-strip-install.patch \

>> @@ -70,3 +70,9 @@ python () {

>>       if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):

>>           d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")

>>   }

>> +

>> +ALTERNATIVE_PRIORITY = "100"

>> +ALTERNATIVE_${PN} = "klogd syslogd"

>> +ALTERNATIVE_LINK_NAME[klogd] = "${base_sbindir}/klogd"

>> +ALTERNATIVE_LINK_NAME[syslogd] = "${base_sbindir}/syslogd"

>> +

>> --

>> 2.18.0

> This is a (partial) revert of commit 988aad01b2 (sysklogd: don't use

> update-alternatives). Can you come to an agreement regarding which is

> the correct solution?

>

> //Peter

>



I think the previous commit (syslogd: don't use update-alternatives) is 
made because syslog daemon conflict with each other. I guess the author 
assumed that the 'syslogd' and 'klogd' alternatives entries are handled 
by busybox-syslog package.

On the other hand, I think the patch is trying to solve the problem of 
busybox being installed after sysklogd.
We are currently not seeing errors because busybox is likely to be 
installed before sysklogd. Even in this situation, the result is not all 
correct, because the links busybox's postinstall creates are covered by 
the real binaries from sysklogd.

I think the problem is about busybox's handling of alternatives.

Khem, I've sent out a patch to fix busybox's alternatives logic. Could 
you please help review it?

Best Regards,
Chen Qi
-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Markus Lehtonen Sept. 3, 2018, 6:49 a.m. | #3
Hi,

IIRC, the problem was that all the syslog packages were providing ${sysconfdir}/init.d/syslog which caused problems. And I don't think that has changed.

Why would you want to install two syslog daemons on the system? You should be able to install busybox after syslog as busybox-syslog is packaged in separate binary rpm.

Cheers,
  Markus

On 30/08/2018, 12.41, "ChenQi" <Qi.Chen@windriver.com> wrote:

    On 08/30/2018 03:44 PM, Peter Kjellerstedt wrote:
    >> -----Original Message-----
    >> From: openembedded-core-bounces@lists.openembedded.org <openembedded-
    >> core-bounces@lists.openembedded.org> On Behalf Of Khem Raj
    >> Sent: den 30 augusti 2018 05:56
    >> To: openembedded-core@lists.openembedded.org
    >> Subject: [OE-core] [PATCH 3/7] sysklogd: Use update-alternatives
    >>
    >> busybox also provides klogd and syslogd, this change makes it coexist
    >> peacefully. Currently rootfs fails in situations where both of them are
    >> providing these binaries and busybox postinsts fail
    >>
    >> update-alternatives: Error: not linking
    >> /mnt/a/oe/build/tmp/work/qemuriscv64-bec-linux/core-image-full-
    >> cmdline/1.0-r0/rootfs/sbin/klogd
    >> to /bin/busybox.nosuid since
    >> /mnt/a/oe/build/tmp/work/qemuriscv64-bec-linux/core-image-full-
    >> cmdline/1.0-r0/rootfs/sbin/klogd
    >> exists and is not a link
    >>
    >> Signed-off-by: Khem Raj <raj.khem@gmail.com>
    >> ---
    >>   meta/recipes-extended/sysklogd/sysklogd.inc | 8 +++++++-
    >>   1 file changed, 7 insertions(+), 1 deletion(-)
    >>
    >> diff --git a/meta/recipes-extended/sysklogd/sysklogd.inc
    >> b/meta/recipes-extended/sysklogd/sysklogd.inc
    >> index fc4e67c18e..2a8bed00f3 100644
    >> --- a/meta/recipes-extended/sysklogd/sysklogd.inc
    >> +++ b/meta/recipes-extended/sysklogd/sysklogd.inc
    >> @@ -11,7 +11,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=8ca43cbc842c2336e835926c2166c28b \
    >>                       file://klogd.c;beginline=2;endline=19;md5=7e87ed0ae6142de079bce738c10c899d \
    >>                      "
    >>
    >> -inherit update-rc.d systemd
    >> +inherit update-rc.d systemd update-alternatives
    >>
    >>   SRC_URI = "http://www.infodrom.org/projects/sysklogd/download/sysklogd-${PV}.tar.gz \
    >>              file://no-strip-install.patch \
    >> @@ -70,3 +70,9 @@ python () {
    >>       if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
    >>           d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
    >>   }
    >> +
    >> +ALTERNATIVE_PRIORITY = "100"
    >> +ALTERNATIVE_${PN} = "klogd syslogd"
    >> +ALTERNATIVE_LINK_NAME[klogd] = "${base_sbindir}/klogd"
    >> +ALTERNATIVE_LINK_NAME[syslogd] = "${base_sbindir}/syslogd"
    >> +
    >> --
    >> 2.18.0
    > This is a (partial) revert of commit 988aad01b2 (sysklogd: don't use
    > update-alternatives). Can you come to an agreement regarding which is
    > the correct solution?
    >
    > //Peter
    >
    
    
    I think the previous commit (syslogd: don't use update-alternatives) is 
    made because syslog daemon conflict with each other. I guess the author 
    assumed that the 'syslogd' and 'klogd' alternatives entries are handled 
    by busybox-syslog package.
    
    On the other hand, I think the patch is trying to solve the problem of 
    busybox being installed after sysklogd.
    We are currently not seeing errors because busybox is likely to be 
    installed before sysklogd. Even in this situation, the result is not all 
    correct, because the links busybox's postinstall creates are covered by 
    the real binaries from sysklogd.
    
    I think the problem is about busybox's handling of alternatives.
    
    Khem, I've sent out a patch to fix busybox's alternatives logic. Could 
    you please help review it?
    
    Best Regards,
    Chen Qi
Khem Raj Sept. 3, 2018, 4:33 p.m. | #4
On Sun, Sep 2, 2018 at 11:49 PM Markus Lehtonen
<markus.lehtonen@linux.intel.com> wrote:
>
> Hi,
>
> IIRC, the problem was that all the syslog packages were providing ${sysconfdir}/init.d/syslog which caused problems. And I don't think that has changed.
>
> Why would you want to install two syslog daemons on the system? You should be able to install busybox after syslog as busybox-syslog is packaged in separate binary rpm.
>

thats fine, we need to have a RCONFLICTS statement to catch these
issues explicitly during packaging.

> Cheers,
>   Markus
>
> On 30/08/2018, 12.41, "ChenQi" <Qi.Chen@windriver.com> wrote:
>
>     On 08/30/2018 03:44 PM, Peter Kjellerstedt wrote:
>     >> -----Original Message-----
>     >> From: openembedded-core-bounces@lists.openembedded.org <openembedded-
>     >> core-bounces@lists.openembedded.org> On Behalf Of Khem Raj
>     >> Sent: den 30 augusti 2018 05:56
>     >> To: openembedded-core@lists.openembedded.org
>     >> Subject: [OE-core] [PATCH 3/7] sysklogd: Use update-alternatives
>     >>
>     >> busybox also provides klogd and syslogd, this change makes it coexist
>     >> peacefully. Currently rootfs fails in situations where both of them are
>     >> providing these binaries and busybox postinsts fail
>     >>
>     >> update-alternatives: Error: not linking
>     >> /mnt/a/oe/build/tmp/work/qemuriscv64-bec-linux/core-image-full-
>     >> cmdline/1.0-r0/rootfs/sbin/klogd
>     >> to /bin/busybox.nosuid since
>     >> /mnt/a/oe/build/tmp/work/qemuriscv64-bec-linux/core-image-full-
>     >> cmdline/1.0-r0/rootfs/sbin/klogd
>     >> exists and is not a link
>     >>
>     >> Signed-off-by: Khem Raj <raj.khem@gmail.com>
>     >> ---
>     >>   meta/recipes-extended/sysklogd/sysklogd.inc | 8 +++++++-
>     >>   1 file changed, 7 insertions(+), 1 deletion(-)
>     >>
>     >> diff --git a/meta/recipes-extended/sysklogd/sysklogd.inc
>     >> b/meta/recipes-extended/sysklogd/sysklogd.inc
>     >> index fc4e67c18e..2a8bed00f3 100644
>     >> --- a/meta/recipes-extended/sysklogd/sysklogd.inc
>     >> +++ b/meta/recipes-extended/sysklogd/sysklogd.inc
>     >> @@ -11,7 +11,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=8ca43cbc842c2336e835926c2166c28b \
>     >>                       file://klogd.c;beginline=2;endline=19;md5=7e87ed0ae6142de079bce738c10c899d \
>     >>                      "
>     >>
>     >> -inherit update-rc.d systemd
>     >> +inherit update-rc.d systemd update-alternatives
>     >>
>     >>   SRC_URI = "http://www.infodrom.org/projects/sysklogd/download/sysklogd-${PV}.tar.gz \
>     >>              file://no-strip-install.patch \
>     >> @@ -70,3 +70,9 @@ python () {
>     >>       if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
>     >>           d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
>     >>   }
>     >> +
>     >> +ALTERNATIVE_PRIORITY = "100"
>     >> +ALTERNATIVE_${PN} = "klogd syslogd"
>     >> +ALTERNATIVE_LINK_NAME[klogd] = "${base_sbindir}/klogd"
>     >> +ALTERNATIVE_LINK_NAME[syslogd] = "${base_sbindir}/syslogd"
>     >> +
>     >> --
>     >> 2.18.0
>     > This is a (partial) revert of commit 988aad01b2 (sysklogd: don't use
>     > update-alternatives). Can you come to an agreement regarding which is
>     > the correct solution?
>     >
>     > //Peter
>     >
>
>
>     I think the previous commit (syslogd: don't use update-alternatives) is
>     made because syslog daemon conflict with each other. I guess the author
>     assumed that the 'syslogd' and 'klogd' alternatives entries are handled
>     by busybox-syslog package.
>
>     On the other hand, I think the patch is trying to solve the problem of
>     busybox being installed after sysklogd.
>     We are currently not seeing errors because busybox is likely to be
>     installed before sysklogd. Even in this situation, the result is not all
>     correct, because the links busybox's postinstall creates are covered by
>     the real binaries from sysklogd.
>
>     I think the problem is about busybox's handling of alternatives.
>
>     Khem, I've sent out a patch to fix busybox's alternatives logic. Could
>     you please help review it?
>
>     Best Regards,
>     Chen Qi
>
>
>
Markus Lehtonen Sept. 4, 2018, 6:15 a.m. | #5
Hmm,

There should be rconflicts in place, in both way – i.e. busybox-syslog rconflicts with sysklogd and the other way around. Isn't there(?)
  - Markus

On 03/09/2018, 19.34, "Khem Raj" <raj.khem@gmail.com> wrote:

    On Sun, Sep 2, 2018 at 11:49 PM Markus Lehtonen
    <markus.lehtonen@linux.intel.com> wrote:
    >
    > Hi,
    >
    > IIRC, the problem was that all the syslog packages were providing ${sysconfdir}/init.d/syslog which caused problems. And I don't think that has changed.
    >
    > Why would you want to install two syslog daemons on the system? You should be able to install busybox after syslog as busybox-syslog is packaged in separate binary rpm.
    >
    
    thats fine, we need to have a RCONFLICTS statement to catch these
    issues explicitly during packaging.
    
    > Cheers,
    >   Markus
    >
    > On 30/08/2018, 12.41, "ChenQi" <Qi.Chen@windriver.com> wrote:
    >
    >     On 08/30/2018 03:44 PM, Peter Kjellerstedt wrote:
    >     >> -----Original Message-----
    >     >> From: openembedded-core-bounces@lists.openembedded.org <openembedded-
    >     >> core-bounces@lists.openembedded.org> On Behalf Of Khem Raj
    >     >> Sent: den 30 augusti 2018 05:56
    >     >> To: openembedded-core@lists.openembedded.org
    >     >> Subject: [OE-core] [PATCH 3/7] sysklogd: Use update-alternatives
    >     >>
    >     >> busybox also provides klogd and syslogd, this change makes it coexist
    >     >> peacefully. Currently rootfs fails in situations where both of them are
    >     >> providing these binaries and busybox postinsts fail
    >     >>
    >     >> update-alternatives: Error: not linking
    >     >> /mnt/a/oe/build/tmp/work/qemuriscv64-bec-linux/core-image-full-
    >     >> cmdline/1.0-r0/rootfs/sbin/klogd
    >     >> to /bin/busybox.nosuid since
    >     >> /mnt/a/oe/build/tmp/work/qemuriscv64-bec-linux/core-image-full-
    >     >> cmdline/1.0-r0/rootfs/sbin/klogd
    >     >> exists and is not a link
    >     >>
    >     >> Signed-off-by: Khem Raj <raj.khem@gmail.com>
    >     >> ---
    >     >>   meta/recipes-extended/sysklogd/sysklogd.inc | 8 +++++++-
    >     >>   1 file changed, 7 insertions(+), 1 deletion(-)
    >     >>
    >     >> diff --git a/meta/recipes-extended/sysklogd/sysklogd.inc
    >     >> b/meta/recipes-extended/sysklogd/sysklogd.inc
    >     >> index fc4e67c18e..2a8bed00f3 100644
    >     >> --- a/meta/recipes-extended/sysklogd/sysklogd.inc
    >     >> +++ b/meta/recipes-extended/sysklogd/sysklogd.inc
    >     >> @@ -11,7 +11,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=8ca43cbc842c2336e835926c2166c28b \
    >     >>                       file://klogd.c;beginline=2;endline=19;md5=7e87ed0ae6142de079bce738c10c899d \
    >     >>                      "
    >     >>
    >     >> -inherit update-rc.d systemd
    >     >> +inherit update-rc.d systemd update-alternatives
    >     >>
    >     >>   SRC_URI = "http://www.infodrom.org/projects/sysklogd/download/sysklogd-${PV}.tar.gz \
    >     >>              file://no-strip-install.patch \
    >     >> @@ -70,3 +70,9 @@ python () {
    >     >>       if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
    >     >>           d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
    >     >>   }
    >     >> +
    >     >> +ALTERNATIVE_PRIORITY = "100"
    >     >> +ALTERNATIVE_${PN} = "klogd syslogd"
    >     >> +ALTERNATIVE_LINK_NAME[klogd] = "${base_sbindir}/klogd"
    >     >> +ALTERNATIVE_LINK_NAME[syslogd] = "${base_sbindir}/syslogd"
    >     >> +
    >     >> --
    >     >> 2.18.0
    >     > This is a (partial) revert of commit 988aad01b2 (sysklogd: don't use
    >     > update-alternatives). Can you come to an agreement regarding which is
    >     > the correct solution?
    >     >
    >     > //Peter
    >     >
    >
    >
    >     I think the previous commit (syslogd: don't use update-alternatives) is
    >     made because syslog daemon conflict with each other. I guess the author
    >     assumed that the 'syslogd' and 'klogd' alternatives entries are handled
    >     by busybox-syslog package.
    >
    >     On the other hand, I think the patch is trying to solve the problem of
    >     busybox being installed after sysklogd.
    >     We are currently not seeing errors because busybox is likely to be
    >     installed before sysklogd. Even in this situation, the result is not all
    >     correct, because the links busybox's postinstall creates are covered by
    >     the real binaries from sysklogd.
    >
    >     I think the problem is about busybox's handling of alternatives.
    >
    >     Khem, I've sent out a patch to fix busybox's alternatives logic. Could
    >     you please help review it?
    >
    >     Best Regards,
    >     Chen Qi
    >
    >
    >

Patch

diff --git a/meta/recipes-extended/sysklogd/sysklogd.inc b/meta/recipes-extended/sysklogd/sysklogd.inc
index fc4e67c18e..2a8bed00f3 100644
--- a/meta/recipes-extended/sysklogd/sysklogd.inc
+++ b/meta/recipes-extended/sysklogd/sysklogd.inc
@@ -11,7 +11,7 @@  LIC_FILES_CHKSUM = "file://COPYING;md5=8ca43cbc842c2336e835926c2166c28b \
                     file://klogd.c;beginline=2;endline=19;md5=7e87ed0ae6142de079bce738c10c899d \
                    "
 
-inherit update-rc.d systemd
+inherit update-rc.d systemd update-alternatives
 
 SRC_URI = "http://www.infodrom.org/projects/sysklogd/download/sysklogd-${PV}.tar.gz \
            file://no-strip-install.patch \
@@ -70,3 +70,9 @@  python () {
     if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
         d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
 }
+
+ALTERNATIVE_PRIORITY = "100"
+ALTERNATIVE_${PN} = "klogd syslogd"
+ALTERNATIVE_LINK_NAME[klogd] = "${base_sbindir}/klogd"
+ALTERNATIVE_LINK_NAME[syslogd] = "${base_sbindir}/syslogd"
+