diff mbox series

[v3,8/8] image.bbclass: enable systemd user services

Message ID 20250120124605.263817-10-arturkow2000@gmail.com
State Accepted, archived
Commit cdc3b3028f6d71788b5fdd99436f69fbf18f613e
Headers show
Series Systemd user presets support | expand

Commit Message

Artur Kowalski Jan. 20, 2025, 12:46 p.m. UTC
Run systemctl preset-all with --global flag so user unit's are enabled
the same way system units are.

Signed-off-by: Artur Kowalski <arturkow2000@gmail.com>
---
 meta/classes-recipe/image.bbclass | 1 +
 1 file changed, 1 insertion(+)

Comments

Markus Volk Jan. 24, 2025, 12:51 p.m. UTC | #1
With this patch applied I see an error in image creation after 
do_rootfs if gnome-shell is installed:

| Error: Systemctl preset_all issue in org.gnome.Shell@wayland.service
| WARNING: 
/home/flk/poky/build/tmp/work/intel_corei7_64-poky-linux/gnome-image/1.0/temp/run.systemd_preset_all.2011511:158 
exit 1 from 'systemctl 
--root="/home/flk/poky/build/tmp/work/intel_corei7_64-poky-linux/gnome-image/1.0/rootfs" 
--global --preset-mode=enable-only preset-all'



On Mon, Jan 20 2025 at 13:46:06 +01:00:00, Artur Kowalski via 
lists.openembedded.org <arturkow2000=gmail.com@lists.openembedded.org> 
wrote:
> Run systemctl preset-all with --global flag so user unit's are enabled
> the same way system units are.
> 
> Signed-off-by: Artur Kowalski <arturkow2000@gmail.com 
> <mailto:arturkow2000@gmail.com>>
> ---
>  meta/classes-recipe/image.bbclass | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/meta/classes-recipe/image.bbclass 
> b/meta/classes-recipe/image.bbclass
> index 84a2017eb5..f08818db03 100644
> --- a/meta/classes-recipe/image.bbclass
> +++ b/meta/classes-recipe/image.bbclass
> @@ -702,6 +702,7 @@ reproducible_final_image_task () {
>  systemd_preset_all () {
>      if [ -e ${IMAGE_ROOTFS}${root_prefix}/lib/systemd/systemd ]; then
>  	systemctl --root="${IMAGE_ROOTFS}" --preset-mode=enable-only 
> preset-all
> +	systemctl --root="${IMAGE_ROOTFS}" --global 
> --preset-mode=enable-only preset-all
>      fi
>  }
> 
> --
> 2.47.1
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#210039): 
> <https://lists.openembedded.org/g/openembedded-core/message/210039>
> Mute This Topic: <https://lists.openembedded.org/mt/110714552/3618223>
> Group Owner: openembedded-core+owner@lists.openembedded.org 
> <mailto:openembedded-core+owner@lists.openembedded.org>
> Unsubscribe: 
> <https://lists.openembedded.org/g/openembedded-core/unsub> 
> [f_l_k@t-online.de <mailto:f_l_k@t-online.de>]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Artur Kowalski Jan. 24, 2025, 6:24 p.m. UTC | #2
Can you provide your `log.do_image` file? I will try to reproduce this 
locally too.


W dniu 24.01.2025 o 13:51, Markus Volk pisze:
> With this patch applied I see an error in image creation after 
> do_rootfs if gnome-shell is installed:
>
> | Error: Systemctl preset_all issue in org.gnome.Shell@wayland.service
> | WARNING: 
> /home/flk/poky/build/tmp/work/intel_corei7_64-poky-linux/gnome-image/1.0/temp/run.systemd_preset_all.2011511:158 
> exit 1 from 'systemctl 
> --root="/home/flk/poky/build/tmp/work/intel_corei7_64-poky-linux/gnome-image/1.0/rootfs" 
> --global --preset-mode=enable-only preset-all'
>
>
>
> On Mon, Jan 20 2025 at 13:46:06 +01:00:00, Artur Kowalski via 
> lists.openembedded.org <arturkow2000=gmail.com@lists.openembedded.org> 
> wrote:
>> Run systemctl preset-all with --global flag so user unit's are 
>> enabled the same way system units are. Signed-off-by: Artur Kowalski 
>> <arturkow2000@gmail.com> --- meta/classes-recipe/image.bbclass | 1 + 
>> 1 file changed, 1 insertion(+) diff --git 
>> a/meta/classes-recipe/image.bbclass 
>> b/meta/classes-recipe/image.bbclass index 84a2017eb5..f08818db03 
>> 100644 --- a/meta/classes-recipe/image.bbclass +++ 
>> b/meta/classes-recipe/image.bbclass @@ -702,6 +702,7 @@ 
>> reproducible_final_image_task () { systemd_preset_all () { if [ -e 
>> ${IMAGE_ROOTFS}${root_prefix}/lib/systemd/systemd ]; then systemctl 
>> --root="${IMAGE_ROOTFS}" --preset-mode=enable-only preset-all + 
>> systemctl --root="${IMAGE_ROOTFS}" --global --preset-mode=enable-only 
>> preset-all fi }
>> -- 
>> 2.47.1
>>
Markus Volk Jan. 24, 2025, 9:24 p.m. UTC | #3
DEBUG: Executing python function do_image
NOTE: Executing systemd_preset_all ...
DEBUG: Executing shell function systemd_preset_all
/home/flk/poky/build/tmp/work/intel_corei7_64-poky-linux/gnome-image/1.0/recipe-sysroot-native/usr/bin/systemctl:222: 
DeprecationWarning: 'count' is passed as positional argument
  unit = re.sub(r"@[^\.]*\.", "@.", self.unit, 1)
ln -s /usr/lib/systemd/system/systemd-boot-update.service 
/home/flk/poky/build/tmp/work/intel_corei7_64-poky-linux/gnome-image/1.0/rootfs/etc/systemd/system/sysinit.target.wants/systemd-boot-update.service
ln -s /usr/lib/systemd/system/remote-cryptsetup.target 
/home/flk/poky/build/tmp/work/intel_corei7_64-poky-linux/gnome-image/1.0/rootfs/etc/systemd/system/multi-user.target.wants/remote-cryptsetup.target
ln -s /usr/lib/systemd/system/systemd-resolved.service 
/home/flk/poky/build/tmp/work/intel_corei7_64-poky-linux/gnome-image/1.0/rootfs/etc/systemd/system/sysinit.target.wants/systemd-resolved.service
ln -s /usr/lib/systemd/system/systemd-resolved.service 
/home/flk/poky/build/tmp/work/intel_corei7_64-poky-linux/gnome-image/1.0/rootfs/etc/systemd/system/dbus-org.freedesktop.resolve1.service
ln -s /usr/lib/systemd/system/remote-fs.target 
/home/flk/poky/build/tmp/work/intel_corei7_64-poky-linux/gnome-image/1.0/rootfs/etc/systemd/system/multi-user.target.wants/remote-fs.target
ln -s /usr/lib/systemd/system/reboot.target 
/home/flk/poky/build/tmp/work/intel_corei7_64-poky-linux/gnome-image/1.0/rootfs/etc/systemd/system/ctrl-alt-del.target
ln -s /usr/lib/systemd/system/getty@.service 
/home/flk/poky/build/tmp/work/intel_corei7_64-poky-linux/gnome-image/1.0/rootfs/etc/systemd/system/getty.target.wants/getty@tty1.service
ln -s /usr/lib/systemd/system/systemd-journald-audit.socket 
/home/flk/poky/build/tmp/work/intel_corei7_64-poky-linux/gnome-image/1.0/rootfs/etc/systemd/system/sockets.target.wants/systemd-journald-audit.socket
ln -s /usr/lib/systemd/system/systemd-journald-audit.socket 
/home/flk/poky/build/tmp/work/intel_corei7_64-poky-linux/gnome-image/1.0/rootfs/etc/systemd/system/systemd-journald.service.wants/systemd-journald-audit.socket
ln -s /usr/lib/systemd/system/systemd-userdbd.socket 
/home/flk/poky/build/tmp/work/intel_corei7_64-poky-linux/gnome-image/1.0/rootfs/etc/systemd/system/sockets.target.wants/systemd-userdbd.socket
/home/flk/poky/build/tmp/work/intel_corei7_64-poky-linux/gnome-image/1.0/recipe-sysroot-native/usr/bin/systemctl:222: 
DeprecationWarning: 'count' is passed as positional argument
  unit = re.sub(r"@[^\.]*\.", "@.", self.unit, 1)
ln -s 
/usr/lib/systemd/user/xdg-desktop-portal-rewrite-launchers.service 
/home/flk/poky/build/tmp/work/intel_corei7_64-poky-linux/gnome-image/1.0/rootfs/etc/systemd/user/graphical-session-pre.target.wants/xdg-desktop-portal-rewrite-launchers.service
ln -s /usr/lib/systemd/user/localsearch-3.service 
/home/flk/poky/build/tmp/work/intel_corei7_64-poky-linux/gnome-image/1.0/rootfs/etc/systemd/user/gnome-session.target.wants/localsearch-3.service
ln -s /usr/lib/systemd/user/gnome-keyring-daemon.service 
/home/flk/poky/build/tmp/work/intel_corei7_64-poky-linux/gnome-image/1.0/rootfs/etc/systemd/user/default.target.wants/gnome-keyring-daemon.service
ln -s /usr/lib/systemd/user/gnome-keyring-daemon.socket 
/home/flk/poky/build/tmp/work/intel_corei7_64-poky-linux/gnome-image/1.0/rootfs/etc/systemd/user/sockets.target.wants/gnome-keyring-daemon.socket
ln -s /usr/lib/systemd/user/pipewire-pulse.service 
/home/flk/poky/build/tmp/work/intel_corei7_64-poky-linux/gnome-image/1.0/rootfs/etc/systemd/user/default.target.wants/pipewire-pulse.service
ln -s /usr/lib/systemd/user/pipewire-pulse.socket 
/home/flk/poky/build/tmp/work/intel_corei7_64-poky-linux/gnome-image/1.0/rootfs/etc/systemd/user/sockets.target.wants/pipewire-pulse.socket
Error: Systemctl preset_all issue in org.gnome.Shell@wayland.service
WARNING: 
/home/flk/poky/build/tmp/work/intel_corei7_64-poky-linux/gnome-image/1.0/temp/run.systemd_preset_all.16269:158 
exit 1 from 'systemctl 
--root="/home/flk/poky/build/tmp/work/intel_corei7_64-poky-linux/gnome-image/1.0/rootfs" 
--global --preset-mode=enable-only preset-all'
WARNING: Backtrace (BB generated script):
	#1: systemd_preset_all, 
/home/flk/poky/build/tmp/work/intel_corei7_64-poky-linux/gnome-image/1.0/temp/run.systemd_preset_all.16269, 
line 158
	#2: main, 
/home/flk/poky/build/tmp/work/intel_corei7_64-poky-linux/gnome-image/1.0/temp/run.systemd_preset_all.16269, 
line 162
DEBUG: Python function do_image finished

This is all there is in log.do_image

On Fri, Jan 24 2025 at 19:24:52 +01:00:00, Artur Kowalski 
<arturkow2000@gmail.com> wrote:
> Can you provide your `log.do_image` file? I will try to reproduce 
> this locally too.
> 
> 
> W dniu 24.01.2025 o 13:51, Markus Volk pisze:
>> With this patch applied I see an error in image creation after 
>> do_rootfs if gnome-shell is installed:
>> 
>> | Error: Systemctl preset_all issue in 
>> org.gnome.Shell@wayland.service 
>> <mailto:org.gnome.Shell@wayland.service>
>> | WARNING: 
>> /home/flk/poky/build/tmp/work/intel_corei7_64-poky-linux/gnome-image/1.0/temp/run.systemd_preset_all.2011511:158 
>> exit 1 from 'systemctl 
>> --root="/home/flk/poky/build/tmp/work/intel_corei7_64-poky-linux/gnome-image/1.0/rootfs" 
>> --global --preset-mode=enable-only preset-all'
>> 
>> 
>> 
>>  On Mon, Jan 20 2025 at 13:46:06 +01:00:00, Artur Kowalski via 
>> lists.openembedded.org 
>> <arturkow2000=gmail.com@lists.openembedded.org> 
>> <mailto:arturkow2000=gmail.com@lists.openembedded.org> wrote:
>>> Run systemctl preset-all with --global flag so user unit's are 
>>> enabled
>>> the same way system units are.
>>> 
>>> Signed-off-by: Artur Kowalski <arturkow2000@gmail.com 
>>> <mailto:arturkow2000@gmail.com>>
>>> ---
>>>  meta/classes-recipe/image.bbclass | 1 +
>>>  1 file changed, 1 insertion(+)
>>> 
>>> diff --git a/meta/classes-recipe/image.bbclass 
>>> b/meta/classes-recipe/image.bbclass
>>> index 84a2017eb5..f08818db03 100644
>>> --- a/meta/classes-recipe/image.bbclass
>>> +++ b/meta/classes-recipe/image.bbclass
>>> @@ -702,6 +702,7 @@ reproducible_final_image_task () {
>>>  systemd_preset_all () {
>>>      if [ -e ${IMAGE_ROOTFS}${root_prefix}/lib/systemd/systemd ]; 
>>> then
>>>  	systemctl --root="${IMAGE_ROOTFS}" --preset-mode=enable-only 
>>> preset-all
>>> +	systemctl --root="${IMAGE_ROOTFS}" --global 
>>> --preset-mode=enable-only preset-all
>>>      fi
>>>  }
>>> 
>>> --
>>> 2.47.1
>>> 
>>> 
>>> -=-=-=-=-=-=-=-=-=-=-=-
>>> Links: You receive all messages sent to this group.
>>> View/Reply Online (#210039): 
>>> <https://lists.openembedded.org/g/openembedded-core/message/210039>
>>> Mute This Topic: 
>>> <https://lists.openembedded.org/mt/110714552/3618223>
>>> Group Owner: openembedded-core+owner@lists.openembedded.org 
>>> <mailto:openembedded-core+owner@lists.openembedded.org>
>>> Unsubscribe: 
>>> <https://lists.openembedded.org/g/openembedded-core/unsub> 
>>> [f_l_k@t-online.de <mailto:f_l_k@t-online.de>]
>>> -=-=-=-=-=-=-=-=-=-=-=-
>>>
diff mbox series

Patch

diff --git a/meta/classes-recipe/image.bbclass b/meta/classes-recipe/image.bbclass
index 84a2017eb5..f08818db03 100644
--- a/meta/classes-recipe/image.bbclass
+++ b/meta/classes-recipe/image.bbclass
@@ -702,6 +702,7 @@  reproducible_final_image_task () {
 systemd_preset_all () {
     if [ -e ${IMAGE_ROOTFS}${root_prefix}/lib/systemd/systemd ]; then
 	systemctl --root="${IMAGE_ROOTFS}" --preset-mode=enable-only preset-all
+	systemctl --root="${IMAGE_ROOTFS}" --global --preset-mode=enable-only preset-all
     fi
 }