↓ Skip to main content

When the Homelab Goes Dark: Troubleshooting Pangolin After a Restart

·11 mins· AI-written

There’s a particular kind of confidence that comes from having a homelab running smoothly. Your services are up. Your dashboards are green. Everything is humming along nicely. You start to believe that perhaps you’ve finally built something resembling a reliable infrastructure platform.

Then you restart a machine.

Suddenly, your public-facing services return 502 Bad Gateway, and your carefully constructed infrastructure becomes a very expensive way of displaying error messages.

BAD gateway, very bad
Fudge…

Welcome to homelabbing.

The incident
#

My public services run through Pangolin, which provides secure access to services hosted on my home network. Rather than exposing every service directly to the internet, Pangolin provides a central entry point on a VPS, with a tunnel back to my homelab. The setup involves a few moving parts:

  • Pangolin: The control plane and management interface.
  • Gerbil: The component handling the tunnel and proxy networking on the VPS.
  • Newt: The connector running at home, linking my services to Pangolin.
  • Traefik: The reverse proxy routing incoming requests to the appropriate services.
  • Docker: Keeping the whole arrangement contained, reproducible, and occasionally frustrating.

The home services themselves were fine. I could reach them directly over my LAN, and the Raspberry Pi running the connector could reach the backend services too. But requests coming in through Pangolin were failing with 502 Bad Gateway. The dashboard was initially affected as well, although I eventually got that working again while troubleshooting. At this point, I had a classic networking problem: the services worked locally, but the path between the public internet and those services didn’t.

Time to start pulling on threads.

First, check the obvious things
#

My first instinct was to investigate the backend services. Were the containers running? Had their IP addresses changed? Was something listening on the wrong port? Fortunately, those checks were reassuring. The services were healthy, and direct requests to their LAN addresses returned HTTP 200. That gave me an important piece of information:

the applications weren’t the problem. Something in the path between Pangolin and the applications was broken.

The next place to look was the tunnel.

Following the packets
#

Pangolin uses a WireGuard-based tunnel to connect the VPS to the home network. On the VPS, I checked the WireGuard interface inside the Gerbil container:

docker exec gerbil ip -s link show wg0

The results weren’t encouraging:

wg0: <POINTOPOINT,NOARP,UP,LOWER_UP>
    RX: bytes packets errors dropped missed mcast
         0       0      0       0      0     0

    TX: bytes packets errors dropped carrier collsns
         0       0      2       0       0

The interface existed and was up, but it hadn’t received a single packet. I also checked the route to the expected tunnel address:

docker exec gerbil ip route get 100.89.128.4

Gerbil had a route to the address through wg0. That confirmed the operating system knew where it wanted to send traffic. It didn’t confirm that the other end of the tunnel was actually communicating. This is an important distinction when troubleshooting networking: a route existing doesn’t mean the destination is reachable. Gerbil’s logs showed that it had created the WireGuard interface and configured a peer. However, that alone wasn’t enough to establish that the tunnel was carrying traffic. The problem was somewhere between having a configured tunnel and having a functioning one.

An ageing connector enters the picture
#

My Raspberry Pi was running the fosrl/newt Docker image. A quick inspection showed that the image had been created in April 2025. That wasn’t necessarily proof of a problem, but it was a useful clue: the connector had been running for quite a while without being replaced. More importantly, the logs told a story. Newt had previously been able to ping the tunnel address on the VPS, with latencies around 10–13 milliseconds. So the underlying connection had worked before. After the incident, however, the logs showed repeated failures while attempting to reconnect. One error was particularly interesting:

Failed to connect: failed to get token:
failed to request new token:
Post "https://pangolin.example/api/v1/auth/newt/get-token":
http: server gave HTTP response to HTTPS client

