I get an error when starting the VM.
Describe the bug
When I run finch vm start I get the following error:
FATA[0044] failed to update the user's .profile file: failed to read config file: file does not exist
But exists .profile file.
$ ls -la ~/ | grep profile
-rw-r--r-- 1 mymac staff 0 May 13 21:53 .profile
Steps to reproduce
finch vm start
Expected behavior The vm boot completes without any errors.
Screenshots or logs
INFO[0000] Starting existing Finch virtual machine...
INFO[0044] Finch virtual machine started successfully
FATA[0044] failed to update the user's .profile file: failed to read config file: file does not exist
Additional context
- My mac
macOS Monterey ver 12.3.1 Intel Core i7
- How i installed finch
brew install finch --cask
To help debug the issue as quickly as possible, we recommend generating a support bundle with finch support-bundle-generate and attaching it to this issue. This packages all Finch-related configs and logs into one file.
Hi @north-hoshi, I checked the .profile permission and it is the same with mine. Could you help run finch support-bundle-generate and attaching it to this issue? Meanwhile, could you please try finch vm stop, finch vm remove, and finch vm init to see if it helps unblock?
@north-hoshi What is the USER env variable set to on your machine? Finch uses this variable to write to .bashrc inside the VM and if the user running finch does not have this variable set on his machine or it's different to the user running the finch process, it's possible to see this error. Can you try export USER=<user running finch> and they try finch vm start. Thanks!
Hey @vsiravar having the same issue. I can confirm that the USER environment variable is set and I also installed finch via Homebrew. Thanks!
@strongishllama Thanks for trying finch! Is this(68825) the same user as the one running the finch process? Finch updates the finch user's .bashrc file in the finch vm post vm initialization. If this is the case can you try running finch as 68825 or run
export USER=`whoami`
@vsiravar Looks like the issue might be on my end. I tried it on another laptop and it worked fine. I'll keep digging for a solution on my end, cheers! 😄
The support-bundle command above is incorrect. It should be finch support-bundle generate.
I'm getting this error when running either finch vm init or finch vm start. My $USER has an @ character in it; could this cause the error?
@KevinLiAWS Hi, I also encountered the same error and submitted a PR to correct it. I would appreciate it if you could confirm this. https://github.com/runfinch/finch/pull/712
The cause is that the username in the VM will fall back to lima if the host username does not match the lima regular expression. The full path of .bashrc could be /home/lima.linux/.bashrc.
ref: https://github.com/lima-vm/lima/blob/a8c703bf8b66d213d00542ef68271cd7b73612ef/pkg/osutil/user.go#L114-L119
Resolved by #712