srt is pinned to 0.0.83, the version the smoketest passed with. A computer with another version sees the agents item as to do in configure, which installs the pinned one. Move the pin only after smoketest/run 50 80 passes. The installer and configure stop on Pop!_OS (or Ubuntu) older than 26.04. The smoketest builds on Ubuntu 26.04, with checks that 24.04 is refused. 26.04's own AppArmor profile lets bubblewrap make user namespaces, so the connector's profile for it, and the code that offered to add it, are gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
188 lines
19 KiB
Markdown
188 lines
19 KiB
Markdown
# Federated Connector for Pop!_OS
|
|
|
|
Sets up a Pop!_OS computer for your Federated Core. It's the Pop!_OS counterpart of [CoreDesktop](https://gitea.federated.computer/Federated_Computer/coredesktop)'s `configure`, with the same items, and works the same way: it shows what's set up, sets up the rest, and can test and fix a Core later.
|
|
|
|
## Requirements
|
|
|
|
- Pop!_OS 26.04 or later, with COSMIC. Older releases aren't supported: the installer and `configure` stop on them. Most of it works on other Ubuntu-based systems too; `configure` says so if it's run on one.
|
|
- An administrator account (in the `sudo` group): `configure` installs packages and changes system settings such as mounts, printers and Tailscale.
|
|
|
|
## Installing
|
|
|
|
In a terminal:
|
|
|
|
```
|
|
curl -fsSL https://federated.sh/pop | bash
|
|
```
|
|
|
|
federated.sh/pop sends curl to [install.sh](install.sh) here on Gitea, so you can read what it runs first. In a browser, it opens this page.
|
|
|
|
It checks the computer first: Linux with apt, not run as root, and an internet connection. It warns if this isn't Pop!_OS, or if your account isn't an administrator. Then it:
|
|
|
|
- installs the few packages `configure` itself needs: curl, jq, libsecret-tools, python3-gi, gir1.2-secret-1 and libnotify-bin
|
|
- downloads the latest version into `~/.local/share/federated-connector/connector`. Pop!_OS doesn't come with git, so it downloads an archive.
|
|
- adds the `configure` and `update` commands to `~/.local/bin`
|
|
- makes sure `~/.local/bin` is on your PATH, at the top of `~/.bashrc`
|
|
- offers to run `configure`
|
|
|
|
Running it again reinstalls the latest version. The logs are in `~/.local/state/federated-connector/`.
|
|
|
|
The install's folder never moves. That matters because the backup, email-watch and network storage services point into it.
|
|
|
|
## Running it
|
|
|
|
```
|
|
configure # show what's set up and choose what to set up
|
|
configure core # set up one item
|
|
configure --list # show what's set up, and the item names
|
|
```
|
|
|
|
## Updating
|
|
|
|
```
|
|
update # get the latest version, showing what changed
|
|
update --version # the version installed
|
|
```
|
|
|
|
`update` downloads the latest version and swaps it in at once, so it's safe while a backup runs. It brings the services `configure` set up up to date too. Your settings, accounts, keyring items and downloaded tools stay as they are.
|
|
|
|
Everything `configure` installs from apt (Evolution, davfs2, restic, Tailscale, mise...) is updated by Pop!_OS' own updates, in the COSMIC Store or with `sudo apt upgrade`. Flatpak apps such as Element update there too.
|
|
|
|
## What it sets up
|
|
|
|
Each item installs what it needs the first time you set it up, after asking.
|
|
|
|
- **Your Federated Core.** Give it your Superpanel's address (e.g. https://superpanel.example.com), your Core email, name and password. It sets up:
|
|
- **Email, calendars and contacts**, shown in Evolution. COSMIC doesn't have online accounts of its own yet, so `configure` installs GNOME Online Accounts and Evolution and adds the accounts the way GNOME Settings would. GNOME Online Accounts runs on its own, without GNOME. Your passwords are kept in your keyring, which COSMIC unlocks when you log in.
|
|
- Email keeps your Core password, because the mail server doesn't take Nextcloud app passwords. Its settings come from the mail server's autoconfig, or the usual ones if the server doesn't publish them.
|
|
- Calendars and contacts use a Nextcloud app password, "Pop!_OS on {your computer}", which you can revoke in Nextcloud under Settings > Security.
|
|
- **Superpanel** in your applications (the COSMIC launcher and app library), with Superpanel's own icon.
|
|
- **Your Nextcloud files**, mounted at /mnt/example.com with davfs2, and shown in the COSMIC Files sidebar as "example.com". `configure` makes `mount.davfs` setuid and adds you to the `davfs2` group, so you can mount it without sudo. It mounts when you log in.
|
|
- **Element**, pointed at your Core's Matrix server, for your main Core. If Element isn't installed, it offers to install it from Flathub, as the COSMIC Store would.
|
|
- **Tally for Plausible**, if it's installed and your main Core runs Plausible Analytics: it's pointed at plausible.example.com.
|
|
- **An email watcher**, a user service that pauses your Core's email if its password stops working (see below).
|
|
|
|
You can add more Cores: run `configure core` again and choose "Add a Core". Each gets its own Superpanel, accounts and files. Element, Tailscale and backups use your main Core (the first one, unless you choose another).
|
|
|
|
`configure core` also offers:
|
|
- **Test a Core**: it checks Superpanel, calendars and contacts, email, your files, Element and backups the way this computer uses them, says which work, and offers to fix those that don't. If a fix needs it, for example a new app password for one that was revoked, it asks for your Core password. Then it tests again.
|
|
- **Your Core password changed**: email gets the new password, and signing in to Nextcloud with it turns the app passwords for calendars, contacts, files and backups back on (Nextcloud turns them off when your password changes). Then it checks each of them.
|
|
- **Remove a Core**: it removes the accounts, the mount and Superpanel, and revokes the app password. Everything on the Core itself stays as it is.
|
|
- **Tailscale**: joins this computer to your Core's Tailscale network through headscale.example.com. If Tailscale isn't installed, it installs it from Tailscale's own apt repository. You can use `tailscale` without sudo afterwards. Files your other computers send here with Taildrop (`tailscale file cp <file> <computer>:`, or Tailscale's apps) are saved to Downloads, with a notification. On a network with a sign-in page (hotels, airports, trains), a Tailscale exit node would keep the page from loading, so a NetworkManager script stops using it until you've signed in, then uses it again (`/etc/NetworkManager/dispatcher.d/90-federated-connector-captive-portal`). To leave the network, run `configure tailscale` again.
|
|
- **Backup**: backs up your home folder daily to your Nextcloud files, in a `.backup-{computer name}` folder, with restic (from Ubuntu's packages).
|
|
- The backup is encrypted with a passphrase that `configure` shows you once. Save it somewhere other than this computer, such as Bitwarden.
|
|
- It keeps 7 daily, 4 weekly and 6 monthly backups. It leaves out caches, things that can be reinstalled, and Flatpak apps' caches. To leave out more, list paths in `~/.config/federated-connector/backup-exclude`, one per line.
|
|
- restic reaches Nextcloud directly through rclone, with its own Nextcloud app password ("Federated Backup on {your computer}"), so the backup doesn't depend on the /mnt mount.
|
|
- A systemd user timer runs it, and catches up at your next login if the computer was off. If a backup fails, you get a notification. To follow one: `journalctl --user -fu federated-connector-backup`.
|
|
- To turn backups off, run `configure backup` again. It also offers to delete the backups from your Nextcloud files (they go to Nextcloud's trash bin).
|
|
- **AI agents**: offers to install Claude Code, opencode and Hermes Agent with each one's own installer, and runs them in a sandbox (see below). `configure claude`, `configure opencode` and `configure hermes` sign in to them and choose their model providers.
|
|
- **Languages**: installs programming languages and tools with [mise](https://mise.jdx.dev), from mise's own apt repository: Ruby on Rails, or any tool mise knows (`mise registry` lists them), such as `node@lts` or `java@21`. To update them: `mise upgrade`. To remove one: `mise unuse -g <tool>`.
|
|
- **AI servers**: LLM servers on your network, such as Ollama on a Mac. It finds the machines on your network over mDNS and asks each one on the ports LLM servers use (11434 Ollama, 1234 LM Studio, 8080 llama.cpp, 8000 vLLM), since LLM servers don't announce themselves. Once you've run `configure tailscale`, it also asks the computers on the Core's network, so a laptop away from home still finds them; a machine found both ways is listed once, by its Tailscale name. Or you enter a server's address. For the server you choose, it:
|
|
- lets the sandboxed agents reach it (that port only)
|
|
- adds it to opencode with its models
|
|
- offers to make it Hermes' model
|
|
- lets the commands Claude Code runs reach it too
|
|
|
|
A server has to accept connections from other machines: in Ollama's settings, turn on "Expose Ollama to the network"; in LM Studio, "Serve on Local Network".
|
|
- **Printers** on your network. It lists the printers it finds, whether they're reached directly or shared by another computer, and adds the ones you choose as printers on this computer, without drivers (IPP Everywhere), so they're in every print dialog. A printer another computer shares that can also be reached directly is marked, and not chosen unless you pick it. Printers already added (e.g. by cups-browsed) are left alone. To choose without being asked, set a default printer or print a test page, run `~/.local/share/federated-connector/connector/system/setup-printers.sh --help`.
|
|
- **Network storage**: shared folders from other machines on your network, mounted in /mnt and added to the COSMIC Files sidebar. It finds SMB servers (Windows, Samba and NAS boxes, and Macs with File Sharing on) and machines you can ssh to. Once you've run `configure tailscale`, it also finds them on the Core's network, so a laptop away from home still finds the MiniServer: it asks each computer there whether it takes SSH or SMB connections. A machine found both ways is listed once, by its Tailscale name, and mounted at /mnt/<its short name> either way. Or you enter an address (`smb://nas.local/files`, `sftp://me@server.local/srv/data`).
|
|
- An SMB share is in /etc/fstab and mounts the first time you open its folder, so a server that's off doesn't hold anything up. Its password is kept in /etc/federated-connector/smb, readable only by root.
|
|
- An SFTP folder is mounted by sshfs as you, at login, with the SSH keys in your Bitwarden SSH agent or your keyring's, so the server has to accept one of them (it can't ask for a password).
|
|
- "Remove one" unmounts it and takes it back out.
|
|
- **Agent sandbox**, if WinBoat is set up: the sandbox hides WinBoat's settings (~/.winboat) from agents, since they include your Windows password. To let agents read them, run `configure sandbox` and switch it; switch it again to hide them.
|
|
- **Security key**, if one is plugged in: a FIDO2 key (YubiKey, Nitrokey, SoloKey, ...) to touch instead of typing your password for sudo and the password prompts of COSMIC's apps and settings (polkit). Without the key, they ask for your password as before. It installs `libpam-u2f`, `pamu2fcfg` and `fido2-tools`. Run it again to add a spare key, or to stop using keys.
|
|
- **Fingerprint**, if this computer has a fingerprint reader: the same, with your fingerprint. It installs `fprintd` and enrolls your right index finger, unless you've enrolled one already. With the laptop's lid shut, it goes straight to your password. The login and lock screens still ask for your password. Run it again to stop.
|
|
|
|
Both add a line at the top of `/etc/pam.d/sudo` and `/etc/pam.d/polkit-1` (a copy of `/usr/lib/pam.d/polkit-1`), not to `common-auth`, which every sign-in uses. `/etc/pam.d/sudo` is a file the `sudo-common` package owns, so if an update to it changes the file, apt keeps yours or asks. Security keys are in `/etc/u2f_mappings`, and the lid check is `/usr/local/lib/federated-connector/lid-closed`.
|
|
|
|
### When your Core password changes
|
|
|
|
Your email keeps your Core password, so after you change it (e.g. in Superpanel), the mail server starts refusing the old one. Online Accounts tries it again each time your network changes, and Evolution each time it fetches mail. After a few wrong passwords, the mail server blocks this computer for a while.
|
|
|
|
So the email watcher watches for it, without ever trying the password on the mail server:
|
|
|
|
1. When your password changes, Nextcloud stops accepting the app passwords this computer uses, and Online Accounts notices.
|
|
2. The watcher then checks the password your email has with Nextcloud, once.
|
|
3. If Nextcloud says it's wrong, the watcher pauses your email: this computer stops trying the old password, and you get a notification.
|
|
|
|
Click the notification to open `configure core` in COSMIC Terminal, choose "Your Core password changed" and enter your new password; that ends the pause.
|
|
|
|
Online Accounts doesn't reliably tell a refused password from a server it just can't reach. The watcher and "Test a Core" don't take that to mean a wrong password: they check with Nextcloud first, and do nothing if Nextcloud can't be reached either.
|
|
|
|
### Restoring from a backup
|
|
|
|
To see the backups and get files back:
|
|
|
|
```
|
|
source ~/.local/share/federated-connector/connector/system/backup-env.sh
|
|
restic snapshots
|
|
restic restore latest --target ~/restored --include ~/Documents
|
|
```
|
|
|
|
On a new computer, run `configure core` and `configure backup` first. Then name the old computer's folder, and restic asks for the passphrase you saved:
|
|
|
|
```
|
|
source ~/.local/share/federated-connector/connector/system/backup-env.sh .backup-{old computer's name}
|
|
restic snapshots
|
|
```
|
|
|
|
## Sandboxed AI agents
|
|
|
|
opencode, Hermes and Cline Desktop run in Anthropic's sandbox runtime (srt), which uses bubblewrap. In the sandbox, an agent:
|
|
|
|
- can change files only in the folder you start it in (plus its own settings, /tmp and a few package caches), so start it from a project folder
|
|
- can't read your SSH keys, keyrings, password managers, browser profiles, Evolution's mail, calendars and contacts, Thunderbird, Element, cloud and Git credentials, the other agents' logins, or Federated Connector's settings (your Core's domain and user name, and what the sandbox allows)
|
|
- can reach only AI providers and common developer sites: GitHub, Gitea, npm, PyPI, crates.io, RubyGems, the Go module proxy, and Ubuntu's and Pop!_OS' sites
|
|
|
|
Typing `opencode`, `hermes` or `hermes-agent` runs it in the sandbox: `configure agents` adds a block at the end of ~/.bashrc that puts `sandbox/bin` first on PATH. To run one without the sandbox, type `unsandboxed opencode`. Claude Code uses its own built-in sandbox, also on bubblewrap, for every command it runs, which `configure agents` turns on (see `/sandbox` inside Claude). If you had no Claude Code settings, it also adds notifications for when Claude needs you and when it's done. Clicking one brings back the app Claude runs in (COSMIC Terminal, VS Codium, or the terminal tmux is in); the title shows the project folder. Settings written by an earlier version, whose notifications did nothing when clicked, are changed to match the next time you run `configure agents`, and only those two hooks.
|
|
|
|
If Hermes' gateway is set up as a service, `configure agents` runs it in the sandbox too. Hermes can change its own settings from inside the sandbox, so the Matrix server they name isn't trusted on its own: `configure hermes` asks whether it's your server and may be reached, and keeps your answer in `~/.config/federated-connector/sandbox/hermes.json`, which no sandbox can read or write. For other messaging services, add their domains to that file as shown below. If Cline Desktop is installed, its entry in the app library opens it in the sandbox.
|
|
|
|
srt needs Node.js 22.12 or later, which Pop!_OS doesn't install. Unless a new enough one is installed already (Pop!_OS 26.04's `nodejs` package is), `configure agents` downloads the current LTS from nodejs.org into `~/.local/share/federated-connector/node`, checks it against the SHA-256 sums nodejs.org publishes, and uses it only for srt. srt itself is pinned to a version the smoketest has passed with (`SRT_VERSION` in `configure.d/lib/tools.sh`); when a newer Federated Connector moves the pin, `configure` shows the agents item as to do, and running it installs that version.
|
|
|
|
To allow more, put a file in the same format as `sandbox/config/base.json` in `~/.config/federated-connector/sandbox/`: `base.json` for every agent, or `<agent>.json` for one. Lists in it are added to the built-in ones.
|
|
|
|
## Where things are
|
|
|
|
- Your answers: `~/.config/federated-connector/`. That's `cores/<domain>.conf`, `core.conf` for the main Core, `tailscale.conf`, `backup.conf`, `storage`, `ai-servers`, `printers`, `languages`, `agents`, and your own `sandbox/` config.
|
|
- Accounts: GNOME Online Accounts (`~/.config/goa-1.0/accounts.conf`), with their passwords in your keyring
|
|
- The backup's app password and passphrase: your keyring, attributes `federated-connector backup`
|
|
- Your files' app password: `~/.davfs2/secrets`
|
|
- Services: `~/.config/systemd/user/federated-connector-{backup.service,backup.timer,email-watch.service,taildrop.service,sftp-*.service}`
|
|
- The Files sidebar: `~/.config/cosmic/com.system76.CosmicFiles/v1/favorites`, and `~/.config/gtk-3.0/bookmarks` for GTK apps
|
|
- Federated Connector itself: `~/.local/share/federated-connector/connector`, with `configure` and `update` linked in `~/.local/bin`
|
|
- Downloaded tools: `~/.local/share/federated-connector` (`node`, `srt`)
|
|
|
|
## Adding an item
|
|
|
|
Each file in `configure.d/` is one item. It sets `TITLE` and `DESCRIPTION` and defines `is_configured` and `run_configure`. It can also define `is_installed`, and the item is left out when that fails. Items get `CONNECTOR`, `CONF_DIR`, `confirm` and `confirm_yes` from `configure`, and `pkg_ensure` to install what they need. Libraries are in `configure.d/lib/`:
|
|
|
|
- `packages.sh`: apt packages and Flatpak apps
|
|
- `goa-account`: accounts in GNOME Online Accounts
|
|
- `nextcloud.sh`: app passwords
|
|
- `sidebar.sh` and `cosmic-favorites`: the Files sidebar
|
|
- `json.sh`: editing JSON settings files
|
|
- `mdns.sh`: finding things on the network with Avahi
|
|
- `tailnet.sh`: finding the computers on the Core's Tailscale network
|
|
- `pam.sh`: adding sign-in methods to sudo and polkit
|
|
- `agents.sh`: the agents' real commands and srt
|
|
- `tools.sh`: Node.js and srt
|
|
|
|
`system/` has what runs in the background (`backup`, `email-watch`, `sftp-mount`) and their systemd units, and `sandbox/` has the sandbox wrapper and its config.
|
|
|
|
## Testing
|
|
|
|
`make lint` runs shellcheck. `smoketest/run` runs the scenarios in `smoketest/`, each in a fresh Ubuntu 26.04 container with Docker. See [smoketest/README.md](smoketest/README.md).
|
|
|
|
## Differences from CoreDesktop
|
|
|
|
- Email, calendars and contacts are shown in Evolution, as COSMIC has no Online Accounts of its own. CoreDesktop adds them to GNOME's Settings.
|
|
- What each item needs is installed when you set it up, from apt, Flathub or the tool's own apt repository, rather than all at install time.
|
|
- The Files sidebar is COSMIC Files'; folders are added to GTK's bookmarks too.
|
|
- davfs2 mounts need Ubuntu's setuid `mount.davfs` and the `davfs2` group, where Arch uses the `network` group.
|
|
- Languages come from mise's apt repository, and nothing is installed with it up front. CoreDesktop's `update` upgrades them; here, run `mise upgrade`.
|
|
- The agents are installed by `configure agents`, and srt runs on its own Node.js. bubblewrap needs Pop!_OS 26.04's AppArmor profile for it (`bwrap-userns-restrict`).
|
|
- A fingerprint works for sudo and polkit, but not the login and lock screens: COSMIC's greeter signs in through `common-auth`, which this leaves alone. CoreDesktop's works on GNOME's login and lock screens too.
|
|
- `update` updates only Federated Connector; Pop!_OS updates the rest. Like CoreDesktop's, it keeps the computer awake until it's done.
|
|
- Taildrop receives files, but COSMIC Files has no Scripts menu for CoreDesktop's "Send with Tailscale"; send with `tailscale file cp`.
|