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

Podman truncates last character of userdata symlink with a specific path length #9661

Closed
zv0n opened this issue Mar 8, 2021 · 14 comments
Closed
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. stale-issue

Comments

@zv0n
Copy link

zv0n commented Mar 8, 2021

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

/kind bug

Description
When running rootless podman with XDG_RUNTIME_DIR that has 25 characters the process fails due to truncating of socket dir symlink. Only the last character of the symlink path is truncated, I think there might be some problem with '\0' going on, but I couldn't find the userdata socket symlink in the source code.

For example this happens with $XDG_RUNTIME_DIR of length 25:

${XDG_RUNTIME_DIR}/libpod/tmp/socket/b3ee91f2f7e4e382f6395d3d5ead9ac24757b9bed6e86090069cab68c6477b2 -> ${PODMAN_ROOT}/overlay-containers/b3ee91f2f7e4e382f6395d3d5ead9ac24757b9bed6e86090069cab68c6477b28/userdata

as you can see the '8' that is supposed to be at the end of the symlink name is not there. Therefore podman fails with the following error:

Error: failed to connect to container's attach socket: ${XDG_RUNTIME_DIR}/libpod/tmp/socket/b3ee91f2f7e4e382f6395d3d5ead9ac24757b9bed6e86090069cab68c6477b28/attach: no such file or directory

Steps to reproduce the issue:

  1. Create a directory whose path is 25 characters long

  2. export XDG_RUNTIME_DIR=$created_directory

  3. podman run -it ubuntu /bin/bash

Describe the results you received:

Error: failed to connect to container's attach socket: ${XDG_RUNTIME_DIR}/libpod/tmp/socket/b3ee91f2f7e4e382f6395d3d5ead9ac24757b9bed6e86090069cab68c6477b28/attach: no such file or directory

Describe the results you expected:

Running container

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide?

Yes

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Mar 8, 2021
@mheon
Copy link
Member

mheon commented Mar 8, 2021

What Podman version? I'm fairly certain this was fixed as of 3.0.x.

@zv0n
Copy link
Author

zv0n commented Mar 8, 2021

Version 3.0.1

@rhatdan
Copy link
Member

rhatdan commented Mar 9, 2021

Since the maximum length of a unix domain socket is 104 chars, that seems to be the issue. I know there were fixes for this in both Podman and Conmon. @haircommander @giuseppe PTAL

@haircommander
Copy link
Collaborator

#8979 should fix, which I've had trouble getting over the finish line. hopefully conmon 2.0.27 will solve the last CI problems with it

@zv0n
Copy link
Author

zv0n commented Mar 10, 2021

@rhatdan I don't think it's the socket path issue as the path to the directory containing the socket (the one that's being symlinked to) is longer than the symlink path.

Also if I make the runtime directory path longer it works just fine. The 25 character long runtime path is the only one I've found so far that exhibits this behavior. If I had to guess I'd think that there might be a buffer problem somewhere that causes the last char to disappear. I don't know golang, but in C I'd think that somewhere strlen might say that the desired path can fit in buffer exactly, but then strncpy would replace the last character with \0. But as I said originally I couldn't find handling of this symlink in the source code, so I can't verify my hunch :/

@zv0n
Copy link
Author

zv0n commented Mar 10, 2021

@haircommander nice, thanks for letting me know. I'll test the new version out when it's ready and hopefully the problem will be gone :)

@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@baude
Copy link
Member

baude commented Jul 6, 2021

@zv0n 2.0.27 is out now ... if you are happy, please close this issue.

@rhatdan
Copy link
Member

rhatdan commented Jul 6, 2021

Let's reverse this and say reopen if it does not fix the issue.

@rhatdan rhatdan closed this as completed Jul 6, 2021
@zv0n
Copy link
Author

zv0n commented Jul 12, 2021

Hi, I've updated conmon to 2.0.27 and the issue persists.

XDG_RUNTIME_DIR="/test/dir/podman/runtime" podman --root=/test/dir/podman run -it ubuntu /bin/bash

results in: Error: failed to connect to container's attach socket: /test/dir/podman/runtime/libpod/tmp/socket/460fb287adb6629610497aea213c97f0fe1d5fa6001f9374c7a89ad4773e7719/attach: no such file or directory

but

XDG_RUNTIME_DIR="/test/dir/podman/runtime2" /usr/bin/podman-real --root=/test/dir/podman run -it ubuntu /bin/bash

results in a running container

@mheon mheon reopened this Jul 12, 2021
@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@rhatdan
Copy link
Member

rhatdan commented Aug 12, 2021

@zv0n Does this issue still persist?

@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@rhatdan
Copy link
Member

rhatdan commented Sep 13, 2021

Since I got no response, I will assume it no longer exists. Reopen if I am mistaken.

@rhatdan rhatdan closed this as completed Sep 13, 2021
@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 21, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 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. stale-issue
Projects
None yet
Development

No branches or pull requests

6 participants