Commit Graph

956 Commits

Author SHA1 Message Date
openshift-merge-bot[bot]
17beac160c Merge pull request #27405 from baude/setdefaultconnection
Add `update-connection` to machine start and init
2025-11-04 20:03:58 +00:00
Brent Baude
b4ec460ed4 Add update-connection to machine start and init
This allows users to set the associated machine's system connection to the system default when running `podman machine init --now` or `podman machine start`.  It also changes the default bbehavior of these commands in that the user will be prompted and asked if they would like to switch the system connection.  It also introduces a command line switch called `--update-connection`.  If the switch is unset, then the user will be prmpted.  If the command value is explicitly set to `false`, the user will not be prompted and the system connection will not be altered.  If the value is set to `true`, the system connection will be made the default and the user will not be prompted.

Fixes: https://issues.redhat.com/browse/RUN-3632

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-11-04 10:35:28 -06:00
Mario Loriedo
7c51ad0ef8 Fix cache misses when pulling WSL machine image
Fixes a regression introduced by b2e6d53 that made always failing the
match of the WSL image from the registry with the image in the local
cache. The result was that the WSL machine image was always pulled from
quay.io even if an identical image was in the local cache.

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2025-11-04 12:12:10 +01:00
Brent Baude
553c4a16d5 Fix use of duplicate machine names
A condition was changed in the refgactor of init where duplicate names would be allowed but no machine was created.  Duplicate names are not permitted and should return an error.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-10-30 07:50:08 -05:00
Brent Baude
5e1c2f8d7d Machine init --provider
Add the ability for users to override the default provider when creating mahcines.  The new flag is `--provider` and allows you to specifiy a valid vmtype for the platform.  This PR also removes the previous list test where we tested listing all providers.  I added a PR for testing --provider which includes a standard `machine ls` which defaults now to showing all providers.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-10-29 07:59:34 -05:00
Brent Baude
0f22c1c772 Provider obfuscation in command line
For Podman 6, we still have providers and will continue to have a default provider for each platform.  But where a platform has multiple providers, we want users to be able to cross provider boudnaries imposed in Podman 4/5.  The key change is to look up virtual machines by name, as before, but to then also iterate all possible providers.  As of this PR, init will still only create with the default provider, but a subsequent PR will introdouce an provider override.

I also removed the "--all-providers" command line option on `podman
machine ls` because it no longer makes sense. And I marked the all
provider list test to be skipped.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-10-27 08:40:19 -05:00
Matt Heon
34166fc004 Bump Go version to v6
Tremendous amount of changes in here, but all should amount to
the same thing: changing Go import paths from v5 to v6.

Also bumped go.mod to github.com/containers/podman/v6 and updated
version to v6.0.0-dev.

Signed-off-by: Matt Heon <mheon@redhat.com>
2025-10-23 11:00:15 -04:00
openshift-merge-bot[bot]
49c1fd6cea Merge pull request #27270 from lsm5/new-octal-format
fileperms: newer Go 1.13+ octal literal format
2025-10-17 14:36:36 +00:00
Daniel J Walsh
a27fd9bd89 Allow artifact add to override org.opencontainers.image.title annotation
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2025-10-16 14:24:57 -04:00
Lokesh Mandvekar
74788a3fe1 fileperms: newer Go 1.13+ octal literal format
Problem: While removing cgroupsv1 code, I noticed my neovim Go config
automatically changed fileperms to the new octal format and I didn't
want that polluting my diffs.

Decision: I thought it best to switch to the new octal format in a dedicated PR.

Action:
- Cursor switched to new octal format for all fileperm ocurrences in Go
 source and test files.
- vendor/, docs/ and non-Go files were ignored.
- Reviewed manually.

