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

Error: invalid socket name: "console-socket" #2910

Closed
morganllewellynjones opened this issue Sep 10, 2024 · 5 comments · Fixed by #2915
Closed

Error: invalid socket name: "console-socket" #2910

morganllewellynjones opened this issue Sep 10, 2024 · 5 comments · Fixed by #2915
Assignees
Labels

Comments

@morganllewellynjones
Copy link
Contributor

morganllewellynjones commented Sep 10, 2024

Bug Description

docker run -it --rm --runtime youki busybox

docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: /path/to/youki did not terminate successfully: exit status 1: error in executing command: invalid socket name: "console-socket"

Caused by:
ENAMETOOLONG: File name too long
Error: invalid socket name: "console-socket"

Caused by:
ENAMETOOLONG: File name too long
: unknown.

Steps to Reproduce

docker run --tty --runtime youki hello-world

System and Setup Info

debian 12
rustup 1.27.1 (54dd3d00f 2024-04-24)
cargo 1.80.0 (376290515 2024-07-16)
filesystem ext4

Additional Context

I did some hunting on this one. The break is actually here:

https://docs.rs/nix/latest/src/nix/sys/socket/addr.rs.html#348-378

It occurs in crates/libcontainer/src/tty.rs::setup_console_socket

When we try to connect to our socket in the docker runtime directory, the full pathname is very long. This might be architecture specific, but socket::connect throws an error at:

        if bytes.len() >= ret.sun_path.len() {
            return Err(Errno::ENAMETOOLONG);
        }

Looking into a fix, I'm not certain if I have permissions to assign the ticket to myself though.

@morganllewellynjones
Copy link
Contributor Author

morganllewellynjones commented Sep 14, 2024

Turns out sun_path has a max_length of 108 characters, and the pathname to console-socket for me is 109 characters. I just fixed this on my local by changing environment to the container directory first and then linking the console-socket. I'll make a PR for this shortly.

@utam0k
Copy link
Member

utam0k commented Sep 16, 2024

@morganllewellynjones Thanks! I'll assign you.

@morganllewellynjones
Copy link
Contributor Author

Thanks!

@YJDoc2
Copy link
Collaborator

YJDoc2 commented Sep 18, 2024

Hey @morganllewellynjones , thanks for your PR! If you want to continue contributing, #2917 is a good low-hanging fruit (its ok if you're doing something else, just pinging)

@YJDoc2 YJDoc2 linked a pull request Sep 26, 2024 that will close this issue
@utam0k
Copy link
Member

utam0k commented Oct 8, 2024

Thanks @morganllewellynjones!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants