You are not logged in.

#1 2017-12-01 09:54:21

giacombum
Member
Registered: 2011-08-03
Posts: 94

Gogs doesn't start

I've updated Gogs via yaourt package on my server and now gogs service doesn't restart. I obtain the following error:

systemctl status gogs.service
● gogs.service - Gogs
   Loaded: loaded (/usr/lib/systemd/system/gogs.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Fri 2017-12-01 10:45:06 CET; 5min ago
  Process: 18743 ExecStart=/usr/bin/gogs web --config /etc/gogs/app.ini (code=exited, status=2)
 Main PID: 18743 (code=exited, status=2)

Dec 01 10:45:06 sputnik systemd[1]: gogs.service: Service hold-off time over, scheduling restart.
Dec 01 10:45:06 sputnik systemd[1]: gogs.service: Scheduled restart job, restart counter is at 5.
Dec 01 10:45:06 sputnik systemd[1]: Stopped Gogs.
Dec 01 10:45:06 sputnik systemd[1]: gogs.service: Start request repeated too quickly.
Dec 01 10:45:06 sputnik systemd[1]: gogs.service: Failed with result 'exit-code'.
Dec 01 10:45:06 sputnik systemd[1]: Failed to start Gogs.

Can you help me? How can I obtain more info about the issue?

Last edited by giacombum (2017-12-01 09:54:47)

Offline

#2 2017-12-01 10:02:33

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: Gogs doesn't start

Does /var/log/gogs contain anything relevant?


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#3 2017-12-01 12:41:15

giacombum
Member
Registered: 2011-08-03
Posts: 94

Re: Gogs doesn't start

Nope, because the server doesn't start...

Offline

#4 2017-12-02 04:48:11

GenkiSky
Member
From: This account is henceforth dis
Registered: 2017-04-04
Posts: 82

Re: Gogs doesn't start

Have you tried running the ExecStart command directly? And is there no --debug / --verbose / etc. flag you can pass to the program to say what it's doing and why it's exiting with an error?

Offline

#5 2017-12-04 08:24:37

giacombum
Member
Registered: 2011-08-03
Posts: 94

Re: Gogs doesn't start

I start the server via systemd command, so I don't know if is there another command to start gogs...

Offline

#6 2017-12-04 12:24:52

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,868

Re: Gogs doesn't start

Loaded: loaded (/usr/lib/systemd/system/gogs.service; enabled; vendor preset: disabled)

/usr/lib/systemd/system/gogs.service is the file systemd uses to start it, just look at the content of that file to see what is done.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#7 2017-12-04 14:49:32

giacombum
Member
Registered: 2011-08-03
Posts: 94

Re: Gogs doesn't start

The content of the file is the following:

[Unit]
Description=Gogs
After=syslog.target
After=network.target
After=mariadb.service mysqld.service postgresql.service memcached.service 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
Type=simple
User=gogs
Group=gogs
WorkingDirectory=/var/lib/gogs
ExecStart=/usr/bin/gogs web --config /etc/gogs/app.ini
Restart=always
Environment=USER=gogs HOME=/var/lib/gogs

[Install]
WantedBy=multi-user.target

I've tried to execute the ExecStart command, but it requires the user 'gogs' so I can't start it...

Offline

#8 2017-12-04 14:59:21

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: Gogs doesn't start

It's easy enough to run the command as a different user...

sudo -u gogs /usr/bin/gogs web --config /etc/gogs/app.ini

No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#9 2017-12-05 08:17:22

giacombum
Member
Registered: 2011-08-03
Posts: 94

Re: Gogs doesn't start

sudo -u gogs /usr/bin/gogs web --config /etc/gogs/app.ini
panic: error getting work directory: stat .: permission denied

goroutine 1 [running]:
github.com/gogits/gogs/vendor/gopkg.in/macaron%2ev1.init.1()
        /tmp/yaourt-tmp-giacomo/aur-gogs/src/build/src/github.com/gogits/gogs/vendor/gopkg.in/macaron.v1/macaron.go:317 +0x142
github.com/gogits/gogs/vendor/gopkg.in/macaron%2ev1.init()
        <autogenerated>:1 +0x413
github.com/gogits/gogs/vendor/github.com/go-macaron/cache.init()
        <autogenerated>:1 +0x50
github.com/gogits/gogs/vendor/github.com/go-macaron/cache/memcache.init()
        <autogenerated>:1 +0x53
github.com/gogits/gogs/pkg/setting.init()
        <autogenerated>:1 +0x7f
github.com/gogits/gogs/models.init()
        <autogenerated>:1 +0x8c
github.com/gogits/gogs/cmd.init()
        <autogenerated>:1 +0x8c
main.init()
        <autogenerated>:1 +0x4e

Offline

#10 2017-12-05 17:00:24

TheGoliath
Member
From: Germany
Registered: 2017-03-24
Posts: 51
Website

Re: Gogs doesn't start

[Unit]
Description=Gogs (Go Git Service)
After=network.target mariadb.service

[Service]
Type=simple
User=gogs
Group=gogs
Environment="GOGS_WORK_DIR=/var/lib/gogs"
WorkingDirectory=/var/lib/gogs
ExecStart=/usr/bin/gogs web
Restart=always

[Install]
WantedBy=multi-user.target

Offline

#11 2017-12-05 17:01:29

TheGoliath
Member
From: Germany
Registered: 2017-03-24
Posts: 51
Website

Re: Gogs doesn't start

giacombum wrote:
sudo -u gogs /usr/bin/gogs web --config /etc/gogs/app.ini
panic: error getting work directory: stat .: permission denied

goroutine 1 [running]:
github.com/gogits/gogs/vendor/gopkg.in/macaron%2ev1.init.1()
        /tmp/yaourt-tmp-giacomo/aur-gogs/src/build/src/github.com/gogits/gogs/vendor/gopkg.in/macaron.v1/macaron.go:317 +0x142
github.com/gogits/gogs/vendor/gopkg.in/macaron%2ev1.init()
        <autogenerated>:1 +0x413
github.com/gogits/gogs/vendor/github.com/go-macaron/cache.init()
        <autogenerated>:1 +0x50
github.com/gogits/gogs/vendor/github.com/go-macaron/cache/memcache.init()
        <autogenerated>:1 +0x53
github.com/gogits/gogs/pkg/setting.init()
        <autogenerated>:1 +0x7f
github.com/gogits/gogs/models.init()
        <autogenerated>:1 +0x8c
github.com/gogits/gogs/cmd.init()
        <autogenerated>:1 +0x8c
main.init()
        <autogenerated>:1 +0x4e

You should do a

sudo chown -R gogs:gogs /etc/gogs

Offline

#12 2017-12-06 20:30:37

giacombum
Member
Registered: 2011-08-03
Posts: 94

Re: Gogs doesn't start

I've tried to change the permissions in every gogs folder, but the problem still persists... Do you think I need a reboot?

Offline

#13 2017-12-06 21:49:00

GenkiSky
Member
From: This account is henceforth dis
Registered: 2017-04-04
Posts: 82

Re: Gogs doesn't start

It's failing to stat "." i.e. your current working directory. Did you cd to /var/lib/gogs like the unit does (WorkingDirectory=/var/lib/gogs) ?

Offline

#14 2017-12-07 10:51:58

giacombum
Member
Registered: 2011-08-03
Posts: 94

Re: Gogs doesn't start

No, I can't cd to /var/lib/gogs: but the permissions seems correct...

/var/lib 23 files, 100Kb
└──────╼ lt
total 92K
drwxrwxrwt  2 root   root   4.0K Sep  6  2015 ex
drwxr-xr-x  2 root   root   4.0K Aug  4  2016 upower
drwxr-xr-x  2 root   root   4.0K Nov  7  2016 dhcpcd
drwxr-xr-x  2 root   root   4.0K Mar 26  2017 misc
drwxr-xr-x  2 root   root   4.0K Mar 27  2017 iptables
drwxr-xr-x  2 root   root   4.0K Mar 27  2017 ip6tables
drwxr-xr-x  2 root   root   4.0K May  1  2017 arpd
drwx------  2 root   root   4.0K May 18  2017 udisks2
drwxr-xr-x  2 root   root   4.0K May 21  2017 alsa
drwx------  2 root   root   4.0K Jun 20 17:36 machines
drwxr-xr-x  6 root   root   4.0K Jun 20 17:59 systemd
drwxr-xr-x 13 sddm   sddm   4.0K Jun 20 18:00 sddm
drwxr-xr-x  2 root   root   4.0K Oct  5 11:47 krb5kdc
drwxr-xr-x  2 root   root   4.0K Nov  6 09:19 dbus
drwx------  2 redis  redis  4.0K Nov 13 09:09 redis
drwx------  5 mysql  mysql  4.0K Nov 18 07:32 mysql
drwxr-xr-x  2 root   root   4.0K Nov 18 07:32 xkb
drwx------  2 root   root   4.0K Nov 18 07:32 NetworkManager
drwxr-xr-x  2 ntp    root   4.0K Nov 18 08:32 ntp
drwxr-xr-x  3 colord colord 4.0K Nov 28 14:56 colord
drwx------  7 gogs   gogs   4.0K Dec  1 10:45 gogs
drwxr-xr-x  4 root   root   4.0K Dec  6 09:14 pacman

Offline

#15 2017-12-07 16:32:16

GenkiSky
Member
From: This account is henceforth dis
Registered: 2017-04-04
Posts: 82

Re: Gogs doesn't start

The directory only has permissions for gogs. So to enter it, it should be run as gogs: sudo -u gogs sh -c 'cd /var/lib/gogs && ...'

Last edited by GenkiSky (2017-12-07 16:33:03)

Offline

#16 2017-12-11 08:53:23

giacombum
Member
Registered: 2011-08-03
Posts: 94

Re: Gogs doesn't start

 sudo -u gogs sh -c 'cd /var/lib/gogs && ls -lrth'
total 16K
drwxr-xr-x 2 gogs gogs 4.0K Oct  9 16:53 repos
drwxr-xr-x 2 gogs gogs 4.0K Oct  9 16:53 avatars
drwxr-xr-x 2 gogs gogs 4.0K Oct  9 16:53 certs
drwx------ 3 gogs gogs 4.0K Dec  1 10:40 data

It seems everything ok... or not?

Offline

#17 2017-12-11 17:38:16

GenkiSky
Member
From: This account is henceforth dis
Registered: 2017-04-04
Posts: 82

Re: Gogs doesn't start

So, recap, please make sure you're doing everything in the service file you posted...

1) You have the following services running: mariadb.service mysqld.service postgresql.service memcached.service redis.service
2) You're using the following command:

sudo -u gogs sh -c 'cd /var/lib/gogs && GOGS_WORK_DIR=/var/lib/gogs /usr/bin/gogs web --config /etc/gogs/app.ini'

3) You've looked to see if there are any --debug or --verbose commands for gogs that you can add to help see why it fails when you run step 2, as presumably it will fail if the service fails.

Offline

#18 2017-12-12 12:29:25

giacombum
Member
Registered: 2011-08-03
Posts: 94

Re: Gogs doesn't start

I've all the service up and running, except for postgresql and memcached (but they don't seems necessary), now, when I launch the command I obtain this error:

sudo -u gogs sh -c 'cd /var/lib/gogs && GOGS_WORK_DIR=/var/lib/gogs /usr/bin/gogs web --config /etc/gogs/app.ini'
2017/12/12 13:26:27 [TRACE] Custom path: /var/lib/gogs/custom
2017/12/12 13:26:27 [TRACE] Log path: /var/log/gogs
2017/12/12 13:26:27 [TRACE] Log Mode: File (Trace)
2017/12/12 13:26:27 [ INFO] SpQR Team 0.11.34.1122
panic: length of langs is not same as length of names

goroutine 1 [running]:
github.com/gogits/gogs/vendor/github.com/go-macaron/i18n.prepareOptions(0xc420236000, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /tmp/yaourt-tmp-giacomo/aur-gogs/src/build/src/github.com/gogits/gogs/vendor/github.com/go-macaron/i18n/i18n.go:123 +0x603
github.com/gogits/gogs/vendor/github.com/go-macaron/i18n.I18n(0xc420236000, 0x1, 0x1, 0xc420735f60, 0x20)
        /tmp/yaourt-tmp-giacomo/aur-gogs/src/build/src/github.com/gogits/gogs/vendor/github.com/go-macaron/i18n/i18n.go:157 +0x7a
github.com/gogits/gogs/cmd.newMacaron(0xc420214140)
        /tmp/yaourt-tmp-giacomo/aur-gogs/src/build/src/github.com/gogits/gogs/cmd/web.go:122 +0xa98
github.com/gogits/gogs/cmd.runWeb(0xc420214140, 0x0, 0xc420214140)
        /tmp/yaourt-tmp-giacomo/aur-gogs/src/build/src/github.com/gogits/gogs/cmd/web.go:166 +0x74
github.com/gogits/gogs/vendor/github.com/urfave/cli.HandleAction(0xe28840, 0xf90e70, 0xc420214140, 0xc42016c200, 0x0)
        /tmp/yaourt-tmp-giacomo/aur-gogs/src/build/src/github.com/gogits/gogs/vendor/github.com/urfave/cli/app.go:483 +0xb7
github.com/gogits/gogs/vendor/github.com/urfave/cli.Command.Run(0xf470c9, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf5931d, 0x10, 0x0, ...)
        /tmp/yaourt-tmp-giacomo/aur-gogs/src/build/src/github.com/gogits/gogs/vendor/github.com/urfave/cli/command.go:193 +0xa99
github.com/gogits/gogs/vendor/github.com/urfave/cli.(*App).Run(0xc4202901a0, 0xc4200100c0, 0x4, 0x4, 0x0, 0x0)
        /tmp/yaourt-tmp-giacomo/aur-gogs/src/build/src/github.com/gogits/gogs/vendor/github.com/urfave/cli/app.go:250 +0x758
main.main()
        /tmp/yaourt-tmp-giacomo/aur-gogs/src/build/src/github.com/gogits/gogs/gogs.go:41 +0x3b4

I've seen the 'panic' line, maybe is there some error in the /etc/gogs/app.ini file?

Offline

#19 2017-12-12 17:46:52

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,868

Re: Gogs doesn't start

I've seen the 'panic' line, maybe is there some error in the /etc/gogs/app.ini file?

very likely, what is the content of it ?

Log path: /var/log/gogs

The content of the log file could also be helpful.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#20 2018-09-22 20:06:29

TheGoliath
Member
From: Germany
Registered: 2017-03-24
Posts: 51
Website

Re: Gogs doesn't start

[Thought it was a thread about a problem I had before (using the wrong logdir)]
Meanwhile, is the problem solved?


Cheers,
Felix

Last edited by TheGoliath (2018-09-22 20:23:30)

Offline

Board footer

Powered by FluxBB