Bug 1221646

Summary: Running attached code as root user errors GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown
Product: [Fedora] Fedora Reporter: Parag Nemade <pnemade>
Component: gnome-softwareAssignee: Richard Hughes <rhughes>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 22CC: kalevlember, pmatyas, rhughes
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-01-08 09:25:57 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
This code fails to run as a root user none

Description Parag Nemade 2015-05-14 13:27:53 UTC
Created attachment 1025404 [details]
This code fails to run as a root user

Description of problem:
Can someone help why attached code when run as a normal user works but run as a root user gives
Unable to use PackageKit: g-dbus-error-quark: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.PackageKit was not provided by any .service files (2)

I see same code works fine in F21 with/without root user.

Version-Release number of selected component (if applicable):
gnome-software-3.16.2-1.fc22

How reproducible:
always

Steps to Reproduce:
1.
2.
3.

Actual results:
Attached code fails to run as root user when used dbus packagekit API

Expected results:
code should run as a root user as well. It was working fine in F21.

Additional info:

Comment 1 Parag Nemade 2015-05-18 13:12:42 UTC
Richard or Kalev,
   Can anyone of you help here please?

Comment 2 Kalev Lember 2015-05-18 14:13:35 UTC
I pushed https://git.gnome.org/browse/gnome-software/commit/?id=79404faac5996351297e97c36a2afa040487d9cb which should make sure that gnome-software is autolaunched when a request comes in over the bus. Not sure it's going to fully fix your use case though - we don't have gnome-shell running in the root session, so it won't be able to show notifications, for example.

Comment 3 Parag Nemade 2015-05-19 08:38:23 UTC
Can you please suggest a way to use dbus packagekit api to install packages as root user as s-c-l needs to write /etc/locale.conf as well?

I am not sure but can it be possible to create a compat packagekit api package that provides same functionality as available in F21 to allow package installation using packagekit api?

I think there should be some provision in current gnome-software's packagekit service api to run under root user so that the running code can also do some other work that need to be done as root user.

Comment 4 Kalev Lember 2015-05-19 08:49:17 UTC
My suggestion would be to not run system-config-language as root. Instead, I would change it it to run as a regular user process and have a separate privileged helper for writing /etc/locale.conf. I am sure the people on #fedora-desktop can help come up with a good way how to do the privileged helper.

Comment 5 Richard Hughes 2016-01-08 09:25:57 UTC
(In reply to Kalev Lember from comment #4)
> My suggestion would be to not run system-config-language as root. Instead, I
> would change it it to run as a regular user process and have a separate
> privileged helper for writing /etc/locale.conf.

Totally agreed.