23.05 upgrade: I still have the 5.x.x kernel !?

Hello,

This is the second time I’m trying to upgrade from 22.11 to 23.05. In the first after rebooting X server just wouldn’t start, but I had the 6.x.x Linux kernel.

Steps I followed now:

  1. sudo nix-channel --list

This step returns the only channel available: nixos https://nixos.org/channels/nixos-22.11

  1. sudo nix-channel --remove nixos

  2. sudo nix-channel --add https://nixos.org/channels/nixos-23.05 nixos

  3. sudo nix-channel --update

  4. sudo nixos-rebuild switch

I just notice that in the upgrade Manual it says that step 4 should be sudo nix-channel --update nixos, not sure why I omitted the “nixos”, but I recal that I had created this upgrade script after my first attempt, and it was based on the Manual.

At the end of the upgrade, which suprisingly didn’t fail, but I could see some collision warnings, and also a systemd related warning that I’m attaching. I’m attaching also the output of neofetch that shows that I’m still using the 5.x.x Linux Kernel.

The ERROR in text:

warning: the following units failed: systemd-oomd.socket

× systemd-oomd.socket - Userspace Out-Of-Memory (OOM) Killer Socket
     Loaded: loaded (/etc/systemd/system/systemd-oomd.socket; linked; preset: enabled)
     Active: failed (Result: trigger-limit-hit) since Fri 2023-06-30 08:18:55 CEST; 12s ago
   Duration: 4d 7h 6min 57.024s
   Triggers: ● systemd-oomd.service
  Condition: start condition failed at Fri 2023-06-30 08:18:58 CEST; 10s ago
             └─ ConditionControlGroupController=memory was not met
       Docs: man:systemd-oomd.service(8)
     Listen: /run/systemd/oom/io.system.ManagedOOM (Stream)

Jun 26 01:11:58 pi systemd[1]: Listening on Userspace Out-Of-Memory (OOM) Killer Socket.
Jun 30 08:18:55 pi systemd[1]: systemd-oomd.socket: Trigger limit hit, refusing further activation.
Jun 30 08:18:55 pi systemd[1]: systemd-oomd.socket: Failed with result 'trigger-limit-hit'.
Jun 30 08:18:58 pi systemd[1]: Userspace Out-Of-Memory (OOM) Killer Socket was skipped because of an unmet condition check (ConditionControlGroupController=memory).
warning: error(s) occurred while switching to the new configuration

Any pointers on where exactly I blundered? If necessary I can share my configuration.nix file in a pastebin.

Thank you very much for the community and for this lovely OS.

Mike

ps: I’m afraid rebooting because X might not start. But I understand that at some point I will have to (or it will happen randomly, by a random power cut).

ps2: most likely I’ve used sudo nix-channel --update instead of sudo nix-channel --update nixos because I had found this community comment.

You’re thinking about a couple of different red herrings, to start. 1) sudo nix-channel --update just means to update every channel the user has, so omitting the nixos argument doesn’t matter. 2) The systemd-oomd error is an issue with the rpi kernel. To fix it, you can add cgroup_enable=memory to your kernel params.

As for why you’re still on linux 5.15, I don’t exactly understand the text of your post.

So you did have linux 6.x at some point? What did you do that made it go back?

I’m also noticing that in your screenshot where you showed your systemd-oomd error, it looks like you did nixos-rebuild switch after a major update. This is fine, though it’s perhaps preferable to use nixos-rebuild boot and then reboot when it comes to major updates. But the point I’m getting at here is that it looks like you started debugging right after a nixos-rebuild switch to the new version before rebooting? In this scenario, the kernel hasn’t updated yet, so neofetch would still say the old kernel version. A reboot has to happen before the kernel will appear updated.

Hi,

Thanks for the reply it’s much appreciated.

Regarding the system-oomd error I’ll try following your suggestion.

So you did have linux 6.x at some point? What did you do that made it go back?

Yes. I had 6.x.x kernel when I tried the major upgrade for the first time. I then reverted back to 22.11 because I couldn’t get X work in 23.05 at that time. Having a “deprecated” NixOS seemed preferable than banging my head over an X-server crashing issue and blocking me from using the system…

