Linux Kernel Runtime Guard (LKRG) for Debian, Whonix, Qubes, Kicksecure

From Kicksecure
Jump to navigation Jump to search
LKRG logo

LKRG performs runtime integrity checking of the Linux kernel and detection of security vulnerability exploits against the kernel.

Info This page is archived.

Deprecation in Kicksecure[edit]



LKRG is Freedom Software / Open Source. [1]

The focus of this wiki page is to provide simplified user documentation and easy installation of LKRG in Debian, Kicksecure, Qubes, Whonix, and perhaps Debian-based Linux distributions. Installable from an APT repository.

This is a lightweight software and no changes will be made to the core of LKRG. Links to the official LKRG and other original resources can be found here.


LKRG logo FREE Download LKRG

LKRG Overview[edit]

This is only a very brief introduction, since LKRG technical details are not the focus of this page. Quote official LKRG

LKRG performs runtime integrity checking of the Linux kernel and detection of security vulnerability exploits against the kernel.

As controversial as this concept is, LKRG attempts to post-detect and hopefully promptly respond to unauthorized modifications to the running Linux kernel (integrity checking) or to credentials such as user IDs of the running processes (exploit detection). For process credentials, LKRG attempts to detect the exploit and take action before the kernel would grant access (such as open a file) based on the unauthorized credentials.

LKRG defeats many pre-existing exploits of Linux kernel vulnerabilities, and will likely defeat many future exploits (including of yet unknown vulnerabilities) that do not specifically attempt to bypass LKRG. While LKRG is bypassable by design, such bypasses tend to require more complicated and/or less reliable exploits.

To learn more about LKRG, interested readers can:

Performance Impact[edit]

Quote LKRG upstream:

No benchmarks have yet been performed, but it appears the performance penalty is around 2.5% for fully enabled LKRG.

