Unable to restore a Gitea dump #7275

Closed
opened 2025-11-02 07:21:30 -06:00 by GiteaMirror · 9 comments
Owner

Originally created by @mrv96 on GitHub (Apr 30, 2021).

  • Gitea version (or commit ref): 1.14.1
  • Git version: 2.25.1
  • Operating system: Ubuntu 20.04
  • Database:
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • NA
  • Log gist:
2021/04/30 16:24:26 cmd/web.go:82:runWeb() [I] Starting Gitea on PID: 9060
2021/04/30 16:24:26 ...dules/setting/git.go:101:newGit() [I] Git Version: 2.25.1, Wire Protocol Version 2 Enabled
2021/04/30 16:24:26 cmd/web.go:126:runWeb() [I] Global init
2021/04/30 16:24:26 ...dules/setting/git.go:101:newGit() [I] Git Version: 2.25.1, Wire Protocol Version 2 Enabled
2021/04/30 16:24:26 routers/init.go:134:GlobalInit() [T] AppPath: /usr/local/bin/gitea
2021/04/30 16:24:26 routers/init.go:135:GlobalInit() [T] AppWorkPath: /var/lib/gitea/
2021/04/30 16:24:26 routers/init.go:136:GlobalInit() [T] Custom path: /var/lib/gitea/custom
2021/04/30 16:24:26 routers/init.go:137:GlobalInit() [T] Log path: /var/lib/gitea/log
2021/04/30 16:24:26 routers/init.go:49:checkRunMode() [I] Run Mode: Prod
2021/04/30 16:24:26 ...dules/setting/log.go:287:newLogService() [I] Gitea v1.14.1 built with GNU Make 4.1, go1.16.3 : bindata, sqlite, sqlite_unlock_notify
2021/04/30 16:24:26 ...dules/setting/log.go:333:newLogService() [I] Gitea Log Mode: Console(Console:info)
2021/04/30 16:24:26 ...dules/setting/log.go:250:generateNamedLogger() [I] Router Log: Console(console:info)
2021/04/30 16:24:26 ...les/setting/cache.go:73:newCacheService() [I] Cache Service Enabled
2021/04/30 16:24:26 ...les/setting/cache.go:88:newCacheService() [I] Last Commit Cache Service Enabled
2021/04/30 16:24:26 ...s/setting/session.go:77:newSessionService() [I] Session Service Enabled
2021/04/30 16:24:26 ...s/storage/storage.go:158:initAttachments() [I] Initialising Attachment storage with type: 
2021/04/30 16:24:26 ...les/storage/local.go:47:NewLocalStorage() [I] Creating new Local Storage at /var/lib/gitea/data/attachments
2021/04/30 16:24:26 ...s/storage/storage.go:152:initAvatars() [I] Initialising Avatar storage with type: 
2021/04/30 16:24:26 ...les/storage/local.go:47:NewLocalStorage() [I] Creating new Local Storage at /var/lib/gitea/data/avatars
2021/04/30 16:24:26 ...s/storage/storage.go:170:initRepoAvatars() [I] Initialising Repository Avatar storage with type: 
2021/04/30 16:24:26 ...les/storage/local.go:47:NewLocalStorage() [I] Creating new Local Storage at /var/lib/gitea/data/repo-avatars
2021/04/30 16:24:26 ...s/storage/storage.go:164:initLFS() [I] Initialising LFS storage with type: 
2021/04/30 16:24:26 ...les/storage/local.go:47:NewLocalStorage() [I] Creating new Local Storage at /var/lib/gitea/data/lfs
2021/04/30 16:24:26 routers/init.go:150:GlobalInit() [I] SQLite3 Supported
2021/04/30 16:24:26 routers/init.go:68:initDBEngine() [I] Beginning ORM engine initialization.
2021/04/30 16:24:26 routers/init.go:75:initDBEngine() [I] ORM engine initialization attempt #1/10...
2021/04/30 16:24:26 ...om/urfave/cli/app.go:524:HandleAction() [I] PING DATABASE mysql
2021/04/30 16:24:26 ...ations/migrations.go:378:Migrate() [F] Gitea no longer supports auto-migration from your previously installed version.
	Please try upgrading to a lower version first (suggested v1.6.4), then upgrade to this version.

