<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>15710</bug_id>
          
          <creation_ts>2025-01-08 16:14:13 +0000</creation_ts>
          <short_desc>systemd.bbclass does not handle presets for user services properly</short_desc>
          <delta_ts>2025-01-23 16:32:53 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>configuration</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>5.2 M2</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Artur Kowalski">arturkow2000</reporter>
          <assigned_to name="Artur Kowalski">arturkow2000</assigned_to>
          <cc>pavel</cc>
    
    <cc>randy.macleod</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Don&apos;t know</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>100556</commentid>
    <comment_count>0</comment_count>
    <who name="Artur Kowalski">arturkow2000</who>
    <bug_when>2025-01-08 16:14:13 +0000</bug_when>
    <thetext>systemd.bbclass creates all presets in ${systemd_unitdir}/system-preset where presets for user services should be created in ${systemd_unitdir}/user-preset instead.

An example recipe

SUMMARY = &quot;Bug reproduction&quot;
LICENSE = &quot;MIT&quot;
LIC_FILES_CHKSUM = &quot;file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302&quot;

do_configure[noexec] = &quot;1&quot;
do_compile[noexec] = &quot;1&quot;

inherit allarch systemd

SYSTEMD_PACKAGES = &quot;${PN}&quot;
SYSTEMD_SERVICE:${PN} = &quot;test-service.service&quot;

do_install() {
    install -d ${D}${systemd_user_unitdir}
    cat &lt;&lt;EOF &gt; ${D}${systemd_user_unitdir}/test-service.service
[Unit]
Description=Test
[Service]
ExecStart=${bindir}/true
EOF
}

Results in

./usr
./usr/lib
./usr/lib/systemd
./usr/lib/systemd/user
./usr/lib/systemd/user/test-service.service
./usr/lib/systemd/system-preset
./usr/lib/systemd/system-preset/98-do-something.preset


In effect, this causes image build to fail if broken package is included:

ERROR: core-image-minimal-1.0-r0 do_rootfs: Error: Systemctl main enable issue in test-service.service (test-service.service)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100573</commentid>
    <comment_count>1</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2025-01-09 15:53:00 +0000</bug_when>
    <thetext>Artur, are you willing and able to send a patch?
Even adding a readable error message would help.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100596</commentid>
    <comment_count>2</comment_count>
    <who name="Artur Kowalski">arturkow2000</who>
    <bug_when>2025-01-09 18:57:35 +0000</bug_when>
    <thetext>Fix is underway, I will provide patches in a day or two.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100611</commentid>
    <comment_count>3</comment_count>
    <who name="Artur Kowalski">arturkow2000</who>
    <bug_when>2025-01-12 14:44:35 +0000</bug_when>
    <thetext>Patches sent: https://patchwork.yoctoproject.org/project/oe-core/list/?series=30672</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100730</commentid>
    <comment_count>4</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2025-01-23 16:32:53 +0000</bug_when>
    <thetext>Merged 8 commits, the most recent of which was:

https://git.openembedded.org/openembedded-core/commit/?id=ce62b88d8f71368e356b6409ada46a34a6017ddf

Thanks Artur!</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>