Commit Graph

999 Commits

Author SHA1 Message Date
Paul Holzinger
8fbda3fbef Merge pull request #27999 from baude/applytransports
add bootc transports to os-apply
2026-02-03 14:53:18 +01:00
Paul Holzinger
cadc74b796 Merge pull request #27995 from chkpnt/proxyenv
Write DefaultEnvironment proxy values to /etc/systemd/user.conf.d/default-env.conf
2026-02-03 12:48:21 +01:00
Brent Baude
40b2a585f9 Autocomplete machine fixes
Fixups for autocomplete for machine commands.  This was authored by Paul
Holzinger.

Thank you very much!

Signed-off-by: Brent Baude <bbaude@redhat.com>
2026-02-02 15:19:37 -06:00
Brent Baude
f4138d3599 add bootc transports to os-apply
now that we use `bootc switch` for changing out-of-band updates, we can
consider also using some of their supported transports.

* containers-storage
* oci
* oci-archive
* registry

RUN-3963
Signed-off-by: Brent Baude <bbaude@redhat.com>
2026-02-02 09:07:08 -06:00
Gregor Dschung
644bf2e04a Fix interfering escaping of commas and spaces in no_proxy variable
Signed-off-by: Gregor Dschung <gregor@chkpnt.de>
2026-02-02 15:49:25 +01:00
Gregor Dschung
a6167bdecc Write DefaultEnvironment proxy values to /etc/systemd/user.conf.d/default-env.conf
Otherwise, the proxy values aren't passed to rootless podman.

Signed-off-by: Gregor Dschung <gregor@chkpnt.de>
2026-02-02 15:49:05 +01:00
Gregor Dschung
e545f9ca61 Fix test proxyenv/env_test.go for systems that use proxy variables
Signed-off-by: Gregor Dschung <gregor@chkpnt.de>
2026-02-02 15:42:00 +01:00
Chawye Hsu
ce568f75dc chore(machine): remove unused EvalSymlinksOrClean function and tests
Related to https://github.com/containers/container-libs/pull/612

Signed-off-by: Chawye Hsu <su+git@chawyehsu.com>
2026-01-28 02:42:45 +08:00
lstocchi
cfa1b51775 fix hyperv ignition cleanup and error handling
this fixes two bugs in Hyper-V VM ignition handling:

1. Changed `err := readAndSplitIgnition()` to
`err = readAndSplitIgnition()` so the deferred cleanup function can
properly detect errors and clean up ignition
2. The function was trying to remove keys with pattern `vm.ElementName + index`, but
the actual keys were created using `"ignition.config." + index` pattern.

It also improve the deletion by calculating in how many parts the ignition file is splitted when being added in the registry and delete just them instead of blidnly iterating through 0-50.

Signed-off-by: lstocchi <lstocchi@redhat.com>
2026-01-21 15:50:17 +01:00
Brent Baude
aba2df7517 Add podman machine os upgrade command
Implements automatic OS upgrade functionality for Podman machines that requires no user input beyond running the command. The upgrade logic automatically determines the appropriate upgrade path using a three-way comparison between client version, machine version, and OCI registry:

* When the client version is older than the machine version, no action is taken and an error is returned.
* When the client version matches the machine version, the OCI registry is queried to check for in-band updates by comparing image digests.  This handles minor, patch level, and updates oci image use cases.
* When the client version is newer than the machine version, the machine is upgraded to match the client's major.minor version.
* No manual image selection or version specification required.

The command supports dry-run mode and JSON (only) output format for automation.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2026-01-16 14:14:06 -06:00
Mario Loriedo
7c9d4a42c5 Merge pull request #27885 from lstocchi/i27615
Prevent starting and stopping legacy hyperv machines when not elevated
2026-01-13 14:38:07 +01:00
lstocchi
ca44e3a4d7 Fix race condition in CleanupGVProxy when reading gvproxy PID file
When startVM fails quickly, CleanupGVProxy may attempt to read the
gvproxy.pid file before gvproxy has written it, causing cleanup to
fail.

This commit adds retry logic that waits up to 2 seconds for the PID
file to appear.

Signed-off-by: lstocchi <lstocchi@redhat.com>
2026-01-09 08:07:04 +01:00
lstocchi
d2ea5a3fd0 prevent starting/stopping legacy Hyper-v machines when not elevated
Podman 5.x and earlier required to run as admin to work with Hyper-v.
Starting from Podman 6 this is not mandatory anymore as Registry
entries are handled differently. However, it may
happen the user have a legacy machine running when switching to Podman 6
or starts an old machine in elevated mode and then tries to stop it as a
normal user with Podman 6. If that happens the system will end up in a corrupted state
as the gvproxy process will not be stopped.
To prevent such scenario and issues, this commit maintains the original
behavior Podman 5.x has. Legacy Hyper-v machines needs to be handled
with elevated rights.