Ref: https://go.dev/ref/spec#Go_1.13

Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2025-10-16 14:11:29 -04:00
Matt Souza
090304a054 lint: reenable revive unused-parameter check
Signed-off-by: Matt Souza <medsouz99@gmail.com>
2025-10-01 10:42:08 -04:00
Kir Kolyshkin
f198fe6b13 pkg/machine/wsl: use any instead of interface{}
Since Go 1.18, any is a type alias for interface{}. After commit 8631032556
there is still one last instance of interface{} left -- replace it
manually.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-09-29 22:11:39 -07:00
Kir Kolyshkin
5824197774 pkg/machine/e2e: remove obsoleted comment
The code which comment refers to was removed by commit 2e4e1bb97c
("podman machine ssh handling"), so the comment is no longer valid.

Remove it.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-09-29 22:05:58 -07:00
Paul Holzinger
8631032556 run modernize -fix ./...
Using golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize

+ some manual cleanup in libpod/lock/shm/shm_lock_test.go as it
  generated an unused variable
+ restored one removed comment

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-09-10 16:17:04 +02:00
Paul Holzinger
b97525a78d use strings.SplitSeq where possible
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-09-10 16:17:04 +02:00
openshift-merge-bot[bot]
9dd5fb2c99 Merge pull request #26950 from jiridostal/sigpipe-handler
Handle SIGPIPE to prevent machine stuck in Starting state
2025-09-08 14:12:54 +00:00
Jiri Dostal
59df0782f2 Handle SIGPIPE to prevent machine stuck in Starting state
Fixes: #26949
Signed-off-by: Jiri Dostal <jdostal@redhat.com>
2025-09-02 09:39:29 +02:00
Jan Kaluza
a98154a978 Switch common, storage and image to monorepo.
Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
2025-09-01 12:33:04 +02:00
Paul Holzinger
5a2098cf61 windows: do not convert unconfined seccomp path
unconfined is a special value and not a path as such it must not be
converted otherwise --security-opt seccomp=unconfined fails as it tries
to access a file called unconfined.

Fixes: 3e8b2d7d96 ("Fix seccomp profile path on Windows")
Fixes: #26855

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-08-20 13:19:40 +02:00
Jan Rodák
cfe4d46d89 Optimize image loading for Podman machines
Add support for loading images directly from machine paths to avoid
unnecessary file transfers when the image archive is already accessible
on the running machine through mounted directories.

Changes include:
- New /libpod/local/images/load API endpoint for direct machine loading
- Machine detection and path mapping functionality
- Fallback in tunnel mode to try optimized loading first

This optimization significantly speeds up image loading operations
when working with remote Podman machines by eliminating redundant
file transfers for already-accessible image archives.

Fixes: https://issues.redhat.com/browse/RUN-3249
Fixes: https://github.com/containers/podman/issues/26321

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2025-08-19 12:33:15 +02:00
openshift-merge-bot[bot]
9f7af81cf8 Merge pull request #26718 from ninja-quokka/machine_init_tls_verify
Add support for configuring tls verification with machine init
2025-08-09 16:25:14 +00:00
Lewis Roy
67ec2037c0 Add support for configuring tls verification with machine init
This patch adds a new --tls-verify flag to the `podman machine init`
sub command which matches many of our other commands. This allows the
user to optionally control whether TLS verification is enabled or
disabled for download of the machine image.

The default remains to leave the TLS verification decision to the
backend library which defaults to enabling it, this patch just
allows the user to explicitly set it on the CLI.

Fixes: #26517

Signed-off-by: Lewis Roy <lewis@redhat.com>
2025-08-05 21:02:28 +10:00
Paul Holzinger
69f8f26d98 pkg/machine/e2e: remove build context skip
The machine images should contain a new enough podman on the server side
to support this so the skips can be removed.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-08-05 12:53:35 +02:00
Joshua Arrevillaga
73f3e98947 Feat: send additional build contexts for remote builds
Fixed the --build-context flag to properly send files for remote builds. Previously
only the main context was sent over as a tar while additional contexts were passed as
local paths and this would cause builds to fail since the files wouldn't exist.

New changes modifies the Build API to use multipart HTTP requests allowing multiple
build contexts to be used. Each additional context is packaged and
transferred based on its type:
- Local Directories: Sent as tar archives
- Git Repositories: link sent to the server where its then cloned
- Container Images: Image reference sent to the server, it then pulls the image there
- URLs/archives: URL sent to the server, which handles the download

Fixes: #23433

Signed-off-by: Joshua Arrevillaga <2004jarrevillaga@gmail.com>
2025-07-23 11:34:38 -04:00
Mario Loriedo
68e7136536 Enforce wsl.exe UTF-8 encoded output
Currently WSL uses UTF-16 encoded output by default but is planning
to use UTF-8.

See https://github.com/containers/podman/issues/26527

To get ready for the change we are enforcing UTF-8 encoded output by
setting the environment variable `WSL_UTF8=1` and by updating the
code that transfomed wsl output from UTF-16 to UTF-8.

Fixes https://github.com/containers/podman/issues/26527

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2025-07-02 20:18:52 +00:00
Mario Loriedo
9fbe2fffe9 WSL commands execution refactoring
Introduced a new function to encapsulate the code to execute WSL
commands.

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2025-07-02 20:18:52 +00:00
openshift-merge-bot[bot]
6355a15082 Merge pull request #25922 from jakecorrenti/krunkit-cmdline
machine: enable nested virt on libkrun by default
2025-07-01 13:39:19 +00:00
openshift-merge-bot[bot]
1a3b35673d Merge pull request #26461 from Luap99/deadcode
remove deadcode
2025-06-26 19:36:02 +00:00
Paul Holzinger
f3c82a917c pkg/machine: remove deadcode
Yes this is a lot.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-06-26 19:37:15 +02:00
Jake Correnti
2ef0148b8a machine: enable nested virt on libkrun by default
With the recent release of krunkit 0.2.0, a CLI option was added to
enable nested virtualization on macOS hosts with an M3 or higher. Enable
this by default. If the host does not support this feature, krunkit will
ignore the argument and continue starting the VM.

Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
2025-06-26 09:53:06 -04:00
Paul Holzinger
e00dfa606a pkg/machine/e2e: add CVE-2025-6032 regression test
Setup a local web server both for HTTP and HTTPS and make sure the
client rejects the connection and does not try to pull the image.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-06-25 19:27:45 +02:00
Paul Holzinger
726b506acc machine init: fix tls check
Ensure we verify the TLS connection when pulling the OCI image.

Fixes: CVE-2025-6032

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-06-23 14:12:55 +02:00
openshift-merge-bot[bot]
60859b07b7 Merge pull request #26201 from lstocchi/wsl
fix wsl install workflow on machine init command
2025-06-13 09:43:50 +00:00
Paul Holzinger
22789928d4 podman machine: pull wsl image from machine-os
Starting with [1] we now build and publish the wsl image from the
machine-os repo, as such this special case is no longer needed.

[1] https://github.com/containers/podman-machine-os/pull/142

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-06-10 18:09:21 +02:00
Paul Holzinger
0f7b21ad00 pkg/machine: remove unsused net recover file
This is not used in the code so it can be deleted.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-06-06 19:46:05 +02:00
Paul Holzinger
0c77654be7 Revert "podman machine: fix proxy test"
This reverts commit 0b8dd90840.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-06-06 19:46:05 +02:00
Paul Holzinger
adc35b157e pkg/machine: remove old fw_cfg service
It has not been in use since commit f218f8430a and should have been
removed there. It seems somehow it is causing a bug since our env file
is empty. In that case it triggers a segfault and since that happens
from within pam we are unable to login in any way.