Quote, Benchmarking The Performance Overhead To The Linux Kernel Runtime (page, Michael (code added):

Out of 90 benchmarks run comparing the performance hit on this Intel Core i9 9900KS from LKRG, having LKRG enabled led to around a 5% hit based on the geometric mean of all tests carried out. Granted, some real-world workloads like code compilation speed were impacted much more dramatically while test cases not involving I/O or other kernel operations tended to see no measurable difference in run-time performance.

LKRG Free vs LKRG Pro[edit]

Kicksecure developer Patrick Schleizer

Contacted upstream LKRG developers privately. To paraphrase: "We don’t oppose you packaging it. As long as LKRG exists, there will always be a free and libre version. There is no pro version yet. A hypothetical future pro version would not change that." In my words: "there won’t be a grsecurity alike situation where everything gets closed down".

Quote LKRG

We will likely use GPLv2 at least for LKRG free. We might or might not use a different license for LKRG Pro, if we ever make it.

Users who benefit from LKRG Free are encouraged to support its further development. However, at the time of writing they are not accepting donations: [2]

We used to accept donations for LKRG via Patreon, but we currently don't. Some of our former supporters are listed in the PATREON file in LKRG distribution tarballs.


Testers only! Warning: This is for testers-only!

Note: Users who require better security can Build the Linux Kernel Runtime Guard (LKRG) Debian Package from Source Code and verify software signatures before installation.

Logo Host Operating System Installation Instructions Note
Debian hosts Follow the instructions below to install from the Kicksecure repository. [3] If intending to run the VirtualBox host software (such as for running Kicksecure virtual machine (VM)) additional configuration is required. [4]
Kicksecure Follow the installation instructions below. In Kicksecure, skip the following "Add Kicksecure repository" step since it is already enabled by default.
Qubes Debian based VMs Follow these LKRG Qubes instructions. See footnote. [5]
Kicksecure for Qubes Follow these LKRG Kicksecure-Qubes instructions. See footnote. [5]
Other Linux distributions LKRG is available for most Linux distributions. Follow the installation instructions for non-Debian distributions on the official LKRG

Add Kicksecure repository.

1. Download the Signing Key.


2. Optional: Check the Signing Key for better security.

3. Add Kicksecure signing key.

sudo cp derivative.asc /usr/share/keyrings/derivative.asc

4. Kicksecure APT repository choices.

Optional: See Kicksecure Packages for Debian Hosts and Kicksecure Host Enhancements instead of the next step for more secure and complex options.

5. Add Kicksecure APT repository.

echo "deb [signed-by=/usr/share/keyrings/derivative.asc] trixie main contrib non-free" | sudo tee /etc/apt/sources.list.d/derivative.list

Install LKRG.

1. Update the package lists.

sudo apt update

2. Install LKRG. [6] [7] [8]

sudo apt install lkrg-dkms linux-headers-amd64

The LKRG installation is complete. [9]

It is recommended to review optional hardening and other entries below, but this is not required.


It might be possible to further improve the security provided by LKRG though LKRG configuration, but this can potentially lead to decreased system stability. Note: Unspecific to Kicksecure.


These configuration sysctl where up to date at time of writing but might be outdated in future LKRG releases. Please refer to upstream sysctl configuration chapter Runtime configuration and upstream configuration file /etc/sysctl.d/

General LKRG Configuration Tips[edit]

Note: All the possible configuration changes in this section are optional.

Table: General LKRG Configuration Tips

Category Instructions
View Current Runtime Configuration To view the current configuration, run.

sudo sysctl -a | grep lkrg

Refer to upstream chapter Runtime configuration.

Temporary Runtime Configuration Changes To temporarily change configuration settings until next reboot, run.

Note: Replace lkrg.pcfi_validate=1 with the actual sysctl setting you like to change as per upstream documentation.

sudo sysctl -w lkrg.pcfi_validate=1

Persistent Configuration Changes To enable any (LKRG) sysctl persistently after reboot.

Open file /etc/sysctl.d/50_user.conf in an editor with root rights.


This box uses sudoedit for better security.

sudoedit /etc/sysctl.d/50_user.conf

Kicksecure for Qubes


sudoedit /etc/sysctl.d/50_user.conf

  • After applying this change, shutdown the Template.
  • All App Qubes based on the Template need to be restarted if they were already running.
  • This is a general procedure required for Qubes and unspecific to Kicksecure for Qubes.

Others and Alternatives

  • This is just an example. Other tools could achieve the same goal.
  • If this example does not work for you or if you are not using Kicksecure, please refer to this link.

sudoedit /etc/sysctl.d/50_user.conf

Paste (LKRG) sysctl settings such as.

Note: Replace lkrg.pcfi_validate=1 with the actual sysctl setting you like to change as per upstream documentation.



The procedure of persistently changing sysctl settings is complete.

VirtualBox host software compatibility


Not required for VirtualBox guest VM. [10]

Kicksecure specific LKRG Configuration Tips[edit]

Table: Kicksecure specific LKRG Configuration Tips

Category Instructions
Block Module Loading Users which use lkrg.block_modules in Kicksecure would also have to follow Kicksecure instructions on module loading.
Hardening - UMH Validation and Enforcement Better do not use lkrg.umh_validate=2 for now. Might break Kicksecure Firewall. Advanced users could refer to upstream documentation on lkrg.umh_validate and lkrg.umh_enforce.


Once LKRG has been installed, little effort is required since it will protect the kernel without the user's knowledge and/or interaction. However, it is sensible to check that LKRG is running correctly and to monitor system logs for any suspicious entries. Check this entry at a later date for any additional recommendations.

To check systemd journal log for kernel messages by LKRG, run.

sudo journalctl -b | grep lkrg

To keep watching systemd journal log for new LKRG messages, run.

sudo journalctl -b -f | grep lkrg

At this stage a graphical user interface (GUI) is not provided that can proactively inform users who fail to analyze the systemd journal log for relevant LKRG messages. A GUI or popup notification might be developed later on -- help is most welcome.


Quote upstream readme:

To account for the hopefully unlikely but really unfortunate event that some incompatibility between the Linux kernel or other components of the system and LKRG isn't detected prior to LKRG installation yet leads to system crash on bootup, we've included support for the "nolkrg" kernel parameter in the systemd unit file for LKRG. Thus, if you've followed the above installation procedure for LKRG with systemd, you may disable LKRG by specifying "nolkrg" on the kernel command-line via your bootloader. The system should then boot up without LKRG, and thus without triggering the problem, letting you fix it.

Quote upstream

[...] I would use a different kernel cmd parameter: `` -- which drops me to the shell before even mounting (as read/write) the root file system, and I can disable whatever service I want. [...]

Secure Boot[edit]

Not compatible because it is a kernel module.

Kicksecure Feature Default Status Information[edit]

Not installed by default.

  • Risk of broken VM boot after LKRG major version upgrade.
  • Risk of broken VM if using kernel from backports or porting to the next major version of Debian.
  • Broken in Qubes?



dpkg -l | grep linux-image

Should include:

ii  linux-image-4.19.0-6-amd64                    4.19.67-2+deb10u2               amd64        Linux 4.19 for 64-bit PCs (signed)
ii  linux-image-amd64


dpkg -l | grep linux-head

Should include:

ii  linux-headers-4.19.0-6-amd64                  4.19.67-2+deb10u2               amd64        Header files for Linux 4.19.0-6-amd64
ii  linux-headers-4.19.0-6-common                 4.19.67-2+deb10u2               all          Common header files for Linux 4.19.0-6
ii  linux-headers-amd64


sudo modinfo p_lkrg

filename:       /lib/modules/5.10.0-0.bpo.7-amd64/updates/dkms/p_lkrg.ko
license:        GPL v2
description:    pi3's Linux kernel Runtime Guard
author:         Adam 'pi3' Zabrocki (
retpoline:      Y
name:           p_lkrg
vermagic:       5.10.0-0.bpo.7-amd64 SMP mod_unload modversions
parm:           log_level:log_level [3 (warn) is default] (uint)
parm:           heartbeat:heartbeat [0 (don't print) is default] (uint)
parm:           block_modules:block_modules [0 (don't block) is default] (uint)
parm:           interval:interval [15 seconds is default] (uint)
parm:           kint_validate:kint_validate [3 (periodically + random events) is default] (uint)
parm:           kint_enforce:kint_enforce [2 (panic) is default] (uint)
parm:           msr_validate:msr_validate [0 (disabled) is default] (uint)
parm:           pint_validate:pint_validate [1 (current) is default] (uint)
parm:           pint_enforce:pint_enforce [1 (kill task) is default] (uint)
parm:           umh_validate:umh_validate [1 (allow specific paths) is default] (uint)
parm:           umh_enforce:umh_enforce [1 (prevent execution) is default] (uint)
parm:           pcfi_validate:pcfi_validate [2 (fully enabled pCFI) is default] (uint)
parm:           pcfi_enforce:pcfi_enforce [1 (kill task) is default] (uint)
parm:           smep_validate:smep_validate [1 (enabled) is default] (uint)
parm:           smep_enforce:smep_enforce [2 (panic) is default] (uint)
parm:           smap_validate:smap_validate [1 (enabled) is default] (uint)
parm:           smap_enforce:smap_enforce [2 (panic) is default] (uint)

dkms status[edit]

sudo dkms status

Should include:

lkrg, 0.7, 4.19.0-6-amd64, x86_64: installed

Related Files[edit]

Additional Resources[edit]

Forum Discussion[edit]

Upstream Resources[edit]

Upstream Mailing List Discussions[edit]

See Also[edit]


  3. LKRG can be installed inside VirtualBox guest VM without configuration changes required.
  4. 5.0 5.1 make Linux Kernel Runtime Guard (LKRG) easily available in
  5. Only Intel and amd64 are supported at present, see:
  6. No need for package lkrg-systemd. See upstream
  7. Package lkrg is just a meta package. The only thing it would do is adding Depends: lkrg-dkms and Recommends: lkrg-systemd. See also: apt-cache show lkrg apt-cache show lkrg-dkms apt-cache show lkrg-systemd
  8. Note that LKRG versioning is based on upstream's git master branch intention to remain in the "prerelease" stage. Quote Adam

    We're trying to keep master branch stable and let's say in "prerelease" stage :)

  9. VirtualBox host software

Unfinished: This wiki is a work in progress. Please do not report broken links until this notice is removed, use Search Engines First and contribute improving this wiki.

We believe security software like Kicksecure needs to remain Open Source and independent. Would you help sustain and grow the project? Learn more about our 12 year success story and maybe DONATE!