Can someone with serial console access try NixOS kernel on Librem 5?

To test the kernel, I recommend to start with uuu.

This script will boot a given kernel: https://source.puri.sm/Librem5/librem5-devkit-tools/-/blob/pureos/byzantium/uuu_scripts/boot_librem5.lst

I appreciate you take the time to reply, but from my original message it should be quite obvious that I am using uuu.

In the mean time I’ve discovered that the Linux kernel source from https://source.puri.sm/Librem5/linux does produce a booting kernel so some essential code seems not available in upstream.

I’m trying to build a module-less variant to boot NixOS with.

With “build Jumpdrive”, you also mean the kernel? If yes, I assume you we not using upstream kernel as your source?

Oh, sorry. I only looked at the most recent message. Anyway, I think you know as much as I do now.

1 Like

Yes

Correct. git cloned from something on source.puri.sm

1 Like

I’ve managed to get NixOS running on the Librem 5 with a kernel build from https://source.puri.sm/Librem5/linux.git

Biggest issue atm is that I do not have sound in calls due to callaudiod segfaulting.

One of the minor issues that I have to run mkimage by hand to update /boot/boot.scr on configuration changes, to to boot into a new NixOS environment. It seems Purism u-boot does not support u-boot’s Generic Distro Configuration Concept which supports /boot/extlinux/ extlinux.conf: https://u-boot.readthedocs.io/en/latest/develop/distro.html

The part in /etc/nixos/configuration.nix that builds the Purism kernel is:

boot = {
    initrd = {
        kernelModules                       = [ "bq25891_charger" "dwc3" "imx_dcss" "imx_sdma" "mtdblock" "ofpart" "phy_fsl_imx8mq_usb" "snvs_pwrkey" "spi_nor" "tps6598x" "xhci_hcd" "usbcore" "usb_storage" "uas" "xhci_plat_hcd" ];
    };
    kernelParams                            = [ "console=tty0" "earlyprintk=vga" "ignore_loglevel" "rootwait" ];
    loader = {
        generic-extlinux-compatible.enable  =  true;
        grub.enable                         =  false;
    };
    kernelPackages = let
        linux_librem5_pkg = { fetchgit, buildLinux, ... } @ args:
            buildLinux (args // rec {
                defconfig = "librem5_defconfig";
                version = "6.1.6-librem5";
                modDirVersion = version;
                src = fetchgit {
                    url = "https://source.puri.sm/Librem5/linux.git";
                    hash = "sha256-EE6WHqgBmoRuZnbCPO3NrydOHPxG8G7lZXxDNm/2Kq4=";
                };
                kernelPatches = [];
            } // (args.argsOverride or {}));
            linux_librem5 = pkgs.callPackage linux_librem5_pkg{};
        in
            pkgs.recurseIntoAttrs (pkgs.linuxPackagesFor linux_librem5);
};
3 Likes

Perhaps this merge request may be of interest to you:

If it is we can share here how to install it.

2 Likes

Also do you have the mandatory screenshot of it running NixOS :slight_smile:

:scream:
That seems exactly what is needed! Please share :blush:

Will create :yum:

Well…

On a debian based system…

You would download the .deb package from here;

  1. https://source.puri.sm/a-wai/uboot-imx/-/jobs/405334/artifacts/raw/debian/output/u-boot-librem5_2022.10-librem5.1_arm64.deb

install it with:

sudo apt install ./u-boot-librem5_2022.10-librem5.1_arm64.deb

then run sudo u-boot-install-librem5 /dev/mmcblk0

1 Like

But maybe @angus.ainslie can assist with how to do this on a non PureOS system ^^.

$ curl -LOC - https://source.puri.sm/a-wai/uboot-imx/-/jobs/405334/artifacts/raw/debian/output/u-boot-librem5_2022.10-librem5.1_arm64.deb
$ ar -x u-boot-librem5_2022.10-librem5.1_arm64.deb
$ tar xf data.tar.xz
$ cat usr/bin/u-boot-install-librem5
$ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1024 count=1055 seek=2
$ sudo dd if=usr/lib/u-boot/librem5/u-boot.imx conv=notrunc of=/dev/mmcblk0 bs=1024 seek=33

I’ll need to verify and execute this.

edit: this works, thanks! :partying_face:

3 Likes

I’ve revived my Librem 5 after it has been laying on my desk for months - plugged in once a week to prevent the battery from draining to zero - after a failed u-boot update, and wanted to finally follow up to your request:

