Questions about udev rule and systemd-udev,relevant to mounting block device
Defect:
The exiting method of automount of udev in /oe-core/meta/ /is using
/automount.rules/ which call /mount.sh/ that using //bin/mount/ to mount device.
But systemd-udevd detaches /mount()/ operations done within the service
from the rest of the system with MountFlag=slave, this means host can
not access device. (e.g. Executing /mkfs.ext4 /dev/sda1// prompts
//dev/sda1 is apparently in use by the system; will not make a filesystem here!/)
Solution:
Systemd upstream suggest that the best way is to use "systemd-mount"
in udev rules, which will request the mount operation to be executed by PID 1.
And I have tested it was effective.
Uncertain:
The exiting method is designed for /SysV-init /which is not compatible to
systemd-udev, at least that's what I think. So I think that we should design
a new rule or organizational structure to be suitable for systemd-udev and
to mount deferent device. Dose anyone help do this? Or I can make some
improvements on the basis of the existing with "systemd-mount".
Hi all,
Does anyone have suggestion for me?
Thanks.
Hongzhi.Song
Quoted 39 lines · Song
Defect:
The exiting method of automount of udev in /oe-core/meta/ /is using
/automount.rules/ which call /mount.sh/ that using //bin/mount/ to mount device.
But systemd-udevd detaches /mount()/ operations done within the service
from the rest of the system with MountFlag=slave, this means host can
not access device. (e.g. Executing /mkfs.ext4
/dev/sda1//prompts//dev/sda1 is apparently in use by the system; will not make a filesystem here!/)
Solution:
Systemd upstream suggest that the best way is to use "systemd-mount"
in udev rules, which will request the mount operation to be executed by PID 1.
And I have tested it was effective.
Uncertain:
The exiting method is designed for /SysV-init /which is not compatible to
systemd-udev, at least that's what I think. So I think that we should design
a new rule or organizational structure to be suitable for systemd-udev and
to mount deferent device. Dose anyone help do this? Or I can make some
improvements on the basis of the existing with "systemd-mount".
Hi,
I'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:
Regards,
Vincent
[1]https://github.com/rbrito/usbmount
[2]
https://github.com/nefethael/meta-random/blob/master/recipes-support/usbmount/usbmount_git.bb
[3]https://github.com/six-k/automount-usb
2018-03-02 6:44 GMT+01:00 Hongzhi, Song <[email protected]>:
Quoted 61 lines
Hi all,
Does anyone have suggestion for me?
Thanks.
Hongzhi.Song
On 2018年03月01日 18:35, Hongzhi, Song wrote:
Defect:
The exiting method of automount of udev in *oe-core/meta/ *is using
*automount.rules* which call *mount.sh* that using */bin/mount* to mount device.
But systemd-udevd detaches *mount()* operations done within the service
from the rest of the system with MountFlag=slave, this means host can
not access device. (e.g. Executing *mkfs.ext4
/dev/sda1/*prompts*/dev/sda1 is apparently in use by the system; will not make a filesystem here!*)
Solution:
Systemd upstream suggest that the best way is to use "systemd-mount"
in udev rules, which will request the mount operation to be executed by PID 1.
And I have tested it was effective.
Uncertain:
The exiting method is designed for *SysV-init *which is not
compatible tosystemd-udev, at least that's what I think. So I think that we should design
a new rule or organizational structure to be suitable for systemd-udev and
to mount deferent device. Dose anyone help do this? Or I can make some
improvements on the basis of the existing with "systemd-mount".
--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core