Bug about migration #13032

Closed
opened 2025-11-02 10:28:12 -06:00 by GiteaMirror · 14 comments
Owner

Originally created by @Doublefire-Chen on GitHub (May 27, 2024).

Description

Environment:

Server A:
Ubuntu 22.04.3 LTS
Gitea version 1.20.4 built with GNU Make 4.2.1, go1.20.8 : bindata, sqlite, sqlite_unlock_notify
Server B:
Ubuntu 22.04.4 LTS
Gitea version 1.21.11 built with GNU Make 4.3, go1.21.8 : bindata, sqlite, sqlite_unlock_notify

I have gitea running on server A and I try to migrate gitea form A to B. I create a new user named gitea and install a brand new gitea on server B, whose password is different from gitea on server A. Then I migrated gitea following official instruction. When I restarted service, it failed though I have changed password in app.ini. The log shows as below:

May 27 09:44:43 Ali-HK gitea[11072]: 2024/05/27 09:44:43 routers/init.go:131:InitWebInstalled() [I] SQLite3 support is enabled
May 27 09:44:43 Ali-HK gitea[11072]: 2024/05/27 09:44:43 routers/common/db.go:23:InitDBEngine() [I] Beginning ORM engine initialization.
May 27 09:44:43 Ali-HK gitea[11072]: 2024/05/27 09:44:43 routers/common/db.go:30:InitDBEngine() [I] ORM engine initialization attempt #1/10...
May 27 09:44:43 Ali-HK gitea[11072]: 2024/05/27 09:44:43 cmd/web.go:194:serveInstalled() [I] PING DATABASE postgres
May 27 09:44:43 Ali-HK gitea[11072]: 2024/05/27 09:44:43 routers/common/db.go:36:InitDBEngine() [E] ORM engine initialization attempt #1/10 failed. Error: pq: password authentication failed for user "gitea"
May 27 09:44:43 Ali-HK gitea[11072]: 2024/05/27 09:44:43 routers/common/db.go:37:InitDBEngine() [I] Backing off for 3 seconds
May 27 09:44:46 Ali-HK gitea[11072]: 2024/05/27 09:44:46 routers/common/db.go:30:InitDBEngine() [I] ORM engine initialization attempt #2/10...
May 27 09:44:46 Ali-HK gitea[11072]: 2024/05/27 09:44:46 cmd/web.go:194:serveInstalled() [I] PING DATABASE postgres
May 27 09:44:46 Ali-HK gitea[11072]: 2024/05/27 09:44:46 routers/common/db.go:36:InitDBEngine() [E] ORM engine initialization attempt #1/10 failed. Error: pq: password authentication failed for user "gitea"
May 27 09:44:46 Ali-HK gitea[11072]: 2024/05/27 09:44:46 routers/common/db.go:37:InitDBEngine() [I] Backing off for 3 seconds
~
~

After I change password of gitea on server B the same as server A, it works fine for me.
One more small thing, after migration, the avatar does not exit.
Screenshot 2024-05-27 at 09 55 49

Gitea Version

1.20.4 and 1.21.11

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

It is running as a systemd service.

Database

PostgreSQL

