No description
Find a file
2026-02-26 11:15:59 -07:00
src New, and better than ever 2026-02-26 10:33:13 -07:00
.gitignore New, and better than ever 2026-02-26 10:33:13 -07:00
build.sh New, and better than ever 2026-02-26 10:33:13 -07:00
Cargo.lock New, and better than ever 2026-02-26 10:33:13 -07:00
Cargo.toml New, and better than ever 2026-02-26 10:33:13 -07:00
config.toml.example New, and better than ever 2026-02-26 10:33:13 -07:00
install.sh New, and better than ever 2026-02-26 10:33:13 -07:00
README.md readme adjustments 2026-02-26 11:15:59 -07:00
reboot-tester.service New, and better than ever 2026-02-26 10:33:13 -07:00
uninstall.sh New, and better than ever 2026-02-26 10:33:13 -07:00

Reboot Tester

A robust system reboot testing tool for Linux systems. This tool safely performs a configurable number of automated system reboots, with multiple safety mechanisms to prevent infinite reboot loops.

Features

  • Configurable reboot count: Set the exact number of reboots to perform
  • Desktop detection: Waits for the graphical desktop to be ready before counting down
  • Configurable delay: Set how long to wait at the desktop before triggering a reboot
  • Multiple safety mechanisms:
    • Kill switch file to emergency halt reboots
    • Maximum uptime detection (assumes user intervention if exceeded)
    • Consecutive failure tracking
    • Automatic service disable on completion or abort
  • Persistent state: Tracks progress across reboots
  • Detailed logging: Full history of all reboot attempts

Requirements

  • Linux system with systemd
  • Rust toolchain (for building)
  • Root privileges (for installation and execution)

Installation

Quick Install

# Clone or download the project
cd reboot-tester

# Build the binary (as normal user)
./build.sh

# Install (as root)
sudo ./install.sh

Manual Build & Install

# Build the binary (as normal user)
cargo build --release

# Install (as root)
sudo ./install.sh

Installing from Pre-built Binary

If distributing a pre-built package, place these files in the same directory:

  • reboot-tester (the binary)
  • install.sh
  • uninstall.sh
  • config.toml.example
  • reboot-tester.service

Then run:

sudo ./install.sh

Manual Installation (Without Scripts)

# Create directories
sudo mkdir -p /etc/reboot-tester
sudo mkdir -p /var/lib/reboot-tester

# Install files
sudo cp target/release/reboot-tester /usr/local/bin/
sudo cp config.toml.example /etc/reboot-tester/config.toml
sudo cp reboot-tester.service /etc/systemd/system/

# Set permissions
sudo chmod 755 /usr/local/bin/reboot-tester
sudo chmod 644 /etc/reboot-tester/config.toml
sudo chmod 644 /etc/systemd/system/reboot-tester.service

# Reload systemd
sudo systemctl daemon-reload

Configuration

Edit /etc/reboot-tester/config.toml to customize behavior:

[reboot]
# Total number of reboots to perform
target_count = 10

# Seconds to wait after desktop is ready before triggering reboot
wait_after_desktop_seconds = 25

[safety]
# Maximum uptime before assuming user intervention (aborts test)
max_uptime_before_abort_seconds = 300

# Enable the kill switch file feature
enable_kill_switch = true

# Maximum consecutive failed boots before aborting
max_failed_boots = 3

[desktop]
# Detection method: "graphical-target", "display-manager", "dbus-session", "custom-command"
detection_method = "graphical-target"

# Custom command (only if detection_method = "custom-command")
custom_ready_command = ""

# Additional delay after desktop detection
post_detection_delay_seconds = 5

[logging]
log_file = "/var/log/reboot-tester.log"
log_level = "info"
use_journal = true

[state]
state_directory = "/var/lib/reboot-tester"

Usage

Start a Reboot Test

sudo reboot-tester start

This will:

  1. Initialize the test state
  2. Enable the systemd service
  3. Begin the first reboot after a 10-second countdown

Check Status

sudo reboot-tester status

Shows current test progress, safety status, and reboot history.

Stop a Test

sudo reboot-tester stop

Immediately stops the reboot test and disables the service.

