How to see why my machine powered off?

I have a low-power mini-pc which I’m installing NixOS on for various uses. To cut a long story short, I’m fairly happy except for the fact that the system seems to power itself off eventually. I can see from journalctl -k -b -1 that it was up for a few days, but I don’t see a reason listed for it to power off.

I’m on the unstable channel.

I’ve seen some discussion that Desktop Managers can be responsible for this. KDE Plasma is my favoured desktop manager as I use it on my work laptop. I’m looking to reformat my work laptop, and considering using NixOS for it. I see no option to disable this in the NixOS plasma5 options. I’ve searched fairly extensively and tried following various pieces of advice to resolve the issue. I have added the following to my config:

  boot.loader.systemd-boot.enable = true;
  systemd.targets.sleep.enable = false;
  systemd.targets.suspend.enable = false;
  systemd.targets.hibernate.enable = false;
  systemd.targets.hybrid-sleep.enable = false;

After that, I no longer see the machine going into a hibernate state.

I’ve seen some entries like this in the past:

Nov 02 17:05:39 nixos systemd-shutdown[1]: Using hardware watchdog 'SP5100 TCO timer', version 0, device /dev/watchdog0
Nov 02 17:05:39 nixos systemd-shutdown[1]: Watchdog running with a timeout of 10min.
Nov 02 17:05:39 nixos systemd-shutdown[1]: Syncing filesystems and block devices.
Nov 02 17:05:39 nixos systemd-shutdown[1]: Sending SIGTERM to remaining processes...
Nov 02 17:05:39 nixos systemd-journald[653]: Received SIGTERM from PID 1 (systemd-shutdow).

This didn’t happen the last time my machine powered-off, however. The last entry I had was a nixos kernel: refused connection: message.

I’m looking to move to Plasma 6 when it’s ready, but for now I’m looking to see if I can get NixOS running with Plasma 5 set-up just the way I want it.

Share more logs please.

If there’s really nothing, much more likely to be hardware failure. I’ve had bad PSUs cause these symptoms.

I see.

Wouldn’t that cause a message on the next boot to appear in the logs again? Some sort of disk check? Would I need to enable/install that somehow?

I’ve been running a mini PC for a few months and once found it totally locked up and too hot to touch, with nothing notable in the logs. I’ve since added temperature logging, though I suspect the heat was a consequence of the lockup and not the cause.