<div dir="ltr">Hi, <div><br>I&#39;m not sure what is your use case, but you can check usbmount[1][2] or automount-usb[3] for example on how to use udev with systemd:</div><div><br>Regards,<br>Vincent<br><br>[1]<a href="https://github.com/rbrito/usbmount">https://github.com/rbrito/usbmount</a><br>

<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">[2]<a href="https://github.com/nefethael/meta-random/blob/master/recipes-support/usbmount/usbmount_git.bb">https://github.com/nefethael/meta-random/blob/master/recipes-support/usbmount/usbmount_git.bb</a></span>

<br>[3]<a href="https://github.com/six-k/">https://github.com/six-k/</a><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">automount-usb</span>

<br><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2018-03-02 6:44 GMT+01:00 Hongzhi, Song <span dir="ltr">&lt;<a href="mailto:hongzhi.song@windriver.com" target="_blank">hongzhi.song@windriver.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <p>Hi all,</p>
    <p>Does anyone have suggestion for me?</p>
    <p>Thanks.</p><span class="HOEnZb"><font color="#888888">
    <p>Hongzhi.Song<br>
    </p></font></span><div><div class="h5">
    <br>
    <div class="m_3529184748491425439moz-cite-prefix">On 2018年03月01日 18:35, Hongzhi, Song
      wrote:<br>
    </div>
    <blockquote type="cite">
      
      <p>Defect:</p>
      <p>    The exiting method of automount of udev in <font face="Times New Roman, Times, serif"><i>oe-core/meta/ </i></font>is
        using <br>
      </p>
      <p><font face="Times New Roman, Times, serif"><i>automount.rules</i></font>
        which call <font face="Times New Roman, Times, serif"><i>mount.sh</i></font>
        that using <i><font face="Times New Roman, Times, serif">/bin/mount</font></i>
        to mount device. <br>
      </p>
      <p>But systemd-udevd detaches <font face="Times New Roman, Times,
          serif"><i>mount()</i></font> operations done within the
        service <br>
      </p>
      <p>from the rest of the system with MountFlag=slave, this means
        host can <br>
      </p>
      <p>not access device. (e.g. Executing <font face="Times New
          Roman, Times, serif"><i>mkfs.ext4 /dev/sda1/</i></font>
        prompts <br>
      </p>
      <p><i><font face="Times New Roman, Times, serif">/dev/sda1 is
            apparently in use by the system; will not make a filesystem
            here!</font></i>)<br>
      </p>
      <p><br>
      </p>
      <p>Solution:</p>
      <p>    Systemd upstream suggest that the best way is to use
        &quot;systemd-mount&quot; <br>
      </p>
      <p>in udev rules, which will request the mount operation to be
        executed by PID 1.<br>
      </p>
      <p>And I have tested it was effective.</p>
      <p><br>
      </p>
      <p>Uncertain:</p>
      <p>    The exiting method is designed for <font face="Times New
          Roman, Times, serif"><i>SysV-init </i></font>which is not
        compatible to <br>
      </p>
      <p>systemd-udev, at least that&#39;s what I think. So I think that we
        should design</p>
      <p>a new rule or organizational structure to be suitable for
        systemd-udev and <br>
      </p>
      <p>to mount deferent device. Dose anyone help do this? Or I can
        make some <br>
      </p>
      <p>improvements on the basis of the existing with &quot;systemd-mount&quot;.<br>
      </p>
      <br>
      <fieldset class="m_3529184748491425439mimeAttachmentHeader"></fieldset>
      <br>
    </blockquote>
    <br>
  </div></div></div>

<br>--<br>
______________________________<wbr>_________________<br>
Openembedded-core mailing list<br>
<a href="mailto:Openembedded-core@lists.openembedded.org">Openembedded-core@lists.<wbr>openembedded.org</a><br>
<a href="http://lists.openembedded.org/mailman/listinfo/openembedded-core" rel="noreferrer" target="_blank">http://lists.openembedded.org/<wbr>mailman/listinfo/openembedded-<wbr>core</a><br>
<br></blockquote></div><br></div>