Skip to content

perf(runner): replace systemd with minimal init for faster boot #1164

@lancy

Description

@lancy

Summary

Replace systemd with a minimal init system to reduce guest boot time by 3-5 seconds.

Problem

Current guest image uses systemd as init system:

  • systemd has inherent startup overhead
  • Even with services stripped, systemd does dependency resolution
  • journald, udev stubs, and other subsystems still initialize
  • Estimated overhead: 3-5 seconds

Proposed Solution

Replace systemd with a minimal init script that only:

  1. Sets up network interface (already configured via kernel args)
  2. Starts SSH daemon
  3. (Optional) Starts vsock agent

Target Boot Sequence

kernel boot → minimal init → sshd ready

vs current:

kernel boot → systemd → service resolution → sshd ready

Technical Approach

Option A: Custom Shell Init

#!/bin/sh
# /sbin/init
mount -t proc proc /proc
mount -t sysfs sys /sys
mount -t devtmpfs dev /dev

# Network already configured via kernel ip= parameter
/usr/sbin/sshd -D &

# Keep init running
exec /bin/sh

Option B: Busybox Init

Use busybox init with minimal inittab.

Option C: tini/dumb-init

Minimal init designed for containers, adapted for VM.

Key Files

  • turbo/scripts/deploy-runner/Dockerfile - Replace systemd
  • turbo/scripts/deploy-runner/build-rootfs.sh - Update verification

Expected Impact

  • Time saved: ~3-5 seconds per VM startup
  • Image size: Smaller (no systemd packages)

Trade-offs

Aspect systemd Minimal Init
Boot time Slower Faster
Service management Full Manual
Debugging journalctl Manual logs
Maintenance Familiar Custom

Considerations

  • Lose systemd service management
  • Need custom scripts for any additional services
  • Less debugging tooling available
  • Consider keeping systemd as fallback option

Alternative: Alpine Linux

Could also consider Alpine Linux base image which uses OpenRC (lighter than systemd) and has much smaller footprint (~100MB vs 2GB).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions