How to install realtime kernel in Trisquel?

25 replies [Last post]
Tshiong
Offline
Joined: 08/20/2023

Hi all!

I'm trying to install a realtime kernel in Trisquel 11, because I do a lot of live music work on my system and the low latency patches reduce dropouts a lot.

I've searched the forum, but most topics on this were rather old. There actually seems to be a realtime kernel in the repository:
https://archive.trisquel.org/trisquel/pool/main/l/linux-realtime/

However, I've been unsuccessful in trying to install it, so far, apt for me only finds "linux-realtime-headers" and "linux-realtime-tools", but not the kernel itself.

Is this even a full kernel? And if so, how can I install it?

Thanks! :)

andyprough
Offline
Joined: 02/12/2015

liberty is a realtime linux-libre kernel: https://www.fsfla.org/ikiwiki/selibre/linux-libre/liberty.en.html

It's maintained by our very own @jxself.

Tshiong
Offline
Joined: 08/20/2023

Hey, that's good to know. I'll definitely look into it.

I'd much prefer though if it was in the main repository.

In the meantime, I found through an apt search that there is a package named "linux-image-unsigned-5.15.0-1032-realtime", which apparently installs a kernel. It seems to be the one from the archive, but I'm not completely sure.

Is there anything wrong with using that package?

andyprough
Offline
Joined: 02/12/2015

>"I found through an apt search that there is a package named "linux-image-unsigned-5.15.0-1032-realtime", which apparently installs a kernel"

I tried installing it today, and it would boot up but wouldn't give me an Xorg session.

I also tried jxself's and apt is complaining about lack of a release file.

So I hope you have better luck than I did.

jxself
Offline
Joined: 09/13/2010

> I also tried jxself's and apt is complaining about lack of a release file.

That seems concerning, because it does exist - https://linux-libre.fsfla.org/pub/linux-libre/liberty/dists/liberty/Release

andyprough
Offline
Joined: 02/12/2015

I don't know, I'm not good with troubleshooting repos. Do you see anything obvious I can do?

$ sudo apt update
Err:1 http://linux-libre.fsfla.org/pub/linux-libre/liberty/mirrors.txt Mirrorlist
404 Not Found [IP: 2001:470:142:5::54 80]
Ign:2 mirror://linux-libre.fsfla.org/pub/linux-libre/liberty/mirrors.txt liberty InRelease
Err:3 mirror://linux-libre.fsfla.org/pub/linux-libre/liberty/mirrors.txt liberty Release
Downloading mirror file failed
Hit:4 https://archive.trisquel.info/trisquel aramo InRelease
Hit:5 https://archive.trisquel.info/trisquel aramo-security InRelease
Hit:6 https://archive.trisquel.info/trisquel aramo-updates InRelease
Hit:7 https://archive.trisquel.info/trisquel aramo-backports InRelease
Reading package lists... Done
E: The repository 'mirror://linux-libre.fsfla.org/pub/linux-libre/liberty/mirrors.txt liberty Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

jxself
Offline
Joined: 09/13/2010

$ sudo apt update
Err:1 http://linux-libre.fsfla.org/pub/linux-libre/liberty/mirrors.txt Mirrorlist
404 Not Found [IP: 2001:470:142:5::54 80]

That's the actual problem - The mirrors.txt file isn't there. I've put it back and everything should be fine now. It seems concerning that no one mentioned it until now...

andyprough
Offline
Joined: 02/12/2015

OK great, that fixes the apt update problem, but when I try to install the realtime kernel and headers I get a missing dependency error for the linux-image-6.1.46-rt13-gnu package:

The following packages have unmet dependencies:
linux-libre-rt : Depends: linux-image-6.1.46-rt13-gnu but it is not installable
linux-libre-rt-headers : Depends: linux-image-6.1.46-rt13-gnu but it is not installable
Depends: linux-headers-6.1.46-rt13-gnu but it is not installable

I tried specifying the fsfla mirror instead of the cedia.org one that was being auto-selected, but still getting the same missing dependency error.

I see that there are packages in http://linux-libre.fsfla.org/pub/linux-libre/liberty/pool/main/l/linux-libre/ with slightly different names:
linux-image-6.1.46-gnu-rt13_6.1.46-rt13-gnu-1.0_amd64.deb
linux-headers-6.1.46-gnu-rt13_6.1.46-rt13-gnu-1.0_amd64.deb

Maybe the "rt13-gnu" got reversed somewhere? Those package names look a little odd to me, the '6.1.46-gnu-rt13' is being repeated in different ways. As I say, I don't know enough about repos to understand, I may not even be looking in the correct directory.

jxself
Offline
Joined: 09/13/2010

Thank you. I believe I've addressed the underlying matter and pushed an the update to the main server on fsfla.org along with the updated 6.1.47 that came out today. The mirrors should sync up in a day or so.

andyprough
Offline
Joined: 02/12/2015

OK I was able to install the realtime kernel from the fsfla repo, but the headers won't install:

The following packages have unmet dependencies:
linux-libre-rt-headers : Depends: linux-headers-6.1.47-rt13-gnu but it is not installable

I'm using repo https://linux-libre.fsfla.org/pub/linux-libre/liberty/
Maybe if I give it a couple of days it will populate with the dependency.

The kernel is impressive - I thought that with it being so new it might cause trouble on my older laptop, but its doing everything correctly so far and seems quite zippy.

Edit: I gave it a few days but apt is still throwing up the unmet dependency error for the headers. The kernel still runs well though.

jxself
Offline
Joined: 09/13/2010

This had slipped my mind but it should be working now along with the new version 6.1.48. At least on the main server; the mirror should sync up over the next day or so.

andyprough
Offline
Joined: 02/12/2015

OK, seems like it's very close now, the linux-libre-rt kernel updated successfully to version 6.1.48, but now there's a new dependency issue with the headers package:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
linux-libc-dev : Conflicts: linux-kernel-headers
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.

prospero
Offline
Joined: 05/20/2022

> you have requested an impossible situation

You have let the real-time cat into the kernel, it is now dead and alive at once. But at least this seems to be the low-latency kernel we have been looking for:

"The Low-Latency Kernel [...] does contain other optimizations, such as Preempt-RT being enabled in the kernel configuration to achieve the lowest possible latency for audio and other applications, while keeping the user interface usable. Latency as low as 0.1 millisecond can and has been achieved using this kernel."

"LibeRTy is a sub-project that contains .debs of Linux-libre compiled with the PREEMPT_RT patch for realtime operation on 32- and 64-bit x86 CPUs".

andyprough
Offline
Joined: 02/12/2015

That cat has been in a box with a bottle of poison, a radioactive source and a hammer for the past 88 years now. I think we can determine with quite a bit of certainly that the cat is dead now.

prospero
Offline
Joined: 05/20/2022

Sure. Certainly dead, and certainly alive.

UPDATE: LibeRTy *is* in fact the liberated version of the "hard" real-time Linux kernel.

"Preempt-RT" being enabled in the low-latency kernel configuration is not enough to keep the cat live.

jxself
Offline
Joined: 09/13/2010

That's coming from Trisquel's own linux-libc-dev package, which contains:

Conflicts: linux-kernel-headers
Replaces: linux-kernel-headers

So it won't let you have both installed at the same time. Keep in mind you only need kernel headers in a very specific case: You'll need to install the kernel headers when you're planning to compile a new kernel module, such as a device driver that's not already included in the kernel.

andyprough
Offline
Joined: 02/12/2015

OK sounds great, and the kernel is running well. So the final answer to the OP's question is to install your realtime kernel, because with the other "linux-image-unsigned-5.15.0-1032-realtime" package in the Trisquel repo I was not able to get to an X session.

prospero
Offline
Joined: 05/20/2022

> the other "linux-image-unsigned-5.15.0-1032-realtime" package in the Trisquel repo I was not able to get to an X session.

This looks pretty much like the "hard realtime" or "ultra-low latency" kernel we are *not* looking for, except possibly for flight control systems.

Or maybe not.

prospero
Offline
Joined: 05/20/2022

> with the other "linux-image-unsigned-5.15.0-1032-realtime" package in the Trisquel repo I was not able to get to an X session.

By the way, I can find lowlatency kernels in the Trisquel repo, but no such realtime kernel. Where did you dig out that highly unusual package?

Magic Banana

I am a member!

I am a translator!

Offline
Joined: 07/24/2010

I am pretty sure "realtime" and "lowlatency" are not synonymous. You want "lowlatency", which is simply the regular Linux(-libre) configured in a different way (before compilation). Ubuntu 22.04's configuration of its lowlatency kernel is attached. I found it in https://packages.ubuntu.com/jammy-updates/amd64/linux-buildinfo-5.15.0-79-lowlatency/download and I guess you could use it to compile Linux-libre.

AttachmentSize
config.txt 255.87 KB
prospero
Offline
Joined: 05/20/2022

Reading this, I first confused "realtime" with "live" - or whatever it is called when you can apply updates without having to reboot. After clearing that confusion, it appears that real time kernels have indeed very specific targets like automation, avionics or medical equipments. This is sometimes called "ultra-low latency".

Furthermore, "for desktop computer usage, using a real-time kernel can cause security nightmares. The low-latency kernel included in Ubuntu Studio is completely capable of low- to no- latency while not enabling malicious processes to lock-out a user from their computer."
https://help.ubuntu.com/community/UbuntuStudio/RealTimeKernel

Avron

I am a translator!

Offline
Joined: 08/18/2020

In my very short career as a programmer, I worked on a (non-free) unix system with the option of absolute priorities. A task to handle network messages had an absolute priority higher than terminals. When the test team submitted to the machine the highest message rate they could and complained that their terminal did not respond, we told them that it was the expected behaviour, the machine had more important things to do than handle their terminal.

We also had the issue of running out of memory although we were freeing it, we guessed that some kind of garbage collection task had a lower priority and was never scheduled. We solved the problem by running our own memory management (we allocate a fixed chunk of memory at the begining and never allocated anything later).

I would not necessarily describe "real-time kernel" as a source of security problems but it forces you to be careful about everything as tasks can block each other permanently. This indeed looks not suitable for desktop computer usage.

Tshiong
Offline
Joined: 08/20/2023

This topic does come up on occasion when the kernel is mentioned.

I was indeed concerned with the PREEMPT-RT kernel, a.k.a. "linux-rt" and not the Ubuntu "lowlatency" substitute.

The reason is that for audio work, the actual realtime kernel has substantially better performance than any other kernel, including Ubuntu lowlatency. I believe only the Zen/Liquorix kernels come close, but I personally haven't tested those, I can however anecdotally vouch for linux-rt. There are some benchmarks online, but I don't have the link at hand.

I believe that there may be valid concerns for using that kernel on a general system, but for a specific workload (live audio monitoring), it's adequate and I have used it for years without any issues.

prospero
Offline
Joined: 05/20/2022

Yes, I was having a hard time trying to determine what the differences are exactly, but live musicians have indeed been mentioned in several discussions as "hard" realtime kernel users, including by one of the realtime kernel maintainers.

So the general rule may be: if you are not sure what this is about, you do not need it and should probably not use it, but if the latency of the kernel you are currently using is hardly acceptable for your needs, then this may be worth giving a try.

Thanks for confirming this is indeed what you were looking for, and for sharing your experience with us.

andyprough
Offline
Joined: 02/12/2015

>"I was indeed concerned with the PREEMPT-RT kernel, a.k.a. "linux-rt" and not the Ubuntu "lowlatency" substitute."

OK, just so it doesn't get lost in the bowels of the comment thread, @jxself's rt kernel at https://www.fsfla.org/ikiwiki/selibre/linux-libre/liberty.en.html does work with Trisquel 11.

Can we consider this thread "solved"?

prospero
Offline
Joined: 05/20/2022

We must not be hasty, lest we get lost in the bowels.