Enable udisks2 interface in pi-gadget for UC20

Hi, I am not able to find any documentation of how i can enable udisk2 interface on UC20 gadget for Rpi4. Could someone help me?

the udisks2 interface must be provided by an application snap that ships the udisks2 daemon, it can not come from a gadget snap … here is an example snap that builds and uses udisks2 and provides that interface to other snaps too:

Hi @ogra,

When i install this snap and check the daemon service logs, i get:

2021-11-23T09:46:42Z systemd[1]: Stopping Service for snap application automount.udisksd… 2021-11-23T09:46:42Z systemd[1]: snap.automount.udisksd.service: Succeeded. 2021-11-23T09:46:42Z systemd[1]: Stopped Service for snap application automount.udisksd. 2021-11-23T09:46:57Z systemd[1]: Started Service for snap application automount.udisksd. 2021-11-23T09:46:57Z -[6495]: udisks daemon version 2.6.4 starting 2021-11-23T09:46:57Z -[6495]: Can’t load configuration file /usr/etc/udisks2/udisks2.conf 2021-11-23T09:46:58Z -[6495]: Error creating directory /usr/etc/udisks2: Read-only file system 2021-11-23T09:46:58Z -[6495]: Error creating directory /usr/etc/udisks2: Read-only file system 2021-11-23T09:46:58Z -[6495]: Error creating directory /usr/etc/udisks2: Read-only file system 2021-11-23T09:46:58Z -[6495]: Acquired the name org.freedesktop.UDisks2 on the system message bus

and i am not able to see a udisk2 interface in snap interfaces

Or is the udidks2 interface the automount:service?

ah, i only meant the package as an example …

it is only half way ported to core20 yet and might need another autotools-configure-parameters: entry to make it use /etc instead of /usr/etc … probably something like --sysconfdir=/etc

the slot should be the :service, yeah … but that requires to have udisksd start properly …

Hi @ogra,

I tried building after adding the flag you suggested. But, It still fails:

    2021-11-25T10:22:24Z -[7085]: Error opening /etc/crypttab file: Failed to open file “/etc/crypttab”: Permission denied (g-file-error-quark, 2)
2021-11-25T10:22:24Z -[7085]: Error opening /etc/crypttab file: Failed to open file “/etc/crypttab”: Permission denied (g-file-error-quark, 2)
2021-11-25T10:22:24Z -[7085]: Error opening /etc/crypttab file: Failed to open file “/etc/crypttab”: Permission denied (g-file-error-quark, 2)
2021-11-25T10:22:24Z -[7085]: Error opening /etc/crypttab file: Failed to open file “/etc/crypttab”: Permission denied (g-file-error-quark, 2)
2021-11-25T10:22:24Z -[7085]: Error opening /etc/crypttab file: Failed to open file “/etc/crypttab”: Permission denied (g-file-error-quark, 2)
2021-11-25T10:22:24Z -[7085]: Error opening /etc/crypttab file: Failed to open file “/etc/crypttab”: Permission denied (g-file-error-quark, 2)
2021-11-25T10:22:24Z -[7085]: Error opening /etc/crypttab file: Failed to open file “/etc/crypttab”: Permission denied (g-file-error-quark, 2)
2021-11-25T10:22:24Z -[7085]: Acquired the name org.freedesktop.UDisks2 on the system message bus
2021-11-25T10:22:42Z -[7085]: Error opening /etc/crypttab file: Failed to open file “/etc/crypttab”: Permission denied (g-file-error-quark, 2)
2021-11-25T10:22:42Z -[7085]: Error opening /etc/crypttab file: Failed to open file “/etc/crypttab”: Permission denied (g-file-error-quark, 2)

These are the connections:

Interface         Plug                        Slot               Notes
hardware-observe  automount:hardware-observe  :hardware-observe  manual
mount-observe     automount:mount-observe     :mount-observe     manual
udisks2           automount:client            :udisks2           manual
udisks2           stm-snap:udisks2            automount:service  manual

Do you know the reason why?

Should I add a sysytem-file sinterface for /etc/crypttab?

Regards Rahul

After I added a system-files interface most of the errors are removed except one:

2021-11-01T10:29:39Z systemd[1]: snap.automount.automount.service: Succeeded. 2021-11-25T10:35:34Z systemd[1]: Stopping Service for snap application automount.udisksd… 2021-11-25T10:35:34Z systemd[1]: snap.automount.udisksd.service: Succeeded. 2021-11-25T10:35:34Z systemd[1]: Stopped Service for snap application automount.udisksd. 2021-11-25T10:35:34Z systemd[1]: Started Service for snap application automount.udisksd. 2021-11-25T10:35:35Z -[3590]: udisks daemon version 2.6.4 starting 2021-11-25T10:35:35Z systemd[1]: Started Service for snap application automount.automount. 2021-11-25T10:35:36Z -[3590]: Acquired the name org.freedesktop.UDisks2 on the system message bus 2021-11-25T10:35:40Z automount.automount[3642]: Error connecting to the udisks daemon: Could not connect: Permission denied 2021-11-25T10:35:40Z systemd[1]: snap.automount.automount.service: Succeeded.

which is

2021-11-25T10:35:40Z automount.automount[3642]: Error connecting to the udisks daemon: Could not connect: Permission denied

and snappy-debug output:

Log: apparmor=“DENIED” operation=“connect” profile=“snap.automount.automount” name="/run/dbus/system_bus_socket" pid=3642 comm=“udisksctl” requested_mask=“wr” denied_mask=“wr” fsuid=0 ouid=0 File: /run/dbus/system_bus_socket (write) Suggestions:

  • adjust program to use $SNAP_DATA
  • adjust program to use /run/shm/snap.$SNAP_NAME.*
  • adjust program to use /run/snap.$SNAP_NAME.*
  • adjust snap to use snap layouts (Snap layouts)

hmm, not sure where that comes from, the udisks2 interface slot should allow dbus access …

Hi Rahul, looking at the connections I believe you have installed automount snap on classic. In fact, the :udisk2 slot shouldn’t be available on core.

I suggest to try on core and to connect the interfaces as such:

root@ubuntu:~# snap connections automount
Interface         Plug                                  Slot                         Notes
hardware-observe  automount:hardware-observe  :hardware-observe            -
mount-observe     automount:mount-observe     :mount-observe               -
udisks2           automount:client            automount:service  -
~~~
1 Like

For a Ubuntu Core device as you mentioned that udisks2 interface is generated by the application as automount:service . SO, where would automount.client connect to?

Thanks Diego that works

1 Like