Signed-off-by: lstocchi <lstocchi@redhat.com>
2026-01-09 08:07:00 +01:00
Brent Baude
76e14f79f7 use bootc for os apply
Instead of using rpm-ostree, we now use bootc for os apply.  the
implementation is a little murky right now and will require some cleanup
to implement bootc's transports.  for now, we only support oci images
from registries.

once we have an upgrade command, the transports can be added and the
docs for apply can be ammended to be more clear.

Fixes: RUN-3836

Signed-off-by: Brent Baude <bbaude@redhat.com>
2026-01-08 13:32:39 -06:00
openshift-merge-bot[bot]
f66f7c8a5b Merge pull request #27650 from lstocchi/i27614
Prevent non hyper-v admin users to execute machine commands
2025-12-09 12:17:38 +00:00
Brent Baude
f87cefc262 Remove Intel MacOS support
This PR removes support for Intel Apple Macs. The removal includes
impacts to code, tests, Makefile, builds, release builds, and so forth.

Fixes Jira: RUN-3621

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-12-07 07:03:06 -06:00
lstocchi
d150051d7a add windows platform tests
Signed-off-by: lstocchi <lstocchi@redhat.com>
2025-12-02 16:28:20 +01:00
lstocchi
85fe4de1ee fix failing windows platform tests
fixes broken windows tests and enables them to be run on
windows CI

Signed-off-by: lstocchi <lstocchi@redhat.com>
2025-12-02 16:19:50 +01:00
lstocchi
1bd51314ff prevent non hyper-v admin users to execute machine commands
Update GetAll() and GetByVMType() to add a check to prevent non hyper-v admin users to
interact with hyperv machines.
Users can work with hyperv machines only with elevated rights or if
members of the hyperv administrators group

Signed-off-by: lstocchi <lstocchi@redhat.com>
2025-12-02 16:19:31 +01:00
Mario Loriedo
f71b9335f1 Replace FindExecutablePeer with FindHelperBinary
The WSL machine start was using the function FindExecutablePeer that
ignores user configuration (helper_binaries_dir). FindHelperBinary
instead is used when starting the machine for the rest of the providers
and honors user configuration.

This commit requires 4877783c37

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2025-11-26 14:52:32 +01:00
Paul Holzinger
200030914f pkg/machine: make mount units hook into local-fs
The virtiofs mount points do not actually are network mounts so we can
mount them earlier and using multi-user.target to enable them was wrong.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-11-25 18:13:13 +01:00
openshift-merge-bot[bot]
095ddfe995 Merge pull request #26277 from lstocchi/i25038
HyperV machine should reuse hvsock registry entries when possible
2025-11-21 11:32:09 +00:00
Mario Loriedo
9c2a738963 Stop enforcing iptables on WSL
Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2025-11-21 01:01:47 +01:00
openshift-merge-bot[bot]
fac259ef9c Merge pull request #27566 from grey3228/fix/check_newGenericDecompressor_err
check err returned by newGenericDecompressor
2025-11-20 23:15:56 +00:00
openshift-merge-bot[bot]
18aa784988 Merge pull request #27546 from jakecorrenti/libkrun-as-default
machine: change default macOS provider to libkrun
2025-11-20 16:00:23 +00:00
lstocchi
901bd69e05 remove legacy registry entry
if users have legacy VMs (podman machines having hvsock registry entries
with the machineName field) when using podman with this patch, their
Registry entries will never be deleted by the functions added in
previous commits.

This commit adds a helper func to clean the Registry when these legacy
machines get removed

Signed-off-by: lstocchi <lstocchi@redhat.com>
2025-11-20 16:51:47 +01:00
lstocchi
23a297198e add test to verify init reuse hvsock entries for hyperv machines
Signed-off-by: lstocchi <lstocchi@redhat.com>
2025-11-20 16:51:45 +01:00
lstocchi
ab89922f4b hyperv should reuse hvsock registry entries when possible
Previously, each new HyperV Podman machine required creating new hvsock
registry entries, necessitating administrator privileges.

This change modifies the HyperV provider to reuse existing hvsock
entries if found. This is possible due to Podman's current
limitation of running only one HyperV machine at a time.

As a result, administrator privileges are only needed for the first initial
machine setup (when the registry is empty). Subsequent machines can be created by users in the
"Hyper-V Administrators" group without being Admin.

