Skip to content

feat(snap): add snap install method to install.sh when available#2250

Open
olivercalder wants to merge 7 commits into
NVIDIA:mainfrom
olivercalder:feature/install-snap-default
Open

feat(snap): add snap install method to install.sh when available#2250
olivercalder wants to merge 7 commits into
NVIDIA:mainfrom
olivercalder:feature/install-snap-default

Conversation

@olivercalder

@olivercalder olivercalder commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Update install.sh to install the OpenShell snap package if snapd is available on the system and the required conditions are met. Also add the OPENSHELL_INSTALL_METHOD environment variable to force a particular install method rather than fall back to automatic system detection.

Related Issue

Based on: #1697 (picking up the work from @zyga)

Addresses: #1674

Changes

  • The install script detects the presence of snapd and if compatible conditions (docker snap) are met, installs the snap from the store.
  • Adds OPENSHELL_INSTALL_METHOD to override automatic detection
    • Supports deb, rpm, snap, and homebrew

Testing

  • mise run pre-commit passes
  • Unit tests added/updated
  • E2E tests added/updated (if applicable)

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)
  • Architecture docs updated (if applicable)

@copy-pr-bot

copy-pr-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown

All contributors have signed the DCO ✍️ ✅
Posted by the DCO Assistant Lite bot.

@olivercalder

Copy link
Copy Markdown
Contributor Author

I have read the DCO document and I hereby sign the DCO.

@olivercalder

Copy link
Copy Markdown
Contributor Author

recheck

zyga and others added 4 commits July 14, 2026 22:41
…ovisioning

Add snap install path to install.sh so that on Linux systems with snapd
available and no native Docker Engine installed, the installer chooses
the snap path. Snap is preferred when 'snap' command exists and
'snapd.socket' is active.

New functions:
- has_snapd(): detects snapd availability via snap command + snapd.socket
- has_native_docker(): pre-flight check for conflicting native Docker
- install_linux_snap(): installs openshell snap, Docker snap if missing,
  connects interfaces (best-effort), registers gateway via HTTP, verifies status
- register_local_gateway_snap(): gateway add with http:// URL (no mTLS)
- wait_for_local_gateway_listener_snap(): waits for HTTP listener

linux_package_method() returns 'snap' when snapd is available and no native
docker, respecting OPENSHELL_INSTALL_METHOD=classic override.

The installer handles the full flow: installing Docker snap if missing,
connecting all required interfaces, and registering the gateway.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Fix the snap gateway protocol from https to http to match what the
installer actually registers. Correct misleading claims that the
installer "exits with an error" and "refuses" snap installs on hosts
with native Docker — it silently falls back to classic.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Adjust the wording of the installation docs for the `openshell` snap. In
particular, clarify when the snap will be installed, how it currently
requires the docker snap, and how to override the installation method.

Also, prune some of the manual interface connections, as these have
since been granted autoconnection via snap store assertions. See:

https://forum.snapcraft.io/t/please-update-snap-declaration-assertion-for-openshell/51762

Signed-off-by: Oliver Calder <oliver.calder@canonical.com>
As @drew suggested, add `deb`, `rpm`, `snap`, and `homebrew` as
installation methods which the user can specify via
`OPENSHELL_INSTALL_METHOD` rather than falling back to detecting the
package manager automatically.

`homebrew` is not yet supported on Linux, and it is the only supported
option on MacOS.

Also adds a TODO to implement `install_linux_homebrew` in the future.

Signed-off-by: Oliver Calder <oliver.calder@canonical.com>
@olivercalder
olivercalder force-pushed the feature/install-snap-default branch from 70480f2 to 22525a2 Compare July 15, 2026 03:48
@olivercalder

Copy link
Copy Markdown
Contributor Author

Rebased to pull in the changes from #2280 which remove the ssh-keys interface, which was the final remaining interface which required manual connection. Now all interfaces are auto-connected.

@olivercalder

Copy link
Copy Markdown
Contributor Author

We're shipping an improvement to the docker interface in snapd 2.77 to allow the openshell snap to connect to system (non-snap) docker daemons. That will eliminate the requirement for the docker snap to be present. I'm planning to do some testing of snapd latest/edge today to confirm this all works as expected.

Once snapd 2.77 hits latest/stable, the installation instructions and script in this PR can be updated. But we have strict certification processes so it will be several weeks before that happens.

@krishicks

Copy link
Copy Markdown
Collaborator

Would you mind updating the release-canary Github Action to use this? Presently it fetches the snap from the release artifacts and installs it manually, but the other installations (excepting Kubernetes) use install.sh to install the latest available version. In the near future this will all change when we revamp the build and release process, but for now consistency is probably better.