I’ve replaced the hostname in this example, but the error is otherwise representative of what I saw. In plain English, Newt was trying to establish an HTTPS connection but was receiving an ordinary HTTP response instead. There had also been DNS resolution failures earlier in the logs. Neither error, on its own, explained every symptom. But they showed that the connector was having trouble reaching Pangolin’s control plane. There was another reason to reconsider the existing setup: Pangolin’s newer releases had moved towards the Pangolin CLI as the site connector, rather than relying on the older Newt approach. I had a working opportunity to modernise the setup instead of spending the entire morning trying to coax an ageing component back into life.

The Gerbil upgrade
#

While investigating, I also discovered that my original Compose configuration was using an old Gerbil image:

image: fosrl/gerbil:1.0.0-beta.3

That was an early beta release.

I upgraded it to:

image: fosrl/gerbil:1.5.2

The newer version started successfully, created the WireGuard interface, configured its firewall rules, and added the peer. However, the public sites were still returning 502 errors. This was a useful reminder that successfully starting a container doesn’t mean the service it provides is working correctly. Docker can tell you that a container is running. It can’t tell you that the entire networking path through that container is healthy.

During this part of the investigation, I also experimented with port mappings. One change briefly broke HTTPS access to the Pangolin dashboard, producing a browser TLS error. Reverting the mapping restored the dashboard.

That was a detour I could have done without.

In hindsight, I should have been more disciplined about changing one variable at a time. When several components and port mappings change together, it becomes harder to tell which change fixed a problem and which one introduced another. Still, we were making progress. The dashboard was back, and the remaining problem was the connection to the home network.

Time to replace Newt
#

At this point, I decided to stop investing in the old connector and move to the newer Pangolin CLI. The Pangolin dashboard provided a site-specific Docker configuration, including the endpoint, site ID, and site secret. The generated configuration was a useful starting point. Rather than inventing my own registration mechanism, I could use the configuration Pangolin had prepared for the site.

On the Raspberry Pi, I created a dedicated directory for the new connector:

mkdir -p ~/pangolin-site
cd ~/pangolin-site

I put the site-specific settings in an environment file:

PANGOLIN_ENDPOINT=https://pangolin.example
SITE_ID=your-site-id
SITE_SECRET=your-site-secret

The actual secret belongs in the environment file, not in a blog post or a public Git repository. I then created a Compose configuration:

services:
  pangolin-site:
    image: fosrl/pangolin-cli:latest
    container_name: pangolin-site
    restart: unless-stopped
    network_mode: host
    cap_add:
      - NET_ADMIN
    devices:
      - /dev/net/tun:/dev/net/tun
    env_file:
      - .env

This gives the connector host networking, the network administration capability it needs, and access to the TUN device. Before starting it, I checked that the device existed:

ls -l /dev/net/tun

It did. I also verified that the Pi could resolve the Pangolin hostname and establish an HTTPS connection to it:

getent ahosts pangolin.example

curl -sS -o /dev/null \
  -w 'HTTP status: %{http_code}\n' \
  --connect-timeout 5 \
  https://pangolin.example/

The hostname resolved, and the request returned HTTP 200. That was reassuring: at least at that moment, DNS and HTTPS connectivity from the Pi to the VPS were working.

Making the switch
#

I stopped the old connector, leaving its container in place as a rollback option:

docker stop newt

Then I started the new connector:

docker compose pull
docker compose up -d
docker compose logs --tail 100 -f

The next step was to watch the logs and check the Pangolin dashboard. And then…

It worked.

The new connector came up, the site reconnected, and my public-facing services started working again. After a morning of chasing tunnel interfaces, container logs, port mappings, and TLS errors, the homelab was back online.

Neat.

So, what actually fixed it?
#

Here’s where I need to be honest. I can’t conclusively attribute the recovery to a single change. During the troubleshooting process, I upgraded Gerbil, changed and then reverted a port mapping, and replaced the old Newt connector with Pangolin CLI. The old connector was clearly encountering connection errors. Migrating to the new CLI restored service, but I didn’t isolate every variable well enough to prove that the connector alone was responsible. It’s entirely possible that the connector migration was the decisive fix. It’s also possible that the Gerbil upgrade or another change contributed.

The important distinction is between what I observed and what I inferred:

ObservationWhat it tells us
Backend services worked over the LANThe applications themselves were healthy.
Gerbil’s WireGuard interface had zero received packetsThe tunnel wasn’t carrying traffic at the time of the check.
Newt logs showed DNS and HTTPS connection errorsThe old connector was struggling to reach Pangolin.
The newer Gerbil container started successfullyGerbil could initialise, but this alone didn’t prove end-to-end connectivity.
Replacing Newt with Pangolin CLI restored serviceThe new configuration worked, although it doesn’t prove which individual change was decisive.

That last point matters. Troubleshooting is much more useful when you record what actually happened rather than retroactively inventing a neat explanation. The service is working. I have a strong lead on what was wrong. I don’t have a laboratory-grade proof of the root cause.

I’ll take that result.

Lessons learned
#

A few things stand out from this incident.

1. Check the whole path, not just the application
#

When a service returns 502, it’s tempting to immediately investigate the application behind it. But a reverse proxy can only return a successful response if it can reach the upstream service. In this case, the applications were healthy, but the path through Pangolin, Gerbil, the tunnel, and the home network wasn’t. Testing the backend directly over the LAN helped rule out an entire category of potential causes.

2. A running container isn’t necessarily a healthy service
#

Docker reported that the relevant containers were running. That was true, but not particularly useful. The WireGuard interface existed. Gerbil had a configured peer. The connector container was running. Yet the public services were unavailable. For infrastructure services, I need to look beyond container state and check actual connectivity: interfaces, routes, traffic counters, logs, and end-to-end requests.

3. Keep an eye on ageing components
#

The old Newt image had been around since April 2025. There’s nothing inherently wrong with running a stable image for a long time. In fact, constantly updating infrastructure just for the sake of it can create unnecessary risk. However, it’s worth periodically reviewing the components in a homelab, particularly when the upstream project changes its recommended deployment approach. In this case, moving to Pangolin CLI was a sensible opportunity to bring the site connector in line with the newer approach.

4. Change one thing at a time
#

This is probably the lesson I should have followed most carefully. I made multiple changes while troubleshooting, including upgrading Gerbil and experimenting with port mappings. One of those port changes temporarily broke HTTPS access to the dashboard. The more variables you change simultaneously, the harder it becomes to determine what worked. A better process would have been:

  1. Capture the original state and relevant logs.
  2. Identify the failing connection.
  3. Make one change.
  4. Test the result.
  5. Record the outcome before proceeding.

It’s not always possible to avoid changing multiple things, especially when upgrading related components, but it should be a deliberate decision rather than a reaction to the latest error message.

5. Preserve a rollback path
#

I stopped the old Newt container rather than deleting it. That gave me an easy way to return to the previous setup if the migration failed. Once the new connector has been stable for a while, I can remove the old container and its associated configuration. There’s little benefit in deleting your rollback option while you’re still verifying a fix.

6. Document the working configuration
#

The final working state matters more than the sequence of commands I happened to run. I should record the versions of Pangolin and Gerbil, the working port mappings, the connector configuration, and the relevant Docker Compose files. That way, the next time something breaks after a restart, I have a known-good configuration to compare against. And if I ever need to rebuild the VPS, I won’t have to rediscover all of this from scratch.

The homelab is back
#

The public services are working again, and the site connector is now using Pangolin CLI. I haven’t proved the exact root cause, but I have restored service and replaced an ageing connector with the newer approach. Not the most elegant troubleshooting session, perhaps, but a useful one.

The homelab has a few more notes in its documentation, I’ve learned a little more about how Pangolin’s networking fits together, and I’ve been reminded that infrastructure can fail in ways that aren’t immediately obvious from the status of individual containers.