Originally created by @Doublefire-Chen on GitHub (May 27, 2024). ### Description Environment: ``` Server A: Ubuntu 22.04.3 LTS Gitea version 1.20.4 built with GNU Make 4.2.1, go1.20.8 : bindata, sqlite, sqlite_unlock_notify Server B: Ubuntu 22.04.4 LTS Gitea version 1.21.11 built with GNU Make 4.3, go1.21.8 : bindata, sqlite, sqlite_unlock_notify ``` I have gitea running on server A and I try to migrate gitea form A to B. I create a new user named gitea and install a brand new gitea on server B, whose password is different from gitea on server A. Then I migrated gitea following [official instruction](https://docs.gitea.com/zh-cn/next/administration/backup-and-restore). When I restarted service, it failed though I have changed password in app.ini. The log shows as below: ``` May 27 09:44:43 Ali-HK gitea[11072]: 2024/05/27 09:44:43 routers/init.go:131:InitWebInstalled() [I] SQLite3 support is enabled May 27 09:44:43 Ali-HK gitea[11072]: 2024/05/27 09:44:43 routers/common/db.go:23:InitDBEngine() [I] Beginning ORM engine initialization. May 27 09:44:43 Ali-HK gitea[11072]: 2024/05/27 09:44:43 routers/common/db.go:30:InitDBEngine() [I] ORM engine initialization attempt #1/10... May 27 09:44:43 Ali-HK gitea[11072]: 2024/05/27 09:44:43 cmd/web.go:194:serveInstalled() [I] PING DATABASE postgres May 27 09:44:43 Ali-HK gitea[11072]: 2024/05/27 09:44:43 routers/common/db.go:36:InitDBEngine() [E] ORM engine initialization attempt #1/10 failed. Error: pq: password authentication failed for user "gitea" May 27 09:44:43 Ali-HK gitea[11072]: 2024/05/27 09:44:43 routers/common/db.go:37:InitDBEngine() [I] Backing off for 3 seconds May 27 09:44:46 Ali-HK gitea[11072]: 2024/05/27 09:44:46 routers/common/db.go:30:InitDBEngine() [I] ORM engine initialization attempt #2/10... May 27 09:44:46 Ali-HK gitea[11072]: 2024/05/27 09:44:46 cmd/web.go:194:serveInstalled() [I] PING DATABASE postgres May 27 09:44:46 Ali-HK gitea[11072]: 2024/05/27 09:44:46 routers/common/db.go:36:InitDBEngine() [E] ORM engine initialization attempt #1/10 failed. Error: pq: password authentication failed for user "gitea" May 27 09:44:46 Ali-HK gitea[11072]: 2024/05/27 09:44:46 routers/common/db.go:37:InitDBEngine() [I] Backing off for 3 seconds ~ ~ ``` After I change password of gitea on server B the same as server A, it works fine for me. One more small thing, after migration, the avatar does not exit. <img width="313" alt="Screenshot 2024-05-27 at 09 55 49" src="https://github.com/go-gitea/gitea/assets/72138342/ef005726-c5f5-4cc2-86bc-2360c9ba4efa"> ### Gitea Version 1.20.4 and 1.21.11 ### Can you reproduce the bug on the Gitea demo site? Yes ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? It is running as a systemd service. ### Database PostgreSQL
GiteaMirror added the type/bug label 2025-11-02 10:28:12 -06:00
Author
Owner

@Doublefire-Chen commented on GitHub (May 27, 2024):

I can not get access to my old repo though I can log in.
Screenshot 2024-05-27 at 10 10 05

@Doublefire-Chen commented on GitHub (May 27, 2024): I can not get access to my old repo though I can log in. <img width="1440" alt="Screenshot 2024-05-27 at 10 10 05" src="https://github.com/go-gitea/gitea/assets/72138342/ddd7abb8-5224-4e58-a336-cc3b052b0f2c">
Author
Owner

@lunny commented on GitHub (May 27, 2024):

So is this a Duplicate of #31084 ?

@lunny commented on GitHub (May 27, 2024): So is this a Duplicate of #31084 ?
Author
Owner

@Doublefire-Chen commented on GitHub (May 27, 2024):

So is this a Duplicate of #31084 ?

The final result is same, but the database is different between us. https://github.com/go-gitea/gitea/issues/31084 use sqlite as database and did not have authentication problem.

@Doublefire-Chen commented on GitHub (May 27, 2024): > So is this a Duplicate of #31084 ? The final result is same, but the database is different between us. https://github.com/go-gitea/gitea/issues/31084 use sqlite as database and did not have authentication problem.
Author
Owner

@Doublefire-Chen commented on GitHub (May 27, 2024):

I have changed the version of gitea on server B with the same as server A(Gitea version 1.20.4 built with GNU Make 4.2.1, go1.20.8 : bindata, sqlite, sqlite_unlock_notify), the avatar problem disappear, however, I still cannot get access to my repo.

@Doublefire-Chen commented on GitHub (May 27, 2024): I have changed the version of gitea on server B with the same as server A(Gitea version 1.20.4 built with GNU Make 4.2.1, go1.20.8 : bindata, sqlite, sqlite_unlock_notify), the avatar problem disappear, however, I still cannot get access to my repo.
Author
Owner

@lunny commented on GitHub (May 27, 2024):

Can you get error logs when visit the repos.

@lunny commented on GitHub (May 27, 2024): Can you get error logs when visit the repos.
Author
Owner

@Doublefire-Chen commented on GitHub (May 27, 2024):

Can you get error logs when visit the repos.

Thank you, checking logs is an effective way to debug, which solved my issue.
When I visit gitea repo, the error log info as follows:

2024/05/27 14:46:10 .../context_response.go:74:HTML() [D] Template: user/dashboard/dashboard
2024/05/27 14:46:10 ...eb/routing/logger.go:102:func1() [I] router: completed GET / for 127.0.0.1:56596, 200 OK in 58.7ms @ web/home.go:32(web.Home)
2024/05/27 14:46:10 ...eb/routing/logger.go:102:func1() [I] router: completed GET /repo/search?count_only=1&uid=2&team_id=undefined&q=&page=1&mode= for 127.0.0.1:56606, 0  in 8.5ms @ repo/repo.go:491(repo.SearchRepo)
2024/05/27 14:46:10 ...eb/routing/logger.go:102:func1() [I] router: completed GET /repo/search?sort=updated&order=desc&uid=2&team_id=undefined&q=&page=1&limit=15&mode=&archived=false for 127.0.0.1:56614, 200 OK in 9.7ms @ repo/repo.go:491(repo.SearchRepo)
2024/05/27 14:46:12 ...eb/routing/logger.go:102:func1() [I] router: completed GET /user/events for 127.0.0.1:56622, 200 OK in 1571.4ms @ events/events.go:18(events.Events)
2024/05/27 14:46:12 ...ules/context/repo.go:632:RepoAssignment() [E] Repository <Repository 1:doublefire.chen/Hexo> has a broken repository on the file system: /var/lib/gitea/data/gitea-repositories/doublefire.chen/hexo.git Error: no such file or directory
2024/05/27 14:46:12 .../context_response.go:74:HTML() [D] Template: repo/empty
2024/05/27 14:46:12 ...eb/routing/logger.go:102:func1() [I] router: completed GET /doublefire.chen/Hexo for 127.0.0.1:56624, 200 OK in 17.1ms @ repo/view.go:711(repo.Home)

The most valuable info is /var/lib/gitea/data/gitea-repositories/doublefire.chen/hexo.git Error: no such file or directory, so I create this directory and move corresponding files to there. And everything works fine for me.
Screenshot 2024-05-27 at 14 55 08
Before I used command mv repos/* /var/lib/gitea/repositories/ following official document to migrate repo file, obviously the target directory does not match the fact. So maybe it is time to update the official document.

@Doublefire-Chen commented on GitHub (May 27, 2024): > Can you get error logs when visit the repos. Thank you, checking logs is an effective way to debug, which solved my issue. When I visit gitea repo, the error log info as follows: ``` 2024/05/27 14:46:10 .../context_response.go:74:HTML() [D] Template: user/dashboard/dashboard 2024/05/27 14:46:10 ...eb/routing/logger.go:102:func1() [I] router: completed GET / for 127.0.0.1:56596, 200 OK in 58.7ms @ web/home.go:32(web.Home) 2024/05/27 14:46:10 ...eb/routing/logger.go:102:func1() [I] router: completed GET /repo/search?count_only=1&uid=2&team_id=undefined&q=&page=1&mode= for 127.0.0.1:56606, 0 in 8.5ms @ repo/repo.go:491(repo.SearchRepo) 2024/05/27 14:46:10 ...eb/routing/logger.go:102:func1() [I] router: completed GET /repo/search?sort=updated&order=desc&uid=2&team_id=undefined&q=&page=1&limit=15&mode=&archived=false for 127.0.0.1:56614, 200 OK in 9.7ms @ repo/repo.go:491(repo.SearchRepo) 2024/05/27 14:46:12 ...eb/routing/logger.go:102:func1() [I] router: completed GET /user/events for 127.0.0.1:56622, 200 OK in 1571.4ms @ events/events.go:18(events.Events) 2024/05/27 14:46:12 ...ules/context/repo.go:632:RepoAssignment() [E] Repository <Repository 1:doublefire.chen/Hexo> has a broken repository on the file system: /var/lib/gitea/data/gitea-repositories/doublefire.chen/hexo.git Error: no such file or directory 2024/05/27 14:46:12 .../context_response.go:74:HTML() [D] Template: repo/empty 2024/05/27 14:46:12 ...eb/routing/logger.go:102:func1() [I] router: completed GET /doublefire.chen/Hexo for 127.0.0.1:56624, 200 OK in 17.1ms @ repo/view.go:711(repo.Home) ``` The most valuable info is ``` /var/lib/gitea/data/gitea-repositories/doublefire.chen/hexo.git Error: no such file or directory```, so I create this directory and move corresponding files to there. And everything works fine for me. ![Screenshot 2024-05-27 at 14 55 08](https://github.com/go-gitea/gitea/assets/72138342/5e64b122-c97e-4ef3-8dd6-fb5f7348c54f) Before I used command ```mv repos/* /var/lib/gitea/repositories/``` following [official document](https://docs.gitea.com/zh-cn/1.20/administration/backup-and-restore) to migrate repo file, obviously the target directory does not match the fact. So maybe it is time to update the official document.
Author
Owner

@lunny commented on GitHub (May 27, 2024):

Ah, so the documentation needs to be updated. It's wired mv repos/* /var/lib/gitea/repositories/ should work.

@lunny commented on GitHub (May 27, 2024): Ah, so the documentation needs to be updated. It's wired `mv repos/* /var/lib/gitea/repositories/` should work.
Author
Owner

@Doublefire-Chen commented on GitHub (May 27, 2024):

Ah, so the documentation needs to be updated. It's wired mv repos/* /var/lib/gitea/repositories/ should work.

Oh, I forgot that database authentication problem. Now I use the same password to avoid this problem. I do not want to make trouble for both of us😂

@Doublefire-Chen commented on GitHub (May 27, 2024): > Ah, so the documentation needs to be updated. It's wired `mv repos/* /var/lib/gitea/repositories/` should work. Oh, I forgot that database authentication problem. Now I use the same password to avoid this problem. I do not want to make trouble for both of us😂
Author
Owner

@Doublefire-Chen commented on GitHub (May 27, 2024):

I have changed the version of gitea on server B with the same as server A(Gitea version 1.20.4 built with GNU Make 4.2.1, go1.20.8 : bindata, sqlite, sqlite_unlock_notify), the avatar problem disappear

Actually, I found this avatar problem does not disappear. The reason mislead me is the avatar cache.

@Doublefire-Chen commented on GitHub (May 27, 2024): > I have changed the version of gitea on server B with the same as server A(Gitea version 1.20.4 built with GNU Make 4.2.1, go1.20.8 : bindata, sqlite, sqlite_unlock_notify), the avatar problem disappear Actually, I found this avatar problem does not disappear. The reason mislead me is the avatar cache.
Author
Owner

@Doublefire-Chen commented on GitHub (May 27, 2024):

I have changed the version of gitea on server B with the same as server A(Gitea version 1.20.4 built with GNU Make 4.2.1, go1.20.8 : bindata, sqlite, sqlite_unlock_notify), the avatar problem disappear

Actually, I found this avatar problem does not disappear. The reason mislead me is the avatar cache.

This is a small problem. Just re-upload avatar to solve it.

@Doublefire-Chen commented on GitHub (May 27, 2024): > > I have changed the version of gitea on server B with the same as server A(Gitea version 1.20.4 built with GNU Make 4.2.1, go1.20.8 : bindata, sqlite, sqlite_unlock_notify), the avatar problem disappear > > Actually, I found this avatar problem does not disappear. The reason mislead me is the avatar cache. This is a small problem. Just re-upload avatar to solve it.
Author
Owner

@Doublefire-Chen commented on GitHub (May 29, 2024):

A new small bug about migration, the ssh key won't add automatically to user git though the UI shows old ssh public key. I need to delete and readd it.

@Doublefire-Chen commented on GitHub (May 29, 2024): A new small bug about migration, the ssh key won't add automatically to user git though the UI shows old ssh public key. I need to delete and readd it.
Author
Owner

@lunny commented on GitHub (May 29, 2024):

migration will not migrate the ssh keys.
This is a migration between two Gitea instances. ssh keys should be also migrated.

@lunny commented on GitHub (May 29, 2024): ~migration will not migrate the ssh keys.~ This is a migration between two Gitea instances. ssh keys should be also migrated.
Author
Owner

@Doublefire-Chen commented on GitHub (May 29, 2024):

migration will not migrate the ssh keys.

If migration won't migrate the ssh keys, I think it is better to show nothing in ssh key UI page to avoid misunderstanding.

@Doublefire-Chen commented on GitHub (May 29, 2024): > migration will not migrate the ssh keys. If migration won't migrate the ssh keys, I think it is better to show nothing in ssh key UI page to avoid misunderstanding.
Author
Owner

@lunny commented on GitHub (May 29, 2024):

migration will not migrate the ssh keys.

If migration won't migrate the ssh keys, I think it is better to show nothing in ssh key UI page to avoid misunderstanding.

Sorry. If you are using opensshd, you need to regenerated the authorized_keys by clicking the task on admin panel UI.

@lunny commented on GitHub (May 29, 2024): > > migration will not migrate the ssh keys. > > If migration won't migrate the ssh keys, I think it is better to show nothing in ssh key UI page to avoid misunderstanding. Sorry. If you are using opensshd, you need to regenerated the authorized_keys by clicking the task on admin panel UI.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#13032