> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.ggcircuit.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# 🛠️ Fix: "Failed to Connect to Server" When Opening a VM Console (noVNC)

When you open a VM from the ggRock admin panel, such as **ToolchainVM** or an image VM, the noVNC screen shows a red banner reading **"Failed to connect to server"**, and the console never loads.

![](https://storage.crisp.chat/users/helpdesk/website/-/a/f/d/6/afd6941e8bc7d800/image_1sbvo54.png)
### 📌 Who This Affects
Servers updated to **Debian 12 or Debian 13** that are running a recent version of ggRock.

### 🔎 What Causes It
The console connects through a WebSocket path that changed from `/websockify` to `/vnc/websockify`. On affected servers, the new path is handled by an nginx rule that doesn't pass the WebSocket headers, so the connection fails. The fix adds a matching rule for the new path.

### ✅ Step 1: Run the Fix
Open the [Debian Control Panel terminal](https://helpdesk.ggcircuit.com/en/article/accessing-the-debian-control-panel-optional-but-recommended-1rryyk8/), SSH, or the server console as **root**, and run:

```
wget -O - https://images.ggleap.com/ManagedServices/Scripts/fix-novnc-websockify.sh | bash -
```

The script:
- Backs up `/etc/nginx/conf.d/ggrock.conf` with a timestamp
- Adds the new rule, copied from the working `/websockify` rule
- Tests the nginx configuration before applying it
- Restores the backup automatically if the test fails

When it succeeds, it prints:
```
OK: /vnc/websockify block in place; nginx tested and reloaded.
```

**Want to read the script first?** Download it and run it yourself:
```
wget https://images.ggleap.com/ManagedServices/Scripts/fix-novnc-websockify.sh
less fix-novnc-websockify.sh
bash fix-novnc-websockify.sh
```

|| If the error returns after an update, run the fix again

### 🧪 Step 2: Test the Console
1. Refresh the ggRock admin panel.
2. Open the VM and click **Connect** in the noVNC window.
3. The VM's screen should appear.

### 🔁 If the Script Says a Block Already Exists
If someone added a `/vnc/websockify` rule by hand, the script shows it and makes no changes. Those rules are sometimes missing headers or use a short timeout. To replace it with the correct rule, run:
```
wget -O - https://images.ggleap.com/ManagedServices/Scripts/fix-novnc-websockify.sh | REPLACE=1 bash -
```

### ↩️ Undo the Fix
The script prints a rollback command at the end. It looks like this, with your own backup file name:
```
cp -a /etc/nginx/conf.d/ggrock.conf.bak.YYYYMMDD-HHMMSS /etc/nginx/conf.d/ggrock.conf && systemctl reload nginx
```

### ⚠️ Troubleshooting
| Message | What it means |
| ---- | ---- |
| `run as root` | Run the command as root or with `sudo`. |
| `config not found` | `/etc/nginx/conf.d/ggrock.conf` doesn't exist on this server. Contact support. |
| `no 'location /websockify' block found` | The config doesn't look like a standard ggRock install. Contact support. |
| `nginx -t FAILED - reverting` | The script restored your original config. Contact support with a copy of the output. |

### 🧰 Workaround
You can still control VMs from the Debian Control Panel. See [Using Cockpit Virtual Machines on ggRock (Advanced)](https://helpdesk.ggcircuit.com/en/article/using-cockpit-virtual-machines-on-ggrock-advanced-6z4lw3/).

### 🆘 Still Stuck?
Chat with our support team with the purple chat bubble at the bottom-right of [ggcircuit.com](https://www.ggcircuit.com) and include:

- A screenshot of the error
- Your ggRock version (shown at the bottom-left of the admin panel)
- Your Debian version