podman
podman copied to clipboard
Fix updating connection when SSH port conflict happens
Does this PR introduce a user-facing change?
Fixed a bug where `podman machine` connection URIs would become wrong after an SSH port conflict happens
What is this?
I have this issue that a rootful machine becomes unaccessible via its connection. I noticed that in those cases, its connection URI becomes outdated, with wrong port information. I also noticed the rootless connection URI becomes rootful.
Reproducing the error in MacOS:
// have no machines at start
$ podman machine init
$ podman machine set --rootful=true
$ podman machine start
$ podman system connection list
Name URI Identity Default ReadWrite
podman-machine-default ssh://[email protected]:50433/run/user/501/podman/podman.sock /Users/gabrielparreiras/.local/share/containers/podman/machine/machine false true
podman-machine-default-root ssh://[email protected]:50433/run/podman/podman.sock /Users/gabrielparreiras/.local/share/containers/podman/machine/machine true true
$ pkill vfkit
$ podman machine start
Starting machine "podman-machine-default"
WARN[0000] detected port conflict on machine ssh port [50433], reassigning
$ podman system connection list
Name URI Identity Default ReadWrite
podman-machine-default ssh://[email protected]:50471/run/podman/podman.sock /Users/gabrielparreiras/.local/share/containers/podman/machine/machine false true
podman-machine-default-root ssh://[email protected]:50433/run/podman/podman.sock /Users/gabrielparreiras/.local/share/containers/podman/machine/machine true true
With the bug fix of this PR:
// have no machines at start
$ podman machine init
$ podman machine set --rootful=true
$ podman machine start
$ podman system connection list
Name URI Identity Default ReadWrite
podman-machine-default ssh://[email protected]:50485/run/user/501/podman/podman.sock /Users/gabrielparreiras/.local/share/containers/podman/machine/machine false true
podman-machine-default-root ssh://[email protected]:50485/run/podman/podman.sock /Users/gabrielparreiras/.local/share/containers/podman/machine/machine true true
$ pkill vfkit
$ podman machine start
Starting machine "podman-machine-default"
WARN[0000] detected port conflict on machine ssh port [50485], reassigning
$ podman system connection list
Name URI Identity Default ReadWrite
podman-machine-default ssh://[email protected]:50513/run/user/501/podman/podman.sock /Users/gabrielparreiras/.local/share/containers/podman/machine/machine false true
podman-machine-default-root ssh://[email protected]:50513/run/podman/podman.sock /Users/gabrielparreiras/.local/share/containers/podman/machine/machine true true
Thanks for the review, @Luap99 and @rhatdan. Is this failing test something flaky? Is there anything else I should do here?
Yes the test is flaky I can restart it although I wonder if this really should get a proper regression test here.
At least on linux we could create a machine, then get the port and run nc -l -p <port> to block the port then start it and see that we got a new port assigned.
Hi @Luap99, I've added a regression test that covers this failure scenario. Thanks for the suggestion on using nc -l -p <port>.
Ephemeral COPR build failed. @containers/packit-build please check.
Is there anything more missing here? Can these failing tests be retried? They don't seem related to the changes on the PR. cc @Luap99 @rhatdan
Cockpit tests failed for commit ee7f6b77972411b642a09352128da3690eb5d19e. @martinpitt, @jelly, @mvollmer please check.
@gmpify Can you sqaush the commits please and give the first one the same title as the PR, thanks. Sorry should have mentioned it before.
np, just pushed it now
Ephemeral COPR build failed. @containers/packit-build please check.
ignore ELN failures
Cockpit tests failed for commit 85da84311c25e1958f363259877bfff892c035a1. @martinpitt, @jelly, @mvollmer please check.
Ephemeral COPR build failed. @containers/packit-build please check.
Cockpit tests failed for commit e7fc2edbe13e3230da1690163f3a9868f27010e0. @martinpitt, @jelly, @mvollmer please check.
Ephemeral COPR build failed. @containers/packit-build please check.
Cockpit tests failed for commit 277312d28209f38825c779c3669b997580b31746. @martinpitt, @jelly, @mvollmer please check.
Cockpit tests failed for commit 1322254468502f005603a72de82ffe4833684ae1. @martinpitt, @jelly, @mvollmer please check.
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: gmpify, Luap99
The full list of commands accepted by this bot can be found here.
The pull request process is described here
- ~~OWNERS~~ [Luap99]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
Is there a workaround for this until the next release is out? I keep running into this when I reboot my system, and I keep having to tear down and completely rebuild my podman/minikube stack each time via podman machine init etc.