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

nixos/systemd-stage-1: Support resolved #304322

Merged
merged 6 commits into from
May 23, 2024

Conversation

ElvishJerricco
Copy link
Contributor

Description of changes

This comes with an additional change to put systemd-resolved.service in sysinit.target instead of multi-user.target, given that this is what the upstream unit file indicates in its [Install] section.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@ElvishJerricco
Copy link
Contributor Author

ElvishJerricco commented Apr 15, 2024

This still needs a NixOS test. Help would be greatly appreciated on this, because I'm not actually all that familiar with how to deal with DNS and have already spent hours trying to write a test that I'm pretty sure is nowhere near correct. First, the test should make sure that stage 2 resolved works since AFAICT we don't have a test for that yet, and then we can extend to it to make sure stage 1 works as well.

@ElvishJerricco ElvishJerricco changed the title Sd s1 resolved nixos/systemd-stage-1: Support resolved Apr 15, 2024
@ElvishJerricco
Copy link
Contributor Author

ElvishJerricco commented May 21, 2024

So, I've added a test for systemd-resolved, but I'm not quite satisfied with it in stage 1. I couldn't do the resolvectl query part of the test in stage 1 for some reason. I get this:

example.com: resolve call failed: The name org.freedesktop.resolve1 was not provided by any .service files

And looking back at the logs, I sometimes see something like this,

client # [    1.333575] systemd[1]: systemd-networkd.service: Unexpected error response from GetNameOwner(): Connection terminated
client # [    1.341035] systemd[1]: systemd-resolved.service: Unexpected error response from GetNameOwner(): Connection terminated

Or sometimes something like this,

client # [    1.311828] systemd[1]: Failed to subscribe to NameOwnerChanged signal for 'org.freedesktop.network1': Transport endpoint is not connected
client # [    1.312865] systemd[1]: systemd-networkd.service: Cannot watch bus name org.freedesktop.network1: Transport endpoint is not connected
client # [    1.316867] systemd[1]: Failed to subscribe to NameOwnerChanged signal for 'org.freedesktop.resolve1': Transport endpoint is not connected
client # [    1.317882] systemd[1]: systemd-resolved.service: Cannot watch bus name org.freedesktop.resolve1: Transport endpoint is not connected

Or sometimes nothing indicative of any problems. No matter the logs, I get the resolve call failed error from resolvectl.

@arianvp
Copy link
Member

arianvp commented May 21, 2024

Sounds like dbus is not running

@ElvishJerricco
Copy link
Contributor Author

ElvishJerricco commented May 21, 2024

@arianvp It is though. If I add print(client.succeed("systemctl status dbus.socket dbus.service")), I get this:

client: must succeed: systemctl status dbus.socket dbus.service
(finished: must succeed: systemctl status dbus.socket dbus.service, in 0.01 seconds)
● dbus.socket - D-Bus System Message Bus Socket
     Loaded: loaded (/etc/systemd/system/dbus.socket; linked; preset: enabled)
     Active: active (running) since Tue 2024-05-21 07:26:24 UTC; 5s ago
   Triggers: ● dbus.service
     Listen: /run/dbus/system_bus_socket (Stream)
     CGroup: /system.slice/dbus.socket

May 21 07:26:24 localhost systemd[1]: Listening on D-Bus System Message Bus Socket.

● dbus.service - D-Bus System Message Bus
     Loaded: loaded (/etc/systemd/system/dbus.service; linked; preset: enabled)
     Active: active (running) since Tue 2024-05-21 07:26:24 UTC; 5s ago
TriggeredBy: ● dbus.socket
       Docs: man:dbus-daemon(1)
   Main PID: 99 (dbus-daemon)
      Tasks: 1 (limit: 1131)
     Memory: 388.0K (peak: 652.0K)
        CPU: 7ms
     CGroup: /system.slice/dbus.service
             └─99 /nix/store/pvyfwb5fyh0max87rkhch4ac4d9b90lq-dbus-1.14.10/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only

May 21 07:26:24 localhost systemd[1]: Starting D-Bus System Message Bus...
May 21 07:26:24 localhost systemd[1]: Started D-Bus System Message Bus.

And I can see them being started in the log early enough.

@ElvishJerricco
Copy link
Contributor Author

Ah, we didn't have the necessary dbus files from systemd included. Fixed, and ready for review!

@ElvishJerricco ElvishJerricco marked this pull request as ready for review May 22, 2024 00:56
@ElvishJerricco ElvishJerricco requested a review from dasJ as a code owner May 22, 2024 00:56
@flokli flokli merged commit fadd3fe into NixOS:master May 23, 2024
21 checks passed
@philiptaron
Copy link
Contributor

This is really sweet! Thank you for your continued grind on making systemd in stage1 work, @ElvishJerricco. Appreciate you.

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

4 participants