89luca89 / distrobox

Use any linux distribution inside your terminal. Enable both backward and forward compatibility with software and freedom to use whatever distribution you’re more comfortable with. Mirror available at: https://gitlab.com/89luca89/distrobox
https://distrobox.it/
GNU General Public License v3.0
9.76k stars 399 forks source link

[Error] GUI password prompts and app browser logins not working at all #350

Open saenai255 opened 2 years ago

saenai255 commented 2 years ago

Please, before opening a bug:

[x] make sure you've read the documentation. [x] Ensure there isn't already an open issue about this. [x] Ensure there isn't already a closed/resolved issue about this.

Describe the bug I'm not sure if these are two separate bugs or the same one.

Password Prompt

When GUI apps dynamically require root permissions, such as Manjaro's Pamac Manager, the user is prompted to input their password, via an overlay / popup. The problem here is that the password prompt never happens for apps exported from DistroBox

Login with Browser

Apps that require authentication via the browser, like Github Desktop or BlueMail get stuck at the login step.

To Reproduce

Password Prompt

  1. Install pamac-manager or any GUI app that dynamically requires root permissions
  2. Perform action that required root perms, such as installing an app from Pamac
  3. Get a get_authorization() error pamac

Login with Browser

  1. Install Github Desktop or BlueMail on guest
  2. Start one of them and try to login
  3. Login buttons get stuck in loading state and you the browser never gets opened bluemail gh-desktop

Expected behavior

Password Prompt

The host os should display the password prompt

Login with Browser

A browser from either host or guest os should open to continue the login process.

Logs Run the commands with --verbose and post the log here as a file upload Attach also the output of podman logs or docker logs, possibly with --latest flag

Desktop (please complete the following information):

Additional context

Password Prompt

When trying to install anything with pamac-manager I get the following error popup:

get_authorization: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.manjaro.pamac.daemon was not provided by any .service files

and the following process logs:

-> % pamac-manager                                          

(pamac-manager:874): Gtk-WARNING **: 19:45:27.084: Locale not supported by C library.
        Using the fallback 'C' locale.
Gtk-Message: 19:45:27.121: Failed to load module "colorreload-gtk-module"
Gtk-Message: 19:45:27.121: Failed to load module "window-decorations-gtk-module"
Gtk-Message: 19:45:27.121: Failed to load module "appmenu-gtk-module"

** (pamac-manager:874): WARNING **: 19:45:27.420: transaction_interface_daemon.vala:52: failed to connect to dbus daemon: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.manjaro.pamac.daemon was not provided by any .service files

(pamac-manager:874): Gdk-CRITICAL **: 19:45:27.424: gdk_window_set_cursor: assertion 'GDK_IS_WINDOW (window)' failed

Login with Browser

No useful logs sadly

89luca89 commented 2 years ago

Hi @saenai255

So for the password prompt I'll need to investigate, but have you considered exporting the pamac-manager with --sudo?

~:$ distrobox-export --app pamac --sudo

or just launching inside the container sudo pamac-manager, this shouldn't be a security concern on default rootless distrobox, as the sudo you're using is only sudo inside the container

Regarding the login issue Try using 1.3.2 from git (using the --next flag) and use distrobox-host-exec to have xdg-open from the host:

ln -s /bin/distrobox-host-exec /usr/local/bin/xdg-open

this will give a way for the guest to interact with the host's browser

89luca89 commented 2 years ago

So I confirm that using sudo pamac-manager and in case exporting the app with --sudo works as intended.

For github-desktop, it works if you:

sudo pacman -S flatpak-xdg-utils # this installs flatpak-spawn
sudo ln -s /bin/distrobox-host-exec /usr/local/bin/xdg-open

Then it works as intended

saenai255 commented 2 years ago

Thanks @89luca89 for the reply.

Regarding the --sudo export solution: as far as I know, some apps are expected to be run in "user mode" and only elevate to root when needed.

Is it possible to do this currently?

89luca89 commented 2 years ago

Seems to be an issue with polkit inside the container, which needs investigation and I don't know if it's easily solvable

 pkexec bash
Error getting authority: Error initializing authority: Could not connect: No such file or directory

Polkit to work like this needs a dbus running,and a dedicated dbus to the container, which is not easily achieved on non-init containers and risks breaking integration with host's dbus