Latest

Technology

Lunatik 5 takes Linux to the extreme with Lua inside the kernel itself

Lunatik 5.0 has united Lua and eBPF inside the Linux kernel since October 5. We explain what it enables, its risks and how to test it sensibly.

Lunatik 5 takes Linux to the extreme with Lua inside the kernel itself
Lunatik 5 takes Linux to the extreme with Lua inside the kernel itself

The Linux kernel has learned to speak another language, and in this case it is Lua. Lourival Vieira Neto published Lunatik 5.0 on October 5, 2026, with eBPF inside Lua scripts and a complete overhaul of every module, as stated on the official release page. The idea sounds like science fiction to anyone who does not live among drivers. Writing short programs in a simple language that run inside the very heart of the system, where normally only C code compiled with the utmost care gets in.

To understand the leap, you need to know what each piece does. The kernel is the program that controls the hardware and decides which packet passes, which process runs and which file is touched. eBPF is a technology that lets you inject verified mini programs into hot spots in the kernel without recompiling anything. Lua is a lightweight language famous for finding its way into video games and routers. Lunatik brings them together, because it lets those kernel hooks be governed by readable Lua scripts instead of unwieldy C.

The release arrives with lights and shadows that are worth setting out from the start. It brings eBPF maps, traffic control, custom scheduling and file monitoring, all from a script. But it requires a modern kernel, breaks compatibility with scripts from the 4.4 branch and warns of known bugs that can hang a CPU. Let us break it down calmly, the way you explain a powerful engine before handing over the keys.

What is Lunatik and why does it put Lua in the kernel?

Lunatik is a set of kernel modules that embeds a Lua interpreter adapted to live inside it. It sounds reckless, because the kernel does not forgive mistakes and a bad pointer takes down the whole machine. The project solves this with controlled runtimes, declared execution contexts and a review that in this version closes hangs, leaks and calls that slept where sleeping was forbidden.

The appeal lies in the speed of iteration. Testing an idea in kernel C requires compiling, loading the module and praying before every crash. With Lunatik you write a twenty-line script, load it with its terminal tool and watch what happens live. If something fails, the error comes back as a message instead of taking down the machine, except in the most delicate contexts where the documentation calls for extra caution.

This fifth major version raises the stakes with Lua in its 5.5.1 edition. The language brings external strings, more compact tables and an incremental garbage collector that cuts pauses. These are improvements that matter twice as much inside the kernel, where every microsecond and every kilobyte counts. The project also adds a website with a guide, a reference for each module and the C API, something that was missing to take it seriously outside the lab.

What is new in version 5.0?

The headline feature is the union of eBPF and Lua. The bpf module opens eBPF maps pinned with a constructor for each type, and presents them to the script as tables that can be indexed, assigned and traversed, or as queues with push, pop and peek operations. In practice, your Lua script shares state with eBPF programs at kernel speed. It is the bridge that was missing between the convenience of scripting and the power of the verifier.

Traffic control opens another eye-catching front. With the tc module, an eBPF program calls Lua at the ingress and egress layers of the network stack. The sniclassify example classifies outbound traffic by the server name in the encrypted handshake. Put plainly, your script decides what to do with each connection based on where it intends to go, without copying packets to user space.

Custom scheduling completes the flagship trio. With the scx module, a scheduler extension program calls Lua to decide which task runs on each CPU. Changing the scheduler was until recently the territory of heroic kernel patches. Now it is tested with a script that is loaded and unloaded on the fly.

Related article: Docker Agent, software that turns YAML into AI agents

What is the point of monitoring files and network from a script?

File monitoring arrives with two examples that are immediately clear. The fsnotify module places marks on files, directories and mounts, and delivers their events to a Lua function, including permission events. The fsmonitor example logs what changes in a directory, and execguard refuses to run any program whose name is not on an allowed list. An eight-line guardian defending your favorite binary.

Programmable networking from a script solves classic pain points for carriers and labs. The netlink space speaks the generic protocol in Lua, routes with links, addresses and rules, and wifi with interfaces and access points. The netlink channel emits events to user space from softirq. The linkflap and netfailover examples react when a link goes down and comes back up, switching routes without human intervention.

