exec of gitea admin create-user FAILs: "CreateUser: no such table: user" ; sqlite3 db created, not initialized #3799

Closed
opened 2025-11-02 05:25:34 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @pgnd on GitHub (Aug 16, 2019).

  • Gitea version (or commit ref): Gitea version 1.9.1+3-g14c979c1b built with GNU Make 4.2.1, go1.12.9 : bindata, sqlite, sqlite_unlock_notify
  • Git version: git version 2.22.1
  • Operating system: openSUSE Leap 15.1
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • [X ] SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • [X ] Not relevant
  • Log gist:

Description

i've clean-installed

	gitea --version
		Gitea version 1.9.1+3-g14c979c1b built with GNU Make 4.2.1, go1.12.9 : bindata, sqlite, sqlite_unlock_notify

it's running

	systemctl status -l gitea
		● gitea.service - Gitea (Git with a cup of tea)
		   Loaded: loaded (/etc/systemd/system/gitea.service; enabled; vendor preset: disabled)
		   Active: active (running) since Fri 2019-08-16 10:09:53 PDT; 95ms ago
		 Main PID: 30436 (gitea)
		    Tasks: 9 (limit: 9830)
		   CGroup: /system.slice/gitea.service
		           └─30436 /srv/gitea/bin/gitea web -c /etc/gitea/app.ini

sqlite3 db usage is selected

	/etc/gitea/app.ini
		...
		[database]
		DB_TYPE  = sqlite3
		CHARSET  = utf8
		PATH     = /srv/gitea/db/gitea.sqlite3.db
		NAME     = gitea
		USER     = gitea
		PASSWD   =
		SSL_MODE = disable

		...

on 1st install, there's no sqlite3 db yet installed

	ls -al /srv/gitea/db/
		(empty)

on attempt to create admin user

	gitea admin create-user \
	 --admin \
	 --config /etc/gitea/app.ini \
	 --username test \
	 --email test@example.com \
	 --random-password \
	 --random-password-length 48

FAILs

	generated random password is 'W...f'
	2019/08/16 10:35:06 ...dules/setting/git.go:83:newGit() [I] Git Version: 2.22.1, Wire Protocol Version 2 Enabled
	2019/08/16 10:35:06 ...dules/setting/log.go:178:generateNamedLogger() [I] Xorm Log: File(file:debug)
	2019/08/16 10:35:06 main.go:111:main() [F] Failed to run app with [gitea admin create-user --admin --config /etc/gitea/app.ini --username test --email test@example.com --random-password --random-password-length 48]: CreateUser: no such table: user

checking, the DB file was created, but not populated, and is empty

ls -al db/
	total 8
	drwxr-x---  2 gitea gitea 4096 Aug 16 10:46 .
	drwxr-x--- 11 gitea gitea 4096 Aug 16 10:31 ..
	-rw-r--r--  1 gitea gitea    0 Aug 16 10:46 gitea.sqlite3.db
Originally created by @pgnd on GitHub (Aug 16, 2019). - Gitea version (or commit ref): Gitea version 1.9.1+3-g14c979c1b built with GNU Make 4.2.1, go1.12.9 : bindata, sqlite, sqlite_unlock_notify - Git version: git version 2.22.1 - Operating system: openSUSE Leap 15.1 - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [X ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [X ] Not relevant - Log gist: ## Description i've clean-installed ``` gitea --version Gitea version 1.9.1+3-g14c979c1b built with GNU Make 4.2.1, go1.12.9 : bindata, sqlite, sqlite_unlock_notify ``` it's running ``` systemctl status -l gitea ● gitea.service - Gitea (Git with a cup of tea) Loaded: loaded (/etc/systemd/system/gitea.service; enabled; vendor preset: disabled) Active: active (running) since Fri 2019-08-16 10:09:53 PDT; 95ms ago Main PID: 30436 (gitea) Tasks: 9 (limit: 9830) CGroup: /system.slice/gitea.service └─30436 /srv/gitea/bin/gitea web -c /etc/gitea/app.ini ``` sqlite3 db usage is selected ``` /etc/gitea/app.ini ... [database] DB_TYPE = sqlite3 CHARSET = utf8 PATH = /srv/gitea/db/gitea.sqlite3.db NAME = gitea USER = gitea PASSWD = SSL_MODE = disable ... ``` on 1st install, there's no sqlite3 db yet installed ``` ls -al /srv/gitea/db/ (empty) ``` on attempt to create admin user ``` gitea admin create-user \ --admin \ --config /etc/gitea/app.ini \ --username test \ --email test@example.com \ --random-password \ --random-password-length 48 ``` FAILs ``` generated random password is 'W...f' 2019/08/16 10:35:06 ...dules/setting/git.go:83:newGit() [I] Git Version: 2.22.1, Wire Protocol Version 2 Enabled 2019/08/16 10:35:06 ...dules/setting/log.go:178:generateNamedLogger() [I] Xorm Log: File(file:debug) 2019/08/16 10:35:06 main.go:111:main() [F] Failed to run app with [gitea admin create-user --admin --config /etc/gitea/app.ini --username test --email test@example.com --random-password --random-password-length 48]: CreateUser: no such table: user ``` checking, the DB file was created, but not populated, and is empty ``` ls -al db/ total 8 drwxr-x--- 2 gitea gitea 4096 Aug 16 10:46 . drwxr-x--- 11 gitea gitea 4096 Aug 16 10:31 .. -rw-r--r-- 1 gitea gitea 0 Aug 16 10:46 gitea.sqlite3.db ```
Author
Owner

@adelowo commented on GitHub (Aug 19, 2019):

Can you run gitea migrate ?

@adelowo commented on GitHub (Aug 19, 2019): Can you run `gitea migrate` ?
Author
Owner

@pgnd commented on GitHub (Aug 19, 2019):

yep. that appears to eliminate the tables error,

gitea migrate \
 --config /etc/gitea/app.ini

	2019/08/18 17:41:06 ...dules/setting/git.go:83:newGit() [I] Git Version: 2.22.1, Wire Protocol Version 2 Enabled
	2019/08/18 17:41:06 ...dules/setting/log.go:178:generateNamedLogger() [I] Xorm Log: File(file:debug)
	2019/08/18 17:41:06 cmd/migrate.go:29:runMigrate() [T] AppPath: /srv/git/bin/gitea
	2019/08/18 17:41:06 cmd/migrate.go:30:runMigrate() [T] AppWorkPath: /srv/git/bin
	2019/08/18 17:41:06 cmd/migrate.go:31:runMigrate() [T] Custom path: /srv/git/bin/custom
	2019/08/18 17:41:06 cmd/migrate.go:32:runMigrate() [T] Log path: /var/log/gitea

gitea admin create-user \
 --admin \
 --config /etc/gitea/app.ini \
 --username test \
 --email test@example.com \
 --random-password \
 --random-password-length 48

	generated random password is 'GYcl8cZIiesuGB0TVK7X5Fll3Tg7Lp4cLCD9NgYQICjIMwr7'
	2019/08/18 17:42:00 ...dules/setting/git.go:83:newGit() [I] Git Version: 2.22.1, Wire Protocol Version 2 Enabled
	2019/08/18 17:42:00 ...dules/setting/log.go:178:generateNamedLogger() [I] Xorm Log: File(file:debug)
	New user 'test' has been successfully created!

so, iiuc, 'test' should now be the admin user.

nav to

https://gitea.dev.loc/install

I see the install page.

The top 2 sections, "Database Settings" & "General Settings" are populated correctly.

The Optional, "Administrator Account Settings" are NOT ... all fields are empty, despite the 'create-user' step, above.

If I click "Install Gitea", it FAILs with

"You cannot disable user self-registration without creating an administrator account."

Shouldn't that 'successfully-created' admin user prepopulate the form's admin acct settings?

@pgnd commented on GitHub (Aug 19, 2019): yep. that appears to eliminate the tables error, ``` gitea migrate \ --config /etc/gitea/app.ini 2019/08/18 17:41:06 ...dules/setting/git.go:83:newGit() [I] Git Version: 2.22.1, Wire Protocol Version 2 Enabled 2019/08/18 17:41:06 ...dules/setting/log.go:178:generateNamedLogger() [I] Xorm Log: File(file:debug) 2019/08/18 17:41:06 cmd/migrate.go:29:runMigrate() [T] AppPath: /srv/git/bin/gitea 2019/08/18 17:41:06 cmd/migrate.go:30:runMigrate() [T] AppWorkPath: /srv/git/bin 2019/08/18 17:41:06 cmd/migrate.go:31:runMigrate() [T] Custom path: /srv/git/bin/custom 2019/08/18 17:41:06 cmd/migrate.go:32:runMigrate() [T] Log path: /var/log/gitea gitea admin create-user \ --admin \ --config /etc/gitea/app.ini \ --username test \ --email test@example.com \ --random-password \ --random-password-length 48 generated random password is 'GYcl8cZIiesuGB0TVK7X5Fll3Tg7Lp4cLCD9NgYQICjIMwr7' 2019/08/18 17:42:00 ...dules/setting/git.go:83:newGit() [I] Git Version: 2.22.1, Wire Protocol Version 2 Enabled 2019/08/18 17:42:00 ...dules/setting/log.go:178:generateNamedLogger() [I] Xorm Log: File(file:debug) New user 'test' has been successfully created! ``` so, iiuc, 'test' _should_ now be the admin user. nav to https://gitea.dev.loc/install I see the install page. The top 2 sections, "Database Settings" & "General Settings" are populated correctly. The Optional, "Administrator Account Settings" are NOT ... all fields are empty, despite the 'create-user' step, above. If I click "Install Gitea", it FAILs with "You cannot disable user self-registration without creating an administrator account." Shouldn't that 'successfully-created' admin user prepopulate the form's admin acct settings?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#3799