All of lore.kernel.org
 help / color / mirror / Atom feed
* USBmount and systemd-udev namespace conflict
@ 2014-12-15 19:34 Francois P. Gallichand
  2014-12-16  1:22 ` Li, Xin
  0 siblings, 1 reply; 3+ messages in thread
From: Francois P. Gallichand @ 2014-12-15 19:34 UTC (permalink / raw)
  To: yocto


[-- Attachment #1.1: Type: text/plain, Size: 626 bytes --]

Hello,

I need to automount a usb drive when it is plugged in. I found that the necessary udev rules are in the udev-extraconf package so I added that to my build. I tried it but it does not really work since when I insert the key, it is in fact mounted by udev but since the mount namespace of udev is private and not the same one as the shell I want to check if the key is mounted, I don't see it. Is there a way to tell udev to mount using a global namespace so it can be seen be everybody?

Thanks.

François Gallichand
Engineer - Software Group
ABB Group
Analytical Business
(418)877-2944 x268

[ABB logo]


[-- Attachment #1.2: Type: text/html, Size: 3178 bytes --]

[-- Attachment #2: image001.png --]
[-- Type: image/png, Size: 3279 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: USBmount and systemd-udev namespace conflict
  2014-12-15 19:34 USBmount and systemd-udev namespace conflict Francois P. Gallichand
@ 2014-12-16  1:22 ` Li, Xin
  2014-12-18 13:06   ` Francois P. Gallichand
  0 siblings, 1 reply; 3+ messages in thread
From: Li, Xin @ 2014-12-16  1:22 UTC (permalink / raw)
  To: Francois P. Gallichand, yocto


[-- Attachment #1.1: Type: text/plain, Size: 1574 bytes --]

Hi,

This is my way to use udev to automount a usb driver, perhaps it can help you.


1.       Add udev rules.

root # cat /etc/udev/rules.d/10-udevtest.rules

KERNEL=="sda",ACTION=="add",OWNER:="udev",GROUP:="udevs"

2.       Add user and group.

root # useradd udev

root # groupadd udevs

3.       start the udev  service

 root # systemctl start systemd-udevd.service

root # ps aux | grep udev

root     21927  0.3  0.0  26140  1388 ?        Ss   22:51   0:00 /lib/systemd/systemd-udevd

4.       insert usb driver

5.       check

root # ls /dev/sda -al

brw-rw---- 1 udev udevs 8, 0 Sep 15 03:13 /dev/sda
-----------------------------
Best regards,
Li

From: yocto-bounces@yoctoproject.org [mailto:yocto-bounces@yoctoproject.org] On Behalf Of Francois P. Gallichand
Sent: Tuesday, December 16, 2014 3:34 AM
To: yocto@yoctoproject.org
Subject: [yocto] USBmount and systemd-udev namespace conflict

Hello,

I need to automount a usb drive when it is plugged in. I found that the necessary udev rules are in the udev-extraconf package so I added that to my build. I tried it but it does not really work since when I insert the key, it is in fact mounted by udev but since the mount namespace of udev is private and not the same one as the shell I want to check if the key is mounted, I don’t see it. Is there a way to tell udev to mount using a global namespace so it can be seen be everybody?

Thanks.

François Gallichand
Engineer - Software Group
ABB Group
Analytical Business
(418)877-2944 x268

[ABB logo]


[-- Attachment #1.2: Type: text/html, Size: 16585 bytes --]

[-- Attachment #2: image001.png --]
[-- Type: image/png, Size: 3279 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: USBmount and systemd-udev namespace conflict
  2014-12-16  1:22 ` Li, Xin
@ 2014-12-18 13:06   ` Francois P. Gallichand
  0 siblings, 0 replies; 3+ messages in thread
From: Francois P. Gallichand @ 2014-12-18 13:06 UTC (permalink / raw)
  To: Li, Xin, yocto


[-- Attachment #1.1: Type: text/plain, Size: 2346 bytes --]

Hello,

I finally found a solution to my problem. In fact, the mounts made by udevd not being accessible to other processes comes from the way the system-udevd service is started. In the /lib/systemdsystem/system-udevd.service, I just remove the MountFlags=slave line and by doing that, all the mounts are shared (the default) and accessible by all the processes.

Regards,

François Gallichand
Engineer - Software Group
ABB Group
Analytical Business
(418)877-2944 x268

[ABB logo]

From: Li, Xin [mailto:lixin.fnst@cn.fujitsu.com]
Sent: Monday, December 15, 2014 8:23 PM
To: Francois P. Gallichand; yocto@yoctoproject.org
Subject: RE: USBmount and systemd-udev namespace conflict

Hi,

This is my way to use udev to automount a usb driver, perhaps it can help you.


1.       Add udev rules.

root # cat /etc/udev/rules.d/10-udevtest.rules

KERNEL=="sda",ACTION=="add",OWNER:="udev",GROUP:="udevs"

2.       Add user and group.

root # useradd udev

root # groupadd udevs

3.       start the udev  service

 root # systemctl start systemd-udevd.service

root # ps aux | grep udev

root     21927  0.3  0.0  26140  1388 ?        Ss   22:51   0:00 /lib/systemd/systemd-udevd

4.       insert usb driver

5.       check

root # ls /dev/sda -al

brw-rw---- 1 udev udevs 8, 0 Sep 15 03:13 /dev/sda
-----------------------------
Best regards,
Li

From: yocto-bounces@yoctoproject.org<mailto:yocto-bounces@yoctoproject.org> [mailto:yocto-bounces@yoctoproject.org] On Behalf Of Francois P. Gallichand
Sent: Tuesday, December 16, 2014 3:34 AM
To: yocto@yoctoproject.org<mailto:yocto@yoctoproject.org>
Subject: [yocto] USBmount and systemd-udev namespace conflict

Hello,

I need to automount a usb drive when it is plugged in. I found that the necessary udev rules are in the udev-extraconf package so I added that to my build. I tried it but it does not really work since when I insert the key, it is in fact mounted by udev but since the mount namespace of udev is private and not the same one as the shell I want to check if the key is mounted, I don’t see it. Is there a way to tell udev to mount using a global namespace so it can be seen be everybody?

Thanks.

François Gallichand
Engineer - Software Group
ABB Group
Analytical Business
(418)877-2944 x268

[ABB logo]


[-- Attachment #1.2: Type: text/html, Size: 15959 bytes --]

[-- Attachment #2: image001.png --]
[-- Type: image/png, Size: 3279 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-12-18 13:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-15 19:34 USBmount and systemd-udev namespace conflict Francois P. Gallichand
2014-12-16  1:22 ` Li, Xin
2014-12-18 13:06   ` Francois P. Gallichand

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.