Description

Hi, I installed Gitea 1.13.0 and I regularly updated Gitea up to version 1.14.1. Now I'm trying to restore a dump done with version 1.14.1 but I obtain always the auto-migration error visible in the log. I performed several attempts (e.g. Docker, Ubuntu package, binary installation) but everything fails and ends in the already mentioned error.

In the restore process I followed the steps suggested here: https://docs.gitea.io/en-us/backup-and-restore/

At this point I suspects that this is a Gitea issue in some way.

Originally created by @mrv96 on GitHub (Apr 30, 2021). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Make sure it's not mentioned in the FAQ (https://docs.gitea.io/en-us/faq) 5. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.14.1 - Git version: 2.25.1 - Operating system: Ubuntu 20.04 <!-- Please include information on whether you built gitea yourself, used one of our downloads or are using some other package --> <!-- Please also tell us how you are running gitea, e.g. if it is being run from docker, a command-line, systemd etc. ---> <!-- If you are using a package or systemd tell us what distribution you are using --> - Database: - [ ] PostgreSQL - [x] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] NA - Log gist: <!-- It really is important to provide pertinent logs --> <!-- Please read https://docs.gitea.io/en-us/logging-configuration/#debugging-problems --> <!-- In addition, if your problem relates to git commands set `RUN_MODE=dev` at the top of app.ini --> ``` 2021/04/30 16:24:26 cmd/web.go:82:runWeb() [I] Starting Gitea on PID: 9060 2021/04/30 16:24:26 ...dules/setting/git.go:101:newGit() [I] Git Version: 2.25.1, Wire Protocol Version 2 Enabled 2021/04/30 16:24:26 cmd/web.go:126:runWeb() [I] Global init 2021/04/30 16:24:26 ...dules/setting/git.go:101:newGit() [I] Git Version: 2.25.1, Wire Protocol Version 2 Enabled 2021/04/30 16:24:26 routers/init.go:134:GlobalInit() [T] AppPath: /usr/local/bin/gitea 2021/04/30 16:24:26 routers/init.go:135:GlobalInit() [T] AppWorkPath: /var/lib/gitea/ 2021/04/30 16:24:26 routers/init.go:136:GlobalInit() [T] Custom path: /var/lib/gitea/custom 2021/04/30 16:24:26 routers/init.go:137:GlobalInit() [T] Log path: /var/lib/gitea/log 2021/04/30 16:24:26 routers/init.go:49:checkRunMode() [I] Run Mode: Prod 2021/04/30 16:24:26 ...dules/setting/log.go:287:newLogService() [I] Gitea v1.14.1 built with GNU Make 4.1, go1.16.3 : bindata, sqlite, sqlite_unlock_notify 2021/04/30 16:24:26 ...dules/setting/log.go:333:newLogService() [I] Gitea Log Mode: Console(Console:info) 2021/04/30 16:24:26 ...dules/setting/log.go:250:generateNamedLogger() [I] Router Log: Console(console:info) 2021/04/30 16:24:26 ...les/setting/cache.go:73:newCacheService() [I] Cache Service Enabled 2021/04/30 16:24:26 ...les/setting/cache.go:88:newCacheService() [I] Last Commit Cache Service Enabled 2021/04/30 16:24:26 ...s/setting/session.go:77:newSessionService() [I] Session Service Enabled 2021/04/30 16:24:26 ...s/storage/storage.go:158:initAttachments() [I] Initialising Attachment storage with type: 2021/04/30 16:24:26 ...les/storage/local.go:47:NewLocalStorage() [I] Creating new Local Storage at /var/lib/gitea/data/attachments 2021/04/30 16:24:26 ...s/storage/storage.go:152:initAvatars() [I] Initialising Avatar storage with type: 2021/04/30 16:24:26 ...les/storage/local.go:47:NewLocalStorage() [I] Creating new Local Storage at /var/lib/gitea/data/avatars 2021/04/30 16:24:26 ...s/storage/storage.go:170:initRepoAvatars() [I] Initialising Repository Avatar storage with type: 2021/04/30 16:24:26 ...les/storage/local.go:47:NewLocalStorage() [I] Creating new Local Storage at /var/lib/gitea/data/repo-avatars 2021/04/30 16:24:26 ...s/storage/storage.go:164:initLFS() [I] Initialising LFS storage with type: 2021/04/30 16:24:26 ...les/storage/local.go:47:NewLocalStorage() [I] Creating new Local Storage at /var/lib/gitea/data/lfs 2021/04/30 16:24:26 routers/init.go:150:GlobalInit() [I] SQLite3 Supported 2021/04/30 16:24:26 routers/init.go:68:initDBEngine() [I] Beginning ORM engine initialization. 2021/04/30 16:24:26 routers/init.go:75:initDBEngine() [I] ORM engine initialization attempt #1/10... 2021/04/30 16:24:26 ...om/urfave/cli/app.go:524:HandleAction() [I] PING DATABASE mysql 2021/04/30 16:24:26 ...ations/migrations.go:378:Migrate() [F] Gitea no longer supports auto-migration from your previously installed version. Please try upgrading to a lower version first (suggested v1.6.4), then upgrade to this version. ``` ## Description <!-- If using a proxy or a CDN (e.g. CloudFlare) in front of gitea, please disable the proxy/CDN fully and connect to gitea directly to confirm the issue still persists without those services. --> Hi, I installed Gitea 1.13.0 and I regularly updated Gitea up to version 1.14.1. Now I'm trying to restore a dump done with version 1.14.1 but I obtain always the auto-migration error visible in the log. I performed several attempts (e.g. Docker, Ubuntu package, binary installation) but everything fails and ends in the already mentioned error. In the restore process I followed the steps suggested here: https://docs.gitea.io/en-us/backup-and-restore/ At this point I suspects that this is a Gitea issue in some way.
Author
Owner

@zeripath commented on GitHub (Apr 30, 2021):

What is the contents of the version table in the dump?

@zeripath commented on GitHub (Apr 30, 2021): What is the contents of the version table in the dump?
Author
Owner

@mrv96 commented on GitHub (May 3, 2021):

I don't know. How can I check it? My dump contains only app.ini, repo directory and .sql file.

@mrv96 commented on GitHub (May 3, 2021): I don't know. How can I check it? My dump contains only app.ini, repo directory and .sql file.
Author
Owner

@zeripath commented on GitHub (May 3, 2021):

The SQL file will contain SQL commands one of those is going to be creating the version table and inserting the version value.

The other place is to look in the db itself and check what the contents of the version table is.

@zeripath commented on GitHub (May 3, 2021): The SQL file will contain SQL commands one of those is going to be creating the version table and inserting the version value. The other place is to look in the db itself and check what the contents of the version table is.
Author
Owner

@mrv96 commented on GitHub (May 4, 2021):

Are you talking about this?

CREATE TABLE IF NOT EXISTS `version` (`id` BIGINT(20) PRIMARY KEY AUTO_INCREMENT NOT NULL) DEFAULT CHARSET utf8mb4 ROW_FORMAT=DYNAMIC;
INSERT INTO `version` (`id`) VALUES (1);

If yes it seems that there is no stored version.

If I query my running Gitea binary installation the result is:

mysql> SELECT * FROM gitea.version;
+----+---------+
| id | version |
+----+---------+
|  1 |     178 |
+----+---------+
1 row in set (0.00 sec)
@mrv96 commented on GitHub (May 4, 2021): Are you talking about this? ``` CREATE TABLE IF NOT EXISTS `version` (`id` BIGINT(20) PRIMARY KEY AUTO_INCREMENT NOT NULL) DEFAULT CHARSET utf8mb4 ROW_FORMAT=DYNAMIC; INSERT INTO `version` (`id`) VALUES (1); ``` If yes it seems that there is no stored version. If I query my running Gitea binary installation the result is: ``` mysql> SELECT * FROM gitea.version; +----+---------+ | id | version | +----+---------+ | 1 | 178 | +----+---------+ 1 row in set (0.00 sec) ```
Author
Owner

@zeripath commented on GitHub (May 4, 2021):