[ookhoi@librem5:~]$ nix run -- nixpkgs#screenfetch
          ::::.    ':::::     ::::'           ookhoi@librem5
          ':::::    ':::::.  ::::'            OS: NixOS 24.11.20241001.e277415 (Vicuna)
            :::::     '::::.:::::             Kernel: aarch64 Linux 6.6.52-librem5
      .......:::::..... ::::::::              Uptime: 1h 25m
     ::::::::::::::::::. ::::::    ::::.      Packages: 1306
    ::::::::::::::::::::: :::::.  .::::'      Shell: bash 5.2.32
           .....           ::::' :::::'       Disk: 11G / 30G (38%)
          :::::            '::' :::::'        CPU: Unknown @ 4x 1.5GHz
 ........:::::               ' :::::::::::.   GPU:
:::::::::::::                 :::::::::::::   RAM: 682MiB / 2888MiB
 ::::::::::: ..              :::::
     .::::: .:::            :::::
    .:::::  :::::          '''''    .....
    :::::   ':::::.  ......:::::::::::::'
     :::     ::::::. ':::::::::::::::::'
            .:::::::: '::::::::::
           .::::''::::.     '::::.
          .::::'   ::::.     '::::.
         .::::      ::::      '::::.

Not much installed yet.

5 Likes

I’m curious about your experience so far. Does everything work as much as it does on PureOS? Have you been using it on a daily basis?

1 Like

That would be wild, you gave me a really stupid idea using the dev pinout, a 3D printer and a few other things… Imagine a backplate that gives yiu a serial interface RS-232 (the DB connector that is smaller than the other RS-232 connector (which looked like a centronics parallel port). Techincally doable with the breakout board and pogo pins.

1 Like

…or you could just use the USB-C port:

…or you could use the extension connector:

This one is even available to buy from Purism:

[edit] I missed the implied non-seriousness of your post, but I’ll leave these links here in case other people find them useful :slight_smile:

4 Likes

I think I have a box of male 3 pin ATP connectors somewhere in my attic. They were exclusive to Hewlett Packard for RS-232. About the same size as DB9 connectors but with a squeeze plastic locking mechanism.

2 Likes

I’m afraid I’m not using my Librem 5 at all. It is just too slow and too limited to spark joy.

Sound in calls and the camera don’t work with NixOS. Although I expect both can work with some effort.

All other software available for aarch64 works (currently running gnome).

I do play with the Librem 5 now and then. I’ve just reinstalled on a single partition to see if is feasible, to eliminate the trouble of planning disk layout during installation. And it is:

[ookhoi@librem5:~]$ sudo fdisk -l /dev/mmcblk0
Disk /dev/mmcblk0: 29.12 GiB, 31268536320 bytes, 61071360 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: FCC00EA4-5943-4056-878B-17D8D388CAFA

Device         Start      End  Sectors  Size Type
/dev/mmcblk0p1  4096 61071326 61067231 29.1G Linux filesystem
[ookhoi@librem5:~]$ df -h / /boot/
Filesystem      Size  Used Avail Use% Mounted on
/dev/mmcblk0p1   29G   17G   11G  63% /
/dev/mmcblk0p1   29G   17G   11G  63% /boot

What I dislike most about the Librem 5 is that there is no upstream support. I’m stuck with the ancient kernel versions that Purism provides - currently 6.6.74 - with no prospect that the Librem 5 will ever be a truly libre Linux device.

I am thankful for all Purism has done for Linux on mobile.

How is your experience with PureOS on Librem 5?

edit:

[ookhoi@librem5:~]$ nix run -- nixpkgs#screenfetch
          ::::.    ':::::     ::::'           ookhoi@librem5
          ':::::    ':::::.  ::::'            OS: NixOS 25.05.20250311.b62d2a9 (Warbler)
            :::::     '::::.:::::             Kernel: aarch64 Linux 6.6.74-librem5
      .......:::::..... ::::::::              Uptime: 2h 9m
     ::::::::::::::::::. ::::::    ::::.      Packages: 1442
    ::::::::::::::::::::: :::::.  .::::'      Shell: bash 5.2.37
           .....           ::::' :::::'       Disk: 17G / 29G (63%)
          :::::            '::' :::::'        CPU: ARM Cortex-A53 @ 4x 1.5GHz
 ........:::::               ' :::::::::::.   GPU:
:::::::::::::                 :::::::::::::   RAM: 964MiB / 2890MiB
 ::::::::::: ..              :::::
     .::::: .:::            :::::
    .:::::  :::::          '''''    .....
    :::::   ':::::.  ......:::::::::::::'
     :::     ::::::. ':::::::::::::::::'
            .:::::::: '::::::::::
           .::::''::::.     '::::.
          .::::'   ::::.     '::::.
         .::::      ::::      '::::.
3 Likes

Thanks a lot for the response. It seems like a dealbreaker that calls and camera don’t work on it.

I haven’t used Librem 5 with NixOS, but was considering it. Hence I asked.

Btw, there was a discussion about extending ZRam, which seems to greatly improve responsiveness and performance: Why and how to extend ZRAM on L5. A revolution for Librem 5 stability! - #65 by shak

Maybe you can try that?

1 Like