But the point I’m getting at here is that it looks like you started debugging right after a nixos-rebuild switch to the new version before rebooting?

I don’t really understand the question…I followed the steps 1-5. If those did a major update, then yes, you’re right. I changed the channel from 22.11 to 23.05 intending to do a major upgrade without rebooting, so that I might avoid the X-server issue…

I guess I’ll have to reboot either way, and then most likely revert to 22.11 again (if things go south) :expressionless:

Unfortunately it doesn’t work that way. While Linux can boot into another kernel while running using kexec in theory, and NixOS can use this mechanism for installing over an existing Linux installation, this is basically the same as rebooting, so your X server would have to restart as well.

You can however install the latest 5.x kernel even on 23.05:

boot.kernelPackages = pkgs.linuxKernel.kernels.linux_5_15;

See also the boot.kernelPackages option, the list of linux kernels in 23.05 and the Linux Kernel section in the NixOS manual.

3 Likes

Aren’t you missing the “–upgrade” switch on the nixos-rebuild?

This is how I do it:

  • sudo nix-channel --add https://nixos.org/channels/nixos-23.05 nixos
  • sudo nix-channel --update
  • sudo nixos-rebuild boot --upgrade

@Buck That’s redundant. The --upgrade flag for nixos-rebuild is a shorthand for doing nix-channel --update nixos first.

1 Like

Hello,

Thank you very much for the explanation.

It seems that after all it was my mistake, I was indeed using a Tarball (what an ugly workaround…) that contained the 5.x.x kernel. So this is why.

It seems to me that X-server works fine with the 5.x.x kernel plus the 23.05 channel, so I’ll try using this and see how far it goes.

I know it’s still a temporary solution, but it seems that with the raspberryPi NixOS/nixos-hardware/ files, using a tarball like the following is the most compact (but also ugly) way to set up the kernel in the configuration.nix file:

{ config, pkgs, lib, ... }:

  let
    user = "milia";
    password = <PASSWD>;
    hostname = "pi";
  in 
  {
    ## Boot information, and kernel version
    imports = ["${fetchTarball "https://github.com/NixOS/nixos-hardware/archive/4cc688ee711159b9bcb5a367be44007934e1a49d.tar.gz" }/raspberry-pi/4"]; # Since 23.05
    #imports  = ["${fetchTarball "https://github.com/NixOS/nixos-hardware/archive/936e4649098d6a5e0762058cb7687be1b2d90550.tar.gz" }/raspberry-pi/4"]; # Since 21.11

    system.stateVersion = "22.11"; #"21.11"; # Did you read the comment?

...

I’ll surely check the documentation shared as I want to understand better how things work and perhaps find a more elegant solution like the boot.kernelPackages = pkgs.linuxKernel.kernels.linux_5_15;.

I’ll pick this answer as the solution to my original question, as it’s closer to what I was looking for. Thanks.

Do yourself a favour here and set up nixos-hardware the way they recommend in the README. Either via an additional channel or using flakes (note that the latter is still considered unstable).

2 Likes

Thanks.

From what I can see the fetchTarball is one of the suggested methods in the README.

I tried the cleaner method:

imports = [
   <nixos-hardware/raspberry-pi/4>
  ./hardware-configuration.nix
];

but it doesn’t work without the hardware-configuration.nix file…

No, it’s not. fetchTarball is not mentioned a single time in the README.

What do you mean by “it doesn’t work”? Please be more precise when asking questions, just saying “it doesn’t work” makes it much harder for us to understand your problem.

Did you add the channel as the readme explains?

What does nix-channel --update && nix-channel --list retun?

No, it’s not.

You’re right. I confused fetchGit with fetchTarball.

What do you mean by “it doesn’t work”? Please be more precise when asking questions, just saying “it doesn’t work” makes it much harder for us to understand your problem.

Did you add the channel as the readme explains?

Kindly refer to my initial post that is rather precise.

What does nix-channel --update && nix-channel --list retun?

Now it returns the 22.11 and nixos-hardware channels, because I had to backtrack to the deprecated version in order to be able to work.

Anyhow, I’ll follow in the future the README suggestions when I feel adventurous enough.

Consider this ticket resolved and feel free to close it.

Thank you.