Missing `mounts:` no longer defaults to mounting home directory

Open Beginner friendly
#1,533 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
65/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
docker, go, macos
Domain
cli, devtools

Research direction

The issue points to a specific condition in the code (likely around line 376 in the linked diff) that determines default home directory mounting. Start by locating the config loading and mount handling logic in the codebase, likely in a file like config/config.go or vm/lima.go. Reproduce the bug by creating a colima.yaml without a mounts key, then trace through the code to see how the nil slice is handled. The fix involves adjusting the condition to treat a missing mounts key as triggering the default mount. Run the existing tests related to mounts to verify the fix.

Written by the indexing model from the issue text.

Description

Description

When starting up a colima.yaml without a mounts: key, it does not default to mounting the user's home directory as documented in the config file.

The config is also updated to mounts: null instead of the documented default of mounts: [].

Version

colima version 0.10.1
git commit: ed905203afdbc6fd4eae6cc301918099ff31e86e

runtime: docker
arch: aarch64
client: v29.2.1
server: v29.2.1
limactl version 2.0.3
zsh: command not found: qemu-img

Operating System
  • macOS Intel <= 13 (Ventura)
  • macOS Intel >= 14 (Sonoma)
  • Apple Silicon <= 13 (Ventura)
  • Apple Silicon >= 14 (Sonoma)
  • Linux
Output of colima status

INFO[0000] colima is running using macOS Virtualization.Framework
INFO[0000] arch: aarch64
INFO[0000] runtime: docker
INFO[0000] mountType: virtiofs
INFO[0000] docker socket: unix:///Users/cflee/.colima/default/docker.sock
INFO[0000] containerd socket: unix:///Users/cflee/.colima/default/containerd.sock

Reproduction Steps
  1. Write or modify the default instance's colima.yaml to have no mounts: line
  2. Run colima start
  3. Run colima ssh and ls to observe that the home directory is not mounted
  4. Read the colima.yaml and observe that it reflects mounts: null
  5. Run colima restart
  6. Run colima ssh and ls to observe that the home directory is still not mounted
Expected behaviour

Upon colima start, when mounts: is not stated, the home directory should be mounted matching the behaviour stated in the config file, and the config file should be updated to mounts: [] (and that should have this behaviour).

# Colima default behaviour: $HOME is mounted as writable.
# Default: []
Additional context

I suspect this is a regression in v0.10.0 from #1485 as the condition for mounting the user's home directory was updated from len(conf.Mounts) == 0 (would be true where the mounts key is missing as it's unmarshaled into a nil slice that has len 0) to conf.Mounts != nil && len(conf.Mounts) == 0 (would be false as it's a nil slice)

Dominant language
Go
Stars
30.9k
Forks
618
Avg merge
6d 6h
Merged PRs (30d)
4

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from abiosoft/colima

All issues in abiosoft/colima

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.