NixOS on ARM/Raspberry Pi 3: Difference between revisions

imported>Justinas
No edit summary
imported>Motiejusj
HDMI output fully works with least 6.1.45 (nixos 23.05 as of writing), so these old workarounds are no longer necessary.
Line 242: Line 242:
See {{issue|66960}}.
See {{issue|66960}}.


=== HDMI output issue with kernel 5.4 (NixOS 20.03 or NixOS unstable) ===
=== HDMI output issue with kernel ~6.1 (NixOS 23.05 or NixOS unstable) ===


(Unverified for 5.5 or 5.6)
When using HDMI and hardware acceleration (e.g. Kodi), an application may fail to start and/or crash with a dmesg like:


Some users have reported that the 5.4 kernel "hung at Starting kernel..." {{issue|82455}}. In all cases where it was possible to investigate, it was found that the device did boot, but that the HDMI out didn't function as expected.
<pre>
[232195.380745] [drm:vc4_bo_create [vc4]] *ERROR* Failed to allocate from CMA:
[232195.380751] [drm]                        kernel:    432kb BOs (1)
[232195.380755] [drm]                          dumb:  69064kb BOs (14)


It looks like it may be a setup-dependent issue, as a 20.03 image with 5.4 was verified as working.
[306160.152488] cma: cma_alloc: alloc failed, req-size: 142 pages, ret: -16
[306160.152498] [vc_sm_cma_ioctl_alloc]: dma_alloc_coherent alloc of 581632 bytes failed
[306160.152501] [vc_sm_cma_ioctl_alloc]: something failed - cleanup. ret -12
[317686.623989] [drm:vc4_bo_create [vc4]] *ERROR* Failed to allocate from CMA:
[317686.623998] [drm]                          dumb:  74752kb BOs (16)
</pre>


If your setup is having the issue, first report on {{issue|82455}} with the Raspberry Pi model (important to note whether it is a plus or non-plus) and the kind of display used with the HDMI out, including whether it is using adapters or not.
A workaround is to increase the pre-allocated CMA space (which, as of writing, defaults to 65M):


Then, you can work around the issue by configuring your system to use the 4.19 kernel (previous LTS) using one of the following tricks.
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
 
{ config, pkgs, lib, ... }:
# Use the serial console to configure the system, and <code>nixos-rebuild boot</code> it.
# Use a 19.09 image, specify the kernel in its configuration and upgrade to 20.03
# Boot the image, poweroff blindly using a keyboard, edit on another computer <code>/home/nixos/.ssh/authorized_keys</code> from the SD to add your key file, chmod as 600, unmount, boot the Raspberry Pi and find it on your network by some means.
 
<syntaxHighlight>
{
{
   boot.kernelPackages = pkgs.linuxPackages_4_19;
   boot.kernelParams = ["cma=320M"];
}
}
</syntaxHighlight>
</nowiki>}}
 
===Additional Troubleshooting===
 
Additional troubleshooting information may be found [https://elinux.org/R-Pi_Troubleshooting at elinux.org].
 
<hr />