# Cockpit

# Setting Up Cockpit for Multi-Server Management (Linux Mint)

This knowledge base article summarizes the steps taken to get Cockpit running, including specific fixes for errors encountered.

## Objective

To install Cockpit on a primary Linux Mint server and connect other Linux Mint servers to manage them from a single web interface.

### Prerequisites

<div class="bs-callout bs-callout-info" id="bkmrk-primary-server%3A-linu">- **Primary Server:** Linux Mint XFCE (e.g., LinuxServer)
- **Secondary Servers:** Linux Mint XFCE (e.g., MediaServer, LinuxServer3)
- **Unsupported:** Home Assistant OS (HAOS) cannot host Cockpit directly.

</div>---

## Step 1: Install Cockpit on the Primary Server

Run these commands on the computer you want to use as your main controller:

1. **Install the software:**```
    sudo apt update && sudo apt install cockpit -y
    ```
2. **Enable the service:**```
    sudo systemctl enable --now cockpit.socket
    ```
3. **Open the firewall:**```
    sudo ufw allow 9090
    ```

## Step 2: Troubleshooting Installation Errors

**Issue:** `apt` failed due to a broken "synosnap" (Synology Active Backup) package.

**Fix:** Use a dummy script to trick the system into removing the broken package.

1. **Create the dummy script structure:**```
    sudo mkdir -p /opt/synosnap/hooks/
    sudo touch /opt/synosnap/hooks/dpkg-post-hook.sh
    sudo chmod +x /opt/synosnap/hooks/dpkg-post-hook.sh
    ```
2. **Force the install to finish:**```
    sudo apt -f install
    ```
3. **Purge the broken package:**```
    sudo dpkg --purge synosnap
    ```

---

## Step 3: Prepare Secondary Servers

**Issue:** "Unable to contact... port 22" when adding a host.  
**Cause:** Linux Mint does not have the SSH server enabled by default.

Run these commands on **every** secondary server you want to control:

1. **Install and enable SSH:**```
    sudo apt install openssh-server -y
    sudo systemctl enable --now ssh
    ```
2. **Allow SSH through firewall:**```
    sudo ufw allow ssh
    ```
3. **Install Cockpit packages (for metrics):**```
    sudo apt install cockpit cockpit-pcp -y
    ```

## Step 4: Connect Servers in the GUI

1. **Access the Web Interface:** Open a browser and go to `https://<PRIMARY_IP>:9090`.
2. **Note:** Accept the "Not Secure" / SSL warning (Advanced -&gt; Proceed).
3. **Log in:** Use your Linux username and password.
4. **Add Host:**
    - Click the dropdown menu in the top-left (or "Overview").
    - Click "Add new host".
    - Enter the IP of the secondary server.
    - Check "Log in automatically" to save credentials.

## Step 5: Enabling Metrics &amp; History

**Issue:** Missing graphs/history.  
**Fix:** The `cockpit-dashboard` package is deprecated. Use PCP (Performance Co-Pilot) instead.

Run this on **all** servers to enable history recording:

```
sudo apt install cockpit-pcp -y
sudo systemctl enable --now pmlogger
sudo systemctl enable --now pmproxy
```

---

## Known Limitations

- **Home Assistant:** Cannot be added to Cockpit (unless running as a VM inside Linux).
- **"Single Pane" Dashboard:** The old grid view of all servers at once has been deprecated.
- **Navigation:** Use the dropdown menu to switch between servers.