FS#46591 - [linux-firmware] microcode reload via tmpfiles.d fails in container

Attached to Project: Arch Linux
Opened by Johannes Ernst (jernst) - Wednesday, 07 October 2015, 03:00 GMT
Last edited by Laurent Carlier (lordheavy) - Monday, 26 June 2023, 13:55 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Laurent Carlier (lordheavy)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

The PKGBUILD file contains this:

echo 'w /sys/devices/system/cpu/microcode/reload - - - - 1' \
>"${pkgdir}/usr/lib/tmpfiles.d/${pkgname}.conf"

which works fine on a regular physical box, but not in a Linux container. There's a thread here [1] on the systemd-devel list discussing this.

Error message:

Failed to create file /sys/devices/system/cpu/microcode/reload: Read-only file system

Perhaps the way to fix this is to have a separate systemd.service for this (instead of wedging it into tmpfiles)) which is conditional on not running in a container (using key word ConditionVirtualization per [2])

[1] http://lists.freedesktop.org/archives/systemd-devel/2015-July/033371.html
[2] man systemd.unit

This task depends upon

Closed by  Laurent Carlier (lordheavy)
Monday, 26 June 2023, 13:55 GMT
Reason for closing:  Implemented
Additional comments about closing:  linux-firmware-20230625.ee91452d-1
Comment by Evangelos Foutras (foutrelis) - Wednesday, 07 October 2015, 23:59 GMT
If the container booted its own kernel, it would be a reasonable requirement to have a writable /sys.

Since you're using systemd-nspawn, you don't need to have a kernel installed in the container; simply remove the linux and linux-firmware packages ('pacman -Rs linux' should get rid of all unneeded packages).
Comment by nl6720 (nl6720) - Wednesday, 22 June 2022, 11:56 GMT
Linux 5.19 will not have /sys/devices/system/cpu/microcode/reload unless MICROCODE_LATE_LOADING (renamed from MICROCODE_OLD_INTERFACE) is enabled. Upstream considers late loading dangerous so /usr/lib/tmpfiles.d/linux-firmware.conf should be removed.

See https://git.kernel.org/torvalds/c/9784edd73a08ea08d0ce5606e1f0f729df688c59 .
Comment by nl6720 (nl6720) - Tuesday, 16 August 2022, 10:34 GMT
With linux 5.19.1.arch2-1 in core, /sys/devices/system/cpu/microcode/reload is gone as predicted. /usr/lib/tmpfiles.d/linux-firmware.conf is now entirely useless.

Loading...