Unable to load config file #11450

Closed
opened 2025-11-02 09:38:04 -06:00 by GiteaMirror · 11 comments
Owner

Originally created by @Android-X13 on GitHub (Aug 14, 2023).

Description

I cannot run gitea through the command line, example:

gitea admin user list

...s/setting/setting.go:103:MustInstalled() [F] Unable to load config file for a installed Gitea instance, you should either use "--config" to set your config file (app.ini), or run "gitea web" command to install Gitea.

gitea --config /etc/gitea/app.ini admin user list

...s/setting/setting.go:96:InitCfgProvider() [F] Unable to init config provider from "/etc/gitea/app.ini": unable to check if "/etc/gitea/app.ini" is a file. Error: stat /etc/gitea/app.ini: permission denied

I cannot run gitea as user git since that user is setup with --disabled-password as per the official instructions.

Setting the USER environment variable (taken from here) also does not work:

USER=git gitea admin user list
USER=git gitea --config /etc/gitea/app.ini admin user list

Gitea Version

1.20.2

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

2.30.2

Operating System

Raspbian bullseye

How are you running Gitea?

systemd

Database

SQLite

Originally created by @Android-X13 on GitHub (Aug 14, 2023). ### Description I cannot run gitea through the command line, example: `gitea admin user list` > ...s/setting/setting.go:103:MustInstalled() [F] Unable to load config file for a installed Gitea instance, you should either use "--config" to set your config file (app.ini), or run "gitea web" command to install Gitea. `gitea --config /etc/gitea/app.ini admin user list` > ...s/setting/setting.go:96:InitCfgProvider() [F] Unable to init config provider from "/etc/gitea/app.ini": unable to check if "/etc/gitea/app.ini" is a file. Error: stat /etc/gitea/app.ini: permission denied I cannot run gitea as user `git` since that user is setup with `--disabled-password` as per the official instructions. Setting the USER environment variable (taken from [here](https://github.com/go-gitea/gitea/issues/4894)) also does not work: `USER=git gitea admin user list` `USER=git gitea --config /etc/gitea/app.ini admin user list` ### Gitea Version 1.20.2 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version 2.30.2 ### Operating System Raspbian bullseye ### How are you running Gitea? systemd ### Database SQLite
GiteaMirror added the type/bug label 2025-11-02 09:38:04 -06:00
Author
Owner

@wxiaoguang commented on GitHub (Aug 14, 2023):

Make your /etc/gitea/app.ini readable by Gitea. eg: chmod/chown

@wxiaoguang commented on GitHub (Aug 14, 2023): ~~Make your `/etc/gitea/app.ini` readable by Gitea. eg: chmod/chown~~
Author
Owner

@wxiaoguang commented on GitHub (Aug 14, 2023):

ps: USER=git is not right. Maybe you need su or sudo

@wxiaoguang commented on GitHub (Aug 14, 2023): ps: `USER=git` is not right. Maybe you need `su` or `sudo`
Author
Owner

@Android-X13 commented on GitHub (Aug 14, 2023):

Maybe you need su or sudo

Already tried that but it doesn't work, I've setup the user git with --disabled-password following the docs.

