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-ng: fix with nix-upgrade #343709

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pkgs/by-name/sw/switch-to-configuration-ng/src/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1293,7 +1293,8 @@ won't take effect until you reboot the system.
units_to_reload.insert(unit.to_string(), ());
record_unit(RELOAD_LIST_FILE, &unit)
}
} else {
// systemd creates a transient mount unit for /nix/store, that we shouldn't try to unmount
} else if !matches!(mountpoint.as_str(), "/nix/store") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed here and not in the perl one?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know. It wasn't needed when we introduced the test. Was the perl version taking transient mount units into account?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think stc shouldn't touch any transient units. Same reason why transient units have IgnoreOnIsolate=yes. Otherwise you'll kill things like people's graphical applications in GNOME and kill their docker containers

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably get_active_units should skip those units entirely?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dbus interface doesn't seem to return IgnoreOnIsolate directly for the dbus call used, but it may be accessible through some other command.

Copy link
Member

@arianvp arianvp Sep 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a Transient=yes property exposed in dbus. Maybe we can use that?

Copy link
Member Author

@Mic92 Mic92 Sep 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as IgnoreOnIsolate, it's GetUnit() in https://www.freedesktop.org/software/systemd/man/latest/org.freedesktop.systemd1.html
so additional dbus call is needed.
It's just not clear to me how to do this with the generated dbus interface:
https://gist.github.com/Mic92/37f1789f9bfc91fa7376845442fa6d80

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't feel familiar enough with this library. Closing this pull request instead. Probably a release blocker if it indeed can break automounts and docker container.

Copy link
Contributor

@ElvishJerricco ElvishJerricco Sep 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise you'll kill things like people's graphical applications in GNOME

@arianvp Won't those be user units, and thus unaffected?

// Filesystem entry disappeared, so unmount it.
units_to_stop.insert(unit, ());
}
Expand Down