Page MenuHomePhabricator

"panic: user: unknown userid 501" after running "sudo mw docker hosts add"
Open, Needs TriagePublic


~$ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.15.7
BuildVersion:	19H1715

~$ docker --version
Docker version 20.10.12, build e91ed57

~$ docker-compose --version
Docker Compose version v2.2.3

~$ whoami

~$ mw version 
mw version 0.10.2 ( 2022-02-07T10:50:12Z )

1~$ mw docker hosts add
2Wanted to alter your hosts file bu could not.
3You can re-run this command with sudo.
4Or edit the hosts file yourself.
5Temporary file: /var/folders/2l/7z2959rx7yz1c6vsczhg4kqr0000gn/T/mwcli-hosts-678401840
8# Host Database
10# localhost is used to configure the loopback interface
11# when the system is booting. Do not change this entry.
13127.0.0.1 localhost proxy.mwdd.localhost eventlogging.mwdd.localhost adminer.mwdd.localhost mailhog.mwdd.localhost graphite.mwdd.localhost phpmyadmin.mwdd.localhost default.mediawiki.mwdd.localhost
14255.255.255.255 broadcasthost
15::1 localhost
16# Added by Docker Desktop
17# To allow the same kube context to work on the host and the container:
18127.0.0.1 kubernetes.docker.internal
19# End of section

1~$ sudo mw docker hosts add
2panic: user: unknown userid 501
4goroutine 1 [running]:, 0x6, 0x0, 0xf)
6 /builds/repos/releng/cli/internal/util/dirs/dirs.go:22 +0x15f
8 /builds/repos/releng/cli/internal/cli/dir.go:22
10 /builds/repos/releng/cli/internal/config/root.go:15
12 /builds/repos/releng/cli/internal/config/root.go:19 +0x58, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
14 /builds/repos/releng/cli/internal/config/root.go:40 +0x56, 0x7, 0x1fd5894, 0x4, 0x1fd589c, 0x5, 0x1fd6168, 0x7, 0x1fd8ea0, 0x14, ...)
16 /builds/repos/releng/cli/cmd/root.go:181 +0x13b
18 /builds/repos/releng/cli/main.go:29 +0xb5

Event Timeline

Addshore moved this task from Inbox to In Progress on the mwcli board.
Addshore added a subscriber: Addshore.

Thanks for the report!

When using sudo the cli checks the SUDO_UID environment variable to find the ID of the users that is running sudo

Seemingly this ID is 501 for your run, but then go fails to find a user with this ID.

After a quick google I find this

So I have gone ahead and made a build trying with this flag set.

!165 CGO_ENABLED=1 for builds (make-cgo-enabled-1)

I uploaded some release builds from this MR to (also shared on slack now)
Could you give the binary that you normally use in that ZIP file a go and let me know how it goes?

@zeljkofilipin do let me know if the binary that I sent you on slack works!
Then we can merge it and release the fix :)

@Addshore sorry, I got distracted with other things. I'll let you know as soon as I get some time to work on this.