gogs icon indicating copy to clipboard operation
gogs copied to clipboard

can't access gogs after data recovery

Open yuukiyuuna opened this issue 3 years ago • 5 comments

Gogs version

Gogs 0.13.0+dev

Git version

bash-5.1# git --version git version 2.32.3

Operating system

raspberry arm64

Database

mariadb:10.9-rc

Describe the bug

The webpage can be accessed without restarting the container after the data reply is successful Once the container is restarted, the log keeps reporting errors and the webpage cannot be opened.

To reproduce

root@raspberrypi:/data/gogs/git# docker images REPOSITORY TAG IMAGE ID CREATED SIZE mariadb 10.9-rc 920b638c403a 2 days ago 302MB gogs/gogs latest ff0531b8c349 3 days ago 92.2MB

Data recovery success log: Extracting file...gogs-repositories/hanchenglin/v2rayn.wiki.git/objects/bc Extracting file...gogs-repositories/hanchenglin/v2rayn.wiki.git/objects/bc/d4508aa68e51ac8ab91ed252a8fcc25d432823 Extracting file...gogs-repositories/hanchenglin/v2rayn.wiki.git/objects/9a Extracting file...gogs-repositories/hanchenglin/v2rayn.wiki.git/objects/9a/1ad316fb45dd61a926575ae85d3fbe08261a48 Extracting file...gogs-repositories/hanchenglin/v2rayn.wiki.git/objects/9a/82250eef4550e7955dcb5d621e6c804f1a8303 Extracting file...gogs-repositories/hanchenglin/v2rayn.wiki.git/objects/32 Extracting file...gogs-repositories/hanchenglin/v2rayn.wiki.git/objects/32/a0ead7601f6032027bccb1225f47489eb3d7f6 Extracting file...gogs-repositories/hanchenglin/v2rayn.wiki.git/objects/1a Extracting file...gogs-repositories/hanchenglin/v2rayn.wiki.git/objects/1a/f4a421d871752843f6b6afe24da60c69d70285 Extracting file...gogs-repositories/hanchenglin/v2rayn.wiki.git/objects/c7 Extracting file...gogs-repositories/hanchenglin/v2rayn.wiki.git/objects/c7/9126b84bd2561d76767ee39c3537a48a3595ab Extracting file...gogs-repositories/hanchenglin/v2rayn.wiki.git/objects/17 Extracting file...gogs-repositories/hanchenglin/v2rayn.wiki.git/objects/17/76737177b8d04bc34ff438a2e6a446968266fe Extracting file...gogs-repositories/hanchenglin/v2rayn.wiki.git/objects/78 Extracting file...gogs-repositories/hanchenglin/v2rayn.wiki.git/objects/78/747ae6a232087900821880a10b84a9a151c7ce Extracting file...gogs-repositories/hanchenglin/v2rayn.wiki.git/objects/e4 Extracting file...gogs-repositories/hanchenglin/v2rayn.wiki.git/objects/e4/2dcf28f36f3cce80fe82d2affe78925cc6e720 Extracting file...gogs-repositories/hanchenglin/v2rayn.wiki.git/objects/b0 Extracting file...gogs-repositories/hanchenglin/v2rayn.wiki.git/objects/b0/7c651a1ee5b876503edf8a359bdd3bdb569b06 Extracting file...gogs-repositories/hanchenglin/v2rayn.wiki.git/objects/c1 Extracting file...gogs-repositories/hanchenglin/v2rayn.wiki.git/objects/c1/7fef2fdbf3c08c978c0a929062bf4038b1afc4 Extracting file...gogs-repositories/hanchenglin/v2rayn.wiki.git/objects/09 Extracting file...gogs-repositories/hanchenglin/v2rayn.wiki.git/objects/09/6d3f6e5353e630db1098dbde46cefeefda3a99 Extracting file...gogs-repositories/hanchenglin/v2rayn.wiki.git/objects/6b Extracting file...gogs-repositories/hanchenglin/v2rayn.wiki.git/objects/6b/721dc080ec260f403a3b851573ea7fb649a194 Extracting file...gogs-repositories/hanchenglin/v2rayn.wiki.git/objects/53 Extracting file...gogs-repositories/hanchenglin/v2rayn.wiki.git/objects/53/c86f03eb97b88370eee8a9d03d3c872a5adbfd Extracting file...gogs-repositories/hanchenglin/v2rayn.wiki.git/objects/eb Extracting file...gogs-repositories/hanchenglin/v2rayn.wiki.git/objects/eb/70e90933b1420e313f31b9d33adbfd7c10fb21 Extracting file...gogs-repositories/hanchenglin/v2rayn.wiki.git/objects/d7 Extracting file...gogs-repositories/hanchenglin/v2rayn.wiki.git/objects/d7/f28da804183d88662e77f150bec9c351a60457 Extracting file...gogs-repositories/hanchenglin/v2rayn.wiki.git/HEAD Extracting file...gogs-repositories/hanchenglin/v2rayn.wiki.git/branches 2022/08/05 16:30:57 [ INFO] Restore succeed!

After restarting the container with the command docker restart gogs

container logs `root@raspberrypi:~# docker logs gogs usermod: no changes Aug 5 16:18:39 syslogd started: BusyBox v1.33.1 2022/08/05 16:18:39 [ WARN] Custom config "/data/gogs/conf/app.ini" not found. Ignore this warning if you're running for the first time 2022/08/05 16:18:39 [TRACE] Log mode: Console (Trace) 2022/08/05 16:18:39 [ INFO] Gogs 0.13.0+dev 2022/08/05 16:18:39 [TRACE] Work directory: /app/gogs 2022/08/05 16:18:39 [TRACE] Custom path: /data/gogs 2022/08/05 16:18:39 [TRACE] Custom config: /data/gogs/conf/app.ini 2022/08/05 16:18:39 [TRACE] Log path: /app/gogs/log 2022/08/05 16:18:39 [TRACE] Build time: 2022-08-02 07:29:27 UTC 2022/08/05 16:18:39 [TRACE] Build commit: cfa5ddbde82f8aa892a5cc56fcc5aa7388e27ddc 2022/08/05 16:18:39 [ INFO] Run mode: Development 2022/08/05 16:18:39 [ INFO] Available on http://localhost:3000/ Aug 5 08:18:39 sshd[61]: Server listening on :: port 22. Aug 5 08:18:39 sshd[61]: Server listening on 0.0.0.0 port 22. 2022/08/05 16:19:32 [TRACE] Session ID: c114e45745f0b60c 2022/08/05 16:19:32 [TRACE] CSRF Token: fffjIwAJEsFNrv-_Be87FxFmySA6MTY1OTY4NzU3MjY0NDIyNzEwNw 2022/08/05 16:19:32 [TRACE] Session ID: c114e45745f0b60c 2022/08/05 16:19:32 [TRACE] CSRF Token: eIwjVZ-fgrbH6bUhzf6qWtZ4Z486MTY1OTY2OTMzOTEzODc3Njk3Nw 2022/08/05 16:19:32 [TRACE] Template: install 2022/08/05 16:20:11 [TRACE] Session ID: c114e45745f0b60c 2022/08/05 16:20:11 [TRACE] CSRF Token: eIwjVZ-fgrbH6bUhzf6qWtZ4Z486MTY1OTY2OTMzOTEzODc3Njk3Nw 2022/08/05 16:20:14 [TRACE] Log mode: File (Info) [git-module] [timeout: 1m0s] git version git version 2.32.3

Aug 5 08:20:31 su[141]: Successful su for git by root Aug 5 08:20:31 su[141]: pam_unix(su:session): session opened for user git(uid=1000) by (uid=0) Aug 5 08:31:29 su[141]: pam_unix(su:session): session closed for user git Aug 5 16:32:02 syslogd exiting usermod: no changes Aug 5 16:32:05 syslogd started: BusyBox v1.33.1 Aug 5 08:32:05 sshd[29]: Server listening on :: port 22. Aug 5 08:32:05 sshd[29]: Server listening on 0.0.0.0 port 22. 2022/08/05 16:32:05 [TRACE] Log mode: File (Info) 2022/08/05 16:32:06 [TRACE] Log mode: File (Info) 2022/08/05 16:32:07 [TRACE] Log mode: File (Info) 2022/08/05 16:32:08 [TRACE] Log mode: File (Info) 2022/08/05 16:32:09 [TRACE] Log mode: File (Info) 2022/08/05 16:32:10 [TRACE] Log mode: File (Info) 2022/08/05 16:32:11 [TRACE] Log mode: File (Info) 2022/08/05 16:32:12 [TRACE] Log mode: File (Info) 2022/08/05 16:32:13 [TRACE] Log mode: File (Info) 2022/08/05 16:32:14 [TRACE] Log mode: File (Info) 2022/08/05 16:32:15 [TRACE] Log mode: File (Info) 2022/08/05 16:32:16 [TRACE] Log mode: File (Info) 2022/08/05 16:32:17 [TRACE] Log mode: File (Info) 2022/08/05 16:32:18 [TRACE] Log mode: File (Info) 2022/08/05 16:32:19 [TRACE] Log mode: File (Info) 2022/08/05 16:32:20 [TRACE] Log mode: File (Info) 2022/08/05 16:32:21 [TRACE] Log mode: File (Info) 2022/08/05 16:32:22 [TRACE] Log mode: File (Info) 2022/08/05 16:32:23 [TRACE] Log mode: File (Info) 2022/08/05 16:32:24 [TRACE] Log mode: File (Info) 2022/08/05 16:32:25 [TRACE] Log mode: File (Info) 2022/08/05 16:32:26 [TRACE] Log mode: File (Info) `

In-container logs bash-5.1# tail -f gogs.log 2022/08/05 16:44:29 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: Error 1060: Duplicate column name 'sha256' 2022/08/05 16:44:30 [ INFO] Mine Git 0.13.0+dev 2022/08/05 16:44:30 [ INFO] Migration: migrate access tokens to store SHA56 2022/08/05 16:44:30 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: Error 1060: Duplicate column name 'sha256' 2022/08/05 16:44:31 [ INFO] Mine Git 0.13.0+dev 2022/08/05 16:44:31 [ INFO] Migration: migrate access tokens to store SHA56 2022/08/05 16:44:31 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: Error 1060: Duplicate column name 'sha256' 2022/08/05 16:44:32 [ INFO] Mine Git 0.13.0+dev 2022/08/05 16:44:32 [ INFO] Migration: migrate access tokens to store SHA56 2022/08/05 16:44:32 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: Error 1060: Duplicate column name 'sha256' 2022/08/05 16:44:33 [ INFO] Mine Git 0.13.0+dev 2022/08/05 16:44:33 [ INFO] Migration: migrate access tokens to store SHA56 2022/08/05 16:44:33 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: Error 1060: Duplicate column name 'sha256' 2022/08/05 16:44:34 [ INFO] Mine Git 0.13.0+dev 2022/08/05 16:44:34 [ INFO] Migration: migrate access tokens to store SHA56 2022/08/05 16:44:34 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: Error 1060: Duplicate column name 'sha256' 2022/08/05 16:44:35 [ INFO] Mine Git 0.13.0+dev 2022/08/05 16:44:35 [ INFO] Migration: migrate access tokens to store SHA56 2022/08/05 16:44:35 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: Error 1060: Duplicate column name 'sha256' 2022/08/05 16:44:36 [ INFO] Mine Git 0.13.0+dev 2022/08/05 16:44:36 [ INFO] Migration: migrate access tokens to store SHA56 2022/08/05 16:44:36 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: Error 1060: Duplicate column name 'sha256' 2022/08/05 16:44:37 [ INFO] Mine Git 0.13.0+dev 2022/08/05 16:44:37 [ INFO] Migration: migrate access tokens to store SHA56 2022/08/05 16:44:37 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: Error 1060: Duplicate column name 'sha256' 2022/08/05 16:44:38 [ INFO] Mine Git 0.13.0+dev 2022/08/05 16:44:38 [ INFO] Migration: migrate access tokens to store SHA56 2022/08/05 16:44:38 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: Error 1060: Duplicate column name 'sha256' 2022/08/05 16:44:39 [ INFO] Mine Git 0.13.0+dev 2022/08/05 16:44:39 [ INFO] Migration: migrate access tokens to store SHA56 2022/08/05 16:44:39 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: Error 1060: Duplicate column name 'sha256' 2022/08/05 16:44:40 [ INFO] Mine Git 0.13.0+dev 2022/08/05 16:44:40 [ INFO] Migration: migrate access tokens to store SHA56 2022/08/05 16:44:40 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: Error 1060: Duplicate column name 'sha256' 2022/08/05 16:44:41 [ INFO] Mine Git 0.13.0+dev 2022/08/05 16:44:41 [ INFO] Migration: migrate access tokens to store SHA56 2022/08/05 16:44:41 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: Error 1060: Duplicate column name 'sha256' 2022/08/05 16:44:42 [ INFO] Mine Git 0.13.0+dev 2022/08/05 16:44:42 [ INFO] Migration: migrate access tokens to store SHA56 2022/08/05 16:44:42 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: Error 1060: Duplicate column name 'sha256' 2022/08/05 16:44:43 [ INFO] Mine Git 0.13.0+dev 2022/08/05 16:44:43 [ INFO] Migration: migrate access tokens to store SHA56 2022/08/05 16:44:43 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: Error 1060: Duplicate column name 'sha256' 2022/08/05 16:44:44 [ INFO] Mine Git 0.13.0+dev 2022/08/05 16:44:44 [ INFO] Migration: migrate access tokens to store SHA56 2022/08/05 16:44:44 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: Error 1060: Duplicate column name 'sha256' 2022/08/05 16:44:45 [ INFO] Mine Git 0.13.0+dev 2022/08/05 16:44:45 [ INFO] Migration: migrate access tokens to store SHA56 2022/08/05 16:44:45 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: Error 1060: Duplicate column name 'sha256' 2022/08/05 16:44:46 [ INFO] Mine Git 0.13.0+dev 2022/08/05 16:44:46 [ INFO] Migration: migrate access tokens to store SHA56 2022/08/05 16:44:46 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: Error 1060: Duplicate column name 'sha256' 2022/08/05 16:44:47 [ INFO] Mine Git 0.13.0+dev 2022/08/05 16:44:47 [ INFO] Migration: migrate access tokens to store SHA56 2022/08/05 16:44:47 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: Error 1060: Duplicate column name 'sha256' 2022/08/05 16:44:48 [ INFO] Mine Git 0.13.0+dev 2022/08/05 16:44:48 [ INFO] Migration: migrate access tokens to store SHA56 2022/08/05 16:44:48 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: Error 1060: Duplicate column name 'sha256' 2022/08/05 16:44:49 [ INFO] Mine Git 0.13.0+dev 2022/08/05 16:44:49 [ INFO] Migration: migrate access tokens to store SHA56 2022/08/05 16:44:49 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: Error 1060: Duplicate column name 'sha256' 2022/08/05 16:44:50 [ INFO] Mine Git 0.13.0+dev 2022/08/05 16:44:50 [ INFO] Migration: migrate access tokens to store SHA56 2022/08/05 16:44:50 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: Error 1060: Duplicate column name 'sha256' 2022/08/05 16:44:51 [ INFO] Mine Git 0.13.0+dev 2022/08/05 16:44:51 [ INFO] Migration: migrate access tokens to store SHA56 2022/08/05 16:44:51 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: Error 1060: Duplicate column name 'sha256'

Expected behavior

anythings all right

Additional context

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

yuukiyuuna avatar Aug 05 '22 09:08 yuukiyuuna

I have the same issue.

A couple of days ago Gogs started to not working anymore.

My log looks like yours:

`gogs.log

2022/09/20 21:24:41 [ INFO] Gogs: Go Git Service 0.13.0+dev
2022/09/20 21:24:41 [ INFO] Migration: migrate access tokens to store SHA56
2022/09/20 21:24:41 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: duplicate column name: sha256
2022/09/20 21:24:42 [ INFO] Gogs: Go Git Service 0.13.0+dev
2022/09/20 21:24:42 [ INFO] Migration: migrate access tokens to store SHA56
2022/09/20 21:24:42 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: duplicate column name: sha256
2022/09/20 21:24:43 [ INFO] Gogs: Go Git Service 0.13.0+dev
2022/09/20 21:24:43 [ INFO] Migration: migrate access tokens to store SHA56
2022/09/20 21:24:43 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: duplicate column name: sha256
2022/09/20 21:24:44 [ INFO] Gogs: Go Git Service 0.13.0+dev
2022/09/20 21:24:44 [ INFO] Migration: migrate access tokens to store SHA56
2022/09/20 21:24:44 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: duplicate column name: sha256
2022/09/20 21:24:45 [ INFO] Gogs: Go Git Service 0.13.0+dev
2022/09/20 21:24:45 [ INFO] Migration: migrate access tokens to store SHA56
2022/09/20 21:24:45 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: duplicate column name: sha256
2022/09/20 21:24:46 [ INFO] Gogs: Go Git Service 0.13.0+dev
2022/09/20 21:24:46 [ INFO] Migration: migrate access tokens to store SHA56
2022/09/20 21:24:46 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: duplicate column name: sha256
2022/09/20 21:24:47 [ INFO] Gogs: Go Git Service 0.13.0+dev
2022/09/20 21:24:47 [ INFO] Migration: migrate access tokens to store SHA56
2022/09/20 21:24:47 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: duplicate column name: sha256
2022/09/20 21:24:48 [ INFO] Gogs: Go Git Service 0.13.0+dev
2022/09/20 21:24:48 [ INFO] Migration: migrate access tokens to store SHA56
2022/09/20 21:24:48 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: duplicate column name: sha256

gorm.log

2022/09/20 21:25:21 gogs.io/gogs/internal/db/migrations/v20.go:23 duplicate column name: sha256
[0.024ms] [rows:0] ALTER TABLE `access_token` ADD `sha256` VARCHAR(64)
2022/09/20 21:25:22 gogs.io/gogs/internal/db/migrations/v20.go:23 duplicate column name: sha256
[0.019ms] [rows:0] ALTER TABLE `access_token` ADD `sha256` VARCHAR(64)
2022/09/20 21:25:23 gogs.io/gogs/internal/db/migrations/v20.go:23 duplicate column name: sha256
[0.022ms] [rows:0] ALTER TABLE `access_token` ADD `sha256` VARCHAR(64)
2022/09/20 21:25:24 gogs.io/gogs/internal/db/migrations/v20.go:23 duplicate column name: sha256
[0.018ms] [rows:0] ALTER TABLE `access_token` ADD `sha256` VARCHAR(64)
2022/09/20 21:25:25 gogs.io/gogs/internal/db/migrations/v20.go:23 duplicate column name: sha256
[0.019ms] [rows:0] ALTER TABLE `access_token` ADD `sha256` VARCHAR(64)

It looks like this startet around 2022-09-11 for me.

Did you find a solution?

CWempe avatar Sep 20 '22 19:09 CWempe

Starting a container with tag 0.12` did not help.

I just get another error message. 😞

2022/09/20 21:25:34 [ INFO] Gogs: Go Git Service 0.13.0+dev
2022/09/20 21:25:34 [ INFO] Migration: migrate access tokens to store SHA56
2022/09/20 21:25:34 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: duplicate column name: sha256
2022/09/20 21:25:35 [ INFO] Gogs: Go Git Service 0.13.0+dev
2022/09/20 21:25:35 [ INFO] Migration: migrate access tokens to store SHA56
2022/09/20 21:25:35 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: duplicate column name: sha256
2022/09/20 21:25:36 [ INFO] Gogs: Go Git Service 0.13.0+dev
2022/09/20 21:25:36 [ INFO] Migration: migrate access tokens to store SHA56
2022/09/20 21:25:36 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: duplicate column name: sha256
2022/09/20 21:32:06 [ INFO] Gogs: Go Git Service 0.12.10
2022/09/20 21:32:06 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: sync structs to database tables: no such index: IDX_action_idx_action_user_id
2022/09/20 21:32:07 [ INFO] Gogs: Go Git Service 0.12.10
2022/09/20 21:32:07 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: sync structs to database tables: no such index: IDX_action_idx_action_user_id
2022/09/20 21:32:08 [ INFO] Gogs: Go Git Service 0.12.10
2022/09/20 21:32:08 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: sync structs to database tables: no such index: IDX_action_idx_action_user_id
2022/09/20 21:32:09 [ INFO] Gogs: Go Git Service 0.12.10
2022/09/20 21:32:09 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: sync structs to database tables: no such index: IDX_action_idx_action_user_id
2022/09/20 21:32:10 [ INFO] Gogs: Go Git Service 0.12.10
2022/09/20 21:32:10 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: sync structs to database tables: no such index: IDX_action_idx_action_user_id