I reported the issue[1] but because we don't need this just remove it so
we don't have to wait for a fix.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=2370858

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-06-06 19:44:00 +02:00
Paul Holzinger
0b8dd90840 podman machine: fix proxy test
Do not write /etc/environment.d files, something is broken in the new
image that causes the boot to fail when any basic var is set there.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-06-06 16:13:44 +02:00
Paul Holzinger
0c406f25ad pkg/machine/e2e: skip rosetta test
We disabled it in the machine os image so it can no longer be used
currently.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-06-06 15:48:28 +02:00
openshift-merge-bot[bot]
2d234fab34 Merge pull request #26177 from Luap99/machine-linger
pkg/machine: setup lingering for custom username and remove unnecessary sleep service
2025-06-04 14:04:37 +00:00
lstocchi
8532ecb710 fix wsl install workflow on machine init command
this patch changes how the detection of wsl works.
The old way of using wsl --status command output to detect some missing features required by WSL is not fully reliable.
WSL checks if the wsl feature is enabled and if the vmcompute service do exist. However, this is not enough to identify if the virtual machine platform feature is enabled. The vmcompute service could exist because it has been installed by other tools or it could exist but being stopped.

The way proposed by this patch is to try execute the import command and,
if it fails, check the error and if it is related to the Host Compute
Service try to install all features required by WSL.

The flow is the same as before, the user is asked to execute the podman
machine init command with elevated privileges. Eventually, after
enabling WSL and VMP features, the user is asked to reboot the machine.

When the machine restarts, the powershell gets invoked again and execute
the command init.

The code also fixes some issues that could cause misbehaviors when
invoking recursively the elevated shell, like an unreleased lock, or a
missing file.

Signed-off-by: lstocchi <lstocchi@redhat.com>
2025-06-04 14:26:48 +02:00
Mario Loriedo
f25cefcb1b Fix overlay volumes on Windows
The Windows source folder path was not converted in the corresponding
machine folder path when the volume was of type overlay as it does for
other bind mount volumes.

Fix #25988

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2025-05-27 15:11:36 +02:00
Paul Holzinger
5797c1dd27 pkg/machine: don't use dummy linger service
There is no reason to deifne a dummy service to run sleep just to get
the podman.socket enabled. Enabeling a service is just creating the
symlink so we can do that for the user sessions as well.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-05-21 19:08:41 +02:00
Paul Holzinger
79a857e0a0 pkg/machine: correctly enable lingering
When a custom username is requested we must stil enable lingering for
it. The linger setup in the coreos image with the hard coded core user
doesn't really make sense as it doesn't work when another name is used.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-05-21 19:08:41 +02:00
Mario Loriedo
9872f0e83c Update expected output for a machine copy test
The podman machine copy test "attempt copying file to a new directory"
was failing because on recent version of Windows the error message
doesn't match the expected error message. To make it work on new and
old version of Windows both old and new error messages are now
considered as valid.

Fixes https://github.com/containers/podman/issues/26056

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2025-05-21 18:40:52 +02:00
Mario Loriedo
af495e1aa9 Replace alpine_nginx with TESTIMAGE in e2e tests
The image quay.io/libpod/alpine_nginx doesn't have a `linux/arm64` version
and the test "Single character volume mount" on Windows ARM64 was
failing. Changing it to TESTIMAGE (quay.io/libpod/testimage) fixes it.

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2025-05-21 18:40:52 +02:00
Miloslav Trmač
265ca77276 Be explicit about ssh configs suitable only for localhost
... and warn loudly against generalization.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2025-05-15 23:04:49 +02:00
Paul Holzinger
637c264e2e fix issues found by nilness
The conditions are always true so they can be removed. And in the case
of exportCheckpoint() the scope means addToTarFiles was overwritten and
thus when it looped over it later the slice was always empty.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-05-13 17:20:10 +02:00
Matheus Vitório
b6eeaea7f3 Take path for wsl instead of forcing through WindowsApps
Signed-off-by: Matheus Cunha <matheusvflor@hotmail.com>
2025-05-08 16:39:03 +02:00
openshift-merge-bot[bot]
e3df077f0a Merge pull request #26029 from Luap99/machine-tz
pkg/machine: more timezone fixes
2025-05-05 21:00:35 +00:00