Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InitIssuesIndexer: create index, mkdir /usr/local/bin/data: permission denied #4672

Closed
1 of 7 tasks
stachlewski opened this issue Aug 11, 2018 · 8 comments
Closed
1 of 7 tasks
Labels
type/question Issue needs no code to be fixed, only a description on how to fix it yourself.

Comments

@stachlewski
Copy link

  • Gitea version (or commit ref): 1.5.0
  • Git version: 2.17.1
  • Operating system: Ubuntu 18.04
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:
    2018/08/11 16:54:30 [I] Log Mode: File(Info)
    2018/08/11 16:54:30 [I] XORM Log Mode: File(Info)
    2018/08/11 16:54:30 [I] Cache Service Enabled
    2018/08/11 16:54:30 [I] Session Service Enabled
    2018/08/11 16:54:30 [I] Mail Service Enabled
    2018/08/11 16:54:30 [I] Notify Mail Service Enabled
    2018/08/11 16:54:32 [I] Git Version: 2.17.1
    2018/08/11 16:54:32 [...les/indexer/issue.go:64 InitIssueIndexer()] [E] InitIssuesIndexer: create index, mkdir /usr/local/bin/data: permission denied

Description

Fresh install. Done according to documentation, yet it attempts to create a subdirectory of its binary path, not in the working directory.

Started by supervisor with the following config:

[program:gitea]
directory=/var/lib/gitea
command=/usr/local/bin/gitea web -c /etc/gitea/app.ini
autostart=true
autorestart=true
startsecs=10
stdout_logfile=/var/log/gitea/stdout.log
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=10
stdout_capture_maxbytes=1MB
stderr_logfile=/var/log/gitea/stderr.log
stderr_logfile_maxbytes=1MB
stderr_logfile_backups=10
stderr_capture_maxbytes=1MB
user = git
environment = HOME="/home/git", USER="git", GITEA_WORK_DIR="/var/lib/gitea"

@lafriks
Copy link
Member

lafriks commented Aug 11, 2018

What output to you get in gitea.log or stdout about directories?

@SagePtr
Copy link
Contributor

SagePtr commented Aug 11, 2018

Maybe it doesn't parse environment config correct?
What if you remove spaces in last 2 lines?

user=git
environment=HOME="/home/git",USER="git",GITEA_WORK_DIR="/var/lib/gitea"

@stachlewski
Copy link
Author

gitea.log I pasted in my first message.

stdout.log:
2018/08/11 16:49:35 [I] Gitea v1.5.0 built with: bindata, sqlite
2018/08/11 16:51:38 [T] AppPath: /usr/local/bin/gitea
2018/08/11 16:51:38 [T] AppWorkPath: /usr/local/bin
2018/08/11 16:51:38 [T] Custom path: /usr/local/bin/custom
2018/08/11 16:51:38 [T] Log path: /var/log/gitea/

Probably AppWorkPath is the issue here.

Removing spaces in environment didn't help.
Directory structure (created by commands in installation manual) is as follows:
root@repo ~ # ls -la /var/lib/gitea
total 28
drwxr-xr-x 7 root root 4096 Aug 11 15:24 .
drwxr-xr-x 38 root root 4096 Aug 11 16:30 ..
drwxr-xr-x 2 root root 4096 Aug 11 15:24 custom
drwxr-x--- 2 git git 4096 Aug 11 15:24 data
drwxr-x--- 2 git git 4096 Aug 11 15:24 indexers
drwxr-x--- 2 git git 4096 Aug 11 15:24 log
drwxr-xr-x 2 root root 4096 Aug 11 15:24 public

@techknowlogick techknowlogick added the type/question Issue needs no code to be fixed, only a description on how to fix it yourself. label Aug 13, 2018
@mkienenb
Copy link

I also hit this problem while trying to start gitea manually.
This worked for me:

% GITEA_WORK_DIR="/var/lib/gitea" /usr/local/bin/gitea

@lafriks
Copy link
Member

lafriks commented Aug 17, 2018

Looks like problem is that supervisor does not set GITEA_WORK_DIR environment variable

@mkienenb
Copy link

mkienenb commented Aug 17, 2018

Documenting on the off chance that someone else has to deal with this situation,

In order to make the contributed service definition work under Centos 6, I had to make these changes to pick up the GITEA_WORK_DIR. I also had to change the cwd to ~git explicitly in order for it to find the https certificate files.

It seems like there must be a better approach. Maybe a gitea option to set the AppWorkPath: value directly?

Starting with
https://raw.githubusercontent.com/go-gitea/gitea/master/contrib/init/centos/gitea

% diff gitea.default-service /etc/init.d/gitea 
52c52
<   daemon $DAEMON_OPTS "${GITEA_PATH} web -c /etc/${NAME}/app.ini > ${LOGFILE} 2>&1 &"
---
>   daemon $DAEMON_OPTS "cd ~${GITEA_USER}; GITEA_WORK_DIR=${GITEA_HOME} ${GITEA_PATH} web -c /etc/${NAME}/app.ini > ${LOGFILE} 2>&1 &"

@mckaygerhard
Copy link

this problem its due the explained in #5482

@lunny lunny closed this as completed Dec 19, 2018
@lunny
Copy link
Member

lunny commented Dec 19, 2018

see #5482

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type/question Issue needs no code to be fixed, only a description on how to fix it yourself.
Projects
None yet
Development

No branches or pull requests

7 participants