The dropreason example answers the question every administrator has asked at some point. Why are my packets dying? Instead of hunting blindly with captures, the script asks the kernel itself for the drop reason of each packet. For debugging networks it is like going from guessing to reading the coroner's report.

That means Lunatik shines in observability and rapid reaction. Detecting, classifying and responding without leaving the kernel cuts latencies that in user space would be eternal. And all of it is written in a language a student learns in an afternoon, not in the kernel C that demands years of craft.

What risks and limits should you know about?

Power without a safety net is a broken toy. The authors themselves list known bugs that should be read before loading anything into production. A scheduler function runs with its CPU's runqueue lock held, and there printing to the console or completing certain operations can hang the processor. Each module's documentation flags the first five warnings, and the changelog links each case to its public tracking.

Compatibility also demands attention and an afternoon of migration. Scripts written for the 4.4 branch need the API changes detailed in the release, with hook decisions unified in the return value and idempotent shutdowns with stop and close. Positional booleans disappear in favor of option tables, and several kernel families are reorganized into their own tables. It is not a cosmetic leap, because the new consistency requires reworking old code.

Platform requirements close the door on older machines. Lunatik 5.0 requires Linux 6.6 or later and drops the 5.x branch, leaves out 32-bit ARM due to missing division helpers and requires the running kernel's BTF for the network modules. On kernels 7.1 and later, the cryptographic module only loads if the kernel compiles a random generator user. And be careful about mixing pieces, because you must unload the previous version with its own tool or reboot before installing.

Piece What it enables Caution
eBPF maps Sharing state between eBPF and Lua Requires the running kernel's BTF
Traffic control Deciding per connection on ingress and egress A mistake affects all your traffic
Scheduler Testing your own policies on the fly Can hang the CPU if it blocks
fsnotify and execguard Monitoring and allowing only what is listed Define the list well before enabling
Netlink in Lua Routes and wifi from a script Network changes with immediate effect
Compiled bytecode Loading precompiled code Compile with the same configuration

The lesson is the usual one with the kernel, because here experiments are done on a test machine. A virtual machine with a snapshot, a kernel with kdump and scripts reviewed line by line. Speed of iteration does not excuse discipline, it demands it.

Related article: OpenAI halts its top models after DNS leak and 53 photos

How to start testing it sensibly?

The first step is to check the ground before compiling anything. Confirm that your kernel is 6.6 or later, that you have its headers and that BTF is available if you want to play with networking. Clone the repository, compile with your kernel's configuration and load the driver with its tool. The typical beginner's mistake is mixing the new tool with the old driver, and the system tells you so with a clear message about a mismatched build.

Then comes the kernel hello world with a safety net. Start with the read-only examples, such as the one that asks for drop reasons or the one that monitors a test directory. Read each example in full before loading it, understand which hook it registers and how it stops. Practice the full cycle of loading, observing and stopping until you can do it without looking at the cheat sheet.

Once you have mastered the cycle, take it up a notch with the active examples. The execution guard on a toy directory teaches more in ten minutes than a hundred pages of theory. The link switcher on a virtual machine with two network cards shows the reaction to failures without breaking anything real. And the reference for the netfilter module explains how to register packet hooks from a script when you want to filter for real.

It is worth noting that this is not a toy for production servers without a net. Use it to learn, to prototype and to instrument, and let ideas mature in the lab before approaching machines that pay salaries. The project's community, with its public bug tracking and commented examples, is the best travel companion for that journey.

What Lunatik 5 says about the future of the kernel

The substance of the announcement points to a trend that goes beyond a single project. The Linux kernel is becoming programmable in layers, with eBPF as a verified highway and high-level languages at the wheel. Lunatik puts Lua at that wheel with a radical proposal, readable scripts where before there was only C. If the bet pays off, debugging networks, rehearsing schedulers and monitoring systems will look more like programming than performing surgery.

Serious work lies ahead, with known bugs to polish and architectures to win back. But the direction excites those who live among packets and processes. This October 2026, with the version fresh out of the oven, is the perfect moment to set up a lab and look into the kernel without fear, with the caution the host deserves.

José Maldonado

Author

José Maldonado

Activist and blogger on technology, free software and blockchain.

The latest
From Huang to Botín, from Zara to Byron: corporate responsibility in global capitalism

Keep reading