Service Management & Logs
This page is for users who have already installed CubeSandbox and want to keep the stack healthy in day-to-day operation.
After reading this page you will know:
- Which systemd services run on the host and how they depend on each other
- Which service to restart after editing a config file
- How to debug a service that keeps failing
- Where to find runtime logs, startup logs and in-container logs — and the boundaries between them
- How to stop / restart the whole stack cleanly
Scope
This page targets the systemd-managed one-click installer. If your machine still uses the legacy up-with-deps.sh / down-with-deps.sh scripts as the daily entry point, that is the pre-systemd version — re-running the latest one-click installer will migrate it to systemd automatically (the installer detects and takes over the old layout).
TL;DR cheat-sheet
# 1. Are all cube-sandbox services still alive?
sudo systemctl --no-legend list-units 'cube-sandbox-*'
# 2. Edited a config -> restart the matching service
sudo systemctl restart cube-sandbox-cube-api.service
sudo systemctl restart cube-sandbox-cubemaster.service
sudo systemctl restart cube-sandbox-cubelet.service
# 3. Runtime logs (requests / stats / audit / VMM) live under /data/log/, NOT in journalctl
sudo tail -F /data/log/Cubelet/Cubelet-req.log
sudo tail -F /data/log/CubeMaster/cubemaster-req.log
sudo tail -F /data/log/CubeAPI/cube-api-$(date +%F).log
sudo tail -F /data/log/CubeVmm/vmm.log # sandbox VMM lifecycle
# 4. Startup failures / process exit reasons -> journalctl
sudo journalctl -u cube-sandbox-cube-api.service -n 200 --no-pager
# 5. One-shot diagnostic bundle (tails of /data/log + configs + dmesg + process snapshot)
sudo /usr/local/services/cubetoolbox/scripts/cube-diag/collect-logs.shRuntime logs are at /data/log/, NOT journalctl
This is the most common pitfall for new operators: each component only sends startup-time stdout/stderr to journal. Request / scheduling / stat / audit / VMM creation logs are written directly to /data/log/<Module>/. To find "who created a sandbox in the last hour", look at /data/log/, not journalctl.
Service overview
The one-click installer registers 14 systemd units under /etc/systemd/system/ and aggregates them into two role-specific targets.
Role targets
| Target | Purpose | Role |
|---|---|---|
cube-sandbox-control.target | All control-plane services (default all-in-one) | control |
cube-sandbox-compute.target | Minimum subset for compute-only nodes | compute |
How aggregation works
The target lists its child services via Wants=; each service declares membership via PartOf=. So systemctl stop cube-sandbox-control.target stops every PartOf=cube-sandbox-control.target service in one shot — no need to spell out the long list of unit names.
Service catalog
| Unit | Process form | Port / listen | Present on | Upstream deps |
|---|---|---|---|---|
cube-sandbox-mysql.service | Docker container | 3306 | control | docker |
cube-sandbox-redis.service | Docker container | 6379 | control | docker |
cube-sandbox-cubemaster.service | Host process | 8089 | control | mysql, redis |
cube-sandbox-cube-api.service | Host process | 3000 (E2B-compatible API) | control | cubemaster |
cube-sandbox-network-agent.service | Host process | 19090 (health) | control / compute | network |
cube-sandbox-cubelet.service | Host process | 9999 (gRPC) | control / compute | network-agent + /data/cubelet (XFS) |
cube-sandbox-coredns.service | Docker container | 127.0.0.54:53 or 169.254.254.53:53 | control | docker |
cube-sandbox-cube-proxy.service | Docker container | 443 (TLS) / 80 | control | docker, redis |
cube-sandbox-dns.service | oneshot (no daemon) | — | control | coredns (BindsTo) |
cube-sandbox-webui.service | Docker container | 12088 | control | docker, cube-api |
Startup dependency map (control node)
docker.service
├─ mysql.service ─┐
├─ redis.service ─┼─ cubemaster.service ─ cube-api.service ─ webui.service
│ └─ cube-proxy.service
└─ coredns.service ─ dns.service (oneshot, BindsTo coredns)
network-online.target
└─ network-agent.service ─ cubelet.serviceDependencies only express startup ordering via After= / Wants=. If an upstream service crashes at runtime, downstreams are not automatically restarted — cubelet won't be cycled just because cube-api died, and vice versa.
Restarting services
Scenario A: edited a config and want it to take effect
The two most common config entry points:
- Top-level env:
/usr/local/services/cubetoolbox/.one-click.env - Per-component:
Cubelet/config/config.toml,Cubelet/dynamicconf/conf.yaml,CubeMaster/conf.yaml,network-agent/network-agent.yaml,cubeproxy/global.conf,coredns/Corefile
Restart the service that consumes that config:
# Cubelet config
sudo systemctl restart cube-sandbox-cubelet.service
# CubeMaster config
sudo systemctl restart cube-sandbox-cubemaster.service
# CUBE_API_* in .one-click.env
sudo systemctl restart cube-sandbox-cube-api.service
# cubeproxy/global.conf
sudo systemctl restart cube-sandbox-cube-proxy.service
# coredns/Corefile
sudo systemctl restart cube-sandbox-coredns.serviceEditing the systemd unit file itself
If you change /etc/systemd/system/cube-sandbox-*.service, run daemon-reload so systemd picks up the new content:
sudo systemctl daemon-reload
sudo systemctl restart cube-sandbox-<service>.serviceIf you only edited the helper script (/usr/local/services/cubetoolbox/scripts/systemd/*.sh), daemon-reload is not needed — the next restart re-invokes the script.
Scenario B: a service is failing or restart-looping
Every service has Restart=on-failure, so a single crash is auto-recovered. If the unit is restart-looping, find the root cause first.
1. Inspect current state
sudo systemctl status cube-sandbox-cube-proxy.service --no-pagerWatch for:
Active: failed/Active: activating (start-post)(still trying)Restart Counterclimbing rapidly (restart loop)- The last 10 journal lines printed at the bottom
2. Read startup logs
sudo journalctl -u cube-sandbox-cube-proxy.service -n 200 --no-pagerBest for: scripting bugs, ExecStart failures, docker pull errors, apk / apt network errors, ExecStartPost health-check timeouts.
3. Read runtime logs
If the service starts but misbehaves, runtime logs live under /data/log/, not in journal:
sudo tail -200 /data/log/Cubelet/Cubelet-req.log
sudo tail -200 /data/log/CubeMaster/cubemaster-req.log
sudo tail -200 /data/log/CubeAPI/cube-api-$(date +%F).log4. Reset the failed counter and restart
sudo systemctl reset-failed cube-sandbox-cube-proxy.service
sudo systemctl restart cube-sandbox-cube-proxy.serviceScenario C: full restart / post-maintenance recovery
# Control node
sudo systemctl restart cube-sandbox-control.target
# Compute node
sudo systemctl restart cube-sandbox-compute.targetOr from the release-bundle directory:
sudo ./down.sh
sudo systemctl start cube-sandbox-control.targetRestarting the target = ordered restart of every PartOf service
A target has no process of its own. Restarting it makes systemd cycle every PartOf=cube-sandbox-control.target service in dependency order — a shorthand for "restart everything".
Scenario D: full shutdown
# Recommended: use the bundled script (auto-detects role)
sudo /root/cube-sandbox-one-click-<version>/down.sh
# Equivalent
sudo systemctl stop cube-sandbox-control.target # control node
sudo systemctl stop cube-sandbox-compute.target # compute node