Reset State

sudo reboot-tester reset

Clears all state and history.

Safety Mechanisms

1. Kill Switch

Create the file /etc/reboot-tester/STOP to immediately halt all reboots:

sudo touch /etc/reboot-tester/STOP

The tool checks for this file before every reboot.

2. Maximum Uptime Check

If the system has been running longer than max_uptime_before_abort_seconds (default: 300 seconds / 5 minutes), the tool assumes a user is actively using the system and aborts the test.

This prevents accidental reboots if:

  • The service starts unexpectedly
  • Someone logs in and starts working
  • A reboot gets delayed for any reason

3. Consecutive Failure Tracking

If the system fails to complete a reboot cycle multiple times (defined by max_failed_boots), the test is automatically aborted. This prevents issues with systems that boot but fail to reach the desktop.

4. Automatic Service Disable

When a test completes (successfully or via abort), the systemd service is automatically disabled to prevent any future reboots.

How It Works

  1. Start: User runs reboot-tester start
  2. Initialize: Tool creates state file, enables systemd service
  3. First Reboot: System reboots after 10-second countdown
  4. Boot Detection: On boot, systemd runs the service after graphical target
  5. Desktop Wait: Tool waits for desktop to be ready
  6. Countdown: Tool waits configured seconds (default: 25)
  7. Reboot: System reboots if safety checks pass
  8. Repeat: Steps 4-7 repeat until target count is reached
  9. Complete: Service disables itself, test marked complete

Files and Directories

Path Description
/usr/local/bin/reboot-tester Main executable
/etc/reboot-tester/config.toml Configuration file
/etc/reboot-tester/STOP Kill switch file (create to stop)
/var/lib/reboot-tester/state.json Persistent state
/etc/systemd/system/reboot-tester.service Systemd service
/var/log/reboot-tester.log Log file

Packaging for Distribution

To create a distributable package without requiring Rust on the target system:

# Build the binary
./build.sh

# Create distribution directory
mkdir -p dist
cp target/release/reboot-tester dist/
cp install.sh uninstall.sh config.toml.example reboot-tester.service dist/

# Optionally create a tarball
tar -czvf reboot-tester-dist.tar.gz dist/

The dist/ directory (or tarball) can be copied to any compatible Linux system and installed with sudo ./install.sh.

Troubleshooting

Test won't start

  1. Check you're running as root: sudo reboot-tester start
  2. Verify config file exists: cat /etc/reboot-tester/config.toml
  3. Check for existing test: sudo reboot-tester status

Reboots stopped unexpectedly

  1. Check for kill switch: ls -la /etc/reboot-tester/STOP
  2. Check status for reason: sudo reboot-tester status
  3. Check journal logs: journalctl -u reboot-tester.service

Want to abort immediately

Multiple options:

# Option 1: Use the stop command
sudo reboot-tester stop

# Option 2: Create kill switch file
sudo touch /etc/reboot-tester/STOP

# Option 3: Disable the service directly
sudo systemctl disable reboot-tester.service

System stuck in reboot loop - Ubuntu

If you can't get to the desktop fast enough:

  1. At boot, access GRUB menu
  2. Edit boot entry, add systemd.unit=rescue.target
  3. Boot into rescue mode
  4. Run: systemctl disable reboot-tester.service
  5. Or create: touch /etc/reboot-tester/STOP
  6. Reboot normally

System stuck in reboot loop systemd-boot - Pop

If you can't get to the desktop fast enough:

  1. At boot, access systemd-boot menu (Repeatedly tap space on boot)
  2. Mount the OS partition
  3. Add the KillSwitch: touch /etc/reboot-tester/STOP
  4. Reboot normally

Uninstallation

# Stop any active test
sudo reboot-tester stop

# Disable and remove service
sudo systemctl disable reboot-tester.service
sudo rm /etc/systemd/system/reboot-tester.service
sudo systemctl daemon-reload

# Remove files
sudo rm /usr/local/bin/reboot-tester
sudo rm -rf /etc/reboot-tester
sudo rm -rf /var/lib/reboot-tester

License

This tool is provided as-is for system testing purposes. Use at your own risk.