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

I get an error when starting the VM. #399

Closed
ghost opened this issue May 14, 2023 · 8 comments
Closed

I get an error when starting the VM. #399

ghost opened this issue May 14, 2023 · 8 comments
Labels
bug Something isn't working

Comments

@ghost
Copy link

ghost commented May 14, 2023

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.

@ghost ghost added the bug Something isn't working label May 14, 2023
@KevinLiAWS
Copy link
Contributor

KevinLiAWS commented May 15, 2023

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?

@vsiravar
Copy link
Contributor

vsiravar commented Jun 7, 2023

@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!

@strongishllama
Copy link

Hey @vsiravar having the same issue. I can confirm that the USER environment variable is set and I also installed finch via Homebrew. Thanks!

Screenshot 2023-08-16 at 10 32 57 am

@vsiravar
Copy link
Contributor

@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`

@strongishllama
Copy link

@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! 😄

@neil-greenwood
Copy link

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?

@w-haibara
Copy link
Contributor

w-haibara commented Nov 30, 2023

@KevinLiAWS Hi, I also encountered the same error and submitted a PR to correct it.
I would appreciate it if you could confirm this.
#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

vsiravar pushed a commit that referenced this issue Dec 2, 2023
Issue #, if available: #399

*Description of changes:*
In `nerdctl_config_applier.go`, editing `.bashrc` uses a file path based
on the host's username. However, if the host's username contains `.` or
`@`, lima uses `lima` as the username instead of the host's username.
(ref:
https://github.com/lima-vm/lima/blob/a8c703bf8b66d213d00542ef68271cd7b73612ef/pkg/osutil/user.go#L114-L119)
Therefore, if the host's user name contains `.` or `@`, editing
`.bashrc` fails.
This PR fixes this so that you can get the actual username from
`LimaWrapper.LimaUser()`.


*Testing done:* yes


- [x] I've reviewed the guidance in CONTRIBUTING.md


#### License Acceptance

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.

---------

Signed-off-by: Wataru Haibara <[email protected]>
@pendo324
Copy link
Member

Resolved by #712

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

6 participants