<?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>3181</bug_id>
          
          <creation_ts>2012-09-26 15:15:00 +0000</creation_ts>
          <short_desc>runtime directory /run not properly created</short_desc>
          <delta_ts>2013-03-25 16:43:38 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>11</classification_id>
          <classification>Runtime</classification>
          <product>General Runtime</product>
          <component>General Runtime</component>
          <version>1.4</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>VERIFIED</bug_status>
          <resolution>NOTABUG</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>1.4 M4</target_milestone>
          
          <blocked>3179</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Alexandru Damian">alexandru.damian</reporter>
          <assigned_to name="Chen Qi">Qi.Chen</assigned_to>
          <cc>jessica.zhang</cc>
    
    <cc>liezhi.yang</cc>
    
    <cc>mihai.lindner</cc>
    
    <cc>Qi.Chen</cc>
    
    <cc>richard.purdie</cc>
    
    <cc>ross.burton</cc>
    
    <cc>sgw</cc>
    
    <cc>zhenfeng.zhao</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>---</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>25790</commentid>
    <comment_count>0</comment_count>
    <who name="Alexandru Damian">alexandru.damian</who>
    <bug_when>2012-09-26 15:15:00 +0000</bug_when>
    <thetext>The /run directory is currently created after the first boot as a symlink to /var/volatile/run.

Debian implements /run as a tmpfs, and symlinks /var/run/ and similar runtime directories back to /run. 

Anyway, /run needs to be available in the rootfs at first boot, and not created post-install.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>26870</commentid>
    <comment_count>1</comment_count>
    <who name="Saul Wold">sgw</who>
    <bug_when>2012-10-24 23:11:50 +0000</bug_when>
    <thetext>I would suggest that we correctly create the symlink for /run to /var/run since this is targeted for embedded systems, having multiple tmpfs may not be the best.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>26882</commentid>
    <comment_count>2</comment_count>
    <who name="Chen Qi">Qi.Chen</who>
    <bug_when>2012-10-25 05:53:50 +0000</bug_when>
    <thetext>Here&apos;s an article on this issue. http://article.gmane.org/gmane.linux.redhat.fedora.devel/146976

As this article suggests, I suggest a directory hierarchy like this.

tmpfs on /run
/var/run -&gt; /run
/var/run/lock -&gt; /run/lock
/var/run/log -&gt; /run/log
....

This approach has already adopted by major distribution in their new releases.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>26883</commentid>
    <comment_count>3</comment_count>
    <who name="Chen Qi">Qi.Chen</who>
    <bug_when>2012-10-25 06:12:46 +0000</bug_when>
    <thetext>Also, if we make /run the standard directory for volatile runtime data, /var/volatile would not be necessary any more.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>26944</commentid>
    <comment_count>4</comment_count>
    <who name="Chen Qi">Qi.Chen</who>
    <bug_when>2012-10-26 05:56:04 +0000</bug_when>
    <thetext>%solution%
1) change base-file package, make /run a standard directory
   /run /run/tmp /run/lock ...

2) improve populate-volatile.sh, change the way it deals with links
   In current system, if we change /etc/default/volatile/&lt;config file&gt;,
   and then run command &apos;/etc/init.d/populate_volatile.sh update&apos;, it is
   very likely the result is not what we expect.
   For example, changing &apos;l root root 0755 /var/run /var/volatile/run&apos; to
   &apos;l root root 0755 /var/run /run&apos; in the config file does not have any real effect.
   This is caused by the way populate_volatile.sh deals with &apos;l&apos;-type config items.
   It first examines if the &lt;target&gt; (in this example /var/run) exists, and if so, it does nothing.
   I don&apos;t think this is appropriate. The script should do things as the configuration file tells it.
   So I suggest the following way to deal with links in populate_volatile.sh. (similar to Ubuntu&apos;s way to deal with mounted-var. See attachment for more detail.)
   &lt;type&gt; &lt;user&gt; &lt;group&gt; &lt;mode&gt; &lt;target&gt; &lt;link_source&gt;
   if &lt;target&gt; exists as a dir:
      cp -rf &lt;target&gt; &lt;link_source&gt;; rm -rf &lt;target&gt;; 
   if &lt;target&gt; exists as a link or a file:
      rm -f &lt;target&gt;
   ln -sf &lt;link_source&gt; &lt;target&gt;

3) change /etc/fstab
   make /run a mount point for tmpfs
   /var/volatile is no more a mount point for tmpfs
   
