lima icon indicating copy to clipboard operation
lima copied to clipboard

Add possibility to override /tmp

Open afbjorklund opened this issue 1 year ago • 5 comments

Use $TMPDIR to change the location of /tmp on Unix.

Use $TEMP to change the location of /tmp on Windows.

https://pkg.go.dev/os#TempDir

Closes #2339

afbjorklund avatar May 13 '24 16:05 afbjorklund

On second thought, having /var/tmp/lima mount under /tmp/lima breaks the abstraction.

We probably still need to do something different on Windows, and not use localpathutil?

No idea where C:\Users\UserName\AppData\Local\Temp\lima is supposed to end up.

Possibly something like /c/Users/UserName/AppData/Local/Temp/lima, maybe /mnt

afbjorklund avatar May 13 '24 16:05 afbjorklund

Now the location is the same as the mountpoint, so the illusion holds.

i.e. you can still do something like lima /tmp/lima/foo with any temp dir

Reference to the cygpath utility, regarding DOS filepath translation...

https://www.msys2.org/docs/filesystem-paths/ (skipped the /mnt)

afbjorklund avatar May 14 '24 16:05 afbjorklund

No idea where C:\Users\UserName\AppData\Local\Temp\lima is supposed to end up.

Possibly something like /c/Users/UserName/AppData/Local/Temp/lima, maybe /mnt

I have not really used Lima on Windows yet, but aren't we using WSL2 for the emulation? In that case we should be using WSL2 path names and not msys hacks.

Note that with WSL2 (depending on how it is configured) none of our mounting really matters as everything is already mounted anyways:

suse@rd-w11-test-1:~$ wslpath -u c:\\user
/mnt/c/user
suse@rd-w11-test-1:~$ wslpath -w /tmp
\\wsl.localhost\Ubuntu-22.04\tmp

jandubois avatar May 14 '24 16:05 jandubois

This was having the eye towards QEMU (or Hyper-V perhaps), but mostly it was just a (new) unit test failure...

assertion failed: error is not nil: field `mounts[1].location` must be an absolute path, got "/tmp/lima"

As you mention I think WSL comes with (9p) mounts already.

But it doesn't run custom kernels or custom cloud images.

afbjorklund avatar May 14 '24 16:05 afbjorklund

Then again, this feature is really on needed on Fedora or on Windows (i.e. without WSL)

It is not needed on Ubuntu or on macOS, so I think I will just leave it in "draft" for a while

afbjorklund avatar May 14 '24 17:05 afbjorklund