LINUX.ORG.RU

Помогите адаптировать правило udev к systemd

 , , ,


0

1

Долго юзал openrc и такое правило

SUBSYSTEM==«block», KERNEL==«sd[b-z][0-9]», ACTION==«add», RUN+=«/bin/mkdir -p /mnt/$name»
SUBSYSTEM==«block», KERNEL==«sd[b-z][0-9]», ACTION==«add», RUN+=«/bin/mount -O guid=984 /dev/%k /mnt/$name»
SUBSYSTEM==«block», KERNEL==«sd[b-z][0-9]», ACTION==«remove», RUN+=«/bin/rmdir /mnt/$name»

нормально работало, создавало папки в /mnt и монтировало в них разделы. На днях накатил обычный Арч и теперь нифига не работает, папки создаются но в них ничего не монтируется. Помогите починить

★★★

А в арче точно mkdir, mount и rmdir в /bin живут?

И, кстати, не помешает при ACTION=="remove" делать umount -l /mnt/$name например. На всякий случай.

Stanson ★★★★★
()

Раньше не видел заглавную «-O» среди параметров mount. Это не опечатка?

man mount

       -O, --test-opts opts
           Limit the set of filesystems to which the -a option applies. In this regard it
           is like the -t option except that -O is useless without -a. For example, the
           command

router ★★★★★
()
Ответ на: комментарий от router

Не опечатка. Я честно без понятия, скопировал его из инета лет 5 назад и все работало, а на днях пришлось накатить Арч с нуля и теперь не работает. Если бы я шарил, не просил бы помочь починить

Dog ★★★
() автор топика
Ответ на: комментарий от router
man mount
 -O, --test-opts opts
           Limit the set of filesystems to which the -a option applies. In this regard it is like the -t option except that -O is useless without -a. For example, the command

           mount -a -O no_netdev

           mounts all filesystems except those which have the option netdev specified in the options field in the /etc/fstab file.

           It is different from -t in that each option is matched exactly; a leading no at the beginning of one option does not negate the rest.

           The -t and -O options are cumulative in effect; that is, the command

           mount -a -t ext2 -O  _netdev

           mounts all ext2 filesystems with the _netdev option, not all filesystems that are either ext2 or have the _netdev option specified.

       -o, --options opts
           Use the specified mount options. The opts argument is a comma-separated list. For example:

           mount LABEL=mydisk -o noatime,nodev,nosuid

           Note that the order of the options matters, as the last option wins if there are conflicting ones. The options from the command line also overwrite options from fstab by default.

           For more details, see the FILESYSTEM-INDEPENDENT MOUNT OPTIONS and FILESYSTEM-SPECIFIC MOUNT OPTIONS sections.
kostik87 ★★★★★
()
Последнее исправление: kostik87 (всего исправлений: 1)

Поломалось потому что udev запускается в изолированном namespace. Или перепиши на systemd-mount или расшарь udev

systemctl edit systemd-udevd
[Service]
MountFlags=shared

Но лучше всё-таки systemd-mount

mergood
()
Последнее исправление: mergood (всего исправлений: 1)
  • Markdown
Пустая строка (два раза Enter) начинает новый абзац. Знак '>' в начале абзаца выделяет абзац курсивом цитирования.
Внимание: прочитайте описание разметки Markdown.
Используйте Ctrl-Enter для размещения комментария