Udiskie: org.freedesktop.UDisks2.Error.NotAuthorizedCanObtain

Udiskie: org.freedesktop.UDisks2.Error.NotAuthorizedCanObtain

루트 액세스 없이 SD 카드를 실행 udiskie하고 udisks2마운트 하려고 합니다 . udisksctl시스템은 Debian, CL 전용, 헤드리스입니다.

$ udiskie-mount /dev/mmcblk0p1 --verbose
DEBUG [2023-04-04 00:35:15,374] udiskie.config: Failed to read config file: [Errno 2] No such file or directory: '/home/pi/.config/udiskie/config.yml'
DEBUG [2023-04-04 00:35:15,386] udiskie.config: Failed to read config file: [Errno 2] No such file or directory: '/home/pi/.config/udiskie/config.json'
DEBUG [2023-04-04 00:35:15,411] udiskie.udisks2: Daemon version: 2.9.2
DEBUG [2023-04-04 00:35:15,412] udiskie.udisks2: Keyfile support: True
DEBUG [2023-04-04 00:35:15,683] udiskie.config: new rule: {symlinks=/dev/mapper/docker-*} -> {ignore}
DEBUG [2023-04-04 00:35:15,683] udiskie.config: new rule: {symlinks=/dev/disk/by-id/dm-name-docker-*} -> {ignore}
DEBUG [2023-04-04 00:35:15,684] udiskie.config: new rule: {is_loop, !is_ignored, loop_file=/*} -> {!ignore}
DEBUG [2023-04-04 00:35:15,684] udiskie.config: new rule: {!is_block} -> {ignore}
DEBUG [2023-04-04 00:35:15,685] udiskie.config: new rule: {!is_external, is_toplevel} -> {ignore}
DEBUG [2023-04-04 00:35:15,685] udiskie.config: new rule: {is_ignored} -> {ignore}
DEBUG [2023-04-04 00:35:15,693] udiskie.udisks2: found device owning "/dev/mmcblk0p1": "/org/freedesktop/UDisks2/block_devices/mmcblk0p1"
DEBUG [2023-04-04 00:35:15,696] udiskie.mount: mounting /org/freedesktop/UDisks2/block_devices/mmcblk0p1 with {'options': None}
ERROR [2023-04-04 00:35:15,757] udiskie.mount: failed to mount /org/freedesktop/UDisks2/block_devices/mmcblk0p1: GDBus.Error:org.freedesktop.UDisks2.Error.NotAuthorizedCanObtain: Not authorized to perform operation
DEBUG [2023-04-04 00:35:15,759] udiskie.mount: Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/udiskie/mount.py", line 27, in wrapper
    return await fn(self, device, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/udiskie/mount.py", line 165, in mount
    mount_path = await device.mount(**kwargs)
  File "/usr/lib/python3/dist-packages/udiskie/dbus.py", line 183, in call
    result = await proxy.call(method_name, signature, *args)
  File "/usr/lib/python3/dist-packages/udiskie/dbus.py", line 49, in call
    value = proxy.call_finish(result)
gi.repository.GLib.GError: g-io-error-quark: GDBus.Error:org.freedesktop.UDisks2.Error.NotAuthorizedCanObtain: Not authorized to perform operation (36)

해당 문서에 따르면 몇 가지 폴킷(polkit) 항목이 필요합니다.https://github.com/coldfix/udiskie/wiki/Permissions

그래서 다음 파일을 만들었습니다.

$ cat /etc/polkit-1/rules.d/50-udiskie.rules
polkit.addRule(function(action, subject) {
  var YES = polkit.Result.YES;
  var permission = {
    // required for udisks1:
    "org.freedesktop.udisks.filesystem-mount": YES,
    "org.freedesktop.udisks.luks-unlock": YES,
    "org.freedesktop.udisks.drive-eject": YES,
    "org.freedesktop.udisks.drive-detach": YES,
    // required for udisks2:
    "org.freedesktop.udisks2.filesystem-mount": YES,
    "org.freedesktop.udisks2.encrypted-unlock": YES,
    "org.freedesktop.udisks2.eject-media": YES,
    "org.freedesktop.udisks2.power-off-drive": YES,
    // required for udisks2 if using udiskie from another seat (e.g. systemd):
    "org.freedesktop.udisks2.filesystem-mount-other-seat": YES,
    "org.freedesktop.udisks2.filesystem-unmount-others": YES,
    "org.freedesktop.udisks2.encrypted-unlock-other-seat": YES,
    "org.freedesktop.udisks2.encrypted-unlock-system": YES,
    "org.freedesktop.udisks2.eject-media-other-seat": YES,
    "org.freedesktop.udisks2.power-off-drive-other-seat": YES
  };
  if (subject.isInGroup("plugdev")) {
    return permission[action.id];
  }
});

나도 끼워 줘 plugdev:

$ groups
pi adm dialout cdrom sudo audio dip video plugdev staff systemd-journal bluetooth netdev pulse-access

이 오류가 발생하는 이유는 무엇 NotAuthorizedCanObtain이며 어떻게 해결합니까?

관련 정보