Custom folder was created after upgrade to 1.15.10 and dump comand is failing #8370

Closed
opened 2025-11-02 08:04:03 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @Rychu-Pawel on GitHub (Jan 17, 2022).

Gitea Version

1.15.10

Git Version

No response

Operating System

Ubuntu 20.04.3

How are you running Gitea?

Running latest build from https://github.com/go-gitea/gitea/releases/download/v1.15.10/gitea-1.15.10-linux-amd64 as systemd service configured by following https://docs.gitea.io/en-us/linux-service/
My gitea.service file:

[Unit]
Description=Gitea (Git with a cup of tea)
After=syslog.target
After=network.target
#Requires=mysql.service
Requires=mariadb.service
#Requires=postgresql.service
#Requires=memcached.service
Requires=redis.service

[Service]
# Modify these two values and uncomment them if you have
# repos with lots of files and get an HTTP error 500 because
# of that
###
#LimitMEMLOCK=infinity
#LimitNOFILE=65535
RestartSec=2s
Type=simple
User=git
Group=git
WorkingDirectory=/var/lib/gitea/
RuntimeDirectory=gitea
PIDFile=/run/gitea/gitea.pid
ExecStart=/usr/local/bin/gitea web -c /etc/gitea/app.ini -P /var/run/gitea/gitea.pid
Restart=always
Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea
# If you want to bind Gitea to a port below 1024 uncomment
# the two values below
###
#CapabilityBoundingSet=CAP_NET_BIND_SERVICE
#AmbientCapabilities=CAP_NET_BIND_SERVICE

[Install]
WantedBy=multi-user.target

Database

MySQL

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Description

After upgrading to 15.10.1 custom folder was created in /usr/local/bin. It only contains conf subfolder and app.ini file in that subfolder. app.ini file content:

[security]
INTERNAL_TOKEN = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Not sure if that's related but dump command now fails with custom folder related error message:

# sudo -u git /usr/local/bin/gitea dump -c /etc/gitea/app.ini -f "/path/to/zip.zip"
[...]
2022/01/17 20:58:10 cmd/dump.go:270:runDump() [I] [SQL] SELECT `id`, `version` FROM `version` [] - 328.474µs
2022/01/17 20:58:10 cmd/dump.go:279:runDump() [I] Adding custom configuration file from /etc/gitea/app.ini
Failed to include custom: open /usr/local/bin/custom/conf/app.ini: permission denied
2022/01/17 20:58:10 cmd/dump.go:150:fatal() [F] Failed to include custom: open /usr/local/bin/custom/conf/app.ini: permission denied

Adding --skip-custom-dir to the dump command makes it work and looks like creates a valid dump zip file.

Screenshots

No response

Originally created by @Rychu-Pawel on GitHub (Jan 17, 2022). ### Gitea Version 1.15.10 ### Git Version _No response_ ### Operating System Ubuntu 20.04.3 ### How are you running Gitea? Running latest build from https://github.com/go-gitea/gitea/releases/download/v1.15.10/gitea-1.15.10-linux-amd64 as systemd service configured by following https://docs.gitea.io/en-us/linux-service/ My `gitea.service` file: ``` [Unit] Description=Gitea (Git with a cup of tea) After=syslog.target After=network.target #Requires=mysql.service Requires=mariadb.service #Requires=postgresql.service #Requires=memcached.service Requires=redis.service [Service] # Modify these two values and uncomment them if you have # repos with lots of files and get an HTTP error 500 because # of that ### #LimitMEMLOCK=infinity #LimitNOFILE=65535 RestartSec=2s Type=simple User=git Group=git WorkingDirectory=/var/lib/gitea/ RuntimeDirectory=gitea PIDFile=/run/gitea/gitea.pid ExecStart=/usr/local/bin/gitea web -c /etc/gitea/app.ini -P /var/run/gitea/gitea.pid Restart=always Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea # If you want to bind Gitea to a port below 1024 uncomment # the two values below ### #CapabilityBoundingSet=CAP_NET_BIND_SERVICE #AmbientCapabilities=CAP_NET_BIND_SERVICE [Install] WantedBy=multi-user.target ``` ### Database MySQL ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Description After upgrading to 15.10.1 `custom` folder was created in `/usr/local/bin`. It only contains `conf` subfolder and `app.ini` file in that subfolder. `app.ini` file content: ``` [security] INTERNAL_TOKEN = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ``` Not sure if that's related but `dump` command now fails with `custom` folder related error message: ``` # sudo -u git /usr/local/bin/gitea dump -c /etc/gitea/app.ini -f "/path/to/zip.zip" [...] 2022/01/17 20:58:10 cmd/dump.go:270:runDump() [I] [SQL] SELECT `id`, `version` FROM `version` [] - 328.474µs 2022/01/17 20:58:10 cmd/dump.go:279:runDump() [I] Adding custom configuration file from /etc/gitea/app.ini Failed to include custom: open /usr/local/bin/custom/conf/app.ini: permission denied 2022/01/17 20:58:10 cmd/dump.go:150:fatal() [F] Failed to include custom: open /usr/local/bin/custom/conf/app.ini: permission denied ``` Adding `--skip-custom-dir` to the `dump` command makes it work and looks like creates a valid dump zip file. ### Screenshots _No response_
GiteaMirror added the type/question label 2025-11-02 08:04:03 -06:00
Author
Owner

@zeripath commented on GitHub (Jan 17, 2022):

Just remove this custom folder.

However, it's appeared because you've placed gitea in /usr/local/bin and expect it to work as a filesystem hierarchy standard compliant binary, when it's not.

Please either:

  1. Only run gitea with the same enviroment and settings that you use in your .service file. In your case that means setting the GITEA_WORK_DIR environment variable (or you could use the --work-path option along with the -c).
  2. Use the FHS compliant shim provided here https://github.com/go-gitea/gitea/blob/main/contrib/fhs-compliant-script/gitea - Here it suggests placing the gitea binary in /usr/lib/gitea/ and placing this script as /usr/local/bin/gitea.)
  3. Compile Gitea using LDFLAGS to change the default paths as described here https://docs.gitea.io/en-us/install-from-source/#changing-default-paths
@zeripath commented on GitHub (Jan 17, 2022): Just remove this custom folder. However, it's appeared because you've placed gitea in /usr/local/bin and expect it to work as a filesystem hierarchy standard compliant binary, when it's not. Please either: 1. Only run gitea with the same enviroment and settings that you use in your .service file. In your case that means setting the GITEA_WORK_DIR environment variable (or you could use the --work-path option along with the -c). 2. Use the FHS compliant shim provided here https://github.com/go-gitea/gitea/blob/main/contrib/fhs-compliant-script/gitea - Here it suggests placing the gitea binary in /usr/lib/gitea/ and placing this script as /usr/local/bin/gitea.) 3. Compile Gitea using LDFLAGS to change the default paths as described here https://docs.gitea.io/en-us/install-from-source/#changing-default-paths
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#8370