Skip to content

Feat: add option to skip owner transfer of home-dir #461

@mch-sb

Description

@mch-sb

Hey!
We see that some of our workspaces with large home-dirs uses quite a bit of time on the owner-transfer-step:

#3: 🔄 Updating ownership of /home/coder...
#3: 🏡 Updated ownership of /home/coder! [2m1.175064722s]

This might be a somewhat extreme case, where the home-dir has a couple of pipx-installs, and pyenv-venvs. Where the home-dir has been prebuild, and comes with the image.
In our case this is already owned by the coder-user, and the ownership does not seem to be shifted to root on envbuild, so in this case, the ownership-transfer seems to be redundant.

So tested with removing the ownership-transfer (

envbuilder/envbuilder.go

Lines 829 to 842 in 7eabaa4

if execArgs.UserInfo.uid != 0 {
endStage := startStage("🔄 Updating ownership of %s...", execArgs.UserInfo.user.HomeDir)
if chownErr := filepath.Walk(execArgs.UserInfo.user.HomeDir, func(path string, _ fs.FileInfo, err error) error {
if err != nil {
return err
}
return os.Lchown(path, execArgs.UserInfo.uid, execArgs.UserInfo.gid)
}); chownErr != nil {
opts.Logger(log.LevelError, "chown %q: %s", execArgs.UserInfo.user.HomeDir, chownErr.Error())
endStage("⚠️ Failed to update ownership of %s, you may need to fix this manually!", execArgs.UserInfo.user.HomeDir)
} else {
endStage("🏡 Updated ownership of %s!", execArgs.UserInfo.user.HomeDir)
}
}
), and could not see any issues with ownership in our case. So if envbuilder had an option to disable that, that would be great

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions