/research-deep-dives:linux-ubuntu-arch-fedora-macos-internals-researchfrom research-deep-dives
Provides source-cited deep dives on Linux (Ubuntu, Arch, Fedora) and macOS internals covering kernels, boot sequences, user/kernel boundaries, and practical trade-offs.
Ships in research-deep-dives. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
This reference explains how Linux-based operating systems and macOS work, how to program them, how to build distributions and images, and how to test software from user space through kernels and drivers.
Important distinctions:
Commands are version-sensitive. Test bootloaders, kernels, filesystems, drivers, partitions, and security changes only in disposable VMs, snapshots, test disks, or systems with verified backups.
Hardware provides CPUs, privilege levels, virtual-memory hardware, caches, interrupts, timers, buses, storage, networking, GPUs, and firmware. The operating system turns those resources into abstractions:
User programs normally cannot touch arbitrary memory, devices, or privileged instructions. They use system calls, libraries, IPC, device files, sockets, or broker services. The kernel validates addresses, object handles, credentials, resource limits, and access policy.
Kernel bugs are system-wide failures. Prefer user-space APIs, FUSE, eBPF, a service, or macOS DriverKit/system extensions over kernel code whenever the problem allows.
Linux is primarily a monolithic but modular kernel. Most core services run in kernel space; drivers and features may be built in or loaded as modules. Linux also supplies namespaces, cgroups, eBPF, KVM, virtual filesystems, user-space filesystem support, security modules, and many tracing facilities.
The kernel is written mostly in C, with architecture-specific assembly. Rust is now used for selected kernel work, but it does not replace the C/assembly foundation. Linux kernel development HOWTO
Linux programs use system calls such as openat, read, write, mmap, clone, execve, futex, epoll, io_uring, socket, connect, and ioctl. libc wraps many but not all syscalls. glibc, musl, and other libcs are user-space choices; the kernel does not require glibc.
ELF is the normal Linux executable/object format. The dynamic linker maps shared libraries, resolves symbols, applies relocations, and starts the program. ABI compatibility depends on architecture, libc, symbol versions, syscall behavior, compiler ABI, and distribution policy.
Linux uses fork, execve, clone, and clone3 to create and configure processes and threads. Processes have address spaces, credentials, files, signals, namespaces, cgroups, and resource limits. Threads share selected process resources. Synchronization uses atomics, mutexes, futexes, condition variables, semaphores, pipes, sockets, eventfd, epoll, and io_uring.
Signals are asynchronous notifications; child exit status is collected with wait*; orphaned processes are reparented to PID 1 or a subreaper.
On current Ubuntu, Arch, and Fedora installs, systemd commonly supplies PID 1 and service management. Units include services, sockets, timers, mounts, targets, devices, swaps, paths, and slices. Dependencies, ordering, cgroups, journaling, socket activation, and sandbox directives are separate concepts.
Useful inspection:
systemctl status name.service
journalctl -u name.service -b
systemd-analyze critical-chain
systemd-cgls
ps auxww
ss -tulpn
You can program Linux in C, C++, Rust, Go, Zig, Swift, Fortran, Ada, Java, Kotlin, C#, Python, Ruby, Perl, JavaScript/TypeScript, shell, Lua, R, and many more. The stable boundary is the kernel ABI and user-space APIs, not a particular language.
Typical roles:
The build chain is preprocessing/macro expansion, compilation, assembly, linking, packaging, installation, and dynamic loading. Toolchains include GCC, Clang/LLVM, binutils, Make, Ninja, CMake, Meson, Cargo, Go tooling, and language package managers.
A serious build records compiler, SDK, flags, target architecture, dependency versions, source revision, generated files, locale, and timestamps. Use warnings, sanitizers, static analysis, dependency audits, signed artifacts, and reproducible-build checks.
Kernel code must obey context and lifetime rules: interrupt versus process context, sleeping versus atomic context, locking order, memory barriers, RCU, reference counting, user-copy validation, DMA, cache coherence, and resource cleanup. There is no ordinary floating point in normal kernel paths.
A minimal educational module:
#include <linux/init.h>
#include <linux/module.h>
static int __init example_init(void) { pr_info("loaded\\n"); return 0; }
static void __exit example_exit(void) { pr_info("unloaded\\n"); }
module_init(example_init);
module_exit(example_exit);
MODULE_LICENSE("GPL");
Build against the target kernel’s build tree using kbuild; test in a VM; inspect with modinfo, dmesg, journalctl -k, and lsmod. Modules depend on kernel configuration, compiler ABI, symbol versions, architecture, signing, lockdown, and distribution policy.
git clone https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
cd linux
make mrproper
make O=../linux-build olddefconfig
make O=../linux-build -j"$(nproc)"
make O=../linux-build modules
Use a known distribution configuration when testing hardware. Verify kernel, modules, initramfs, boot entry, signatures, and rollback before rebooting.
Kernel testing includes KUnit, kselftest, LTP, syzkaller, lockdep, KASAN, KMSAN, UBSAN, KFENCE, kmemleak, fault injection, stress, QEMU/KVM, performance regression, and real-hardware testing. A booting kernel is not necessarily a correct kernel.
/proc: process and kernel state./sys: devices, buses, drivers, kernel objects, and attributes./dev: device nodes, commonly created by udev/systemd-udevd./run: volatile runtime state./etc: host configuration./var: logs, caches, package state, spools, and databases./usr: most installed userland in modern unified-usr layouts.Namespaces isolate process IDs, mounts, networking, users, IPC, and cgroups. Cgroups control and account for CPU, memory, I/O, PIDs, and other resources. Containers combine these with filesystem isolation and a process runtime but share the host kernel; they are not VMs.
AppArmor and SELinux use Linux security-module hooks. Fedora commonly emphasizes SELinux; Ubuntu commonly uses AppArmor. Capabilities split root privileges, seccomp restricts syscalls, and namespaces reduce visibility.
Ubuntu combines upstream Linux with Debian-derived packaging, Canonical integration, release engineering, installers, security maintenance, and distribution defaults. Official architectures include amd64, arm64, armhf, ppc64el, s390x, and riscv64, with release-specific support. Ubuntu supported architectures
Ubuntu primarily uses Debian packages. APT resolves repository metadata and dependencies; dpkg unpacks/configures individual packages.
apt update
apt policy package
apt show package
apt install package
apt source package
apt build-dep package
dpkg -L package
dpkg -S /path/to/file
Repository metadata and source configuration are version-sensitive; modern Ubuntu releases use deb822 sources in /etc/apt/sources.list.d/*.sources. Ubuntu package management
Snaps are a separate package/distribution mechanism with revisions, channels, confinement, and transactional refresh behavior. A deb, Snap, container, and source build have different integration and update semantics.
Canonical maintains multiple kernel trees and variants. The Ubuntu linux source can produce differently configured binaries such as generic and low-latency kernels. Canonical documents source access, builds, module rebuilds, testing, and kernel-team workflows. Ubuntu kernel variants and Ubuntu kernel how-to guides
For packages use source packages, debuild/dpkg-buildpackage, clean sbuild-style environments, autopkgtest, linting, upgrade tests, systemd units, documentation, and explicit removal/conffile behavior.
Boot commonly involves UEFI, a signed shim or equivalent, GRUB or a unified kernel image, kernel, initramfs, and root filesystem. Secure Boot, AppArmor, systemd, capabilities, namespaces, and seccomp form overlapping security layers.
Arch is a rolling distribution emphasizing upstream-oriented packages, pacman, PKGBUILDs, systemd, and administrator control.
A PKGBUILD is a Bash build recipe containing source retrieval, checksums, dependencies, build steps, and packaging. makepkg creates a compressed package; pacman installs and tracks it. Arch recommends clean chroots because dirty build environments can create unrepeatable dependencies and runtime behavior. Arch Build System and Creating packages
sudo pacman -S --needed base-devel git devtools
pkgctl repo clone --protocol=https package-name
cd package-name
makepkg --verifysource
makepkg -s
makepkg --clean
sudo pacman -U package-name-*.pkg.tar.zst
Read PKGBUILDs before execution: they run shell code. Build as a normal user. Use a clean chroot for reliable packages. Treat AUR recipes as code to audit, not as equivalent to signed official packages.
Arch can reuse the official Linux PKGBUILD, alter configuration or patches, build with makepkg, install kernel and headers, regenerate initramfs, and add bootloader entries. Arch warns custom kernels can cause instability or data loss. Arch kernel build system
Unified kernel images combine a UEFI stub, kernel, initramfs, and resources in a PE file. Boot configuration, microcode, initramfs generation, signing, and firmware behavior all matter.
Fedora is an upstream-oriented distribution ecosystem with RPM, DNF, systemd, SELinux, signed packages, rapid releases, Workstation/Server/IoT and image variants.
RPM packages contain metadata, payloads, dependencies, scripts, and signatures. Spec files describe source, build, files, dependencies, and scriptlets. rpmbuild, rpmdevtools, mock, fedpkg, and DNF are central tools.
sudo dnf install rpmdevtools rpm-build
rpmdev-setuptree
rpmbuild -ba SPECS/example.spec
rpm -qpi RPMS/.../example.rpm
rpm -qpl RPMS/.../example.rpm
Use clean mock or Fedora build infrastructure; do not build packages as root. Test upgrades, scriptlets, SELinux labels, systemd activation, and file ownership.
Fedora’s custom-kernel workflow uses Fedora source/spec trees, fedpkg, build dependencies, pesign, and grubby; official builds are signed through controlled infrastructure. Fedora custom kernel
Fedora image workflows produce ISOs, QCOW2, raw images, OSTree commits, or root filesystems using tools including KIWI, image-builder, mkosi, and lorax depending on the variant. Building Fedora
SELinux enforces policy through labels, domains, types, transitions, and allowed operations.
getenforce
ausearch -m AVC -ts recent
ls -Z path
restorecon -Rv path
Do not blindly paste audit2allow output. Understand the denied operation, correct labels and service design, and write the narrowest policy needed.
Test at multiple levels:
Use QEMU/KVM, libvirt, containers, chroots, systemd-nspawn, snapshots, network namespaces, loopback filesystems, and real hardware. Containers share the host kernel; use a VM to test a new kernel.
Useful tools:
uname -a; cat /proc/cmdline; cat /proc/version
lspci -nnk; lsusb -t; findmnt; ss -tulpn
strace -f -o trace.log command
perf stat command
perf record -g command
vmstat 1; iostat -xz 1
Use gdb for user-space debugging, perf/eBPF for profiling and tracing, tcpdump/Wireshark for networks, crash reports and kernel logs for failures, and sanitizers for memory/undefined behavior.
There are four common meanings:
A viable distribution needs kernel/initramfs, root filesystem, PID 1, libc, shell/core utilities, device management, network/time/logging/certificates, users/permissions, package manager, signed repositories, installer/image builder, upgrades, rollback, recovery, vulnerability response, documentation, build farm, and mirrors.
“Compiled successfully” is not “supported.” Define ABI, hardware, boot, filesystem, upgrade, security, performance, and recovery guarantees.
macOS is built on Darwin/XNU plus proprietary Apple components. Apple describes the kernel environment as Mach, BSD, I/O Kit, filesystems, and networking. Darwin does not include proprietary graphics and application layers such as Cocoa and Quartz. Apple kernel architecture overview
Mach manages processor resources, scheduling support, virtual memory, protection, tasks, threads, ports, messages, IPC, and pagers.
The BSD layer supplies processes, PIDs, signals, file descriptors, VFS/filesystems, sockets, networking, credentials, syscalls, and much of the POSIX environment. Apple notes it is primarily FreeBSD-derived but not identical. Apple BSD overview
Historically I/O Kit provided an object-oriented C++ driver framework built around families, nubs, services, matching, power, and device stacks. Apple I/O Kit overview
Modern macOS prefers user-space system extensions and DriverKit. Apple says DriverKit drivers and system extensions run in user space; kexts are restricted and should be used only where no equivalent exists. Apple DriverKit/system extensions and low-level implementation guidance
C/C++ remain important in XNU, Darwin, system libraries, legacy frameworks, tools, and DriverKit. Objective-C remains in Cocoa and older APIs. Swift is the primary modern application language. Assembly serves boot, ABI, synchronization, SIMD, and hardware-specific code. Shell, Python, Ruby, Perl, Go, Rust, and others can be installed for user-space work; their availability is not equivalent to a stable system component.
macOS uses Mach-O rather than ELF. Universal binaries may contain arm64 and x86_64 slices. Useful inspection:
file program
otool -L program
otool -l program
dyld_info program
codesign -dvvv --entitlements :- program
spctl --assess --type execute program
nm -m program
vmmap pid-or-path
sample pid 5
fs_usage
log stream --level debug
Build with Xcode/clang/Swift toolchains and documented SDK frameworks. Use launchd property-list jobs for persistent services rather than assuming systemd.
System extensions include DriverKit, NetworkExtension, EndpointSecurity, and other specialized interfaces. They are delivered inside an app bundle, activated through SystemExtensions, and checked for signatures, identifiers, entitlements, and placement. DriverKit templates use C++ and an I/O Kit interface-generator header. Apple requires drivers inside Contents/Library/SystemExtensions. DriverKit creation and installation
macOS security layers include code signing, Developer ID, notarization, Gatekeeper, App Sandbox, TCC privacy permissions, hardened runtime, entitlements, quarantine, SIP, and system-extension approval.
Apple’s notarization workflow requires signing, hardened runtime and appropriate entitlements for modern distributed software; notarytool is the current submission tool. Apple notarization
Conceptual workflow:
xcodebuild archive ...
xcodebuild -exportArchive ...
codesign --verify --deep --strict --verbose=4 path
ditto -c -k --keepParent path artifact.zip
xcrun notarytool submit artifact.zip --wait
xcrun stapler staple path
spctl --assess --type execute --verbose=4 path
Test on clean macOS installations and both architectures where relevant. Test sleep/wake, hot plug, multiple users, privacy prompts, sandbox failure, update/uninstall, network loss, and code-signing/notarization behavior.
SIP protects system areas and unauthorized execution. Apple says it may need temporary disabling for certain low-level development, but it should be restored immediately. Apple SIP guidance
| Area | Ubuntu/Arch/Fedora | macOS |
|---|---|---|
| Kernel | Upstream Linux plus distro configuration/patches | XNU: Mach/BSD/I/O Kit and Apple components |
| Public source | Broad upstream and distribution trees | Darwin/XNU portions; proprietary layers remain |
| Executable | ELF | Mach-O |
| Packages | deb/APT, Arch packages/pacman, RPM/DNF | App bundles, installer packages, Mac App Store |
| Services | Usually systemd | launchd and Apple service frameworks |
| Mandatory policy | SELinux/AppArmor/LSM, capabilities, namespaces, seccomp | SIP, TCC, sandbox, entitlements, signatures |
| Drivers | Kernel modules and Linux device subsystems | DriverKit/system extensions preferred; kexts restricted |
| Custom kernel | Normal but risky and distro-specific | Not a general supported replacement path |
| GUI | X11/Wayland plus GTK/Qt/etc. | Quartz/WindowServer/AppKit/SwiftUI |
| Update authority | Distribution repositories and administrator | Apple update/signing/notarization ecosystem |
Use QEMU and a cross-compiler. Implement boot entry, serial output, exceptions, page allocator, virtual memory, timer interrupts, interrupt controller, scheduler, context switching, user mode, syscalls, ELF loading, a filesystem, processes, IPC, and a shell. Start single-core and add SMP, preemption, drivers, and security deliberately.
Reuse Linux and concentrate on kernel configuration, initramfs, rootfs, PID 1, services, package/update mechanism, security policy, image builder, installer, signing, rollback, and recovery. This becomes useful far sooner than a new kernel but still demands long-term security and release engineering.
Keep scheduling, address spaces, IPC, and minimal hardware primitives in the kernel; move drivers, filesystems, networking, and services into user space. This can improve isolation but increases IPC, driver, ecosystem, and performance complexity.
Use standard streams and exit codes; handle permissions, signals, malformed input, temporary files, locale, and interruption. Unit-test logic, integration-test syscalls, package it for target distributions, and trace it in each launch context.
Define protocol, authentication, authorization, timeouts, backpressure, logging, metrics, TLS, resource limits, systemd/launchd integration, upgrade, and recovery. Test packet loss, slow clients, malformed requests, partial writes, restart, clock skew, and credential rotation.
Define crash consistency, fsync, atomicity, permissions, xattrs, sparse files, quotas, encryption, snapshots, case sensitivity, and recovery. Test power loss with loopback images and fault injection.
Document hardware protocol, interrupts/DMA, power states, hotplug, reset, concurrency, firmware, user API, entitlements, security boundaries, and recovery. Test disconnects, suspend/resume, resource exhaustion, concurrent opens, malformed devices, and no-network conditions.
Separate UI, model, I/O, and privileged operations. Test accessibility, localization, scaling, multiple displays, sleep/wake, sandbox/privacy prompts, corrupted data, crash recovery, update, and uninstall.
A serious OS project needs source tags, deterministic toolchains, dependency/license inventory, signed commits and artifacts, reproducible-build comparison, build logs, package repositories, update channels, rollback, vulnerability intake, hardware/VM matrices, upgrade tests, and recovery documentation.
Never put signing keys in source control. Never call an artifact supported merely because it compiled once.
When behavior differs across systems, record OS release, kernel/XNU version, architecture, hardware, executable format/slices, compiler/SDK/libc/runtime, exact package/source revision, environment, working directory, locale, limits, user/group/capabilities, sandbox/SELinux/AppArmor/SIP/TCC/entitlements, launch context, filesystem/mount flags/ACLs/xattrs, network path, logs, traces, crash reports, and whether failure is deterministic or hardware/timing-specific.
Prepared 2026-09-27. This is a deep orientation and engineering roadmap, not a substitute for the current kernel, distribution, Apple SDK, driver, package, or security documentation for a specific release. Commands and policies change. The safest progression is user-space programming in VMs, then packaging and service development, then controlled kernel/driver work with source-backed tests and rollback.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
linux-internals, macos-internals, kernel, operating-systems, ubuntu, arch, fedora
18 skills in this plugin
/actual-food-production-farm-to-food-researchUse when researching actual food production: from farm to food; this source-cited deep dive covers its concepts, evidence, practical trade-offs, and common errors./agricultural-machinery-robotics-technology-researchUse when researching agricultural machinery, automotive/robotic mechanics, and technology; this source-cited deep dive covers its concepts, evidence, practical trade-offs, and common errors./Other plugins' skills for the same job
npx claudepluginhub the-vibey-project/vibey --plugin research-deep-dives