<?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>3404</bug_id>
          
          <creation_ts>2012-11-09 22:36:43 +0000</creation_ts>
          <short_desc>udev mount.sh writes to /tmp before it is symlinked to /var/tmp</short_desc>
          <delta_ts>2013-05-03 03:29:31 +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>1.4</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>Blocked, need some further discussion</status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>1.5 M1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Marc Ferland">marc.ferland</reporter>
          <assigned_to name="Chen Qi">Qi.Chen</assigned_to>
          <cc>jessica.zhang</cc>
    
    <cc>liezhi.yang</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>Qi.Chen</cc>
    
    <cc>sgw</cc>
    
    <cc>yi.zhao</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>27334</commentid>
    <comment_count>0</comment_count>
    <who name="Marc Ferland">marc.ferland</who>
    <bug_when>2012-11-09 22:36:43 +0000</bug_when>
    <thetext>The udev init script is currently run before the bootmisc one. This means that if an &quot;ADD&quot; event for a block device happens _before_ the bootmisc script has terminated the content of /tmp will get deleted (bootmisc removes /tmp completely before creating a symlink to /var/tmp).

This results in the /media/$name directory not being cleaned-up when the device is removed.

To reproduce:
- Start your device with a usb flash drive plugged in (on my system this usually yields to /media/sdb1 being created);
- Once the system has finished booting, unplug the flash drive;
- Look in /media, the sdb1 directory should still be there even if the drive was removed.

What about creating a ram drive very early on boot? Just before udev would be a nice place.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>27337</commentid>
    <comment_count>1</comment_count>
    <who name="Chen Qi">Qi.Chen</who>
    <bug_when>2012-11-10 13:45:05 +0000</bug_when>
    <thetext>Symlink /tmp to /var/tmp should be done in populate_volatiles.sh. So I would suggest delete it from bootmisc.sh, add it to /etc/default/volatiles/&lt;config&gt;. Let populate_volatiles.sh handle the details. 
Something like: 
--- a/meta/recipes-core/initscripts/initscripts-1.0/volatiles
+++ b/meta/recipes-core/initscripts/initscripts-1.0/volatiles
@@ -31,6 +31,7 @@ l root root 1777 /var/lock /var/volatile/lock
 l root root 0755 /var/log /var/volatile/log
 l root root 0755 /var/run /var/volatile/run
 l root root 1777 /var/tmp /var/volatile/tmp
+l root root 1777 /tmp /var/tmp
 d root root 0755 /var/lock/subsys none
 f root root 0664 /var/log/wtmp none
 f root root 0664 /var/run/utmp none

A related bug is Bug#3181.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>27342</commentid>
    <comment_count>2</comment_count>
    <who name="Chen Qi">Qi.Chen</who>
    <bug_when>2012-11-12 02:48:48 +0000</bug_when>
    <thetext>One more problem: udev seems to have a high priority in initscripts that it does no deserve.
The udev script states clearly that it needs &apos;mountvirtfs&apos;.
root@beagleboard:/etc/init.d# head udev 
#!/bin/sh

### BEGIN INIT INFO
# Provides:          udev
# Required-Start:    mountvirtfs
# Required-Stop:     
# Default-Start:     S
# Default-Stop:
# Short-Description: Start udevd, populate /dev and load drivers.
### END INIT INFO

On the other hand, we can see mountall.sh which provides &apos;mountvirtfs&apos; has a lower priority then udev. This should be fixed.
root@beagleboard:/etc/rcS.d# ls -1
S00psplash.sh
S02banner.sh
S02sysfs.sh
S03udev
S04modutils.sh
S06alignment.sh
S07bootlogd
S10checkroot.sh
S35mountall.sh
S37populate-volatile.sh
S38devpts.sh
S39alsa-state
S39hostname.sh
S40networking
S43portmap
S45mountnfs.sh
S55bootmisc.sh

udev should have a lower priority than mountall.sh and populate_volatiles.sh.

Any suggestion would be welcome.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>27343</commentid>
    <comment_count>3</comment_count>
    <who name="Chen Qi">Qi.Chen</who>
    <bug_when>2012-11-12 06:40:18 +0000</bug_when>
    <thetext>(In reply to comment #1)
&gt; Symlink /tmp to /var/tmp should be done in populate_volatiles.sh. So I would
&gt; suggest delete it from bootmisc.sh, add it to
&gt; /etc/default/volatiles/&lt;config&gt;. Let populate_volatiles.sh handle the
&gt; details. 
&gt; Something like: 
&gt; --- a/meta/recipes-core/initscripts/initscripts-1.0/volatiles
&gt; +++ b/meta/recipes-core/initscripts/initscripts-1.0/volatiles
&gt; @@ -31,6 +31,7 @@ l root root 1777 /var/lock /var/volatile/lock
&gt;  l root root 0755 /var/log /var/volatile/log
&gt;  l root root 0755 /var/run /var/volatile/run
&gt;  l root root 1777 /var/tmp /var/volatile/tmp
&gt; +l root root 1777 /tmp /var/tmp
&gt;  d root root 0755 /var/lock/subsys none
&gt;  f root root 0664 /var/log/wtmp none
&gt;  f root root 0664 /var/run/utmp none
&gt; 
&gt; A related bug is Bug#3181.

After a second thought, I realize that updating populate_volatile.sh script described in Bug#3181, together with the changes described above would solve this problem.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>27531</commentid>
    <comment_count>4</comment_count>
    <who name="Chen Qi">Qi.Chen</who>
    <bug_when>2012-11-19 02:13:29 +0000</bug_when>
    <thetext>Blocked due to read-only rootfs support.

(I&apos;m somewhat confused about it, for the previous scripts don&apos;t support RO rootfs as well.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>30554</commentid>
    <comment_count>5</comment_count>
    <who name="Chen Qi">Qi.Chen</who>
    <bug_when>2013-03-08 02:32:00 +0000</bug_when>
    <thetext>merged into poky/master: 297906d39cfcaa56009214e8759b9853f82f02d7

http://git.openembedded.org/?p=openembedded-core.git&amp;a=commit;h=12c4acd7ac5a27cf3676065b60f1c8395c96854c</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32338</commentid>
    <comment_count>6</comment_count>
    <who name="Chen Qi">Qi.Chen</who>
    <bug_when>2013-04-18 08:54:01 +0000</bug_when>
    <thetext>Reopen this bug.
Because if it&apos;s not first boot, /tmp has already been symlinked to /var/volatile/tmp which is not created when udev starts, resulting in touch /tmp/.automount-$name failed.

I&apos;ll send out a patch to fix this problem soon.

Mark the milestone to 1.5 since dylan has been released.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32855</commentid>
    <comment_count>7</comment_count>
    <who name="Chen Qi">Qi.Chen</who>
    <bug_when>2013-05-03 03:29:31 +0000</bug_when>
    <thetext>merged into poky/master: cab467dfd78e667775a3969350961358acf1daaf</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>