Hvsock entries are no longer deleted on each machine removal; cleanup
is handled when the last machine gets removed.

Signed-off-by: lstocchi <lstocchi@redhat.com>
2025-11-20 16:51:31 +01:00
lstocchi
b62c82bff6 move HasAdminRights to windows pkg
this commit moves the HasAdminRights func from the wsl package to a generic windows package as this could also be used by the HyperV provider.

Signed-off-by: lstocchi <lstocchi@redhat.com>
2025-11-20 15:20:57 +01:00
openshift-merge-bot[bot]
dfdd3b5074 Merge pull request #27557 from baude/issue27556
Ignore prompt if stdin not a tty on machine start
2025-11-20 10:03:32 +00:00
Mikhail Dmitrichenko
fdc738b0df fix: check err returned by newGenericDecompressor
There is a couple of newGenericDecompressor function usages, where
returned possibly non-nil `err` is not checked before dereferencing
returned decompressor. It may lead to nil ptr dereferencing.

This commit adds check for `err` to prevent dereferencing potentially
nullable decompressor.

Found by Linux Verification Center (linuxtesting.org) with SVACE

Signed-off-by: Mikhail Dmitrichenko <m.dmitrichenko222@gmail.com>
2025-11-20 12:07:37 +03:00
Brent Baude
6541fc4fb2 Merge pull request #27510 from baude/fakehyperv
fake images: windows hyperv
2025-11-19 12:12:22 -06:00
Brent Baude
3d566d85cf Ignore prompt if stdin not a tty on machine start
When starting a machine and the user has not explicitly passed
-u=true|false AND stdin is a not a tty, we should not prompt to update
connections.

Fixes: #27556

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-11-19 11:50:25 -06:00
Jake Correnti
453a45142f machine: change default macOS provider to libkrun
Now that Podman 6.0 no longer supports Intel Macs, use libkrun as the
default machine provider.

Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
2025-11-17 09:32:29 -05:00
openshift-merge-bot[bot]
d388f9bbd2 Merge pull request #27342 from inknos/run-3578
Remove hardcoded refs from ociartifact code
2025-11-14 12:39:32 +00:00
Nicola Sella
df4905d68b Remove hardcoded refs from ociartifact code
Fixes: https://issues.redhat.com/browse/RUN-3578

Signed-off-by: Nicola Sella <nsella@redhat.com>
2025-11-13 22:57:21 +01:00
Brent Baude
d58dddee66 fake images: windows hyperv
this pr is a follow on to #27493.  it adds support for hyperv "fake"
images and suggests a benefit in terms of test speed.  for hyperv, we
create a generic 4MB vhdx and stick it into the temp dir.  this saves us
from any image copy or compression.

i also followed up on a few comments Paul made about using windows|unix
instead of each platform.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-11-12 12:53:42 -06:00
Brent Baude
57052a8cc7 Fix regression in podman machine ssh
While doing the provider obfuscation, I injected a regression where
podman ssh machine failed.  The regression was added in
0f22c1c772.  I have fixed the regression
and added a test to prevent future occurance.

Fixes: #27491

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-11-12 10:37:48 -06:00
Paul Holzinger
675182c2e9 fix gofumpt issues on main
Two PRs[1,2] were merged without rebasing resulting in a conflict since
the one enabled gofumpt while the other PR contained formatting not
according to that so now the lint fails.

[1] https://github.com/containers/podman/pull/27498
[2] https://github.com/containers/podman/pull/27493

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-11-12 15:44:26 +01:00
openshift-merge-bot[bot]
d5865c1462 Merge pull request #27498 from Luap99/gofumpt
enable gofumpt formatter
2025-11-12 13:29:45 +00:00
Paul Holzinger
5c1ed12d8d enable gofumpt formatter
Based on our discussion gofumpt won the vote so use that one via
golangci-lint.

https://github.com/containers/podman/discussions/27291

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-11-11 12:32:46 +01:00
Brent Baude
9cbb64c525 Use fake images for machine tests
In tests that do not start a machine, we can use "fake" images to speed
up tests.  In the case of darwin and Linux, that can be /dev/null.  The
hypervisors don't care.

In the case of Windows, some research will need to be done to determine
the same approach but this is a start.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-11-10 10:51:23 -06:00
Brent Baude
e059055aa5 Fix WSL machine start with --update-connection
In my previous PR, #27405, the optional WSL tests do not pass because of
an early return consistent with WSL's networking.  This PR corrects the
problem.

Fixes: #27469

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-11-07 10:41:32 -06:00
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