Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSH command to podman machine does not work if using applehv #21090

Closed
fabricepipart1a opened this issue Dec 26, 2023 · 6 comments · Fixed by #21114
Closed

SSH command to podman machine does not work if using applehv #21090

fabricepipart1a opened this issue Dec 26, 2023 · 6 comments · Fixed by #21114
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. podman-desktop remote Problem is in podman-remote

Comments

@fabricepipart1a
Copy link

fabricepipart1a commented Dec 26, 2023

Issue Description

I switched from qemu to applehvby editing /Users/<user>/.config/containers/containers.conf:

...
[machine]
provider="applehv"
...

podman machine ssh date does not work (while podman machine ssh does work).

Steps to reproduce the issue

Steps to reproduce the issue

  1. Create a podman machine with applehv
  2. podman machine ssh date

Describe the results you received

╰─ podman machine ssh date
Error: read /Users/<user>/.config/containers/podman/machine/applehv: is a directory

Describe the results you expected

Result of the date command inside the podman machine

podman info output

╰─ podman info
host:
  arch: arm64
  buildahVersion: 1.32.0
  cgroupControllers:
  - cpuset
  - cpu
  - io
  - memory
  - pids
  - rdma
  - misc
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.1.8-2.fc39.aarch64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.8, commit: '
  cpuUtilization:
    idlePercent: 69.73
    systemPercent: 2.56
    userPercent: 27.71
  cpus: 8
  databaseBackend: boltdb
  distribution:
    distribution: fedora
    variant: coreos
    version: "39"
  eventLogger: journald
  freeLocks: 2040
  hostname: localhost.localdomain
  idMappings:
    gidmap: null
    uidmap: null
  kernel: 6.6.3-200.fc39.aarch64
  linkmode: dynamic
  logDriver: journald
  memFree: 1328447488
  memTotal: 12211875840
  networkBackend: netavark
  networkBackendInfo:
    backend: netavark
    dns:
      package: aardvark-dns-1.8.0-1.fc39.aarch64
      path: /usr/libexec/podman/aardvark-dns
      version: aardvark-dns 1.8.0
    package: netavark-1.8.0-2.fc39.aarch64
    path: /usr/libexec/podman/netavark
    version: netavark 1.8.0
  ociRuntime:
    name: crun
    package: crun-1.12-1.fc39.aarch64
    path: /usr/bin/crun
    version: |-
      crun version 1.12
      commit: ce429cb2e277d001c2179df1ac66a470f00802ae
      rundir: /run/crun
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +YAJL
  os: linux
  pasta:
    executable: /usr/bin/pasta
    package: passt-0^20231119.g4f1709d-1.fc39.aarch64
    version: |
      pasta 0^20231119.g4f1709d-1.fc39.aarch64-pasta
      Copyright Red Hat
      GNU General Public License, version 2 or later
        <https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
      This is free software: you are free to change and redistribute it.
      There is NO WARRANTY, to the extent permitted by law.
  remoteSocket:
    exists: true
    path: /run/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: false
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: true
  serviceIsRemote: true
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.2.2-1.fc39.aarch64
    version: |-
      slirp4netns version 1.2.2
      commit: 0ee2d87523e906518d34a6b423271e4826f71faf
      libslirp: 4.7.0
      SLIRP_CONFIG_VERSION_MAX: 4
      libseccomp: 2.5.3
  swapFree: 0
  swapTotal: 0
  uptime: 0h 26m 17.00s
  variant: ""
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries:
  search:
  - docker.io
store:
  configFile: /usr/share/containers/storage.conf
  containerStore:
    number: 6
    paused: 0
    running: 1
    stopped: 5
  graphDriverName: overlay
  graphOptions:
    overlay.mountopt: nodev,metacopy=on
  graphRoot: /var/lib/containers/storage
  graphRootAllocated: 106769133568
  graphRootUsed: 10946424832
  graphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Supports shifting: "true"
    Supports volatile: "true"
    Using metacopy: "true"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 2
  runRoot: /run/containers/storage
  transientStore: false
  volumePath: /var/lib/containers/storage/volumes
version:
  APIVersion: 4.7.2
  Built: 1698762633
  BuiltTime: Tue Oct 31 15:30:33 2023
  GitCommit: ""
  GoVersion: go1.21.1
  Os: linux
  OsArch: linux/arm64
  Version: 4.7.2

Podman in a container

No

Privileged Or Rootless

Privileged

Upstream Latest Release

Yes

Additional environment details

Additional environment details

Additional information

Additional information like issue happens only occasionally or issue happens with a particular architecture or on a particular setting

@fabricepipart1a fabricepipart1a added the kind/bug Categorizes issue or PR as related to a bug. label Dec 26, 2023
@github-actions github-actions bot added the remote Problem is in podman-remote label Dec 26, 2023
@rhatdan
Copy link
Member

rhatdan commented Dec 26, 2023

Interested in opening a PR to fix?

@fabricepipart1a
Copy link
Author

In theory yes. Practically, this is not a good opportunity because I am a Java developer with scripting capabilities (who did not get attracted each time he started reading some go). If you have hints how this should be fixed, you can share it here in case I have a colleague that wants to get started.

@yangboroy
Copy link

The same issue.

boyang@boyangs-MacBook-Pro tmp % podman machine ssh --log-level=trace pwd  
INFO[0000] podman filtering at log level trace          
DEBU[0000] Using Podman machine with `applehv` virtualization provider 
Error: read /Users/boyang/.config/containers/podman/machine/applehv: is a directory
DEBU[0000] Shutting down engines 

@baude baude self-assigned this Jan 1, 2024
@baude
Copy link
Member

baude commented Jan 1, 2024

i have a fix for this , but it is somewhat layered.

baude pushed a commit to baude/podman that referenced this issue Jan 1, 2024
small correction to properly lookup a applehv vm on disk.

Fixes: containers#21090

[NO NEW TESTS NEEDED]

Signed-off-by: Brent Baude <baude@redhat.com>
@tnk4on
Copy link
Contributor

tnk4on commented Jan 4, 2024

There is a bug in the fix.
For default VM, podman machien ssh <command> will fail if podman-machine-default is not specified in VM name.

% ./podman version
Client:       Podman Engine
Version:      5.0.0-dev
API Version:  5.0.0-dev
Go Version:   go1.21.5
Git Commit:   de797e572404bce3a85b91686b75376a3af117c2-dirty
Built:        Thu Jan  4 22:13:00 2024
OS/Arch:      darwin/arm64

Server:       Podman Engine
Version:      4.7.2
API Version:  4.7.2
Go Version:   go1.21.1
Built:        Tue Oct 31 23:30:33 2023
OS/Arch:      linux/arm64
% ./podman machine ssh date
Error: date: VM does not exist
% ./podman machine ssh podman-machine-default date
Thu Jan  4 22:32:38 JST 2024

@tnk4on
Copy link
Contributor

tnk4on commented Jan 4, 2024

If a command is specified in arg[0], an error occurs in the following part and the command is not added to sshOpts.Args.

if _, err := loadMacMachineFromJSON(fqName); err != nil {
return false, err
}

openshift-cherrypick-robot pushed a commit to openshift-cherrypick-robot/podman that referenced this issue Jan 30, 2024
small correction to properly lookup a applehv vm on disk.

Fixes: containers#21090

[NO NEW TESTS NEEDED]

Signed-off-by: Brent Baude <baude@redhat.com>
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Apr 4, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. podman-desktop remote Problem is in podman-remote
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants