Running packagekitd without a previous "make install" will result in a database open failure (because /var/lib/PackageKit does not exist) warning. However, packagekitd continues to run and listens to client requests. Any incoming client request (e.g. pkcon get repos) will leave packagekit in an unknown state. A second client request leads to a deadlock. Proposed solution: Either error out if the database does not exist or force creation of the database directory and retry.
We have already: static void pk_transaction_db_init (PkTransactionDb *tdb) { gboolean create_file; const gchar *statement; gint rc; g_return_if_fail (tdb != NULL); g_return_if_fail (PK_IS_TRANSACTION_DB (tdb)); tdb->priv = PK_TRANSACTION_DB_GET_PRIVATE (tdb); /* if the database file was not installed (or was nuked) recreate it */ create_file = g_file_test (PK_TRANSACTION_DB_FILE, G_FILE_TEST_EXISTS); pk_debug ("trying to open database '%s'", PK_TRANSACTION_DB_FILE); rc = sqlite3_open (PK_TRANSACTION_DB_FILE, &tdb->priv->db); if (rc) { pk_warning ("Can't open database: %s\n", sqlite3_errmsg (tdb->priv->db)); sqlite3_close (tdb->priv->db); return; } else { if (create_file == FALSE) { statement = "CREATE TABLE transactions (" "transaction_id TEXT primary key," "timespec TEXT," "duration INTEGER," "succeeded INTEGER DEFAULT 0," "role TEXT," "data TEXT," "description TEXT);"; sqlite3_exec (tdb->priv->db, statement, NULL, NULL, NULL); } } /* we might be running an old database, recreate */ pk_transaction_db_create_table_last_action (tdb); } So I think all we need to do is error out on the pk_warning ("Can't open database... string? What do you think?
Erroring out is probably the best solution. It seems as if the rest of the code cannot handle a non-existing database. I get random crashes when ending packagekitd with Ctrl-C.
Yup, I've added a load of checks in 02c8fd68a96cf5f5aece013afee94ecbb1e5752c Does the daemon now do what you expect?
Looks good now.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.