sudoFull project diagnostics
Use this when the repo is installed under /opt.
sudo bash /opt/clayproject-print-server/scripts/pi-diagnose.sh
Common commands for checking Wi-Fi, network, services, Cloudflare Tunnel, CUPS, printer readiness, logs, and local print-server health on the Raspberry Pi.
Best first command when SSH still works. It captures Wi-Fi, DNS, services, journals, CUPS, USB printer presence, and tunnel status.
Use this when the repo is installed under /opt.
sudo bash /opt/clayproject-print-server/scripts/pi-diagnose.sh
Useful when debugging remotely or sharing output later.
sudo bash /opt/clayproject-print-server/scripts/pi-diagnose.sh 2>&1 | tee ~/print-server-diagnostics.txt
Use this if you are in the cloned project directory.
sudo bash scripts/pi-diagnose.sh
Basic identity, hostname, OS, uptime, time sync.
whoami
hostname
uname -a
uptime
timedatectl status --no-pager
Quick resource check for low storage or memory pressure.
df -h
free -h
top -b -n 1 | head -40
Look for the API server, CUPS, Ghostscript, and cloudflared.
ps aux | grep -E 'clayproject|cups|cloudflared|gs' | grep -v grep
Shows the Wi-Fi network the Pi is currently using.
iwgetid -r
Signal strength, connected AP, bitrate, and interface details.
iw dev wlan0 link
ip -brief addr show wlan0
Device state and saved Wi-Fi connection profiles.
nmcli device status
nmcli -f NAME,TYPE,AUTOCONNECT connection show
Replace the connection name with the exact name from nmcli connection show.
sudo nmcli -s -g 802-11-wireless-security.psk connection show "Your-WiFi-SSID"
Useful if the expected studio network is not visible.
nmcli device wifi list
Only useful on older Raspberry Pi OS setups.
wpa_cli -i wlan0 status
sudo sed -n '/network={/,/}/p' /etc/wpa_supplicant/wpa_supplicant.conf
See the Pi's IP addresses and default gateway.
ip -brief addr
ip route
Confirms DNS resolution for the public hostname and Cloudflare.
getent hosts printer.clayproject.at
getent hosts cloudflare.com
Cloudflare trace shows outbound HTTPS connectivity and location info.
curl -fsS --max-time 10 https://www.cloudflare.com/cdn-cgi/trace
Checks whether the local API is listening on port 3000.
ss -tlnp | grep -E '(:3000|cloudflared)' || ss -tlnp
Print server API, Cloudflare Tunnel, and CUPS status.
systemctl --no-pager status clayproject-print-server cloudflared cups
Compact status for quick checks.
systemctl is-active clayproject-print-server cloudflared cups
systemctl is-enabled clayproject-print-server cloudflared cups
Use after changing config or when a service is stuck.
sudo systemctl restart clayproject-print-server
sudo systemctl restart cloudflared
sudo systemctl restart cups
Use this if services do not start after reboot.
sudo systemctl enable cloudflared clayproject-print-server cups
Press Ctrl+C to stop following.
journalctl -u clayproject-print-server -f
journalctl -u cups -f
journalctl -u cloudflared -f
Most useful when local /health or /ready fails.
journalctl -u clayproject-print-server -n 120 --no-pager
Use for 1033 errors, reconnect loops, or auth/config issues.
journalctl -u cloudflared -n 160 --no-pager
Use for stuck jobs, printer offline, or USB printer issues.
journalctl -u cups -n 120 --no-pager
/health checks process and CUPS. /ready checks printer readiness.
curl -s http://127.0.0.1:3000/health | jq
curl -s http://127.0.0.1:3000/ready | jq
Use when the compact command is not enough.
curl -sv --max-time 10 http://127.0.0.1:3000/health
curl -sv --max-time 10 http://127.0.0.1:3000/ready
If local works but public fails, focus on cloudflared.
curl -sv --max-time 20 https://printer.clayproject.at/health
First commands for public hostname failures.
systemctl --no-pager status cloudflared
journalctl -u cloudflared -n 120 --no-pager
Shows the configured tunnel and route information.
sudo cloudflared tunnel list
sudo cloudflared tunnel info clayproject-print-server
Use if the tunnel points at the wrong hostname/origin.
sudo bash /opt/clayproject-print-server/scripts/pi-setup-cloudflared.sh
Checks the configured CUPS printer and its URI.
lpstat -p PM-241-BT
lpstat -v PM-241-BT
Shows pending or stuck jobs.
lpstat -o
The Phomemo USB ID used by this project is 2e3c:5750.
lsusb
lsusb -d 2e3c:5750
This clears every queued CUPS job.
cancel -a
Shows local config. Avoid sharing raw secrets from this output.
sudo sed -E 's/(API_KEY=).*/\1<redacted>/; s/(PRINT_SERVER_API_KEY=).*/\1<redacted>/' /etc/clayproject-print-server/env
Confirms hostname, tunnel, credentials file, and origin service.
sudo sed -E 's/(credentials-file:[[:space:]]*).*/\1<redacted>/' /etc/cloudflared/config.yml
Restart the service after changing this file.
sudo nano /etc/clayproject-print-server/env
sudo systemctl restart clayproject-print-server
These change runtime state. Use them after reading status and logs.
Restart the core stack, then run diagnostics.
sudo systemctl restart cloudflared clayproject-print-server cups
sudo bash /opt/clayproject-print-server/scripts/pi-diagnose.sh
Last resort when services are stuck or USB state looks broken.
sudo reboot
Safe rollback if you need the public tunnel offline.
sudo systemctl stop cloudflared
sudo systemctl stop clayproject-print-server
Independent fallback path from Cloudflare Tunnel.
systemctl --no-pager status tailscaled
tailscale status
tailscale ip
Run this on your Mac, not inside the Pi SSH session.
tailscale status
tailscale ssh <pi-user>@clayproject-print-server
Use once if Tailscale SSH is not configured yet.
sudo bash /opt/clayproject-print-server/scripts/pi-setup-tailscale-ssh.sh