NixOS reboot after first start of the day

In the evening I turn off my computers (cut the power) and the next morning when I restart NixOS it reboots after about 4 minutes and then if I reboot during the day no problem.
Problem only at the first start in the morning.

➜ systemd-analyze
Startup finished in 12.519s (firmware) + 4.498s (loader) + 2.595s (kernel) + 4min 21.865s (userspace) = 4min 41.478s
graphical.target reached after 6.468s in userspace.

What takes 4min 21.865s minutes is my 4TB external drive.

Hm, if you literally just yank the power then maybe ext4 is taking a while to restore the filesystem or such. Have you considered proper shutdown?

To get a clear picture, can you share the output of journalctl --boot after one of these slow boots?

6 Likes

I had to reinstall NixOS and I no longer have disk problems.

I’m having this exact problem and still do not understand the reason.

Soon I’ll be trying a fresh install trying to resolve the issue as @Breizil29 did.

It’d be nice if you could share your logs, maybe we can get to the bottom of why then.

1 Like

When you say “exact problem”, you’re also cutting power without a proper shutdown? If so, have you also considered shutting down in the standard manner?

@TLATER i`ve looked into some of the possible logs in the system and did not find anything useful. Could you specify what kind of logs/procedures would be of interest for me to share in here?

@waffle8946 i`ve been having this problem for a while now and thought it could have something to do with RAM in my system. Anyway, I find it odd because its the exact same as in @Breizil29 account.

My system seems to reboot after some minutes of activity, always only in the first boot of the day. Sometimes it seems to be like if someone had pushed the power button or triggered a reboot in software. Since the shutdown part of the reboot is very fast in my system, i`m not always sure.

I was working around this issue by always rebooting the system in the first boot, since i had no time to try to fix it lately.

If you have any logs in the seconds prior to that first unintentional reboot, that might be helpful.

@waffle8946 @TLATER these are the logs of the last time this happend, today morning:

$ journalctl -b -1 -e

Output in google drive, due to be too long in for this forum: out.txt - Google Drive

Seems like you are running the nixos upgrade service.

abr 14 09:36:35 nixos systemd[1]: Finished NixOS Upgrade.

Then a reboot is scheduled.

From the manual:

This enables a periodically executed systemd service named nixos-upgrade.service. If the allowReboot option is false, it runs nixos-rebuild switch --upgrade to upgrade NixOS to the latest version in the current channel. (To see when the service runs, see systemctl list-timers.) If allowReboot is true, then the system will automatically reboot if the new generation contains a different kernel, initrd or kernel modules. You can also specify a channel explicitly, e.g.

Have you considered disabling this?

3 Likes

I believe this options were burried under my hyprland configs. I’m disabling them now and I’ll check along this week. Thank you very much @bme .

{
  system.autoUpgrade.enable = true;
  system.autoUpgrade.allowReboot = true;
}

P.S. If someone is reading this in the future and I’ve forgot to come back with the results, please mark me so an email notification can remind me.

Hah, I interpreted the original post to mean “the first boot of the day takes 4 minutes”.

2 Likes

As a final thought, removing the auto-update configurations solved my problem. Hope this helps anyone else with the same issues.

2 Likes