All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] cups: set rundir to /run/cups if systemd is used
@ 2021-02-21 20:47 Oleksandr Kravchuk
  2021-02-23 15:53 ` kai
  2021-02-24  7:46 ` kai
  0 siblings, 2 replies; 3+ messages in thread
From: Oleksandr Kravchuk @ 2021-02-21 20:47 UTC (permalink / raw)
  To: openembedded-core; +Cc: kai.kang, 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]

Signed-off-by: Oleksandr Kravchuk <open.source@oleksandr-kravchuk.com>
---
 meta/recipes-extended/cups/cups.inc | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/meta/recipes-extended/cups/cups.inc b/meta/recipes-extended/cups/cups.inc
index e7a704134c..ff1ab70be9 100644
--- a/meta/recipes-extended/cups/cups.inc
+++ b/meta/recipes-extended/cups/cups.inc
@@ -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 () {
@@ -77,6 +80,7 @@ do_install () {
 
 	# Remove /var/run from package as cupsd will populate it on startup
 	rm -fr ${D}/${localstatedir}/run
+	rm -rf ${D}/run
 	rm -fr ${D}/${localstatedir}/log
 	rmdir ${D}/${libexecdir}/${BPN}/driver
 
@@ -97,6 +101,11 @@ do_install () {
 	    install -m 0644 ${WORKDIR}/volatiles.99_cups \
 		    ${D}${sysconfdir}/default/volatiles/99_cups
 	fi
+
+    if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
+        install -d ${D}${sysconfdir}/tmpfiles.d
+        echo "d /run/${BPN}/cert 0755 - - - -" > ${D}${sysconfdir}/tmpfiles.d/cups.conf
+    fi
 }
 
 PACKAGES =+ "${PN}-lib ${PN}-libimage"
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] cups: set rundir to /run/cups if systemd is used
  2021-02-21 20:47 [PATCH v2] cups: set rundir to /run/cups if systemd is used Oleksandr Kravchuk
@ 2021-02-23 15:53 ` kai
  2021-02-24  7:46 ` kai
  1 sibling, 0 replies; 3+ messages in thread
From: kai @ 2021-02-23 15:53 UTC (permalink / raw)
  To: Oleksandr Kravchuk, openembedded-core

On 2/22/21 4:47 AM, Oleksandr Kravchuk wrote:
> 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.

Hi Oleksandr,

Did you test it with qemu image? The app "Manage Printing" of the sato 
image could not be launched. And I update the cupsd.conf with

Listen 0.0.0.0:631

But it can not access from outside. Any suggestion please?

Regards,
Kai

> [YOCTO #14152]
>
> Signed-off-by: Oleksandr Kravchuk <open.source@oleksandr-kravchuk.com>
> ---
>   meta/recipes-extended/cups/cups.inc | 9 +++++++++
>   1 file changed, 9 insertions(+)
>
> diff --git a/meta/recipes-extended/cups/cups.inc b/meta/recipes-extended/cups/cups.inc
> index e7a704134c..ff1ab70be9 100644
> --- a/meta/recipes-extended/cups/cups.inc
> +++ b/meta/recipes-extended/cups/cups.inc
> @@ -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 () {
> @@ -77,6 +80,7 @@ do_install () {
>   
>   	# Remove /var/run from package as cupsd will populate it on startup
>   	rm -fr ${D}/${localstatedir}/run
> +	rm -rf ${D}/run
>   	rm -fr ${D}/${localstatedir}/log
>   	rmdir ${D}/${libexecdir}/${BPN}/driver
>   
> @@ -97,6 +101,11 @@ do_install () {
>   	    install -m 0644 ${WORKDIR}/volatiles.99_cups \
>   		    ${D}${sysconfdir}/default/volatiles/99_cups
>   	fi
> +
> +    if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
> +        install -d ${D}${sysconfdir}/tmpfiles.d
> +        echo "d /run/${BPN}/cert 0755 - - - -" > ${D}${sysconfdir}/tmpfiles.d/cups.conf
> +    fi
>   }
>   
>   PACKAGES =+ "${PN}-lib ${PN}-libimage"


-- 
Kai Kang
Wind River Linux


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] cups: set rundir to /run/cups if systemd is used
  2021-02-21 20:47 [PATCH v2] cups: set rundir to /run/cups if systemd is used Oleksandr Kravchuk
  2021-02-23 15:53 ` kai
@ 2021-02-24  7:46 ` kai
  1 sibling, 0 replies; 3+ messages in thread
From: kai @ 2021-02-24  7:46 UTC (permalink / raw)
  To: Oleksandr Kravchuk, openembedded-core, steve

On 2/22/21 4:47 AM, Oleksandr Kravchuk wrote:
> 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]

Hi Oleksandr,

Thanks for your work. But there is a fix in master alreay:

https://git.openembedded.org/openembedded-core/commit/meta/recipes-extended/cups?id=6c3f56020da7a26c2daea73e39c2f324f1f597db


commit a5b9fa3c450af3beac5f1b68797a1d044091fbbe
Author: Chen Qi <Qi.Chen@windriver.com>
Date:   Fri Oct 16 12:58:56 2020 +0800

     cups: use /run instead /var/run in systemd's unit file

     /var/run has been deprecated by systemd, so use /run instead,
     as suggested by systemd.

     (From OE-Core rev: 6c3f56020da7a26c2daea73e39c2f324f1f597db)

     Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
     Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>


Hi Steve,

Would like to cherry pick that commit for dunfell please? It fixes YOCTO 
#14152.

Thanks.

Kai

>
> Signed-off-by: Oleksandr Kravchuk <open.source@oleksandr-kravchuk.com>
> ---
>   meta/recipes-extended/cups/cups.inc | 9 +++++++++
>   1 file changed, 9 insertions(+)
>
> diff --git a/meta/recipes-extended/cups/cups.inc b/meta/recipes-extended/cups/cups.inc
> index e7a704134c..ff1ab70be9 100644
> --- a/meta/recipes-extended/cups/cups.inc
> +++ b/meta/recipes-extended/cups/cups.inc
> @@ -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 () {
> @@ -77,6 +80,7 @@ do_install () {
>   
>   	# Remove /var/run from package as cupsd will populate it on startup
>   	rm -fr ${D}/${localstatedir}/run
> +	rm -rf ${D}/run
>   	rm -fr ${D}/${localstatedir}/log
>   	rmdir ${D}/${libexecdir}/${BPN}/driver
>   
> @@ -97,6 +101,11 @@ do_install () {
>   	    install -m 0644 ${WORKDIR}/volatiles.99_cups \
>   		    ${D}${sysconfdir}/default/volatiles/99_cups
>   	fi
> +
> +    if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
> +        install -d ${D}${sysconfdir}/tmpfiles.d
> +        echo "d /run/${BPN}/cert 0755 - - - -" > ${D}${sysconfdir}/tmpfiles.d/cups.conf
> +    fi
>   }
>   
>   PACKAGES =+ "${PN}-lib ${PN}-libimage"


-- 
Kai Kang
Wind River Linux


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-24  7:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-21 20:47 [PATCH v2] cups: set rundir to /run/cups if systemd is used Oleksandr Kravchuk
2021-02-23 15:53 ` kai
2021-02-24  7:46 ` kai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.