Skip to content

Linux machinectl Guide

Mattscreative edited this page Dec 5, 2025 · 2 revisions

Linux machinectl Guide

Complete beginner-friendly guide to machinectl on Linux, covering Arch Linux, CachyOS, and other distributions including container management, systemd-nspawn containers, and machine control.


Table of Contents

  1. Understanding machinectl
  2. machinectl Basics
  3. Container Management
  4. Machine Control
  5. Troubleshooting

Understanding machinectl

What is machinectl?

machinectl controls systemd-nspawn containers.

Uses:

  • List containers: Show containers
  • Start containers: Start containers
  • Stop containers: Stop containers
  • Container management: Manage containers

Why it matters:

  • Container management: Manage systemd containers
  • Systemd-nspawn: Control nspawn containers
  • Virtualization: Lightweight virtualization

machinectl Basics

List Machines

Basic usage:

# List containers
machinectl list

# Shows all containers

Machine Status

Container status:

# Container status
machinectl status container-name

# Shows container status

Container Management

Start Container

Start machine:

# Start container
sudo machinectl start container-name

# Starts container

Stop Container

Stop machine:

# Stop container
sudo machinectl stop container-name

# Stops container

Machine Control

Shell Access

Access container:

# Get shell in container
sudo machinectl shell container-name

# Opens shell in container

Container Logs

View logs:

# Container logs
sudo journalctl -M container-name

# Shows container logs

Troubleshooting

machinectl Not Found

Check systemd:

# machinectl is part of systemd
# Usually pre-installed on systemd systems

# Check systemd
systemctl --version

Summary

This guide covered machinectl usage, container management, and systemd-nspawn control for Arch Linux, CachyOS, and other distributions.


Next Steps


This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.

Clone this wiki locally