I'm unsure about exposing an env var to force the installation mechanism. To me, the contract of install.sh is to do that for you. The only real knob it has today is which version to install, typically dev. We may be adding additional knobs to the installer later, but I don't think we should incorporate that into this change.

Split the `ubuntu` release canary into three jobs:

- `ubuntu-deb`: test that `install.sh` installs the OpenShell .deb
  package on Ubuntu when snapd is not present.
- `ubuntu-deb-native-docker`: test that `install.sh` installs the
  OpenShell .deb package on Ubuntu when a native docker daemon is
  present -- this will change when snapd 2.77 is released to the
  `latest/stable` channel, which will allow the `openshell` snap to
  connect to non-snap Docker daemons; this job will then be renamed to
  `ubuntu-snap-native-docker`.
- `ubuntu-snap-without-docker`: test that `install.sh` installs both the
  `openshell` and `docker` snaps if snapd is present and there is no
  Docker daemon installed.

In all variants, the canary tests that `openshell status` succeeds after
installation.

Signed-off-by: Oliver Calder <oliver.calder@canonical.com>
The change in snapd to support the `openshell` snap connecting to a
non-snap Docker daemon will ship in snapd 2.77, not 2.76.

Also, all the `openshell` snap interfaces are now auto-connected, so
there is no need for manual connection anymore. Remove these from the
description.

Signed-off-by: Oliver Calder <oliver.calder@canonical.com>
The contract of `install.sh` is to choose the best installation method
for the host system. Adding the `OPENSHELL_INSTALL_METHOD` variable
breaks that contract, so it is best to remove it.

Signed-off-by: Oliver Calder <oliver.calder@canonical.com>
@olivercalder

olivercalder commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

Done and done, thanks for the suggestions.

I've split the ubuntu job into three, as there are three configurations that I think each deserve their own jobs:

  • ubuntu-deb: test that install.sh installs the OpenShell .deb package on Ubuntu when snapd is not present.
  • ubuntu-deb-native-docker: test that install.sh installs the OpenShell .deb package on Ubuntu when a native docker daemon is present.
    • This will change when snapd 2.77 is released to the latest/stable channel, which will allow the openshell snap to connect to non-snap Docker daemons; this job will then be renamed to ubuntu-snap-native-docker.
  • ubuntu-snap-without-docker: test that install.sh installs both the openshell and docker snaps if snapd is present and there is no Docker daemon installed.

In all jobs, test that openshell status works as expected.

The .deb package and snap package both need to be tested, and the snap will need to be tested with both the docker snap and a non-snap Docker daemon, once snapd 2.77 finishes certification testing, so I want to lay the groundwork for that here. The change is already in snapd latest/edge so I want to open another PR based on this PR soon and check that if we tweak the canary job to use snapd latest/edge and install.sh to not gate the snap on docker presence, the openshell snap can now connect to the Docker daemon provided by docker.io in the ubuntu-latest runner.

@krishicks krishicks added the test:e2e Requires end-to-end coverage label Jul 17, 2026
@github-actions

Copy link
Copy Markdown

Label test:e2e applied, but pull-request/2250 is at {"messa while the PR head is c91aea9. A maintainer needs to comment /ok to test c91aea97067e56503eb746e8601e26dfe95f61bb to refresh the mirror. Once the mirror catches up, re-run Branch E2E Checks from the Actions tab.

fi
sudo systemctl start docker || sudo service docker start
mkdir -p "${HOME}/.config/openshell"
printf 'OPENSHELL_DRIVERS=docker\n' > "${HOME}/.config/openshell/gateway.env"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this line required? I would have expected gateway auto-detection of Docker to work.

When installing from the Snap Store, snapd automatically connects the `home`,
`network`, and `network-bind` plugs. The `docker` plug still
requires manual connection:
The OpenShell snap requires the Docker snap, which you can install with:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the OpenShell snap requires the Docker snap, does that also mean it cannot be used with Podman? I'm wondering what this means for auto-detection, which prefers Podman over Docker. It seems like we need to document this limitation of the snap more clearly, if that's the case. I'd expect to see the docs say very clearly that the snap only works with Docker and you should configure Docker as the openshell driver explicitly to avoid issues if you also have Podman running.

@krishicks

Copy link
Copy Markdown
Collaborator

/ok to test c91aea9

@krishicks krishicks removed the test:e2e Requires end-to-end coverage label Jul 17, 2026
@krishicks

krishicks commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

I ran this with e2e but what I actually meant to do was run the release-canary workflow for it, which I did here: https://github.com/NVIDIA/OpenShell/actions/runs/29593468971

The snap installation without Docker failed, which we expect until this is merged and a new snap is published. The others succeeded, though, which is good.

@krishicks krishicks self-assigned this Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants