Skip to content

gitea dump -c failed to connect to database: Unknown database type: #12663

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

Closed
crobarcro opened this issue Aug 31, 2020 · 18 comments
Closed

gitea dump -c failed to connect to database: Unknown database type: #12663

crobarcro opened this issue Aug 31, 2020 · 18 comments
Labels
type/question Issue needs no code to be fixed, only a description on how to fix it yourself.

Comments

@crobarcro
Copy link

When I try to backup using the command documented in the official documentation for backup and restore I get the following:

$ su git
git@ed-mh-pi01:/root$ gitea dump -R -c /etc/gitea/app.ini -f /home/git/gitea-dump.zip
2020/08/12 10:38:52 ...dules/setting/git.go:93:newGit() [I] Git Version: 2.20.1, Wire Protocol Version 2 Enabled
2020/08/12 10:38:52 ...dules/setting/log.go:233:newLogService() [I] Gitea v1.12.3 built with GNU Make 4.1, go1.14.6 : bindata, sqlite, sqlite_unlock_notify
2020/08/12 10:38:52 ...dules/setting/log.go:279:newLogService() [I] Gitea Log Mode: Console(Console:info)
2020/08/12 10:38:53 ...les/setting/cache.go:70:newCacheService() [I] Cache Service Enabled
2020/08/12 10:38:53 ...les/setting/cache.go:81:newCacheService() [I] Last Commit Cache Service Enabled
2020/08/12 10:38:53 ...s/setting/session.go:63:newSessionService() [I] Session Service Enabled
2020/08/12 10:38:53 main.go:111:main() [F] Failed to run app with [gitea dump -R -c /etc/gitea/app.ini -f /home/git/gitea-dump.zip]: Failed to connect to database: Unknown database type: 

I'm using a mariadb database. I recently migrated to a new server, the command worked fine on the old server.

I'm encountering this issue with gitea 1.12.3

Gitea version 1.12.3 built with GNU Make 4.1, go1.14.6 : bindata, sqlite, sqlite_unlock_notify

This is the same issue as #6393, encountered in an older version, but this issue is marked as closed.

@6543 6543 added the type/bug label Sep 6, 2020
@6543
Copy link
Member

6543 commented Sep 6, 2020

@crobarcro how do your DB config in the app.ini looks like?

@crobarcro
Copy link
Author

@crobarcro how do your DB config in the app.ini looks like?

[database]
DB_TYPE  = mysql
HOST     = 127.0.0.1:3306
NAME     = giteadb
USER     = gitea
PASSWD   = <snip>
SSL_MODE = disable
CHARSET  = utf8
PATH     = /var/lib/gitea/data/gitea.db


@6543
Copy link
Member

6543 commented Sep 7, 2020

two things (but this should not solfe the problem - I'll test some things localy ...):
you can delete PATH as it is only used for sqlite3
and CHARSET should be utf8mb4 when upgrading, if you like proper emoji support.

@6543
Copy link
Member

6543 commented Sep 7, 2020

@crobarcro can cant reproduce, i tried a lot

you must have some sort of edgecase setup who is not covered by dump - it's always posible to backup things manually
Is gitea running fine otherwise?

@danielemoroni
Copy link

I have the same problem. Just upgraded to 1.12.3 from 1.5.0 originally deployed on AWS using Turnkey Linux

admin@gitea /home/git$ sudo -u git ./gitea dump -c ./custom/conf/app.ini
2020/09/07 16:38:34 ...s/setting/setting.go:539:SetCustomPathAndConf() [W] Using 'custom' directory as relative origin for configuration file: '/home/git/custom/custom/conf/app.ini'
2020/09/07 16:38:34 ...dules/setting/git.go:93:newGit() [I] Git Version: 2.11.0
2020/09/07 16:38:34 ...dules/setting/log.go:233:newLogService() [I] Gitea v1.12.3 built with GNU Make 4.1, go1.14.6 : bindata, sqlite, sqlite_unlock_notify
2020/09/07 16:38:34 ...dules/setting/log.go:279:newLogService() [I] Gitea Log Mode: Console(Console:info)
2020/09/07 16:38:34 ...les/setting/cache.go:70:newCacheService() [I] Cache Service Enabled
2020/09/07 16:38:34 ...les/setting/cache.go:81:newCacheService() [I] Last Commit Cache Service Enabled
2020/09/07 16:38:34 ...s/setting/session.go:63:newSessionService() [I] Session Service Enabled
2020/09/07 16:38:34 main.go:111:main() [F] Failed to run app with [./gitea dump -c ./custom/conf/app.ini]: Failed to connect to database: Unknown database type:

This is my app.ini

[database]
NAME     = gitea
USER     = gitea
PASSWD   = <omit>
LOG_SQL  = false
DB_TYPE  = mysql
HOST     = 127.0.0.1:3306
SSL_MODE = disable
PATH     = data/gitea.db

Otherwise everything else looks fine

@6543
Copy link
Member

6543 commented Sep 7, 2020

@danielemoroni is your config realy stored in '/home/git/custom/custom/conf/app.ini' ?

@6543
Copy link
Member

6543 commented Sep 7, 2020

I only get this error when gitea get's a wrong config file to work with

@6543
Copy link
Member

6543 commented Sep 7, 2020

@danielemoroni @crobarcro make sure you use the same config-file who is used wenn you run gitea normaly!!
can be checked if INSTALL_LOCK is set in it

@danielemoroni
Copy link

@6543 You're right, it's getting the wrong config file. This simply works

admin@gitea /home/git$ sudo -u git ./gitea dump

and yes, I do have this in the app.ini

[security]
INSTALL_LOCK   = true

@6543 6543 removed the type/bug label Sep 7, 2020
@6543
Copy link
Member

6543 commented Sep 7, 2020

#12760 will add a message for the user to check the path to config

@6543 6543 added the type/question Issue needs no code to be fixed, only a description on how to fix it yourself. label Sep 7, 2020
@6543
Copy link
Member

6543 commented Sep 7, 2020

@crobarcro how do you start/run gitea normaly?

@danielemoroni
Copy link

there is a service, so I use

sudo systemctl stop/restart gitea

@6543
Copy link
Member

6543 commented Sep 8, 2020

@danielemoroni what Configuration File Path is displayed at http(s)://your-gitea-instance.com/admin/config

@crobarcro
Copy link
Author

there is a service, so I use

sudo systemctl stop/restart gitea

Same for me

@danielemoroni
Copy link

@6543 Sorry, I don't have access to the admin webpage. I'm kind of new to gitea. Is there an equivalent way from the admin CLI or where can I look in the app.ini?

@6543
Copy link
Member

6543 commented Sep 8, 2020

@danielemoroni your dump works so only @crobarcro has to be "fixed" ...

but to get the path of the actual used app.ini, if gitea dump works, then gitea doctor shoult tell you the paths it use

@crobarcro
Copy link
Author

crobarcro commented Sep 8, 2020

Indeed, it turns out the path to my app.ini was incorrect, as you guessed above. I guess I copied the command from the old server where it worked because the file was actually in that location. So it was a user issue.

However, to avoid people like me taking up your time I would suggest you consider issuing a more relevant error message in this case that helps diagnose the problem.

EDIT: I see you already plan to do that

Thanks for your help!

@6543
Copy link
Member

6543 commented Sep 8, 2020

@crobarcro happy to help :)

and gitea >= 1.12.5 will have this new error message :)

@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
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

3 participants