@Android-X13 commented on GitHub (Aug 14, 2023): > Maybe you need `su` or `sudo` Already tried that but it doesn't work, I've setup the user `git` with `--disabled-password` following the [docs](https://docs.gitea.com/installation/install-from-binary#prepare-environment).
Author
Owner

@wxiaoguang commented on GitHub (Aug 14, 2023):

Already tried that but it doesn't work,

That's impossible, it should work.

@wxiaoguang commented on GitHub (Aug 14, 2023): > Already tried that but it doesn't work, That's impossible, it should work.
Author
Owner

@Android-X13 commented on GitHub (Aug 14, 2023):

Can you give an example?

su - git -c 'gitea --version'
su git -c 'gitea --version'

Asks for password and I get an Authentication failure

@Android-X13 commented on GitHub (Aug 14, 2023): Can you give an example? `su - git -c 'gitea --version'` `su git -c 'gitea --version'` Asks for password and I get an Authentication failure
Author
Owner

@wxiaoguang commented on GitHub (Aug 14, 2023):

su or sudo is a basic linux command, I do not know how you setup your linux, so I don't know what is the right command for you.

Usually, you need to use the similar command like when you want to edit system (root-owned) files.

@wxiaoguang commented on GitHub (Aug 14, 2023): `su` or `sudo` is a basic linux command, I do not know how you setup your linux, so I don't know what is the right command for you. Usually, you need to use the similar command like when you want to edit system (root-owned) files.
Author
Owner

@Android-X13 commented on GitHub (Aug 14, 2023):

I can get around this by actually setting a password for git user, then the su command works after authenticating. It's just that the docs specify to use --disabled-password for setting that user so I opened this issue in case there was something I'm missing here

@Android-X13 commented on GitHub (Aug 14, 2023): I can get around this by actually setting a password for git user, then the `su` command works after authenticating. It's just that the docs specify to use `--disabled-password` for setting that user so I opened this issue in case there was something I'm missing here
Author
Owner

@wxiaoguang commented on GitHub (Aug 14, 2023):

sudo

@wxiaoguang commented on GitHub (Aug 14, 2023): `sudo`
Author
Owner

@eeyrjmr commented on GitHub (Aug 14, 2023):

I can get around this by actually setting a password for git user, then the su command works after authenticating. It's just that the docs specify to use --disabled-password for setting that user so I opened this issue in case there was something I'm missing here

--disabled-password is file as it means the user git doesn't set a password but still allows the user to login (ie via ssh or be usable via su/sudo)

Can you give an example?

su - git -c 'gitea --version' su git -c 'gitea --version'

Asks for password and I get an Authentication failure

It will do if you are executing that via a regular user. if you 1st switch user to root, then switch user to git you should not be asked for a password

  1. su root
  2. su git
  3. gitea admin user list

in short: gitea must be run by the configured user (either git or gitea). You must switch to that user from the root account. The only password you will be asked for is roots. If you are on a system (eg ubuntu) where root's password is randomised and you must use sudo then you can do:

**sudo su git ** to gain root-priv to switch to the git user

@eeyrjmr commented on GitHub (Aug 14, 2023): > I can get around this by actually setting a password for git user, then the `su` command works after authenticating. It's just that the docs specify to use `--disabled-password` for setting that user so I opened this issue in case there was something I'm missing here --disabled-password is file as it means the user **git** doesn't set a password but still allows the user to login (ie via ssh or be usable via su/sudo) > Can you give an example? > > `su - git -c 'gitea --version'` `su git -c 'gitea --version'` > > Asks for password and I get an Authentication failure It will do if you are executing that via a regular user. if you 1st switch user to root, then switch user to git you should not be asked for a password 1. su root 2. su git 3. gitea admin user list in short: gitea must be run by the configured user (either git or gitea). You must switch to that user from the root account. The only password you will be asked for is roots. If you are on a system (eg ubuntu) where root's password is randomised and you must use sudo then you can do: **sudo su git ** to gain root-priv to switch to the git user
Author
Owner

@Android-X13 commented on GitHub (Aug 14, 2023):

sudo su git -c 'gitea --config /etc/gitea/app.ini admin user list'

It's a bit too much but it works for me

@Android-X13 commented on GitHub (Aug 14, 2023): `sudo su git -c 'gitea --config /etc/gitea/app.ini admin user list'` It's a bit too much but it works for me
Author
Owner

@wxiaoguang commented on GitHub (Aug 15, 2023):

Hmm, since sudo works, I think what you need is sudo -u git gitea --config /etc/gitea/app.ini admin user list

@wxiaoguang commented on GitHub (Aug 15, 2023): Hmm, since `sudo` works, I think what you need is `sudo -u git gitea --config /etc/gitea/app.ini admin user list`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#11450