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: add options for hardware watchdog management #92759

Merged
merged 1 commit into from Jul 12, 2020
Merged

nixos/systemd: add options for hardware watchdog management #92759

merged 1 commit into from Jul 12, 2020

Conversation

mdlayher
Copy link
Member

@mdlayher mdlayher commented Jul 9, 2020

Motivation for this change

I'd like to have systemd manage a watchdog device on one of my machines without having to write the appropriate lines into extraConfig. These options should also appear during a search for "watchdog" in NixOS options, which is what prompted me to figure out how to do this manually.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

See https://www.freedesktop.org/software/systemd/man/systemd-system.conf.html#RuntimeWatchdogSec= for a guide on the options being set here. I have a couple of questions:

  1. The options have the suffix "Sec=" but expose a more general duration instead; is the "runtimeTime" and etc suffix I've chosen appropriate or should I go with what systemd uses: "runtimeSec"?

  2. I know there are ways to type check a unit and it would probably be smart to check for a valid unit suffix on user inputs, but I'm unsure how to do so. Any pointers would be appreciated!

/cc @grahamc per our conversation in #nixos-systemd

@mdlayher mdlayher requested a review from grahamc July 9, 2020 01:47
@mdlayher
Copy link
Member Author

mdlayher commented Jul 9, 2020

@GrahamcOfBorg test systemd

@mdlayher
Copy link
Member Author

mdlayher commented Jul 9, 2020

/marvin opt-in

@marvin-mk2
Copy link

marvin-mk2 bot commented Jul 9, 2020

Hi! I'm an experimental bot. My goal is to guide this PR through its stages, hopefully ending with a merge. You can read up on the usage here.

@mdlayher
Copy link
Member Author

mdlayher commented Jul 9, 2020

/status needs_reviewer

@flokli
Copy link
Contributor

flokli commented Jul 11, 2020

Usage question:

On my thinkpad, I already see two different watchdogs:

❯ ls -la /dev|grep watchdog
crw-------   1 root root     10, 130 Jul  9 12:21 watchdog
crw-------   1 root root    245,   0 Jul  9 12:21 watchdog0
[   11.679080] iTCO_wdt: Intel TCO WatchDog Timer Driver v1.11
[   11.679213] iTCO_wdt: Found a Intel PCH TCO device (Version=4, TCOBASE=0x0400)
[   11.679329] iTCO_wdt: initialized. heartbeat=30 sec (nowayout=0)

How am I supposed to know which one is correct?

@mdlayher
Copy link
Member Author

@flokli I note the same on my PC Engines apu4d4. I can confirm /dev/watchdog (the default) works but am rather new to the Linux watchdog subsystem and don't understand the meaning of the extra device node either unfortunately.

@flokli flokli requested review from andir and arianvp July 11, 2020 21:49
@flokli
Copy link
Contributor

flokli commented Jul 12, 2020

hah, mystery solved: https://unix.stackexchange.com/a/401325

@flokli
Copy link
Contributor

flokli commented Jul 12, 2020

So /dev/watchdog and /dev/watchdog0 should both be a fine default.

@flokli flokli merged commit 94dc0c0 into NixOS:master Jul 12, 2020
@mdlayher
Copy link
Member Author

Makes sense to me, thanks for the review and merge!

@mdlayher mdlayher deleted the mdl-systemd-watchdog branch July 12, 2020 12:27
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

2 participants