Gitea: Gitea install complains that 'Run user is not the current user: gitea -> '

Created on 27 Feb 2018  ·  6Comments  ·  Source: go-gitea/gitea

  • Gitea version (or commit ref): 1.4
  • Git version: git version 1.8.3.1
  • Operating system: CentOS 7
  • Database (use [x]):

    • [ X] PostgreSQL

    • [ ] MySQL

    • [ ] MSSQL

    • [ ] SQLite

  • Can you reproduce the bug at https://try.gitea.io:

    • [ ] Yes (provide example URL)

    • [ ] No

    • [X ] Not relevant

  • Log gist:

Log at failure is this:
[...tons of DB stuff...]
2018/02/27 22:10:51 [I] [SQL] SELECT column_name, column_default, is_nullable, data_type, character_maximum_length, numeric_precision, numeric_precision_radix ,
CASE WHEN p.contype = 'p' THEN true ELSE false END AS primarykey,
CASE WHEN p.contype = 'u' THEN true ELSE false END AS uniquekey
FROM pg_attribute f
JOIN pg_class c ON c.oid = f.attrelid JOIN pg_type t ON t.oid = f.atttypid
LEFT JOIN pg_attrdef d ON d.adrelid = c.oid AND d.adnum = f.attnum
LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
LEFT JOIN pg_constraint p ON p.conrelid = c.oid AND f.attnum = ANY (p.conkey)
LEFT JOIN pg_class AS g ON p.confrelid = g.oid
LEFT JOIN INFORMATION_SCHEMA.COLUMNS s ON s.column_name=f.attname AND c.relname=s.table_name
WHERE c.relkind = 'r'::char AND c.relname = $1 AND s.table_schema = $2 AND f.attnum > 0 ORDER BY f.attnum; [reaction public]
2018/02/27 22:10:51 [I] [SQL] SELECT indexname, indexdef FROM pg_indexes WHERE schemaname=$1 AND tablename=$2 [public reaction]
2018/02/27 22:10:51 [W] Table user Column max_repo_creation db default is '-1'::integer, struct default is -1
2018/02/27 22:10:51 [W] Table user Column diff_view_style db default is '''::character varying', struct default is ''
2018/02/27 22:10:51 [W] Table gpg_key column key_id db type is VARCHAR(16), struct type is CHAR(16)
2018/02/27 22:10:51 [W] Table gpg_key column primary_key_id db type is VARCHAR(16), struct type is CHAR(16)
[Macaron] 2018-02-27 22:10:52: Completed POST /install 200 OK in 665.482751ms

Description

I am trying to build a proper container to use with OpenShift (Origin or Red Hat OpenShift Container Platform). OpenShift assigns a random UID every time a container runs. There are ways to make this work and I think I did everything correct. At container startup I am finding out the UID and I'm updating /etc/passwd (made group writeable - which is fine since the container runs with root group) to point the "gitea" user to the UID that has gotten assigned.

However when I try to configure Gitea from the setup screen I get the error that 'Run user is not the current user: gitea -> '

I can ssh into my container and the process is in fact running as gitea:

sh-4.2$ whoami
gitea
sh-4.2$ ps -ef
UID PID PPID C STIME TTY TIME CMD
gitea 1 0 0 22:08 ? 00:00:00 /home/gitea/gitea web --config=/home/gitea/conf/app.ini
gitea 48 0 0 22:19 ? 00:00:00 /bin/sh
gitea 57 48 0 22:22 ? 00:00:00 ps -ef

You can see that the gitea process is running as PID 1 (since I started with exec as one should) and UID gitea.

For reference the repo used to build this image is here:
https://github.com/wkulhanek/docker-openshift-gitea
(Relevant are Dockerfile and /root/usr/bin/rungitea).

Happy to provide any additional information that may be useful.

kinquestion

Most helpful comment

@sdwolfz That was it! I also think I needed USERNAME in addition as well. But now it works. :-) Thank you!

All 6 comments

Having the exact same problems with the same setup.

I went the nss_wrapper route to try to handle this, no luck though.

@joakimberglund yes, tried that, too. This must be a bug in the code @lunny , not just a “question”.

You might need to export USER=gitea before starting the web server. This is what I needed to do when running inside a docker container.

@sdwolfz That was it! I also think I needed USERNAME in addition as well. But now it works. :-) Thank you!

Shouldn't this be included in the installation documentation. I ran into the same issue trying to install gitea 1.5 on Termux terminal. This solved the issue. Just tell the user to do the export in .bashrc so that gitea works perfectly. Another solution could be for gitea installation to get the user itself using whoami when running on linux.

Put this in .bashrc
export USER=$(whoami)

Use this same whoami username in installation.

This ensures that subsequent runs will work as expected.

Update march 2019, same issue.
If you look at the source code the container runs as the user "git", just input this.

This could have been default though saving us the trouble ;).

Was this page helpful?
0 / 5 - 0 ratings