Deploying OpenClaw AI Agents on Bare Metal: A Hetzner VPS Guide
These articles are AI-generated summaries. Please check the original sources for full details.
Bare Metal AI: Taming OpenClaw on a Hetzner VPS (and surviving the systemd boss fight)
Mateusz Rusowicz deployed OpenClaw on a Hetzner Ubuntu arm64 VPS to achieve autonomous task management without SaaS limitations. The setup revealed critical dependencies on Linux user spaces and specific DBUS environment configurations.
Why This Matters
Moving AI agents from SaaS platforms to bare-metal infrastructure requires managing the disconnect between high-level autonomous logic and low-level Linux environments. Developers often face silent failures when tools like Homebrew lack compiler toolchains or when systemd services lack access to the user-space DBUS, which can stall deployment for several hours.
Key Insights
- Homebrew on fresh Ubuntu arm64 requires build-essential and gcc to prevent silent build failures during formula installation (Rusowicz, 2026).
- Switching users via ‘su -’ instead of a clean SSH login prevents DBUS environment loading, resulting in ‘Failed to connect to bus’ errors (Rusowicz, 2026).
- OpenClaw version 2026.3+ transitions terminal and file operations to the ACPX runtime and Tool Profiles rather than standard plugins (OpenClaw, 2026).
- Headless OAuth authentication for tools like gogcli can be resolved via curl callbacks to local listeners, bypassing the need for SSH port forwarding (Rusowicz, 2026).
- Systemd —user services provide superior path resolution and logging for AI agents compared to standard PM2 implementations (Rusowicz, 2026).
Working Examples
Injecting DBUS environment variables into .bashrc to fix systemd connection issues.
echo 'export XDG_RUNTIME_DIR=/run/user/$(id -u)' >> ~/.bashrc
echo 'export DBUS_SESSION_BUS_ADDRESS=unix:path=${XDG_RUNTIME_DIR}/bus' >> ~/.bashrc
Systemd user service configuration for the OpenClaw agent.
[Unit]
Description=OpenClaw Agent
After=network.target
[Service]
Type=simple
ExecStart=$(which openclaw) gateway
Restart=always
RestartSec=3
Environment="PATH=$PATH"
Environment="NODE_COMPILE_CACHE=/var/tmp/openclaw-compile-cache"
Environment="OPENCLAW_NO_RESPAWN=1"
[Install]
WantedBy=default.target
Practical Applications
- Use case: Autonomous Gmail management using gogcli on headless infrastructure. Pitfall: Using PM2 which restricts environment access, leading to permission errors during file execution.
- Use case: Bare-metal AI file system manipulation via ACPX runtimes. Pitfall: Manually editing JSON configs instead of using the OpenClaw CLI, resulting in ‘plugin not found: fs’ errors.
References:
Continue reading
Next article
containerd at Scale: 5 Day-2 Failure Patterns for High-Density Kubernetes
Related Content
Scaling 20 Autonomous AI Agents on a €4.57/Month Infrastructure
Developer Vilius successfully deployed 20 autonomous AI agents for just €4.57/month using a Hetzner CX23 VPS and a 10-pattern methodology for resilience and memory.
Implementing Agentic Governance: Why Observability Is Not Control in AI Production
Agentic governance provides real-time enforcement of policies to prevent autonomous AI agents from exceeding budgets or leaking PII in production environments.
Self-Hosted AI Infrastructure: The 2026 Guide to Cost-Zero Token Operations
Transitioning to self-hosted AI reduces operational costs by 17x, with DeepSeek V3.2 outperforming Claude Sonnet 4.6 at $0.00024 per request.