<?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>13188</bug_id>
          
          <creation_ts>2019-02-20 01:45:30 +0000</creation_ts>
          <short_desc>systemd 239  bash file test bug</short_desc>
          <delta_ts>2019-08-29 14:47:01 +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>core</component>
          <version>2.6.1</version>
          <rep_platform>All</rep_platform>
          <op_sys>arm</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>critical</bug_severity>
          <target_milestone>2.8 M4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>wei.qingjun</reporter>
          <assigned_to>wei.qingjun</assigned_to>
          <cc>jku</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>randy.macleod</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>83044</commentid>
    <comment_count>0</comment_count>
    <who name="">wei.qingjun</who>
    <bug_when>2019-02-20 01:45:30 +0000</bug_when>
    <thetext>line 231:
[ ! -e ${D}/init ] &amp;&amp; ln -s ${rootlibexecdir}/systemd/systemd ${D}/init
Will trigger symbolic link already exists error. On Ubuntu 18.04 bash.

Should it be
[ ! -L ${D}/init ] &amp;&amp; ln -s ${rootlibexecdir}/systemd/systemd ${D}/init</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83048</commentid>
    <comment_count>1</comment_count>
    <who name="">wei.qingjun</who>
    <bug_when>2019-02-20 03:01:07 +0000</bug_when>
    <thetext>I tried to modify the code but I still get error:

Log below:

| Running custom install script &apos;XXXXXXXXXXX/tmp/hosttools/sh -c touch $DESTDIR/usr&apos;
| ln: failed to create symbolic link &apos;XXXXXXXXXX/tmp/work/cortexa17hf-neon-vfpv4-rk-linux-gnueabi/systemd/1_239-r0/image/sbin/init&apos;: File exists

No idea why the init file exists.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83049</commentid>
    <comment_count>2</comment_count>
    <who name="">wei.qingjun</who>
    <bug_when>2019-02-20 03:33:28 +0000</bug_when>
    <thetext>I can confirm it is a bug.
Althought I have not traced to the cause.
I had to add a line to remove the sbin/init file.

mv ${D}/${base_sbindir}/init

Then I had to mount the ext4 rootfs and manully create the link.
The current symbolic link is linked to a wrong location.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83065</commentid>
    <comment_count>3</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2019-02-21 15:47:30 +0000</bug_when>
    <thetext>Can you explain in detail how to reproduce the error?
Lots of people are building systemd but perhaps this is a silent failure that we&apos;ve been ignoring or it could be that you have a custom install script and have made an error. We need more info to proceed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83071</commentid>
    <comment_count>4</comment_count>
    <who name="">wei.qingjun</who>
    <bug_when>2019-02-21 16:12:10 +0000</bug_when>
    <thetext>I have a local recipe that installs a systemd service to start my system at startup.
The bb file is something like below.
Hope it helps.

Thanks
Qingjun

SUMMARY = &quot;XXX&quot;
LICENSE = &quot;CLOSED&quot;
PV = &quot;1.0&quot;

SRC_URI = &quot;... \
&quot;

S = &quot;${WORKDIR}&quot;

inherit systemd
inherit bin_package
INSANE_SKIP_${PN} = &quot;ldflags&quot;
INHIBIT_PACKAGE_STRIP = &quot;1&quot;
INHIBIT_SYSROOT_STRIP = &quot;1&quot;
INHIBIT_PACKAGE_DEBUG_SPLIT = &quot;1&quot;

do_compile() {
}

do_install () {
	install -Dm 0644 ${S}/XXX.service ${D}/${systemd_unitdir}/system/XXX.service
}


SYSTEMD_SERVICE_${PN} = &quot;XXX.service&quot;
INSANE_SKIP_${PN} += &quot;installed-vs-shipped&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83097</commentid>
    <comment_count>5</comment_count>
    <who name="Stephen K Jolley">sjolley.yp.pm</who>
    <bug_when>2019-02-23 00:05:43 +0000</bug_when>
    <thetext>Chen,

It appears an answer to the question has been given.  I have cleared NEEDINFO.  

Thanks,

Stephen</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83419</commentid>
    <comment_count>6</comment_count>
    <who name="Jussi Kukkonen">jku</who>
    <bug_when>2019-04-03 08:32:26 +0000</bug_when>
    <thetext>(In reply to comment #0)
&gt; line 231:
&gt; [ ! -e ${D}/init ] &amp;&amp; ln -s ${rootlibexecdir}/systemd/systemd ${D}/init

This is not line 231 in yocto 2.6.1 systemd_239.bb.

Do you have local modifications or are you actually running some other yocto version?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83420</commentid>
    <comment_count>7</comment_count>
    <who name="Chen Qi">Qi.Chen</who>
    <bug_when>2019-04-03 09:04:20 +0000</bug_when>
    <thetext>wei,

Sorry for late reply. I guess the cause is that your ubuntu18.04 does not have /lib/systemd/systemd, causing ${D}/init being a dead link.
I think you are right, using &apos;-L&apos; could solve this problem. As an alternative, you can use &apos;ln -sf&apos; instead &apos;ln -s&apos;.
You can send out patch if you like, as you have already found the solution.
You can send patch to openembedded-core@lists.openembedded.org, for both thud and master branches.
If not convenient, I&apos;ll do it for you.

Best Regards,
Chen Qi</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83958</commentid>
    <comment_count>8</comment_count>
    <who name="Chen Qi">Qi.Chen</who>
    <bug_when>2019-05-28 01:09:21 +0000</bug_when>
    <thetext>wei,

Do you still have this bug reproduced on your host?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84469</commentid>
    <comment_count>9</comment_count>
    <who name="Chen Qi">Qi.Chen</who>
    <bug_when>2019-07-22 02:13:45 +0000</bug_when>
    <thetext>I cannot reproduce this problem, nor can I find out the host environment of the reporter.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84470</commentid>
    <comment_count>10</comment_count>
    <who name="">wei.qingjun</who>
    <bug_when>2019-07-22 02:42:29 +0000</bug_when>
    <thetext>Qingjun(In reply to comment #9)
&gt; I cannot reproduce this problem, nor can I find out the host environment of
&gt; the reporter.

Sorry didn&apos;t have a chance to try new release of Yocto.
Will try to test against latest release in this week.

Regards</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84474</commentid>
    <comment_count>11</comment_count>
    <who name="">wei.qingjun</who>
    <bug_when>2019-07-22 18:15:04 +0000</bug_when>
    <thetext>(In reply to comment #9)
&gt; I cannot reproduce this problem, nor can I find out the host environment of
&gt; the reporter.

Hello Chen,
I just tried systemd 2.41 on latest warrior-next branch.
The problem still exists

Below is the log. BTW I am running on a Ubuntu 18.04 X64.

ln: failed to create symbolic link &apos;/home/weiqj/rk-yocto-bsp/libre-hub/tmp/work/cortexa17hf-neon-vfpv4-rk-linux-gnueabi/systemd/1_241+AUTOINC+c1f8ff8d0d-r0/image/sbin/init&apos;: $
WARNING: exit code 1 from a shell command.
ERROR: Function failed: do_install (log file is located at /home/weiqj/rk-yocto-bsp/libre-hub/tmp/work/cortexa17hf-neon-vfpv4-rk-linux-gnueabi/systemd/1_241+AUTOINC+c1f8ff8d0$

Still, I had to manually modify the script to make it work.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84475</commentid>
    <comment_count>12</comment_count>
    <who name="Chen Qi">Qi.Chen</who>
    <bug_when>2019-07-23 01:16:50 +0000</bug_when>
    <thetext>Hi Wei,

I&apos;m wondering why other people don&apos;t have such problem. I also use ubuntu hosts.
Do you have some additional layer which might have systemd bbappend files?

What does your run.do_install file under ${WORKDIR}/temp look like?
What creates the ${D}/init link before this line? [ ! -e ${D}/init ] &amp;&amp; xxx

Could you please show your run.do_install file?

Also, you mentioned ${D}/init, but your error log is about ${D}/sbin/init.

Anyway, I think showing your run.do_install will help.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84731</commentid>
    <comment_count>13</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2019-08-22 15:01:22 +0000</bug_when>
    <thetext>Wei?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84764</commentid>
    <comment_count>14</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2019-08-29 14:47:01 +0000</bug_when>
    <thetext>No reponse so I&apos;m closing the defect. We&apos;d be happy to have the defect re-opened if the needed info is provided.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>