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

Building hangs forever on M1 mac #13535

Closed
hyche opened this issue Mar 17, 2022 · 20 comments · Fixed by #13665
Closed

Building hangs forever on M1 mac #13535

hyche opened this issue Mar 17, 2022 · 20 comments · Fixed by #13665
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. macos MacOS (OSX) related remote Problem is in podman-remote

Comments

@hyche
Copy link

hyche commented Mar 17, 2022

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description

Steps to reproduce the issue:

  1. Install dev podman with brew install --HEAD podman

  2. Init and start machine podman machine --init --cpus 2 --disk-size 50 -m 4096 --now

  3. Build any Dockerfile with podman build -f path/to/Dockerfile . (with or without Dockerfile)

Describe the results you received:
Hanging forever
image

Describe the results you expected:
Should process building as normal

Additional information you deem important (e.g. issue happens only occasionally):

Output of podman version:

Client:       Podman Engine
Version:      4.0.0-dev
API Version:  4.0.0-dev
Go Version:   go1.17.8
Git Commit:   33d808108f837e70dc7cc0803bfa4684953fe05e-dirty
Built:        Mon Mar 14 21:28:33 2022
OS/Arch:      darwin/arm64

Server:       Podman Engine
Version:      4.0.2
API Version:  4.0.2
Go Version:   go1.16.14

Built:      Thu Mar  3 21:58:50 2022
OS/Arch:    linux/arm64

Output of podman info --debug:

host:
  arch: arm64
  buildahVersion: 1.24.1
  cgroupControllers:
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.1.0-2.fc35.aarch64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.0, commit: '
  cpus: 2
  distribution:
    distribution: fedora
    variant: coreos
    version: "35"
  eventLogger: journald
  hostname: localhost.localdomain
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 1000000
    uidmap:
    - container_id: 0
      host_id: 501
      size: 1
    - container_id: 1
      host_id: 100000
      size: 1000000
  kernel: 5.15.18-200.fc35.aarch64
  linkmode: dynamic
  logDriver: journald
  memFree: 69296128
  memTotal: 4086738944
  networkBackend: netavark
  ociRuntime:
    name: crun
    package: crun-1.4.2-1.fc35.aarch64
    path: /usr/bin/crun
    version: |-
      crun version 1.4.2
      commit: f6fbc8f840df1a414f31a60953ae514fa497c748
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    exists: true
    path: /run/user/501/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: true
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: true
  serviceIsRemote: true
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.1.12-2.fc35.aarch64
    version: |-
      slirp4netns version 1.1.12
      commit: 7a104a101aa3278a2152351a082a6df71f57c9a3
      libslirp: 4.6.1
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.3
  swapFree: 0
  swapTotal: 0
  uptime: 11h 38m 48.31s (Approximately 0.46 days)
plugins:
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries:
  search:
  - docker.io
store:
  configFile: /var/home/core/.config/containers/storage.conf
  containerStore:
    number: 4
    paused: 0
    running: 4
    stopped: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /var/home/core/.local/share/containers/storage
  graphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 4
  runRoot: /run/user/501/containers
  volumePath: /var/home/core/.local/share/containers/storage/volumes
version:
  APIVersion: 4.0.2
  Built: 1646319530
  BuiltTime: Thu Mar  3 21:58:50 2022
  GitCommit: ""
  GoVersion: go1.16.14
  OsArch: linux/arm64
  Version: 4.0.2

Package info (e.g. output of rpm -q podman or apt list podman):

Output of brew info podman

podman: stable 4.0.2 (bottled), HEAD
Tool for managing OCI containers and pods
https://podman.io/
/opt/homebrew/Cellar/podman/HEAD-33d8081 (172 files, 43.5MB) *
  Built from source on 2022-03-15 at 02:28:33
/opt/homebrew/Cellar/podman/3.4.4 (170 files, 41.0MB)
  Poured from bottle on 2022-03-02 at 02:56:25
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/podman.rb
License: Apache-2.0
==> Dependencies
Build: go ✔, go-md2man ✔
Required: qemu ✔
==> Options
--HEAD
	Install HEAD version
==> Caveats
fish completions have been installed to:
  /opt/homebrew/share/fish/vendor_completions.d
==> Analytics
install: 12,156 (30 days), 37,696 (90 days), 105,786 (365 days)
install-on-request: 12,145 (30 days), 37,673 (90 days), 105,764 (365 days)
build-error: 13 (30 days)

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/main/troubleshooting.md)

Yes (no useradd as mentioned in point 6)

Additional environment details (AWS, VirtualBox, physical, etc.):

@openshift-ci openshift-ci bot added the kind/bug Categorizes issue or PR as related to a bug. label Mar 17, 2022
@hyche hyche changed the title Building hung forever on M1 mac Building hangs forever on M1 mac Mar 17, 2022
@github-actions github-actions bot added macos MacOS (OSX) related remote Problem is in podman-remote labels Mar 17, 2022
@afbjorklund
Copy link
Contributor

afbjorklund commented Mar 17, 2022

Try podman machine ssh podman build - <Dockerfile or similar, it is possible that remote building got broken again ?

@Luap99
Copy link
Member

Luap99 commented Mar 17, 2022

Are you sure it is hanging? Is your context directory very large by any chance? podman-remote has to copy the complete directory into the VM.

@hyche
Copy link
Author

hyche commented Mar 17, 2022

Try podman machine ssh podman build - <Dockerfile or similar, it is possible that remote building got broken again ?

Yes this works for me, but to do this I have to clone a new repo inside the VM

Are you sure it is hanging? Is your context directory very large by any chance? podman-remote has to copy the complete directory into the VM.

I have thought so, but then after writing a .dockerignore it still didn't work.

@afbjorklund
Copy link
Contributor

afbjorklund commented Mar 17, 2022

You can also pass a tarball instead of a file, if you want to control the size of the build context / troubleshoot.

Keeping files cached on the VM is much faster than copying them, though (for large mostly unchanged ones, that is)

@baude
Copy link
Member

baude commented Mar 17, 2022

can you please update to 4.0.2? it is in brew.

@baude
Copy link
Member

baude commented Mar 17, 2022

FWIW:

brentbaude@Brents-Mac-mini foobar % podman build -t foo .
STEP 1/2: FROM alpine
Resolved "alpine" as an alias (/etc/containers/registries.conf.d/000-shortnames.conf)
Trying to pull docker.io/library/alpine:latest...
Getting image source signatures
Copying blob sha256:148d739a8e6b9342daa1f5b428d3a3c6118f340f21df28c16e06f918ef150147
Copying blob sha256:148d739a8e6b9342daa1f5b428d3a3c6118f340f21df28c16e06f918ef150147
Copying config sha256:3abe2e34c907c211ddd925e548becebcb14607ed4276ae94205bda4b99cc4549
Writing manifest to image destination
Storing signatures
STEP 2/2: RUN apk update && apk add bash
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/aarch64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/aarch64/APKINDEX.tar.gz
v3.15.1-4-g3c455a95af [https://dl-cdn.alpinelinux.org/alpine/v3.15/main]
v3.15.1-3-g5a0989e449 [https://dl-cdn.alpinelinux.org/alpine/v3.15/community]
OK: 15730 distinct packages available
(1/4) Installing ncurses-terminfo-base (6.3_p20211120-r0)
(2/4) Installing ncurses-libs (6.3_p20211120-r0)
(3/4) Installing readline (8.1.1-r0)
(4/4) Installing bash (5.1.16-r0)
Executing bash-5.1.16-r0.post-install
Executing busybox-1.34.1-r4.trigger
OK: 8 MiB in 18 packages
COMMIT foo
--> 75f19e83237
Successfully tagged localhost/foo:latest
75f19e832372a0865c792d723e6e158f4b5ef3a5089d8884d0e0b0b5a4ce13f4
brentbaude@Brents-Mac-mini foobar % podman images
REPOSITORY                TAG         IMAGE ID      CREATED         SIZE
localhost/foo             latest      75f19e832372  13 seconds ago  10 MB
docker.io/library/alpine  latest      3abe2e34c907  12 hours ago    5.6 MB

@hyche
Copy link
Author

hyche commented Mar 18, 2022

can you please update to 4.0.2? it is in brew.

I tried to reinstall it, the client version stays at 4.0.0-dev with git commit e59f71d230cf5435dc569add90e22cc644e38647-dirty, and the build still hangs though.

@baude
Copy link
Member

baude commented Mar 21, 2022

I just completely nuked my mac (to be dead sure). Completely clean install, install brew, install podman and the version is 4.0.2.

brentbaude@Brents-Mac-mini ~ % podman version
Client:       Podman Engine
Version:      4.0.2
API Version:  4.0.2
Go Version:   go1.17.8

Built:      Wed Mar  2 08:04:36 2022
OS/Arch:    darwin/arm64

Server:       Podman Engine
Version:      4.0.2
API Version:  4.0.2
Go Version:   go1.16.14

Built:      Thu Mar  3 08:58:50 2022
OS/Arch:    linux/arm64

@hyche
Copy link
Author

hyche commented Mar 21, 2022

ah I see you installed stable podman, mine was dev version which is installed with brew install --HEAD, but neither of them works. To give more information, the command hangs even if i specify the wrong location of Dockerfile, or just any path ie podman build -f any_path ., so there might be problem with file reading or with my Mac ?

@baude
Copy link
Member

baude commented Mar 21, 2022

hard to say, are you seeing any clues in podman --log-level=debug build .... ?

@hyche
Copy link
Author

hyche commented Mar 22, 2022

hard to say, are you seeing any clues in podman --log-level=debug build .... ?

Here is the log

INFO[0000] podman filtering at log level debug          
DEBU[0000] Called build.PersistentPreRunE(podman --log-level=debug build -f abc .) 
DEBU[0000] SSH Ident Key "/Users/ugen/.ssh/podman-machine-default" SHA256:xxx 
DEBU[0000] Found SSH_AUTH_SOCK "/private/tmp/com.apple.launchd.AupngmxwR7/Listeners", ssh-agent signer(s) enabled 
DEBU[0000] SSH Agent Key SHA256:yyy 
DEBU[0000] DoRequest Method: GET URI: http://d/v4.0.2/libpod/_ping 
DEBU[0000] Loading registries configuration "/etc/containers/registries.conf" 
DEBU[0000] DoRequest Method: POST URI: http://d/v4.0.2/libpod/build 

@hyche
Copy link
Author

hyche commented Mar 22, 2022

More on the logs, I waited for ~10 mins, it finally built

DEBU[0485] Skipping excluded path: ...
DEBU[0485] Skipping excluded path: ...
DEBU[0485] Skipping excluded path: ...
DEBU[0485] Skipping excluded path: ...
DEBU[0485] Skipping excluded path: ... 
DEBU[0485] Skipping excluded path: ...
DEBU[0485] Skipping excluded path: ...
Error: stat /var/tmp/libpod_builder889470900/build/abc: no such file or directory

@baude
Copy link
Member

baude commented Mar 22, 2022

Im not sure what is going on here. Here are some things to try:

  1. podman machine rm
  2. podman init ....
  3. try a different build
  4. share your build context dir so we can try it

@hyche
Copy link
Author

hyche commented Mar 24, 2022

I think the problem is my context dir is probably too large, I have a Rust project dir which is a workspace, it contains 3 binary crates. After I remove all target/ dir (which is build directory), it did speed up, and only delay a few seconds, but even I have a .dockerignore which blacklists target dir, it still checks for it ? Also the few seconds delay is also not good, I expect it would build instantly though.

The .dockerignore is simply like this

target/

@rhatdan
Copy link
Member

rhatdan commented Mar 24, 2022

@jwhonce I think we were doing the filtering on the client side, for just this reason, was that removed?

@jwhonce
Copy link
Member

jwhonce commented Mar 25, 2022

@rhatdan Short answer - yes filtering is still there. https://github.com/containers/podman/blame/37bb6aa346e584a37366538b33cd906f4762b5ab/pkg/bindings/images/build.go#L583
Longer answer - there have been a number of changes in that code, one could have broken the filename matches.
A quick scan of the e2e tests, does not show a test covering this scenario.

@jwhonce
Copy link
Member

jwhonce commented Mar 25, 2022

@rhatdan @hyche I added a test in #13665 to ensure that .containerignore is being honored.

@hyche How many files were in the target/ directory? We currently use filepath.Walk() when building the tarball and I suspect filepath.WalkDir() might be faster when there are a lot of files in an ignored directory.

@hyche
Copy link
Author

hyche commented Mar 26, 2022

The target/ dir contains 334 directories, and 3136 files, it's about 2.6GB size.. So it's fairly large. And yeah, I can confirm the .dockerignore works, there is another large directory which is .git dir (around ~800 MB), after I exclude it the build now build instantly though. Thanks all for the support!

@rhatdan
Copy link
Member

rhatdan commented Mar 26, 2022

@jwhonce Are you going to switch to filepath.WalkDir()?

@jwhonce
Copy link
Member

jwhonce commented Mar 28, 2022

@rhatdan I am looking into that now

jwhonce added a commit to jwhonce/podman that referenced this issue Mar 31, 2022
Ensure a directory added to .containerignore on client is not included
in tar sent to remote podman API service

* Clean up podman invocations to not include duplicate --remote and
  --url flags
* Use pkill vs. pgrep when cleaning up podman API service in tests
* Add exit code when logging error when testing

Closes containers#13535

Signed-off-by: Jhon Honce <[email protected]>
@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 Sep 20, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 20, 2023
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. macos MacOS (OSX) related remote Problem is in podman-remote
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants