How to create a sqlite database

Hello!

On my Linuxmint machine I installed tryton and all modules to have a quick look on that stuff. The server is running:
27608 ? Ss 0:02 /usr/bin/python3 /usr/bin/trytond --config /etc/tryton/trytond.conf --logconf /etc/tryton/trytond_log.conf

but if I execute trytond-admin -c /etc/tryton/tryton.conf -d tryton --all
as root I get

Traceback (most recent call last):
  File "/usr/bin/trytond-admin", line 21, in <module>
    admin.run(options)
  File "/usr/lib/python3/dist-packages/trytond/admin.py", line 24, in run
    with Transaction().start(db_name, 0, _nocache=True):
  File "/usr/lib/python3/dist-packages/trytond/transaction.py", line 88, in start
    database = Database(database_name).connect()
  File "/usr/lib/python3/dist-packages/trytond/backend/sqlite/database.py", line 251, in connect
    raise IOError('Database "%s" doesn\'t exist!' % db_filename)
OSError: Database "tryton.sqlite" doesn't exist!

I first did not change anything in /etc/tryton/tryton.conf and all other tries changing something leaded to the same error.

Can someone help?

Kind regards
Andreas

To initialize an SQLite database, you must first create an empty file with the extension .sqlite in the database path. You can do that with the touch command.

On a side note, we do not recommend to use SQLite backend for anything else than running tests. Even for discovering Tryton, it is better to use PostgreSQL backend.

I did a touch tryton.sqlite in /var/lib/tryton

-rw-r--r--   1 root   root      0 Jan 16 01:14 tryton.sqlite

$ grep tryton /etc/passwd
tryton:x:142:152::/var/lib/tryton:/usr/sbin/nologin

but I still get the same error messages.
OSError: Database "tryton.sqlite" doesn't exist!

When I have this running I’ll set up a postgresql database.

Andreas

Check out again your /etc/tryton/trytond.conf settings and take account that the default folder to lookup for a sqlite database is the db folder in user’s home directory.

First, the tryton.sqlite file must be writable by the user running trytond.
And second, I guess this is not the correct directory, by default it is in ${HOME}/db of the user running trytond. So in your case, if the user is tryton, it should be in /var/lib/tryton/db.

trytond is running as user tryton.

/var/lib/tryton/db# ll
drwxr-xr-x 2 tryton root 4096 Jan 16 10:44 ./
drwxr-xr-x 3 tryton tryton 4096 Jan 16 10:44 …/
-rwxrwxrwx 1 tryton root 0 Jan 16 01:14 tryton.sqlite*

[database]
path = /var/lib/tryton/db
is the only setting I have in /etc/tryton/trytond.conf regarding the database.

It doesn’t work either with path = /var/lib/tryton

The tryton-server is started by systemd.
I’m clueless.

This is the correct configuration for you.

But what is the full output of the trytond-admin command in verbose mode?
Are you sure the configuration file is readable by the user?
Are you sure you run trytond-admin with the same user as the service?

Yes, the configfile is 644.
I now did a
su - tryton -c “trytond-admin -c etc/tryton/tryton.conf -d tryton --all”
This account is currently not available.

Then I changed /etc/passwd from
tryton:x:142:152::/var/lib/tryton:/usr/sbin/nologin
to
tryton:x:142:152::/var/lib/tryton:/bin/bash
and /var/lib/tryton/db/tryton.sqlite was filled up and has now a size of 1073152 bytes.

And now I can login with the tryton client.

A post was split to a new topic: Content of web root

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.