STAP-ONBOOT(8)

✨ STAP-ONBOOT ✨

okay bestie, gather round πŸ’– this is the stap-onboot page from the System Manager's Manual β€” section 8, admin girlies only. it's giving "let's run SystemTap scripts before the root filesystem even wakes up" energy and honestly? iconic.


🌸 NAME 🌸

stap-onboot β€” embed SystemTap scripts into an initramfs so they run at early boot πŸ¦‹


✨ SYNOPSIS ✨

stap-onboot [OPTIONS] [SCRIPT...]

πŸ’… DESCRIPTION πŸ’…

so like, stap-onboot takes your SystemTap scripts, compiles them, and then uses dracut to tuck them all cozy inside an initramfs πŸŽ€ which means those scripts get to run during early boot β€” before the root filesystem is even mounted. main character behaviour, fr fr.

why would you want that? two reasons, bestie:

  • debugging early-boot issues 😭 (the messy part of boot nobody wants to look at)
  • applying CVE band-aid scripts that need to run as early as physically possible 🩹

scripts get read from /etc/systemtap/script.d/ ✨ and compiled modules get cached in /var/cache/systemtap/KERNEL/ 🧚


πŸ‘‘ OPTIONS πŸ‘‘

  • -b β€” back up the existing initramfs before you overwrite it 🫢 the backup gets saved with a .bak extension. safety first, no cap.
  • -c configfile β€” point at an alternate config file instead of the default /etc/systemtap/config πŸ’œ
  • -o path.img β€” set the output initramfs file path πŸ“ by default the initramfs for the current kernel gets updated at /boot/initramfs-KERNEL.img
  • -r kernelrelease β€” pick which kernel release to build the initramfs for 🌈 defaults to the currently running kernel, i.e. uname -r

πŸ¦‹ ARGUMENTS πŸ¦‹

  • SCRIPT β€” one or more script names (without the .stp extension, ok?) to compile and embed in the initramfs πŸ’– those scripts must exist in /etc/systemtap/script.d/ ⭐ and if you pass no scripts at all? you get a clean initramfs with zero SystemTap scripts in it. a little palate cleanser 🧼

πŸŽ€ EXAMPLES πŸŽ€

compile and embed myScript.stp into the initramfs, and back up the original while you're at it:

# stap-onboot -b myScript

build an initramfs for a whole different kernel, go off:

# stap-onboot -r 6.1.0-1.fc37.x86_64 earlyDebug

custom initramfs in a specific location? say less:

# stap-onboot -o /tmp/test-initramfs.img bandaid

and if you wanna remove all the SystemTap scripts from the initramfs:

# stap-onboot

πŸ“ FILES πŸ“

  • /etc/systemtap/script.d/SCRIPT.stp β€” the source SystemTap scripts that get embedded ✨
  • /etc/systemtap/config β€” config file for script options πŸ’œ each script can have options defined as SCRIPTNAME_OPT=...
  • /var/cache/systemtap/KERNEL/ β€” the directory where compiled .ko modules get cached 🧚
  • /boot/initramfs-KERNEL.img β€” default output location for the generated initramfs 🌸
  • /usr/lib/dracut/modules.d/99stap β€” dracut module directory for the SystemTap integration πŸŽ€

🌈 SEE ALSO 🌈

stap(1), staprun(8), dracut(8), systemd.service(5)


and that's the whole page bestie!! πŸ’– this was STAP-ONBOOT(8) straight outta the System Manager's Manual, section 8, mwah 😘 go forth and embed those scripts, you've got this 🫢✨πŸ’