Skip to content

[Summary] USER_UID/uid related problems (snap/docker) #23632

Open
@wxiaoguang

Description

@wxiaoguang

Background

  1. Discord: "v1.19.0 installed via snap on Ubuntu server doesn't launch. all is OK with 1.18.5 , but with the last one i got" : setting.go:322:loadRunModeFrom() [F] Expect user 'gitea' but current user is: root.
    • "no i didn't change anything, automatic snap update last night to 1.19, break my gitea. i just rollback to 1.18 and all is ok again without touch my config", the chat link
    • Personally I guess it is likely a misconfiguration problem, but I can't see the details nor get more clues from the reporter at the moment.
  2. Docker config: USER_UID=1000 & USER_GID=1000
    • It's unclear what they are used for, or what they affect.
  3. Can not verify your SSH key: SSHKeyGenParsePublicKey failed: exit status 255 No user exists for uid 997 #19920
    • Although it was closed, actually it didn't get a fix, it's closed because no time spending on it.
  4. The pterodactyl / parkervcp:
    • I used pterodactyl which uses docker with this docker image: ghcr.io/parkervcp/yolks:debian
    • And installs from the config generated from this file: https://github.com/parkervcp/eggs/blob/master/software/gitea/egg-gitea.json
    • Then: AddPublicKey, calcFingerprintSSHKeygen: 'ssh-keygen -lf /tmp/....' failed with error 'exec(64c52017-2:AddPublicKey) failed: exit status 255(<nil>) stdout: stderr: No user exists for uid 999 ': No user exists for uid 999

TODO

I haven't spent time on these problems. Some brief thoughts:

  1. If Gitea runs with root, it should be able to setuid/seteuid to switch to the "gitea" user.
    • However, "setuid" correctly in a complex Go program like Gitea is very difficult.
  2. Gitea checks the current running user by its name, it's not ideal, because in some rare cases, the UID could be used without an existing user name.
    • Update: eg: Builtin SSH Server & Docker-rootless only needs a virtual SSH_USER.
  3. The USER_UID/USER_GID config for docker-root/docker-rootless are unclear, and it might cause problems if something mismatches or changes.

I guess Gitea needs to spend some time on these problems, work them out, clarify the behaviors and improve documents.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions