pop-os / shop

Pop!_Shop
GNU General Public License v3.0
91 stars 19 forks source link

Errors when starting Pop!_Shop with pkexec #101

Open evertiro opened 6 years ago

evertiro commented 6 years ago

Distribution (run cat /etc/os-release):

NAME="Pop!_OS" VERSION="18.04 LTS" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Pop!_OS 18.04 LTS" VERSION_ID="18.04" HOME_URL="https://system76.com/pop" SUPPORT_URL="http://support.system76.com" BUG_REPORT_URL="https://github.com/pop-os/pop/issues" PRIVACY_POLICY_URL="https://system76.com/privacy" VERSION_CODENAME=bionic UBUNTU_CODENAME=bionic

Related Application and/or Package Version (run apt policy $PACKAGE NAME):

pop-shop: Installed: 0.2.9\~1536344543\~18.04\~ad78647 Candidate: 0.2.9\~1536344543\~18.04\~ad78647 Version table: *** 0.2.9\~1536344543\~18.04\~ad78647 1001 1001 http://ppa.launchpad.net/system76/pop/ubuntu bionic/main amd64 Packages 100 /var/lib/dpkg/status

Issue/Bug Description:

Running sudo io.elementary.appcenter -u results in a successful start of Pop!_Shop with the Installed tab active, as expected. However, running pkexec io.elementary.appcenter -u results in the following error:

** (process:2692): CRITICAL **: 20:14:14.945: SuspendControl.vala:40: Cannot autolaunch D-Bus without X11 $DISPLAY

** (process:2692): WARNING **: 20:14:15.227: ComponentValidator.vala:38: Could not get the contents of blacklist file: Failed to open file “/etc/io.elementary.appcenter/appcenter.blacklist”: No such file or directory
Unable to init server: Could not connect: Connection refused

(io.elementary.appcenter:2692): Gtk-WARNING **: 20:14:15.252: cannot open display:

The same issue exists without the -u, but as Pop!_Shop itself doesn't require elecated access, I'm including the -u as a demonstration of why one might want to launch with root access.

Steps to reproduce (if you know):

Launch Pop!_Shop with elevated permissions by running pkexec io.elementary.appcenter from terminal.

Expected behavior:

Pop!_Shop will open to the Installed tab.

Other Notes:

This may be an upstream issue, I'm currently downloading the latest ElementaryOS image and will be testing shortly. If it is an upstream issue, I will open an issue with them and reference here. Additionally, this may be an inconsistent issue; it has been reported that this may work fine on a completely clean install.

Note that the warning regarding the appcenter.blacklist file does not appear to be relevant.

evertiro commented 6 years ago

Further research indicates that this is related to a known issue. You can work around it with a script like the following. The script should work in both Wayland and X11 environments. It's a quick fix, but should work in most instances.

https://gitlab.com/snippets/1762368

Edit: Moved code to GitLab, I don't want to lose it and might want to tweak it later.

mmstick commented 6 years ago

The appcenter shouldn't be run as root, however. So I think this is more about fixing the -u flag rather than fixing running it as root.

evertiro commented 6 years ago

Agreed, only reason I needed to find a way was due to -u requiring root, and wanting to use appcenter in conjunction with the Apt Update Indicator extension.