secret-service icon indicating copy to clipboard operation
secret-service copied to clipboard

Secret Service not found in Docker Container

Open xinyuxu1026 opened this issue 1 year ago • 4 comments

Distro: AlmaLinux 8 container on top of Ubuntu 20.04 with privilege secret-service version: 1.6.2 Error shows that

Exception in thread "main" java.lang.RuntimeException: java.io.IOException: The secret service is not available.

Caused by: java.io.IOException: The secret service is not available.
	at org.freedesktop.secret.simple.SimpleCollection.init(SimpleCollection.java:277)
	at org.freedesktop.secret.simple.SimpleCollection.<init>(SimpleCollection.java:57)

The org.freedesktop.secrets.service and org.gnome.keyring.service exist.

ls /usr/share/dbus-1/services/
ca.desrt.dconf.service                  org.freedesktop.secrets.service            org.gnome.keyring.SystemPrompter.service
org.freedesktop.systemd1.service           org.gnome.keyring.service
org.a11y.Bus.service                    org.gnome.keyring.PrivatePrompter.service  org.gtk.GLib.PACRunner.service

gnome-keyring is also running

ps aux | grep gnome-keyring
user    1217  0.0  0.0 154656  4864 ?        Sl   01:12   0:00 gnome-keyring-daemon --daemonize --login
user    1222  0.0  0.1 302364  9232 ?        Sl   01:12   0:00 gnome-keyring-daemon --unlock
user    1227  0.0  0.0      0     0 ?        Z    01:12   0:00 [gnome-keyring-d] <defunct>
user    1517  0.0  0.0   9220  1204 ?        S    01:13   0:00 grep gnome-keyring

We also have some keyring related tests running successfully in the container.

Why is it complaining about the secret service is not available? Is there any general advice about how to run this in container?

Thank you very much.

xinyuxu1026 avatar Jul 21 '23 23:07 xinyuxu1026

any updates on this bug? we are facing the same issue.

tanmaymanolkar1 avatar Sep 11 '23 20:09 tanmaymanolkar1

Distro: AlmaLinux 8 container on top of Ubuntu 20.04 with privilege secret-service version: 1.6.2 Error shows that

Exception in thread "main" java.lang.RuntimeException: java.io.IOException: The secret service is not available.

Caused by: java.io.IOException: The secret service is not available.
	at org.freedesktop.secret.simple.SimpleCollection.init(SimpleCollection.java:277)
	at org.freedesktop.secret.simple.SimpleCollection.<init>(SimpleCollection.java:57)

The java.io.IOException that hits you comes from the isAvailable() method returning false.

The method checks for certain services, registered on the bus, namely:

  • org.freedesktop.DBus
  • org.freedesktop.secrets
  • org.gnome.keyring

As you have these, the method probably fails on encrypting the session, which is done next.

It's hard to tell, what javax.crypto or java.security parts are missing in your container.

purejava avatar Sep 15 '23 09:09 purejava

Thank you! @purejava , do you know how to install those parts? and is there a way to check which part is missing?

xinyuxu1026 avatar Oct 19 '23 06:10 xinyuxu1026

Thank you! @purejava , do you know how to install those parts? and is there a way to check which part is missing?

No, I've never used Java inside a container.

According to the JavaDoc the javax.crypto implementation is provider-based.

Maybe another Java vendor works better?

purejava avatar Oct 19 '23 11:10 purejava