mport error after installing on VirtualBox

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

mport error after installing on VirtualBox

deyamie
After installing MidnightBSD version 1.2 I get an error any time I try to use the `mport` command, e.g. `mport install vim`:
"mport: Error at /usr/src/lib/libimport/db.c:(287): Invalid master database version"

The version of VirtualBox I installed it on and am using is version 6.1.4 r136177

Any idea as to what is causing it and how to fix it would be highly appreciated.
Reply | Threaded
Open this post in threaded view
|

Re: mport error after installing on VirtualBox

fxddyy
Well,seems you got a CORRUPT version of Midnight BSD
I once installed a 32-bit version,and when I type "mport index"
It says "Cann't unzip the index file"
I redownload the OS(MUST CHECK SHA256), reinstalled the system, and solve the problem.
If you wish,you can try again ,or install it to a REAL machine.
Feel free to give more details as possible.
Our community will help you.
Reply | Threaded
Open this post in threaded view
|

Re: mport error after installing on VirtualBox

laffer1
Administrator
In reply to this post by deyamie
Was this an upgrade or new install?  

if it's a new install and you haven't installed anything yet, you can simply delete the master.db file
It is in /var/db/mport/

The master.db is the file that contains all the info on installed packages on the system.  It's a sqlite3 database.

This can happen for a few reasons including running out of disk space in /var or a programming bug or crash with mport.

You can also sometimes recover this file by doing this procedure:
cd /var/db/mport/
sqlite3 master.db ".dump" | sqlite3 new.db
verify it works by running sqlite3 new.db
.schema

You should see something like this:
CREATE TABLE packages (pkg text NOT NULL, version text NOT NULL, origin text NOT NULL, prefix text NOT NULL, lang text, options text, status text default 'dirty', comment text, os_release text NOT NULL default '1.0', cpe text, locked int NOT NULL default '0', deprecated text default '', expiration_date int64 NOT NULL default '0', no_provide_shlib int default '0', flavor text default '');
CREATE TABLE depends (pkg text NOT NULL, depend_pkgname text NOT NULL, depend_pkgversion text, depend_port text NOT NULL);
CREATE TABLE log (pkg text NOT NULL, version text NOT NULL, date int NOT NULL, msg text NOT NULL);
CREATE TABLE assets (pkg text NOT NULL, type int NOT NULL, data text, checksum text, owner text, grp text, mode text);
CREATE TABLE categories (pkg text NOT NULL, category text NOT NULL);
CREATE TABLE settings (name text NOT NULL, val text NOT NULL);
CREATE UNIQUE INDEX packages_pkg ON packages (pkg);
CREATE INDEX packages_origin ON packages (origin);
CREATE INDEX depends_pkg ON depends (pkg);
CREATE INDEX depends_dependpkgname ON depends (depend_pkgname);
CREATE INDEX log_pkg ON log (pkg, version);
CREATE INDEX assets_pkg ON assets (pkg);
CREATE INDEX categories_pkg ON categories (pkg, category);
CREATE INDEX settings_name ON settings (name);

if it's ok, mv new.db master.db

As for the other comment, the mport index can get corrupted or fail to download.  You don't need to reinstall the whole system for that either.  Simply delete the /var/db/mport/index.db and /var/db/mport/index.db.bz2 files and then run mport index to fetch a new one.  It's always safe to delete the index and refetch it.