CWempe avatar Sep 20 '22 19:09 CWempe

Restoring a backup from 2022-09-11 and using v0.12.10 did not work.

But I noticed v0.13.0 was working for a few days before the issue occured.

022/09/06 12:03:12 [ INFO] Gogs: Go Git Service 0.13.0+dev
2022/09/06 12:03:12 [ INFO] Run mode: Production
2022/09/06 12:03:12 [ INFO] Available on https://gogs.*********/

[...]

2022/09/11 12:01:39 [ INFO] Gogs: Go Git Service 0.13.0+dev
2022/09/11 12:01:39 [ INFO] Run mode: Production
2022/09/11 12:01:39 [ INFO] Available on https://gogs..*********/
2022/09/11 20:43:42 [ INFO] Gogs: Go Git Service 0.13.0+dev
2022/09/11 20:43:42 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: sync structs to database tables: no such index: IDX_action_idx_action_user_id
2022/09/11 20:43:42 [ INFO] Gogs: Go Git Service 0.13.0+dev
2022/09/11 20:43:42 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: sync structs to database tables: no such index: IDX_action_idx_action_user_id
2022/09/11 20:43:58 [ INFO] Gogs: Go Git Service 0.13.0+dev
2022/09/11 20:43:58 [ INFO] Migration: migrate access tokens to store SHA56
2022/09/11 20:43:58 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: duplicate column name: sha256
2022/09/11 20:43:58 [ INFO] Gogs: Go Git Service 0.13.0+dev
2022/09/11 20:43:58 [ INFO] Migration: migrate access tokens to store SHA56
2022/09/11 20:43:58 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: duplicate column name: sha256
2022/09/11 20:43:59 [ INFO] Gogs: Go Git Service 0.13.0+dev
2022/09/11 20:43:59 [ INFO] Migration: migrate access tokens to store SHA56
2022/09/11 20:43:59 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: duplicate column name: sha256

CWempe avatar Sep 20 '22 21:09 CWempe

Same with a backup from 2022-08-16 and v0.12.9. 😢

CWempe avatar Sep 20 '22 22:09 CWempe

I have the same issue.

A couple of days ago Gogs started to not working anymore.

My log looks like yours:

`gogs.log

2022/09/20 21:24:41 [ INFO] Gogs: Go Git Service 0.13.0+dev
2022/09/20 21:24:41 [ INFO] Migration: migrate access tokens to store SHA56
2022/09/20 21:24:41 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: duplicate column name: sha256
2022/09/20 21:24:42 [ INFO] Gogs: Go Git Service 0.13.0+dev
2022/09/20 21:24:42 [ INFO] Migration: migrate access tokens to store SHA56
2022/09/20 21:24:42 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: duplicate column name: sha256
2022/09/20 21:24:43 [ INFO] Gogs: Go Git Service 0.13.0+dev
2022/09/20 21:24:43 [ INFO] Migration: migrate access tokens to store SHA56
2022/09/20 21:24:43 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: duplicate column name: sha256
2022/09/20 21:24:44 [ INFO] Gogs: Go Git Service 0.13.0+dev
2022/09/20 21:24:44 [ INFO] Migration: migrate access tokens to store SHA56
2022/09/20 21:24:44 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: duplicate column name: sha256
2022/09/20 21:24:45 [ INFO] Gogs: Go Git Service 0.13.0+dev
2022/09/20 21:24:45 [ INFO] Migration: migrate access tokens to store SHA56
2022/09/20 21:24:45 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: duplicate column name: sha256
2022/09/20 21:24:46 [ INFO] Gogs: Go Git Service 0.13.0+dev
2022/09/20 21:24:46 [ INFO] Migration: migrate access tokens to store SHA56
2022/09/20 21:24:46 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: duplicate column name: sha256
2022/09/20 21:24:47 [ INFO] Gogs: Go Git Service 0.13.0+dev
2022/09/20 21:24:47 [ INFO] Migration: migrate access tokens to store SHA56
2022/09/20 21:24:47 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: duplicate column name: sha256
2022/09/20 21:24:48 [ INFO] Gogs: Go Git Service 0.13.0+dev
2022/09/20 21:24:48 [ INFO] Migration: migrate access tokens to store SHA56
2022/09/20 21:24:48 [FATAL] [...o/gogs/internal/route/install.go:75 GlobalInit()] Failed to initialize ORM engine: migrate: do migrate: add column: duplicate column name: sha256

gorm.log

2022/09/20 21:25:21 gogs.io/gogs/internal/db/migrations/v20.go:23 duplicate column name: sha256
[0.024ms] [rows:0] ALTER TABLE `access_token` ADD `sha256` VARCHAR(64)
2022/09/20 21:25:22 gogs.io/gogs/internal/db/migrations/v20.go:23 duplicate column name: sha256
[0.019ms] [rows:0] ALTER TABLE `access_token` ADD `sha256` VARCHAR(64)
2022/09/20 21:25:23 gogs.io/gogs/internal/db/migrations/v20.go:23 duplicate column name: sha256
[0.022ms] [rows:0] ALTER TABLE `access_token` ADD `sha256` VARCHAR(64)
2022/09/20 21:25:24 gogs.io/gogs/internal/db/migrations/v20.go:23 duplicate column name: sha256
[0.018ms] [rows:0] ALTER TABLE `access_token` ADD `sha256` VARCHAR(64)
2022/09/20 21:25:25 gogs.io/gogs/internal/db/migrations/v20.go:23 duplicate column name: sha256
[0.019ms] [rows:0] ALTER TABLE `access_token` ADD `sha256` VARCHAR(64)

It looks like this startet around 2022-09-11 for me.

Did you find a solution?

I don't have a good solution so far Tried several times, but also used different parameters and still have this problem

yuukiyuuna avatar Sep 21 '22 01:09 yuukiyuuna

@unknwon Can you help in any way?

Do you know what the cause of this issue is?

Is there a way to save/restore our data or is everything lost?

CWempe avatar Sep 27 '22 20:09 CWempe

@yuukiyuuna @CWempe - Thanks for reporting! I'm not sure what the cause of this would be but based on the error message:

Failed to initialize ORM engine: migrate: do migrate: add column: duplicate column name: sha256

It looks like the version table lowered down (due to old value from backup?) but the access_token table is already up-to-date (because created by a newer version of Gogs that doesn't need such migration).

To workaround the failure migration, I think you cloud execute the following SQL:

UPDATE version SET version = 21;

Where 21 is the latest schema version if you boot up a fresh Gogs instance as the time of this comment, then start you Gogs again.


Note to myself: We should add an existence check of the column before trying add it.

unknwon avatar Sep 28 '22 10:09 unknwon

Thank you, @unknwon 👍

I was able to start the service again and access my data. by setting version to 21 with the latest docker container.

First I tried using sqlite an my server, but I got the following error:

Unable to open database "gogs.db": file is encrypted or is not a database

But then I copied the file to my windows PC and edited it with the DB Browser for SQLite.

CWempe avatar Oct 04 '22 20:10 CWempe

fyi:

I rebooted my server today and restarted gogs (pulled the latest image again). I had the same issue and had to update the version in the gogs.db from 19 to 21 again.

CWempe avatar Oct 18 '22 22:10 CWempe