RoamSwitch Pocket manual
RoamSwitch Pocket turns an M5Stack CardputerZero into a pocket travel gateway. It checks a public Wi-Fi network before and after you join, opens your own WireGuard or Tailscale tunnel, and lets your phone or laptop join the Pocket's Wi-Fi so their traffic goes through the tunnel. If the tunnel drops, device traffic is blocked instead of leaving outside the tunnel.
There are two packages.
| Package | Contents | How to install |
|---|---|---|
roamswitch-pocket-core | the network service pocketd (runs as root) and the pocketctl command | apt |
roamswitch-pocket | the screen and keyboard app (runs as your user; depends on roamswitch-pocket-core) | apt |
The screen app runs as your user, and everything that changes the network is in pocket-core, which runs as root. Both come from lafine.net/apt (the same repository as RoamSwitch for Linux).
1. Install
pocket-core uses the Tailscale package. Tailscale is not in Debian's own repositories, so add Tailscale's apt repository (Tailscale documents the steps for Debian 13) and the RoamSwitch apt repository, then install.
curl -fsSL https://pkgs.tailscale.com/stable/debian/trixie.noarmor.gpg | sudo tee /usr/share/keyrings/tailscale-archive-keyring.gpg >/dev/null
curl -fsSL https://pkgs.tailscale.com/stable/debian/trixie.tailscale-keyring.list | sudo tee /etc/apt/sources.list.d/tailscale.list
curl -fsSL https://lafine.net/apt/roamswitch-archive-keyring.asc \
| sudo gpg --dearmor -o /usr/share/keyrings/roamswitch-archive-keyring.gpg
echo "deb [arch=amd64,arm64 signed-by=/usr/share/keyrings/roamswitch-archive-keyring.gpg] https://lafine.net/apt stable main" \
| sudo tee /etc/apt/sources.list.d/roamswitch.list
sudo apt update
sudo apt install roamswitch-pocket-core roamswitch-pocket
sudo reboot
- apt installs the missing packages (nftables, wireguard-tools, tailscale, iw, hostapd, dnsmasq-base and others).
- pocketd starts tailscaled only while it uses it. On first install, the always-on tailscaled service is turned off.
- The pocketd service starts now and at every boot. It does not change the Pocket's own traffic until you start using a tunnel.
- The first user (uid 1000) is added to the
pocket-uigroup. The group's permissions take effect after you log in again, so reboot once after installing. - After the reboot, open RoamSwitch Pocket from the launcher.
2. Set up the tunnel
In the app, press 8 “Settings”, select the “Tunnel” row and press Enter to open the tunnel setup screen. Z/C switches between the WireGuard and Tailscale screens. Settings cannot be changed while protected. Saved settings are used from the next protected session.
WireGuard
The Pocket creates its own key pair the first time you open this screen. The private key is encrypted with a key made from your PIN and kept on the Pocket. It is never shown or sent out.
- Select “This device's key” and press Enter to show the public key as a QR code. Add it as
PublicKeyin the server's[Peer]section. - Give the Pocket the server settings. There are two ways.
- Use the guide page (recommended)
Press 8 “Guide” to show a QR code. Scan it with your phone to open the guide page on roamswitch.com. The page includes this Pocket's IP address, user name and public key. These values are in the URL after#, so they are not sent to the site. Following the page, writewg0.confon your computer, copy it to~/wg0.confon the Pocket withscp, then press 6 “Import”. Leave out thePrivateKeyline inwg0.conf. The Pocket adds its own key. After importing,~/wg0.confis deleted. - Type them on the Pocket
Select each row (server public key, server endpoint asIPv4:port, this device's address, DNS if you want), press Enter to type it, then press 5 “Save”.
- Use the guide page (recommended)
- Press 7 “New key” twice to create a new key pair. Then register the new public key on the server.
- Write the server endpoint as an IPv4 address and port (
203.0.113.10:51820). Names are not accepted, because looking up a name would use DNS outside the tunnel. - If you set DNS, your devices' DNS queries go to that resolver inside the tunnel. Without it, they go to
1.1.1.1. - The settings are saved in
/etc/pocket/tunnels.d/wg0.conf(root, 0600). The private key is not written there. It is encrypted and kept in/var/lib/pocket/vault/.
Tailscale
- Press 6 “Get list”. The first time, a login QR code appears. Scan it on another device, log in to Tailscale and approve.
- The exit nodes in your tailnet are listed. Select one with F/X, press Enter, then press 5 “Save”.
- “This device's name” is the name in your tailnet. Use only letters, digits and
-. - On the “Tunnel” row of the “Settings” screen, switch to Tailscale with Z/C.
- The exit node must be approved as an exit node in the tailnet admin console.
- When tailscaled is started to get the list, it is stopped again once the list is in. tailscaled runs only while the Pocket is protecting.
- The settings are saved in
/etc/pocket/tunnels.d/tailscale.conf.
3. First use
- When you open the app, it asks you to choose a PIN. Type 4 to 8 digits, press Enter, then type the same PIN again to confirm.
- The PIN itself is not stored. The Pocket makes a key from the PIN with Argon2id, encrypts the WireGuard private key with it, and keeps the result in
/var/lib/pocket/vault/(readable by root only). The PIN is checked by decrypting this. - After that, you unlock with this PIN each time the Pocket starts.
If you forget the PIN, run the following on the Pocket and choose a new one.
sudo rm -rf /var/lib/pocket/vault /var/lib/pocket/pin
sudo systemctl restart pocketd
The WireGuard private key cannot be decrypted without the PIN, so it is deleted too. After choosing a new PIN, open Settings → Tunnel (Enter) → WireGuard. The Pocket creates a new key pair, so replace the PublicKey in the server's [Peer] with the new public key. The other WireGuard settings and the Tailscale settings are kept.
After 5 wrong PINs in a row, the Pocket ignores PINs for 30 seconds.
4. Use
| Screen | What to do |
|---|---|
| Wi-Fi networks | Press 4 to scan. Select with F/X and press Enter to check. Look-alike access points are shown in red. |
| Check | Read the result before joining. Press 6 “Continue” to join, and type the password if asked. If a result is critical, press 6 again to join anyway. |
| Login page | Pages that only ask you to accept terms are passed automatically. If the page needs input such as an email address, press 6 “Help login”, join the temporary Wi-Fi shown on the screen with your phone, and open the shown URL in its browser to log in. Traffic is not protected during this step. |
| Status | When it says “Protected”, press 5 “Devices” to show the Pocket's Wi-Fi name, password and a QR code. Scan the QR code with your phone's camera to join. With USB, it shows the address range and the number of connected devices. |
| Stop | Press 7 “Stop” twice. Device traffic stops, the rules are removed and the Pocket's own traffic goes back to normal. |
- Press H (fn+H) on any screen for the key list.
- ESC goes back; hold it to close the app. pocketd keeps running after the app closes.
- The Pocket's Wi-Fi name and password change each time you start a session.
If the tunnel drops, Status shows “Traffic blocked” and device traffic does not leave. When the tunnel comes back, it returns to “Protected”.
Connect over USB
You can connect a device with a USB cable instead of the Pocket's Wi-Fi. The Pocket then does not start its Wi-Fi access point and uses its Wi-Fi only for the upstream.
- Set the Pocket's USB-SW switch to Slave. In this position, USB Wi-Fi and wired LAN adapters plugged into the Pocket cannot be used, so the upstream is the Pocket's own Wi-Fi.
- While not protecting, open 8 “Settings”, select “Devices” and press Z/C to choose USB. The choice is saved in
/var/lib/pocket/downlinkand kept after a restart. It cannot be changed while protected. - Choose a Wi-Fi network and continue as usual. When it says “Protected”, the Pocket starts sharing over USB.
- Connect your device to the USB-C port on the right side of the Pocket. A new wired network appears on the device and gets an address in
10.78.0.0/24. No password is needed. 5 “Devices” shows the address range and the number of connected devices.
- The default mode is ECM. It was confirmed to work on a Mac without extra drivers. For Windows 10 (1903 or later) and 11, write
usb_function=ncmin/etc/pocket/pocketd.confand runsudo systemctl restart pocketd(NCM is the mode Windows supports out of the box). - If the device is also on another network such as Wi-Fi, its traffic may go out that way. Turn off the device's Wi-Fi, or move USB to the top of its network order.
- Stop, lock and exiting pocketd stop USB sharing and return the Pocket's USB to how it was. USB sharing changes only the running settings (
/sys/kernel/config/usb_gadget) and does not edit any boot configuration file.
Use it from a terminal (pocket-tui)
pocket-core includes pocket-tui, which gives the screen app's controls in a terminal. Connect from a computer over SSH and start it with a terminal allocated (-t).
ssh -t <user>@<address> pocket-tui
- The SSH user must be in the
pocket-uigroup. Otherwise it shows “Cannot reach pocketd”. Runsudo adduser <user> pocket-ui, then connect over SSH again. - The screens and keys are the same as the screen app. Arrow keys also work. Press Q or Ctrl-C to quit. pocketd keeps running.
- The language follows the one chosen in the screen app. You can also choose it, for example
pocket-tui --lang ja. - The terminal does not show QR codes. It shows the Wi-Fi name and password, the public key or the URL as text. Long URLs wrap across lines, so remove the line breaks after copying, then paste into a browser.
5. At boot
Choose with boot in /etc/pocket/pocketd.conf.
- With
boot=normal(default), the Pocket's own traffic is not blocked until you start a session. - With
boot=gateway, all of the Pocket's traffic is blocked from boot until you unlock. Use this when the Pocket is only a gateway.
If pocketd stops unexpectedly, its rules stay in place, so traffic stays blocked. At the next start it keeps traffic blocked until you unlock, and tells you on the screen.
6. Troubleshooting
| Symptom | Check |
|---|---|
| The app says “Cannot reach pocketd” | systemctl status pocketd shows it running. id lists pocket-ui (if not, reboot). |
| “pocketd is not set up” | /etc/pocket/pocketd.conf exists and is valid. journalctl -u pocketd shows the reason. |
| “WireGuard is not set up” / “No Tailscale exit node is set” | Set up that tunnel in “Settings” → “Tunnel” (Enter). |
| The WireGuard tunnel does not open | The server's UDP port is reachable and the keys match. If the public Wi-Fi blocks UDP, try Tailscale. |
| The phone joins the Pocket's Wi-Fi but cannot reach the internet | If your WireGuard server runs in a Docker Desktop container on a Mac, TCP through the tunnel arrives with incorrect checksums, and only device traffic does not get through. Run the server on the host, not in a container. |
| WireGuard dropped but Status does not change to “Traffic blocked” right away | With no traffic, WireGuard handshakes about every 3 minutes, so detecting the drop takes up to about 3.5 minutes. Device traffic does not leave outside the tunnel in the meantime. |
| The Tailscale tunnel does not open | The exit node is running and approved as an exit node in the admin console. |
| No new network appears on the device after connecting USB | Is USB-SW set to Slave? Does the cable carry data (a charge-only cable will not work)? Does Status say “Protected” (USB sharing runs only while protected)? journalctl -u pocketd shows the reason. |
| “Restarting in N s” appears | The Pocket's Wi-Fi chip stopped and cannot reconnect (this rarely happens when the Pocket's own Wi-Fi is turned off). A restart fixes it, so pocketd restarts after 30 seconds. ESC cancels, but Wi-Fi then stays unavailable until a restart. |
Protection ended while upgrading with apt | An upgrade stops pocketd, which ends protection. Upgrade while not protecting. |
Logs are in journalctl -u pocketd. You can also check the current state with pocketctl '{"type":"get_state"}'.
7. Not in this version
- Devices join over the Pocket's Wi-Fi or USB. Bluetooth is not supported.
- USB sharing has been tested only with a Mac. Windows and Linux devices have not been tested yet.
- The WireGuard
Endpointaccepts IPv4 addresses only. - Tailscale login is only by browser from the QR code. Auth keys are not supported.
- Only the WireGuard private key is encrypted with the PIN. The Tailscale login state is where tailscaled keeps it (files readable by root only) and is not encrypted with the PIN.
- The Pocket has no secure element to protect keys. Anyone who takes out the microSD card can try PINs on another computer. A PIN of 4 to 8 digits can be found quickly. If you lose the Pocket, delete its public key on your server.
- The Pocket's Wi-Fi name and password cannot be fixed yet.
8. Remove
sudo apt remove roamswitch-pocket-core # keeps settings
sudo apt purge roamswitch-pocket-core # also deletes the PIN-encrypted key, known access points and tunnel settings
pocketd is stopped first, so its rules are removed and the Pocket's own traffic goes back to normal.
M5Stack and CardputerZero are trademarks or product names of their respective owners. RoamSwitch Pocket is not an official M5Stack product.