Troubleshooting
Troubleshooting
Common issue remediation/prevention
To solve some common issues:
- Ensure
PermitRootLogin yesremains set in/etc/ssh/sshd_config(in the instance) or the machine may become inaccessible/fail to start. - If a custom root password (e.g.
pass) is set (in the instance), addrootpassword: passinconfig.yamlviaalpine edit machine-nameor directly with any text editor. - If
alpine listreports a machine isRunningbut the process has been terminated/killed, deleting the PID file at~/.macpine/machine-name/alpine.pidmay resolve the issue.killall qemu-systemmay also be useful to hard stop any running instances if needed.
Adjusting time
Time sync issues between the host and a VM are well known. For example, when the host is suspended, the VM clock will also stop ticking.
To re-adjust a macpine instance real-time clock to its system clock, execute (inside the instance):
hwclock -s
Or on the host:
alpine exec instance-name "hwclock -s"
Also, consider an ntp daemon within your instance to maintain the system clock. This can be added inside your instance:
apk update; apk add openntpd
rc-update add openntpd default
rc-service openntpd start
or
apk update; apk add chrony
service chronyd start
More information on chronyd can be found on the Arch wiki
Networking issues
- Due to how
qemuforwards network connections from the guest out via the host, utilities such aspingmay not work (as ICMP is not handled). - If an instance fails to start with a port error, there may be a listener already bound to the requested port(s). Ensure that the
sshport and any ports on the host side in thePortsconfiguration are mutually exclusive between instances which must run simultaneously. netstat -anp tcpandnetstat -anp udpcan be used to discover activeLISTENconnections on the host. Ensure no other running services have bound ports that are configured to be forwarded to an instance (sshor otherwise).qemubinds0.0.0.0for forwarded ports. This means that by default any source IP may send traffic to a guest. If the host system does not have a firewall enabled then any machines which can reach the host can send traffic to the guest. If this is not desired, enable a host firewall. You do not need to click "Allow" for incoming connection toqemuwhen prompted by macOS as loopback connections (i.e. directly from the host itself) will still be allowed.
Instance hangs on boot with no console output (qemu 11.1.1 regression)
On Apple Silicon, aarch64 instances using vmnet networking (vmnet: true in config.yaml) may fail to boot when using qemu 11.1.1: the qemu-system-aarch64 process pins a CPU core near 100%, produces no serial console output at all, and the instance never acquires a DHCP lease or becomes reachable. This reproduces with a bare qemu-system-aarch64 invocation (outside of macpine), so it is not a macpine bug — it appears to be a regression in qemu 11.1.1 itself affecting early boot/firmware on the aarch64 virt machine type with HVF acceleration.
Downgrading to qemu 10.0.3 resolves the issue. If you have an older 10.0.3 keg still available via Homebrew:
brew unlink qemu
brew link qemu@10.0.3 # or manually symlink the qemu-system-* binaries from
# /opt/homebrew/Cellar/qemu/10.0.3/bin into /opt/homebrew/bin
brew pin qemu # prevent `brew upgrade` from reintroducing the regression
If Homebrew has already removed the old keg, you can also build/install qemu 10.0.3 from source or an older bottle. Track upstream for a fix before unpinning.
Other issues
- If alpine is not able to resize the disk, it will error out with this message:
unable to resize disk: signal: abort trap. Internally, it runs the commandqemu-img resize <IMAGE_LOCATION> <+SIZE>. If theqemu-img resizecommand errors out withdyld[...]: Library not loaded: /opt/homebrew/opt/libunistring/lib/libunistring.2.dylibthen re-installinggettextviabrew reinstall gettextmay resolve the issue.