Kernel
import { dmesg, lsmod, modinfo, kexecLoad, kexecExec } from '@sysopkit/linux/kernel';dmesg()
Section titled “dmesg()”Retrieves kernel ring buffer messages. Parses JSON output when available.
const entries = await dmesg({ level: 'err', since: '1 hour ago' });// entries: DmesgEntry[] with facility, level, timestamp, messagelsmod()
Section titled “lsmod()”Lists currently loaded kernel modules by parsing /proc/modules.
const modules = await lsmod();// [{ module: 'ext4', size: 131072, usedBy: ['/'], count: 1 }, ...]modinfo()
Section titled “modinfo()”Retrieves detailed information about a kernel module using modinfo.
const info = await modinfo('ext4');// { filename: '/lib/modules/.../ext4.ko', license: 'GPL',// description: 'Fourth Extended Filesystem', ... }kexecLoad()
Section titled “kexecLoad()”Loads a kernel into memory using kexec -l. The kernel is loaded but not executed.
await kexecLoad({ kernel: '/boot/vmlinuz-linux', initrd: '/boot/initramfs-linux.img', cmdline: 'root=/dev/sda1 ro quiet',});kexecExec()
Section titled “kexecExec()”Executes the loaded kernel, rebooting the system immediately using kexec -e.
await kexecExec();