4) change /etc/default/volatiles/&lt;default config&gt;, make the following directory hierarchy
   /var/run -&gt; /run
   /var/cache -&gt; /run/cache
   /var/lock -&gt; /run/lock
   ...
   /var/volatile/run -&gt; /run
   /var/volatile/cache -&gt; /run/cache
   ...

   I still keep /var/volatile in system for backward compatibility reason. Because I&apos;m not sure whether some packages in yocto will need it. But no tmpfs mounted at /var/volatile. 

(Any suggestion would be welcome.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>26976</commentid>
    <comment_count>5</comment_count>
    <who name="Saul Wold">sgw</who>
    <bug_when>2012-10-26 18:30:26 +0000</bug_when>
    <thetext>Please look at the base_files recipe also since it lays down some of the original layout so we do not need to do the cp or rm, also continue to implement a prototype this so we can confirm it&apos;s operation.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>26982</commentid>
    <comment_count>6</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2012-10-26 22:11:55 +0000</bug_when>
    <thetext>We&apos;ve added code which links /run to /var/run in the recent udev upgrade.

Whilst I appreciate the desire to match &quot;standards&quot;, is there a strong reason to change these defaults and break backwards compatibility with existing systems? I have a suspicion this is going to be a very disruptive change for users and I&apos;m not sure we have a good reason for it?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>26996</commentid>
    <comment_count>7</comment_count>
    <who name="Chen Qi">Qi.Chen</who>
    <bug_when>2012-10-29 08:13:23 +0000</bug_when>
    <thetext>Thank you for your advices. Here&apos;s a few thoughts of mine, please feel free to give me your opinions and suggestions.

1) Backward compatibility
Backward compatibility is the first thing that came into my mind when I first looked at this issue. That&apos;s why I still keep /var/volatile directory in my design.
After applying changes as stated above, I built a sato image and tested it on beagleboard. The weekly test cases all passed. 

2) populate_volatile.sh
Three major files (of course there&apos;re others) in yocto that change the directory hierarchy are &apos;fs-perms.txt&apos;, which is used by package.bbclass, &apos;base_files_xxx.bb&apos; and &apos;initscripts&apos; (volatiles and populate_volatile.sh).
Syntax in volatiles:    &lt;type&gt; &lt;user&gt; &lt;group&gt; &lt;mode&gt; &lt;target&gt; &lt;link_source&gt;
In current system, if &lt;target&gt; has been created in fs-perms.txt or base_file_xxx.bb (or other recipes), populate_volatile.sh has no real effect on that &lt;target&gt;. In other words, it has the lowest &apos;priority&apos; (forgive me if I used the wrong word). However, /etc/default/volatiles/&lt;config&gt; and populate_volatile.sh are files that the end user actually see. They don&apos;t see fs-perms.txt or base_files_xxx.bb. If that script doesn&apos;t behave as expected, the user may be confused. So I suggest improve the script. Also, as Saul suggested, implementing a prototype for user confirmation is necessary.

3) problem with linking /run to /var/run
I think linking /run to /var/run in current system is OK. It&apos;s simple and seems to work so far. 
However, there may be two potential problems.
*) what if some application needs /run/lock or /run/cache, as udev needs /run
*) symlink /run to /var/run is specified in /etc/default/volatiles/&lt;config&gt;, if /run or /run/xxx is created by some recipes in yocto, the symlink will not be correctly created by the current populate_volatile.sh script. Actually, we have &apos;meta/recipes-core/initrdscripts/files/init-live.sh:    mkdir -p /run&apos; and &apos;meta/recipes-core/initrdscripts/initramfs-framework/udev:	     mkdir -p /run &apos;. I&apos;m not sure wehther other recipes may use /run.
With these two problems considered, I prefer making /run dir a mount point for tmpfs. We can symlink /var/run to it, and also, symlink /var/volatile/run to /run for backward compatibility.

4) summary
There&apos;re two things we have to decide.
*) whether we should improve the populate_volatile.sh script
*) whether we should make /run dir a mount point for tmpfs or just symlink link it to /var/run</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29900</commentid>
    <comment_count>8</comment_count>
    <who name="Chen Qi">Qi.Chen</who>
    <bug_when>2013-02-18 06:02:08 +0000</bug_when>
    <thetext>For now, everything seems OK to symlink /run to /var/run.

There seems no compelling reason to do this, so I&apos;ll mark this bug as RESOLVED/NOTABUG.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>31136</commentid>
    <comment_count>9</comment_count>
    <who name="Mihai Lindner">mihai.lindner</who>
    <bug_when>2013-03-25 16:43:38 +0000</bug_when>
    <thetext>Setting to VERIFIED.
/run and /var/run/ symlink to /var/volatile/run, which is working fine now.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>