jirutka / akms

Alpine Kernel Module Support – aka DKMS for Alpine Linux
MIT License
30 stars 2 forks source link

akms and diskless alpine installs? #15

Open DavyLandman opened 2 months ago

DavyLandman commented 2 months ago

Is there any guidance on how to use akms with diskless alpine installs?

I managed to compile the kernel module, but now it does t want to install into /lib/modules/../kernel/extra because it's read-only.

but I'm feeling like maybe if I did something magical, I could get that to work as well. Like make a package out of it, and have that add to the file system?

here is the console log:

server-home-1:/usr/src/realtek-r8125-dkms$ doas akms build -v realtek-r8125-dkms
akms: Building module r8125/9.013.02-1 for kernel 6.6.50-0-lts
akms: Mounting overlay in /tmp/akms/1725919110/overlay
akms: Installing dependencies (in overlay): linux-lts-dev=6.6.50-r0 build-base bash
(1/16) Installing jansson (2.14-r4)
(2/16) Installing binutils (2.42-r0)
(3/16) Installing libmagic (5.45-r1)
(4/16) Installing file (5.45-r1)
(5/16) Installing libgomp (13.2.1_git20240309-r0)
(6/16) Installing libatomic (13.2.1_git20240309-r0)
(7/16) Installing isl26 (0.26-r1)
(8/16) Installing gcc (13.2.1_git20240309-r0)
(9/16) Installing libstdc++-dev (13.2.1_git20240309-r0)
(10/16) Installing musl-dev (1.2.5-r0)
(11/16) Installing g++ (13.2.1_git20240309-r0)
(12/16) Installing make (4.4.1-r2)
(13/16) Installing fortify-headers (1.1-r3)
(14/16) Installing patch (2.7.6-r10)
(15/16) Installing build-base (0.5-r3)
(16/16) Installing .akms-build (20240909.215831)
OK: 525 MiB in 192 packages
/bin/sh: VER: not found
make -C src/ KVER=6.6.50-0-lts BASEDIR=/usr/src/linux-headers-6.6.50-0-lts modules
make[1]: Entering directory '/var/lib/akms/6.6.50-0-lts/r8125/9.013.02-1/build/src'
make -C /usr/src/linux-headers-6.6.50-0-lts M=/var/lib/akms/6.6.50-0-lts/r8125/9.013.02-1/build/src modules
make[2]: Entering directory '/usr/src/linux-headers-6.6.50-0-lts'
  CC [M]  /var/lib/akms/6.6.50-0-lts/r8125/9.013.02-1/build/src/r8125_n.o
  CC [M]  /var/lib/akms/6.6.50-0-lts/r8125/9.013.02-1/build/src/rtl_eeprom.o
  CC [M]  /var/lib/akms/6.6.50-0-lts/r8125/9.013.02-1/build/src/rtltool.o
  LD [M]  /var/lib/akms/6.6.50-0-lts/r8125/9.013.02-1/build/src/r8125.o
  MODPOST /var/lib/akms/6.6.50-0-lts/r8125/9.013.02-1/build/src/Module.symvers
  CC [M]  /var/lib/akms/6.6.50-0-lts/r8125/9.013.02-1/build/src/r8125.mod.o
  LD [M]  /var/lib/akms/6.6.50-0-lts/r8125/9.013.02-1/build/src/r8125.ko
  BTF [M] /var/lib/akms/6.6.50-0-lts/r8125/9.013.02-1/build/src/r8125.ko
Skipping BTF generation for /var/lib/akms/6.6.50-0-lts/r8125/9.013.02-1/build/src/r8125.ko due to unavailability of vmlinux
make[2]: Leaving directory '/usr/src/linux-headers-6.6.50-0-lts'
make[1]: Leaving directory '/var/lib/akms/6.6.50-0-lts/r8125/9.013.02-1/build/src'
akms: Module r8125/9.013.02-1 for 6.6.50-0-lts is built successfully
akms: Unmounting root overlay /tmp/akms/1725919110/overlay
server-home-1:/usr/src/realtek-r8125-dkms$ doas akms install realtek-r8125-dkms
akms: Installing module r8125 9.013.02-1 for kernel 6.6.50-0-lts
install: can't create directory '/lib/modules/6.6.50-0-lts/kernel/extra/': Read-only file system
install: can't create '/lib/modules/6.6.50-0-lts/kernel/extra/akms/r8125.ko': No such file or directory
Ikke commented 1 month ago

There is logic in the modloop service to automatically setup an overlayfs for /lib/modules. This logic depends on:

  1. overlayfs be available in /proc/filesystems
  2. The overlay_size variable not being empty

For 2, it's set to 0 by default, which means it should allow up to 50% of memory, so that should be fine. So maybe overlayfs needs to be added to the modules= kernel argument to make sure it's loaded at boot.

In any case, to try you could modprobe overlayfs and restart the modloop service and see if it sets up the overlay.

DavyLandman commented 1 month ago

Hi @Ikke thanks, hmm, yeah, that sounds logical.

Fun story, after all that work in getting that r8125 driver to compile and load (which was the manufactors recommendation for slow network speeds) I figured out that I was using the wrong cable. After switching that cable out, I got normal speeds again. 🤦🏼

In the process of getting to that point, I've also switched away from diskless to regular sys install, so I cannot try this out without breaking a working setup.

I'll leave it up to you / @jirutka if you want to leave this open as a reminder to maybe add a section to the readme, or prefer to close the issue.