Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch-to-configuration.pl: Interact via DBus #1665

Merged
merged 2 commits into from Apr 21, 2014

Conversation

ocharles
Copy link
Contributor

@ocharles ocharles commented Feb 2, 2014

Currently switch-to-configuration.pl uses system() calls to interact
with DBus. This can be error prone, especially when we are parsing
output that could change. In this commit, almost all calls to the
systemctl binary have been replaced with equivalent operations via DBus.

Currently switch-to-configuration.pl uses system() calls to interact
with DBus. This can be error prone, especially when we are parsing
output that could change. In this commit, almost all calls to the
systemctl binary have been replaced with equivalent operations via DBus.
@ocharles
Copy link
Contributor Author

ocharles commented Feb 2, 2014

This obviously needs people to help test. So far I've tried enabling and disabling services, and it has behaved as expected.

@shlevy
Copy link
Member

shlevy commented Mar 15, 2014

+1. @edolstra are you willing to take a look at this? Otherwise I will but it may be some time before I can do it properly.

@edolstra
Copy link
Member

Seems like a good idea to me (but haven't tested yet). The only downside would be that switch-to-configuration will fail if dbus is down. But I guess that won't be a problem anymore in the glorious kdbus future.

@shlevy
Copy link
Member

shlevy commented Mar 22, 2014

@edolstra do you have any thoughts on what should be tested for this? It seems like something we should have.

@shlevy shlevy added this to the 14.04 milestone Mar 29, 2014
@shlevy
Copy link
Member

shlevy commented Mar 29, 2014

I don't have time to test this right now, but I've added the 14.04 milestone so that we make sure it gets in soon.

@shlevy shlevy self-assigned this Apr 5, 2014
@shlevy
Copy link
Member

shlevy commented Apr 5, 2014

Will test and try to get this in before 14.04, unless @edolstra objects.

@shlevy
Copy link
Member

shlevy commented Apr 19, 2014

@ocharles This looks good to me, can you bring it up to date and we can merge?

@ocharles
Copy link
Contributor Author

Sure thing, will try and get that done tonight or tomorrow.
On 19 Apr 2014 02:18, "Shea Levy" notifications@github.com wrote:

@ocharles https://github.com/ocharles This looks good to me, can you
bring it up to date and we can merge?

Reply to this email directly or view it on GitHubhttps://github.com//pull/1665#issuecomment-40856952
.

@edolstra
Copy link
Member

Just updated systemd to 212, but I don't think it changes the d-bus API. (It did change the "systemctl" output...)

Conflicts:
	nixos/modules/system/activation/switch-to-configuration.pl
@ocharles
Copy link
Contributor Author

I've merged master in - do we want to get this in for the next release, or give it time to have more testing? I think for something so essential, we may be better waiting.

@shlevy
Copy link
Member

shlevy commented Apr 20, 2014

We'll have a week+ for testing after this is in, I'd like to get this in if you're up for it. I tested the current state already against nixpkgs of a few weeks ago

@ocharles
Copy link
Contributor Author

Sure, I'm fine with that - just wanted to make sure others were :)

On Sun, Apr 20, 2014 at 7:39 PM, Shea Levy notifications@github.com wrote:

We'll have a week+ for testing after this is in, I'd like to get this in
if you're up for it. I tested the current state already against nixpkgs of
a few weeks ago

Reply to this email directly or view it on GitHubhttps://github.com//pull/1665#issuecomment-40901617
.

@shlevy
Copy link
Member

shlevy commented Apr 21, 2014

@ocharles Is this ready to merge?

@ocharles
Copy link
Contributor Author

I'm just testing it now, will merge if everything checks out OK.

@ocharles ocharles merged commit 42ae633 into NixOS:master Apr 21, 2014
@edolstra
Copy link
Member

So has anybody tested what happens if dbus is restarted by switch-to-configuration?

@lucabrunox
Copy link
Contributor

I've nixos-rebuild switch from old master to new master (3b93b7b + #2344)

updating GRUB 2 menu...
stopping the following units: .......(including dbus)................. 
org.freedesktop.DBus.Error.Disconnected: Connection is closed

Then dbus was dead. I could systemctl start dbus and it was alive. Doing switch and got the same problem as above.
Then I nixos-rebuild boot, rebooted and it worked fine. Did a nixos-rebuild switch and:

updating GRUB 2 menu...
stopping the following units: local-fs.target, network-interfaces.target, remote-fs.target
NOT restarting the following units: display-manager.service
activating the configuration...
setting up /etc...
restarting the following units: polkit.service
no introspection data available for method 'Restart' in object '/org/freedesktop/systemd1', and object is not cast to any interface at /nix/store/5v9f24b4kr0pxg5afbbskr0hk830nssl-perl-Net-DBus-1.0.0/lib/perl5/site_perl/5.16.3/x86_64-linux-thread-multi/Net/DBus/RemoteObject.pm line 405.

@shlevy
Copy link
Member

shlevy commented Apr 21, 2014

Reverted for now, as @ocharles may not have time to look at the problems caused by the new systemd in conjunction with this. We will revisit after 14.04.

@vcunat
Copy link
Member

vcunat commented Apr 22, 2014

Hmm, it seems impossible to reopen a merged PR.

@ocharles
Copy link
Contributor Author

Don't worry, I'll open a new one shortly
On 22 Apr 2014 09:26, "Vladimír Čunát" notifications@github.com wrote:

Hmm, it seems impossible to reopen a merged PR.


Reply to this email directly or view it on GitHubhttps://github.com//pull/1665#issuecomment-41015158
.

@edolstra
Copy link
Member

Another that occured to me is that starting units via d-bus breaks password prompts. (Systemctl spawns systemd-tty-ask-password-agent --watch to perform password prompts made by systemd-ask-password calls in units.)

@shlevy
Copy link
Member

shlevy commented Apr 22, 2014

How does systemctl work if not via dbus?

@edolstra
Copy link
Member

Systemctl doesn't use dbus at all if you're running as root. Also, it does more than talk to systemd - it also starts systemd-tty-ask-password-agent.

@shlevy
Copy link
Member

shlevy commented Apr 22, 2014

Right, but what interface does it use?

@edolstra
Copy link
Member

The /run/systemd/private Unix domain socket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants