Skip to contentSkip to conversation

cups: set rundir to /run/cups if systemd is used

PATCH Superseded Oleksandr Kravchuk 3 participants 4 messages Feb 21, 2021 – Feb 22, 2021

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cups: set rundir to /run/cups if systemd is used

When running under systemd, cups needs to be configured with '--with-rundir=/run/cups', as systemd takes an exception to the activation socket being under /var/run and relocates it.

This leads to fd duplication in cupsd and an inadvertent closure of the activation socket when the daemon exits due to inactivity, so that the daemon cannot be activated again.

[YOCTO #14152]

---
 meta/recipes-extended/cups/cups.inc | 5 +++++
 1 file changed, 5 insertions(+)
meta/recipes-extended/cups/cups.inc +5 -0
index e7a704134c..a8e8d115da 100644
@@ -56,8 +56,11 @@ EXTRA_OECONF = " \
                --enable-libusb \
                --with-domainsocket=/run/cups/cups.sock \
                DSOFLAGS='${LDFLAGS}' \
+               ${EXTRA_OECONF_SYSTEMD} \
                "
 
+EXTRA_OECONF_SYSTEMD = "${@bb.utils.contains('DISTRO_FEATURES','systemd','--with-rundir=/run/cups','',d)}"
+
 EXTRA_AUTORECONF += "--exclude=autoheader"
 
 do_compile () {
@@ -105,6 +108,8 @@ RDEPENDS_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'procps',
 FILES_${PN} += "${libexecdir}/cups/ \
 	       "
 
+FILES_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '/run/cups/certs', '', d)}"
+
 FILES_${PN}-lib = "${libdir}/libcups.so.*"
 
 FILES_${PN}-libimage = "${libdir}/libcupsimage.so.*"
Signature · 1 line
2.25.1
#1 lore raw

Kai -

Could you please verify and confirm the fix is correct?

Quoted 40 lines · Oleksandr Kravchuk

When running under systemd, cups needs to be configured with '--with-rundir=/run/cups', as systemd takes an exception to the activation socket being under /var/run and relocates it.

This leads to fd duplication in cupsd and an inadvertent closure of the activation socket when the daemon exits due to inactivity, so that the daemon cannot be activated again.

[YOCTO #14152]

---
  meta/recipes-extended/cups/cups.inc | 5 +++++
  1 file changed, 5 insertions(+)
meta/recipes-extended/cups/cups.inc +5 -0
index e7a704134c..a8e8d115da 100644
@@ -56,8 +56,11 @@ EXTRA_OECONF = " \
                 --enable-libusb \
                 --with-domainsocket=/run/cups/cups.sock \
                 DSOFLAGS='${LDFLAGS}' \
+               ${EXTRA_OECONF_SYSTEMD} \
                 "
 
+EXTRA_OECONF_SYSTEMD = "${@bb.utils.contains('DISTRO_FEATURES','systemd','--with-rundir=/run/cups','',d)}"
+
  EXTRA_AUTORECONF += "--exclude=autoheader"
 
  do_compile () {
@@ -105,6 +108,8 @@ RDEPENDS_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'procps',
  FILES_${PN} += "${libexecdir}/cups/ \
  	       "
 
+FILES_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '/run/cups/certs', '', d)}"
+
  FILES_${PN}-lib = "${libdir}/libcups.so.*"
 
  FILES_${PN}-libimage = "${libdir}/libcupsimage.so.*"
#2 lore raw
Quoted 3 lines · Oleksandr Kravchuk

Kai -

Could you please verify and confirm the fix is correct?

OK. I'll test the v2 patch.

Regards,
Kai

Quoted 39 lines · Oleksandr Kravchuk
Quoted 37 lines

When running under systemd, cups needs to be configured with '--with-rundir=/run/cups', as systemd takes an exception to the activation socket being under /var/run and relocates it.

This leads to fd duplication in cupsd and an inadvertent closure of the activation socket when the daemon exits due to inactivity, so that the daemon cannot be activated again.

[YOCTO #14152]

---
  meta/recipes-extended/cups/cups.inc | 5 +++++

  1 file changed, 5 insertions(+)
meta/recipes-extended/cups/cups.inc +1 -0
index e7a704134c..a8e8d115da 100644
@@ -56,8 +56,11 @@ EXTRA_OECONF = " \
                  --enable-libusb \
                  --with-domainsocket=/run/cups/cups.sock \
                  DSOFLAGS='${LDFLAGS}' \
+               ${EXTRA_OECONF_SYSTEMD} \

                 "
  +EXTRA_OECONF_SYSTEMD = "${@bb.utils.contains('DISTRO_FEATURES','systemd','--with-rundir=/run/cups','',d)}" +
  EXTRA_AUTORECONF += "--exclude=autoheader"
    do_compile () {

meta/recipes-extended/cups/cups.inc +0 -0
@@ -105,6 +108,8 @@ RDEPENDS_${PN} += 
 "${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'procps',
   FILES_${PN} += "${libexecdir}/cups/ \

             "
  +FILES_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '/run/cups/certs', '', d)}" +
  FILES_${PN}-lib = "${libdir}/libcups.so.*"
    FILES_${PN}-libimage = "${libdir}/libcupsimage.so.*"

Signature · 2 lines
Kai Kang
Wind River Linux
#3 lore raw
In reply to Oleksandr Kravchuk
Quoted 33 lines · Oleksandr Kravchuk

When running under systemd, cups needs to be configured with '--with-rundir=/run/cups', as systemd takes an exception to the activation socket being under /var/run and relocates it.

This leads to fd duplication in cupsd and an inadvertent closure of the activation socket when the daemon exits due to inactivity, so that the daemon cannot be activated again.

[YOCTO #14152]

---
 meta/recipes-extended/cups/cups.inc | 5 +++++
 1 file changed, 5 insertions(+)
meta/recipes-extended/cups/cups.inc +3 -0
index e7a704134c..a8e8d115da 100644
@@ -56,8 +56,11 @@ EXTRA_OECONF = " \
                --enable-libusb \
                --with-domainsocket=/run/cups/cups.sock \
                DSOFLAGS='${LDFLAGS}' \
+               ${EXTRA_OECONF_SYSTEMD} \
                "
 
+EXTRA_OECONF_SYSTEMD = "${@bb.utils.contains('DISTRO_FEATURES','systemd','--with-rundir=/run/cups','',d)}"
+
 EXTRA_AUTORECONF += "--exclude=autoheader"
 
 do_compile () {

meta/recipes-extended/cups/cups.inc RDEPENDS_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'procps', · line 112

Quoted 5 lines
meta/recipes-extended/cups/cups.inc +2 -0
@@ -105,6 +108,8 @@ RDEPENDS_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'procps',
 FILES_${PN} += "${libexecdir}/cups/ \
               "
 
+FILES_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '/run/cups/certs', '', d)}"
+

/run dir is created/populated during runtime. you can use tmpfile fragment in do_install something like

        if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true',
'false', d)}; then
               install -d ${D}${sysconfdir}/tmpfiles.d
               echo "d /run/cups/cert 0755 - - - -" >

${D}${sysconfdir}/tmpfiles.d/cups.conf
fi

Quoted 9 lines
meta/recipes-extended/cups/cups.inc +0 -1
 FILES_${PN}-lib = "${libdir}/libcups.so.*"
 
 FILES_${PN}-libimage = "${libdir}/libcupsimage.so.*"
--

2.25.1