<?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>12644</bug_id>
          
          <creation_ts>2018-04-03 00:13:30 +0000</creation_ts>
          <short_desc>Can&apos;t format block devices related to systemd-udevd.service and udev-extraconf</short_desc>
          <delta_ts>2018-09-26 10:51:37 +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.4</version>
          <rep_platform>x86</rep_platform>
          <op_sys>x86</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>critical</bug_severity>
          <target_milestone>2.6 M4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Hongzhi">hongzhi.song</reporter>
          <assigned_to name="Hongzhi">hongzhi.song</assigned_to>
          <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>ross.burton</cc>
    
    <cc>stephano</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>80071</commentid>
    <comment_count>0</comment_count>
      <attachid>4254</attachid>
    <who name="Hongzhi">hongzhi.song</who>
    <bug_when>2018-04-03 00:13:30 +0000</bug_when>
    <thetext>Created attachment 4254
systemd maintainer&apos;s advice

1)Overview:
    Block device media can&apos;t be format by command:mkfs.ext4, with systemd as init manager and udev-extraconf installed.

2)Bitbake information:
    Build Configuration:
    BB_VERSION           = &quot;1.37.0&quot;
    BUILD_SYS            = &quot;x86_64-linux&quot;
    NATIVELSBSTRING      = &quot;universal-4.8&quot;
    TARGET_SYS           = &quot;i586-poky-linux&quot;
    MACHINE              = &quot;qemux86&quot;
    DISTRO               = &quot;poky&quot;
    DISTRO_VERSION       = &quot;2.4+snapshot-20180403&quot;
    TUNE_FEATURES        = &quot;m32 i586&quot;
    TARGET_FPU           = &quot;&quot;
    meta                 
    meta-poky            
    meta-yocto-bsp       = &quot;master:4574ad343888fd57eabadbcbae5f8123709a6461&quot;

3)Steps to Reproduce:
    1. git clone git://git.yoctoproject.org/poky
    2. branch is master
    3. add follow statements to conf/local.conf
        IMAGE_FSTYPES += &quot;tar.bz2 ext4&quot;
        VIRTUAL-RUNTIME_init_manager = &quot;systemd&quot;
        DISTRO_FEATURES_append = &quot; systemd&quot;
        DISTRO_FEATURES_BACKFILL_CONSIDERED += &quot;sysvinit&quot;
        KERNEL_FEATURES_append = &quot; cfg/systemd.scc&quot;
        IMAGE_INSTALL_append = &quot; e2fsprogs-mke2fs&quot;
        IMAGE_INSTALL_append = &quot; udev-extraconf&quot;
    4. bitbake core-image-minimal 
    5. dd if=/dev/zero of=b.img bs=100m count=1
       mkfs.ext3 b.img
    6. Boot system with qemu
        runqemu qemux86 slirp nographic qemuparams=&quot;-hda b.img&quot;
    7. root@qemux86:~# fdisk /dev/hda -l
       Disk /dev/hda: 100 MB, 104857600 bytes, 204800 sectors
       12 cylinders, 255 heads, 63 sectors/track
       Units: cylinders of 16065 * 512 = 8225280 bytes
    8. root@qemux86:~# mount | grep hda
       root@qemux86:~# umount /dev/hda
       umount: can&apos;t unmount /dev/hda: Invalid argument
    9. root@qemux86:~# cat /etc/udev/mount.blacklist
       /dev/loop
       /dev/ram
       /dev/mtdblock
       /dev/md
       /dev/dm-*
   
    10. format /dev/hda using command:mkfs.ext4
root@qemux86:~# mkfs.ext4 /dev/hda 
mke2fs 1.43.8 (1-Jan-2018)
/dev/hda contains a ext4 file system
	last mounted on Tue Apr  3 06:22:41 2018
Proceed anyway? (y,N) y
/dev/hda is apparently in use by the system; will not make a filesystem here!

4)Actual Results: 
    All block media processed by systemd-udevd.service can&apos;t be formated, if they dosen&apos;t exist in /etc/udev/mount.blacklist.

5) Attachments are my local.conf and email discussion with systemd maintainer.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80116</commentid>
    <comment_count>1</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2018-04-05 07:55:38 +0000</bug_when>
    <thetext>Isn&apos;t this a limitation of qemu perhaps? Can you reproduce the problem on hardware?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80157</commentid>
    <comment_count>2</comment_count>
    <who name="Hongzhi">hongzhi.song</who>
    <bug_when>2018-04-07 18:40:29 +0000</bug_when>
    <thetext>(In reply to comment #1)
&gt; Isn&apos;t this a limitation of qemu perhaps? Can you reproduce the problem on
&gt; hardware?

No, it isn&apos;t limited to qemu. I tried several x86-cpus which can reproduce the problem. In fact, it has nothing to do with hardware but with how systemd-udevd works.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80160</commentid>
    <comment_count>3</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2018-04-08 18:17:39 +0000</bug_when>
    <thetext>I don&apos;t understand why you think this is a problem.

The upstream maintainer has given you a method whereby you *could* have a single partition and yet still format it after boot time. Am I missing something about how many partitions you have since the root partition can&apos;t usually be umounted or formatted when it is in use.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80162</commentid>
    <comment_count>4</comment_count>
    <who name="Hongzhi">hongzhi.song</who>
    <bug_when>2018-04-08 19:08:43 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; I don&apos;t understand why you think this is a problem.
&gt; 
&gt; The upstream maintainer has given you a method whereby you *could* have a
&gt; single partition and yet still format it after boot time. Am I missing
&gt; something about how many partitions you have since the root partition can&apos;t
&gt; usually be umounted or formatted when it is in use.

Sorry, I didn&apos;t accurate enough to describe it. The root of problem comes from systemd-udevd.service and udev-extraconf recipe. Systemd-udevd.service has a variable, MountFlag that is set &apos;slave&apos;, this means udev will mount all block devices within itself namespace and devices can&apos;t be formatted by host space.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80616</commentid>
    <comment_count>5</comment_count>
    <who name="Hongzhi">hongzhi.song</who>
    <bug_when>2018-05-17 18:20:39 +0000</bug_when>
    <thetext>https://patchwork.openembedded.org/patch/150168/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81627</commentid>
    <comment_count>6</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2018-09-26 10:51:37 +0000</bug_when>
    <thetext>Merged in oe-core 4af22800a7af4fcb80cafe08d982a4850d9dd2ad.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>4254</attachid>
            <date>2018-04-03 00:13:30 +0000</date>
            <delta_ts>2018-04-03 00:13:30 +0000</delta_ts>
            <desc>systemd maintainer&apos;s advice</desc>
            <filename>file_12644.txt</filename>
            <type>text/plain</type>
            <size>2610</size>
            <attacher name="Hongzhi">hongzhi.song</attacher>
            
              <data encoding="base64">V2VsbCwgd2UgZ2VuZXJhbGx5IHRyeSB0byBydW4gYWxsIG91ciBzZXJ2aWNlcyB3aXRoIHNhbmRi
b3hlcyB0aGF0IGFyZQ0KYXMgdGlnaHQgYXMgd2UgY2FuIG1ha2UgdGhlbS4gdWRldiBjYW4gcnVu
IGFyYml0cmFyeSBzdHVmZiBmcm9tIGl0cw0KcnVsZXMgaGVuY2UgdGhlIHNhbmRib3ggY2FuJ3Qg
YmUgbWFkZSB0b28gdGlnaHQgdW5mb3J0dW5hdGVseS4NCg0KTW91bnRGbGFncz1zbGF2ZSBpcyBl
c3NlbnRpYWxseSBhIHNhbmRib3hpbmcgc2V0dGluZzogaXQgZGV0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