Yup tha be the problem.

You need to set that number to whatever it was when you dumped gitea. From 1.14 onwards we now dump the value obviously your dump came before that.

So what version did you dump from?

@zeripath commented on GitHub (May 4, 2021): Yup tha be the problem. You need to set that number to whatever it was when you dumped gitea. From 1.14 onwards we now dump the value obviously your dump came before that. So what version did you dump from?
Author
Owner

@zeripath commented on GitHub (May 4, 2021):

For 1.13.x that value should be 156

@zeripath commented on GitHub (May 4, 2021): For 1.13.x that value should be 156
Author
Owner

@mrv96 commented on GitHub (May 6, 2021):

Thank you very much. Your fix works!

I dumped from version 178, and with this two lines

CREATE TABLE IF NOT EXISTS `version` (`id` BIGINT(20) PRIMARY KEY AUTO_INCREMENT NOT NULL, `version` BIGINT(20) NOT NULL) DEFAULT CHARSET utf8mb4 ROW_FORMAT=DYNAMIC;
INSERT INTO `version` (`id`, `version`) VALUES (1, 178);

at the end of gitea-db.sql, everything worked.

Hence the problem is that the command gitea dump doesn't include the field version in the gitea-db.sql file.
I performed multiple dump attempts, but the dump command never creates the version field.

Are you able to reproduce the issue?
Is it possible that this issue is due to the multiple gitea versions update (from 1.13.0 to 1.14.1)?
If yes the issue could be in the updating procedure.

@mrv96 commented on GitHub (May 6, 2021): Thank you very much. Your fix works! I dumped from version 178, and with this two lines ``` mysql CREATE TABLE IF NOT EXISTS `version` (`id` BIGINT(20) PRIMARY KEY AUTO_INCREMENT NOT NULL, `version` BIGINT(20) NOT NULL) DEFAULT CHARSET utf8mb4 ROW_FORMAT=DYNAMIC; INSERT INTO `version` (`id`, `version`) VALUES (1, 178); ``` at the end of gitea-db.sql, everything worked. Hence the problem is that the command `gitea dump` doesn't include the field version in the gitea-db.sql file. I performed multiple dump attempts, but the `dump` command never creates the `version` field. Are you able to reproduce the issue? Is it possible that this issue is due to the multiple gitea versions update (from 1.13.0 to 1.14.1)? If yes the issue could be in the updating procedure.
Author
Owner

@zeripath commented on GitHub (May 6, 2021):

@noerw just noted this on Discord and I've just pushed up a fix for this #15753 to prevent this happening again.

@zeripath commented on GitHub (May 6, 2021): @noerw just noted this on Discord and I've just pushed up a fix for this #15753 to prevent this happening again.
Author
Owner

@mrv96 commented on GitHub (May 7, 2021):

Thank you very much!


From: zeripath @.>
Sent: Friday, May 7, 2021 1:18:00 AM
To: go-gitea/gitea @.
>
Cc: mrv96 @.>; Author @.>
Subject: Re: [go-gitea/gitea] Unable to restore a Gitea dump (#15678)

Closed #15678https://github.com/go-gitea/gitea/issues/15678 via #15753https://github.com/go-gitea/gitea/pull/15753.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/go-gitea/gitea/issues/15678#event-4698375178, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADD27VTHNAPRII2KTMEDEKLTMMPSRANCNFSM434L2SAQ.

@mrv96 commented on GitHub (May 7, 2021): Thank you very much! ________________________________ From: zeripath ***@***.***> Sent: Friday, May 7, 2021 1:18:00 AM To: go-gitea/gitea ***@***.***> Cc: mrv96 ***@***.***>; Author ***@***.***> Subject: Re: [go-gitea/gitea] Unable to restore a Gitea dump (#15678) Closed #15678<https://github.com/go-gitea/gitea/issues/15678> via #15753<https://github.com/go-gitea/gitea/pull/15753>. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub<https://github.com/go-gitea/gitea/issues/15678#event-4698375178>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ADD27VTHNAPRII2KTMEDEKLTMMPSRANCNFSM434L2SAQ>.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#7275