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

File upload does not work with directories with ":" in their names #669

Open
martinkou opened this issue Mar 25, 2024 · 2 comments
Open
Labels
bug Something isn't working

Comments

@martinkou
Copy link

martinkou commented Mar 25, 2024

Let's say I have a directory structure like this, which I wish to copy to a target host..

$ tree gpu-workstation/

gpu-workstation/
├── etc
│   └── k0s
│       ├── certs.d
│       │   └── gpu-workstation:30101
│       │       ├── hosts.toml
│       │       └── ca.pem
│       └── containerd.d
│           └── registry.toml
└── var
    └── lib
        └── tailscale
            └── tailscaled.state

Which I then put into k0sctl.yaml like this..

spec:
  hosts:
  ...
  - ssh:
      address: 100.92.34.7
      user: martin_kou
      port: 22
      keyPath: null
    role: worker
    files:
      - name: test
        src: gpu-workstation
        dstDir: /

The directory gpu-workstation:30101 would cause the file upload to always fail with an "invalid path" log entry. e.g.

time="24 Mar 24 17:41 PDT" level=info msg="\x1b[32m==> Running phase: Upload files to hosts\x1b[0m"
time="24 Mar 24 17:41 PDT" level=info msg="[ssh] 100.92.34.7:22: uploading registry-config"
time="24 Mar 24 17:41 PDT" level=info msg="[ssh] 100.92.34.7:22: uploading file gpu-workstation/etc/k0s/certs.d/gpu-workstation:30101/hosts.toml => /etc/k0s/certs.d/gpu-workstation:30101/hosts.toml (1 of 4)"
time="24 Mar 24 17:41 PDT" level=debug msg="[ssh] 100.92.34.7:22: ensuring directory /etc/k0s/certs.d/gpu-workstation:30101"
time="24 Mar 24 17:41 PDT" level=debug msg="[ssh] 100.92.34.7:22: executing `sudo -s -- test -e /etc/k0s/certs.d/gpu-workstation:30101 2> /dev/null`"
time="24 Mar 24 17:41 PDT" level=debug msg="[ssh] 100.92.34.7:22: executing `sudo -s -- env -i LC_ALL=C stat -c '%s|%y|%a|%F' -- /etc/k0s/certs.d/gpu-workstation:30101/hosts.toml`"
time="24 Mar 24 17:41 PDT" level=debug msg="[ssh] 100.92.34.7:22: remote stat failed: failed to stat /etc/k0s/certs.d/gpu-workstation:30101/hosts.toml: command failed: client exec: ssh session wait: Process exited with status 1"
time="24 Mar 24 17:41 PDT" level=debug msg="[ssh] 100.92.34.7:22: executing `stat --help 2>&1`"
time="24 Mar 24 17:41 PDT" level=debug msg="[ssh] 100.92.34.7:22: executing `stat -c '%#f %s %.9Y //%n//' -- /etc/k0s/certs.d/gpu-workstation:30101/hosts.toml 2> /dev/null`"
time="24 Mar 24 17:41 PDT" level=debug msg="[ssh] 100.92.34.7:22: executing `stat -c '%#f %s %.9Y //%n//' -- /etc/k0s/certs.d/gpu-workstation:30101 2> /dev/null`"
time="24 Mar 24 17:41 PDT" level=debug msg="[ssh] 100.92.34.7:22: 0x41ed 4096 1711326694.424793474 ///etc/k0s/certs.d/gpu-workstation:30101//"
time="24 Mar 24 17:41 PDT" level=debug msg="[ssh] 100.92.34.7:22: executing `install -m 0644 /dev/null /etc/k0s/certs.d/gpu-workstation:30101/hosts.toml`"
time="24 Mar 24 17:41 PDT" level=info msg="\x1b[31m* Running clean-up for phase: Acquire exclusive host lock\x1b[0m"
time="24 Mar 24 17:41 PDT" level=debug msg="[ssh] 100.114.163.115:22: stopped lock cycle, removing file"
time="24 Mar 24 17:41 PDT" level=debug msg="[ssh] 100.92.34.7:22: stopped lock cycle, removing file"
time="24 Mar 24 17:41 PDT" level=debug msg="[ssh] 100.92.34.7:22: executing `sudo -s -- rm -f -- /run/lock/k0sctl 2> /dev/null`"
time="24 Mar 24 17:41 PDT" level=debug msg="[ssh] 100.114.163.115:22: executing `sudo -s -- rm -f -- /run/lock/k0sctl 2> /dev/null`"
time="24 Mar 24 17:41 PDT" level=info msg="\x1b[31m==> Apply failed\x1b[0m"
time="24 Mar 24 17:41 PDT" level=fatal msg="apply failed - log file saved to /home/martin_kou/.cache/k0sctl/k0sctl.log: failed on 1 hosts:\n - [ssh] 100.92.34.7:22: invalid path: open remote file 
/etc/k0s/certs.d/gpu-workstation:30101/hosts.toml for writing: 
open /etc/k0s/certs.d/gpu-workstation:30101/hosts.toml: 
command failed: client exec: ssh session wait: Process exited with status 1"

If I remove any directory with ":" from the source files, then the upload would succeed. Unfortunately, in this particular case I actually need the "gpu-workstation:30101" to be named in that particular way.

@kke kke added the bug Something isn't working label Mar 25, 2024
@kke
Copy link
Contributor

kke commented Mar 25, 2024

That's strange.

It looks like the command install -m 0644 /dev/null /etc/k0s/certs.d/gpu-workstation:30101/hosts.toml fails which creates an empty file with 0644 permissions.

It looks like it didn't use sudo but I can't understand how that could happen.

I need to try this out myself.

@onedr0p
Copy link

onedr0p commented Mar 28, 2024

I think the colon is a red herring, this is probably the same issue I had in #638

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants