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

improve minikube cp error message #17576

Closed
whalderman opened this issue Nov 7, 2023 · 7 comments · Fixed by #17715
Closed

improve minikube cp error message #17576

whalderman opened this issue Nov 7, 2023 · 7 comments · Fixed by #17715
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/improvement Categorizes issue or PR as related to improving upon a current feature.

Comments

@whalderman
Copy link

whalderman commented Nov 7, 2023

What Happened?

When trying to minikube cp a file, I got the following error:

❌  Exiting due to MK_COMMAND_RUNNER: Fail to copy file ./kubernetes/crawler-seccomp.json: sudo test -d /var/lib/kubelet/seccomp && sudo scp -t /var/lib/kubelet/seccomp && sudo touch -d "2023-04-26 13:36:47.006150712 +0900" /var/lib/kubelet/seccomp/crawler-seccomp.json: Process exited with status 1

After checking the logs, it appeared to be caused by a permission error:

stderr:
stat: cannot stat '/var/lib/kubelet/seccomp/crawler-seccomp.json': Permission denied
I1107 12:50:00.285362  855374 ssh_runner.go:362] scp ./kubernetes/crawler-seccomp.json --> /var/lib/kubelet/seccomp/crawler-seccomp.json (13098 bytes) 
I1107 12:50:00.294931  855374 out.go:177] 
W1107 12:50:00.295765  855374 out.go:239] ❌  Exiting due to MK_COMMAND_RUNNER: Fail to copy file ./kubernetes/crawler-seccomp.json: sudo test -d /var/lib/kubelet/seccomp && sudo scp -t /var/lib/kubelet/seccomp && sudo touch -d "2023-04-26 13:36:47.006150712 +0900" /var/lib/kubelet/seccomp/crawler-seccomp.json: Process exited with status 1

So I spent a couple hours testing permission changes.
However, I am naive and glossed over the preceding message...

I1107 12:50:00.285327  855374 ssh_runner.go:352] existence check for /var/lib/kubelet/seccomp/crawler-seccomp.json: stat -c "%s %y" /var/lib/kubelet/seccomp/crawler-seccomp.json: Process exited with status 1

existence check....

Is there any way to improve the message in stderr here?
Or can we add an option to minikube cp for automatically creating directories that don't yet exist?

Thank you for your time.

Attach the log file

Log file created at: 2023/11/07 12:50:00
Running on machine: bcj115
Binary: Built with gc go1.20.7 for linux/amd64
Log line format: [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg
I1107 12:50:00.136817  855374 out.go:296] Setting OutFile to fd 1 ...
I1107 12:50:00.136913  855374 out.go:348] isatty.IsTerminal(1) = true
I1107 12:50:00.136921  855374 out.go:309] Setting ErrFile to fd 2...
I1107 12:50:00.136929  855374 out.go:348] isatty.IsTerminal(2) = true
I1107 12:50:00.137176  855374 root.go:338] Updating PATH: /home/bcj115/.minikube/bin
I1107 12:50:00.137428  855374 mustload.go:65] Loading cluster: minikube
I1107 12:50:00.137699  855374 config.go:182] Loaded profile config "minikube": Driver=docker, ContainerRuntime=docker, KubernetesVersion=v1.27.4
I1107 12:50:00.138123  855374 cli_runner.go:164] Run: docker container inspect minikube --format={{.State.Status}}
I1107 12:50:00.150774  855374 host.go:66] Checking if "minikube" exists ...
I1107 12:50:00.150941  855374 cli_runner.go:164] Run: docker system info --format "{{json .}}"
I1107 12:50:00.188483  855374 info.go:266] docker info: {ID:YNNM:YNXS:BZNI:XECP:XUM5:QWVE:ILVP:VE2L:BHDX:PW7W:BWRQ:XNR4 Containers:4 ContainersRunning:1 ContainersPaused:0 ContainersStopped:3 Images:98 Driver:overlay2 DriverStatus:[[Backing Filesystem extfs] [Supports d_type true] [Using metacopy false] [Native Overlay Diff true] [userxattr false]] SystemStatus:<nil> Plugins:{Volume:[local] Network:[bridge host ipvlan macvlan null overlay] Authorization:<nil> Log:[awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog]} MemoryLimit:true SwapLimit:true KernelMemory:false KernelMemoryTCP:false CPUCfsPeriod:true CPUCfsQuota:true CPUShares:true CPUSet:true PidsLimit:true IPv4Forwarding:true BridgeNfIptables:true BridgeNfIP6Tables:true Debug:false NFd:31 OomKillDisable:false NGoroutines:45 SystemTime:2023-11-07 12:50:00.181718688 +0900 JST LoggingDriver:json-file CgroupDriver:systemd NEventsListener:0 KernelVersion:6.1.0-13-amd64 OperatingSystem:Debian GNU/Linux 12 (bookworm) OSType:linux Architecture:x86_64 IndexServerAddress:https://index.docker.io/v1/ RegistryConfig:{AllowNondistributableArtifactsCIDRs:[] AllowNondistributableArtifactsHostnames:[] InsecureRegistryCIDRs:[127.0.0.0/8] IndexConfigs:{DockerIo:{Name:docker.io Mirrors:[] Secure:true Official:true}} Mirrors:[]} NCPU:12 MemTotal:33571262464 GenericResources:<nil> DockerRootDir:/var/lib/docker HTTPProxy: HTTPSProxy: NoProxy: Name:bcj115 Labels:[] ExperimentalBuild:false ServerVersion:24.0.7 ClusterStore: ClusterAdvertise: Runtimes:{Runc:{Path:runc}} DefaultRuntime:runc Swarm:{NodeID: NodeAddr: LocalNodeState:inactive ControlAvailable:false Error: RemoteManagers:<nil>} LiveRestoreEnabled:false Isolation: InitBinary:docker-init ContainerdCommit:{ID:61f9fd88f79f081d64d6fa3bb1a0dc71ec870523 Expected:61f9fd88f79f081d64d6fa3bb1a0dc71ec870523} RuncCommit:{ID:v1.1.9-0-gccaecfc Expected:v1.1.9-0-gccaecfc} InitCommit:{ID:de40ad0 Expected:de40ad0} SecurityOptions:[name=apparmor name=seccomp,profile=builtin name=cgroupns] ProductLicense: Warnings:<nil> ServerErrors:[] ClientInfo:{Debug:false Plugins:[map[Name:buildx Path:/usr/libexec/docker/cli-plugins/docker-buildx SchemaVersion:0.1.0 ShortDescription:Docker Buildx Vendor:Docker Inc. Version:v0.11.2] map[Name:compose Path:/usr/libexec/docker/cli-plugins/docker-compose SchemaVersion:0.1.0 ShortDescription:Docker Compose Vendor:Docker Inc. Version:v2.21.0]] Warnings:<nil>}}
I1107 12:50:00.188633  855374 ssh_runner.go:195] Run: stat -c "%s %y" /var/lib/kubelet/seccomp/crawler-seccomp.json
I1107 12:50:00.188670  855374 cli_runner.go:164] Run: docker container inspect -f "'{{(index (index .NetworkSettings.Ports "22/tcp") 0).HostPort}}'" minikube
I1107 12:50:00.202021  855374 sshutil.go:53] new ssh client: &{IP:127.0.0.1 Port:32772 SSHKeyPath:/home/bcj115/.minikube/machines/minikube/id_rsa Username:docker}
I1107 12:50:00.285327  855374 ssh_runner.go:352] existence check for /var/lib/kubelet/seccomp/crawler-seccomp.json: stat -c "%s %y" /var/lib/kubelet/seccomp/crawler-seccomp.json: Process exited with status 1
stdout:

stderr:
stat: cannot stat '/var/lib/kubelet/seccomp/crawler-seccomp.json': Permission denied
I1107 12:50:00.285362  855374 ssh_runner.go:362] scp ./kubernetes/crawler-seccomp.json --> /var/lib/kubelet/seccomp/crawler-seccomp.json (13098 bytes)
I1107 12:50:00.294931  855374 out.go:177] 
W1107 12:50:00.295765  855374 out.go:239] ❌  Exiting due to MK_COMMAND_RUNNER: Fail to copy file ./kubernetes/crawler-seccomp.json: sudo test -d /var/lib/kubelet/seccomp && sudo scp -t /var/lib/kubelet/seccomp && sudo touch -d "2023-04-26 13:36:47.006150712 +0900" /var/lib/kubelet/seccomp/crawler-seccomp.json: Process exited with status 1
output: 
W1107 12:50:00.295778  855374 out.go:239] 
W1107 12:50:00.297322  855374 out.go:239] �[31m╭───────────────────────────────────────────────────────────────────────────────────────────╮�[0m
�[31m│�[0m                                                                                           �[31m│�[0m
�[31m│�[0m    😿  If the above advice does not help, please let us know:                             �[31m│�[0m
�[31m│�[0m    👉  https://github.com/kubernetes/minikube/issues/new/choose                           �[31m│�[0m
�[31m│�[0m                                                                                           �[31m│�[0m
�[31m│�[0m    Please run `minikube logs --file=logs.txt` and attach logs.txt to the GitHub issue.    �[31m│�[0m
�[31m│�[0m    Please also attach the following file to the GitHub issue:                             �[31m│�[0m
�[31m│�[0m    - /tmp/minikube_cp_4fd23c4b02e5f86735138fff83a7a281b29cc616_0.log                      �[31m│�[0m
�[31m│�[0m                                                                                           �[31m│�[0m
�[31m╰───────────────────────────────────────────────────────────────────────────────────────────╯�[0m
I1107 12:50:00.298267  855374 out.go:177] 

Operating System

None

Driver

None

@whalderman
Copy link
Author

Running the command directly in the cluster container provides the expected error message:

stat: cannot stat '/var/lib/kubelet/seccomp/crawler-seccomp.json': No such file or directory

@spowelljr spowelljr added the kind/improvement Categorizes issue or PR as related to improving upon a current feature. label Nov 22, 2023
@spowelljr
Copy link
Member

Calling os.MkdirAll if the path to copy inside the cluster doesn't exist seems fine to me. I'm open to improved error output as well, but if we're always going to auto create the directories might not be necessary.

@spowelljr spowelljr added help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. labels Nov 22, 2023
@tarishij17
Copy link
Contributor

/assign

@tarishij17 tarishij17 removed their assignment Dec 2, 2023
@Skalador
Copy link
Contributor

Skalador commented Dec 2, 2023

/assign I want to give it a try as first contribution please :)

@Skalador
Copy link
Contributor

Skalador commented Dec 3, 2023

I honestly dislike, that the PR #17715 was committed just 1 hour after I have claimed this issue.

@martinjirku
Copy link
Contributor

martinjirku commented Dec 3, 2023

I honestly dislike, that the PR #17715 was committed just 1 hour after I have claimed this issue.

I am sorry, I am new here as well. I've seen this ticket got unassigned and I tried to follow the process, but wrongly 😞.

Once you’ve discovered an issue to work on:

Add a comment mentioning that you plan to work on the issue
Send a PR out that mentions the issue
Comment on the issue with /assign to assign it to yourself

I forgot to mention in a comment, that I plan to work on it. When I opened the PR and tried to assign it to me, I realized it was already assigned to you in the meantime while I was working on the ticket. Again, I am sorry, for the chaos, I've created.

If you have the solution ready and you would like to create PR yourself, I can close mine.

@Skalador
Copy link
Contributor

Skalador commented Dec 3, 2023

Hi @martinjirku
please go ahead now with your PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/improvement Categorizes issue or PR as related to improving upon a current feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants