<?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>13784</bug_id>
          
          <creation_ts>2020-02-06 17:38:25 +0000</creation_ts>
          <short_desc>Sysvinit log file creation in /var/log sometimes fails at first boot</short_desc>
          <delta_ts>2021-12-23 15:07:00 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>11</classification_id>
          <classification>Runtime</classification>
          <product>Installation</product>
          <component>Installation</component>
          <version>3.1</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</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>normal</bug_severity>
          <target_milestone>4.0 M2</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Trevor Gamblin">tvgamblin</reporter>
          <assigned_to name="Trevor Gamblin">tvgamblin</assigned_to>
          <cc>kevin.tian</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>tvgamblin</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>86351</commentid>
    <comment_count>0</comment_count>
    <who name="Trevor Gamblin">tvgamblin</who>
    <bug_when>2020-02-06 17:38:25 +0000</bug_when>
    <thetext>First seen when working on bug #13632, building core-image-full-cmdline and core-image-sato-sdk.

On systems with sysvinit there may be a race condition with volatiles creation leading to messages such as the following in /var/log/boot:

Fri Jan 31 15:50:35 2020: touch: cannot touch &apos;/var/log/wtmp&apos;: No such file or directory
Fri Jan 31 15:50:35 2020: chown: cannot access &apos;/var/log/wtmp&apos;: No such file or directory
Fri Jan 31 15:50:35 2020: Failed to set owner -root- for -/var/log/wtmp-.
Fri Jan 31 15:50:35 2020: chmod: cannot access &apos;/var/log/wtmp&apos;: No such file or directory
Fri Jan 31 15:50:35 2020: Failed to set mode -0664- for -/var/log/wtmp-.

/etc/volatile.cache contains something like the following after boot:

touch &quot;/var/log/wtmp&quot;;
                                         
chown root:root /var/log/wtmp || echo &quot;Failed to set owner -root- for -/var/log/wtmp-.&quot; &gt;/dev/tty0 2&gt;&amp;1;       
chmod 0664 /var/log/wtmp || echo &quot;Failed to set mode -0664- for -/var/log/wtmp-.&quot; &gt;/dev/tty0 2&gt;&amp;1

It appears that this in turn comes from meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh. meta/recipes-core/initscripts/initscripts-1.0/volatiles contains a list of files that populate-volatile.sh should create:

26 d root root 1777 /run/lock none
27 d root root 0755 /var/volatile/log none
28 d root root 1777 /var/volatile/tmp none
29 l root root 1777 /var/lock /run/lock
30 l root root 0755 /var/run /run
31 l root root 1777 /var/tmp /var/volatile/tmp
32 l root root 1777 /tmp /var/tmp
33 d root root 0755 /var/lock/subsys none
34 f root root 0664 /var/log/wtmp none
35 f root root 0664 /var/run/utmp none
36 l root root 0644 /etc/resolv.conf /var/run/resolv.conf
37 f root root 0644 /var/run/resolv.conf none

I haven&apos;t seen this with systemd, but it&apos;s possible that something similar could be happening on builds with it installed, depending on the root cause.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>86352</commentid>
    <comment_count>1</comment_count>
    <who name="Trevor Gamblin">tvgamblin</who>
    <bug_when>2020-02-06 18:15:22 +0000</bug_when>
    <thetext>Note that I can&apos;t consistently recreate this issue - for some builds I&apos;ve never seen it, while on others I see some variation of the offending boot messages about 50% of the time after e.g. bitbake -c cleanall core-image-sato-sdk &amp;&amp; bitbake core-image-sato-sdk.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>87158</commentid>
    <comment_count>2</comment_count>
    <who name="Trevor Gamblin">tvgamblin</who>
    <bug_when>2020-05-06 12:16:59 +0000</bug_when>
    <thetext>Seems pretty consistent now, although I&apos;ve only tested this in two environments.

Looking at a fix in meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh. The simplest solution would be to use the until keyword to run touch/chown/chmod until they work, but that may be lead to confusion about expected behavior...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>87159</commentid>
    <comment_count>3</comment_count>
    <who name="Trevor Gamblin">tvgamblin</who>
    <bug_when>2020-05-06 16:40:34 +0000</bug_when>
    <thetext>Been attempting to put &quot;wait&quot; loops of the following form in before any of the key steps run in create_file() and mk_dir() in populate_volatiles.sh:

while [ ! -w \&quot;$1\&quot; ]; do sleep 1; done;

But I haven&apos;t yet added anything that consistently covers both the &quot;touch&quot; and the &quot;chown&quot; calls that show up. I am seeing at least one of the two happen during each boot.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>90041</commentid>
    <comment_count>4</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2021-04-21 19:45:51 +0000</bug_when>
    <thetext>Have you seen/reproduced this bug recently Trevor?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>90042</commentid>
    <comment_count>5</comment_count>
    <who name="Trevor Gamblin">tvgamblin</who>
    <bug_when>2021-04-21 19:55:42 +0000</bug_when>
    <thetext>I am actually still seeing it sometimes, but it is not consistent. Will take another look.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92205</commentid>
    <comment_count>6</comment_count>
    <who name="Trevor Gamblin">tvgamblin</who>
    <bug_when>2021-12-23 15:07:00 +0000</bug_when>
    <thetext>Haven&apos;t seen this in a while now. I suspect that this patch may have fixed it:

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

Marking as WORKSFORME.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>