Could not open database /var/lib/location/database.db

Hello guys when i do location update i get Could not download a new database, and when i write location version i get

location: Could not open database /var/lib/location/database.db: [Errno 2] No such file or directory

Can someone help me?

Hi @stamenkoo

Welcome to the IPFire community.

This error message is indication some problem with the directory/file structure or permissions.

Can you show the result of the following command.
ls -hal /var/lib/location

On my system I get

ls -hal /var/lib/location/
total 58M
drwxr-xr-x  3 root root 4.0K Jan 29 09:38 .
drwxr-xr-x 13 root root 4.0K Jan 29 09:01 ..
-r--r--r--  1 root root  58M Jan 29 09:38 database.db
drwxr-xr-x  2 root root  12K Jul 10  2023 ipset
-rw-r--r--  1 root root  374 Sep 19 15:26 signing-key.pem
1 Like

ls: cannot access ‘/var/lib/location’: No such file or directory

That is not good news. That is suggesting that the whole location directory has been deleted.

What do you get if you run the command
ls -hal /var/lib/

total 172K
drwxr-xr-x 43 root root 4.0K Jan 28 16:43 .
drwxr-xr-x 13 root root 4.0K Sep 28 2022 …
drwxr-xr-x 2 root root 4.0K Oct 2 2022 PackageKit
drwxr-xr-x 3 root root 4.0K Oct 2 2022 apport
drwxr-xr-x 5 root root 4.0K Jan 28 21:40 apt
drwxr-xr-x 2 root root 4.0K Feb 7 2022 boltd
drwxr-xr-x 8 root root 4.0K Jan 28 16:08 cloud
drwxr-xr-x 2 root root 4.0K Jan 28 16:09 command-not-found
drwxr-xr-x 2 root root 4.0K Oct 2 2022 dbus
drwxr-xr-x 2 root root 4.0K Mar 24 2022 dhcp
drwxr-xr-x 7 root root 4.0K Jan 28 21:40 dpkg
drwxr-xr-x 7 root root 4.0K Jan 28 16:42 fwupd
drwxr-xr-x 3 root root 4.0K Jan 28 16:31 gems
drwxr-xr-x 4 root root 4.0K Jan 28 16:30 ghostscript
drwxr-xr-x 2 root root 4.0K Jul 5 2022 git
drwxr-xr-x 4 root root 4.0K Sep 28 2022 grub
drwxr-xr-x 2 root root 4.0K Jan 29 00:00 logrotate
drwxr-xr-x 2 root root 4.0K Sep 28 2022 man-db
drwxr-xr-x 2 root root 4.0K Apr 18 2022 misc
drwxr-xr-x 2 root root 4.0K Mar 24 2022 os-prober
drwxr-xr-x 2 root root 4.0K Jan 28 16:11 pam
drwxr-xr-x 2 root root 4.0K Mar 18 2022 plymouth
drwx------ 3 root root 4.0K Sep 28 2022 polkit-1
drwx------ 2 root root 4.0K Sep 28 2022 private
drwxr-xr-x 2 root root 4.0K Jan 28 16:43 python
drwxr-xr-x 2 root root 4.0K Jan 28 16:44 sgml-base
-rw-r–r-- 1 root root 0 Sep 28 2022 shells.state
drwxr-xr-x 3 root root 4.0K Sep 28 2022 shim-signed
drwxr-xr-x 23 root root 4.0K Jan 29 18:01 snapd
drwxr-xr-x 3 root root 4.0K Sep 28 2022 sudo
drwxr-xr-x 11 root root 4.0K Oct 2 2022 systemd
drwxr-xr-x 5 root root 4.0K Jan 28 16:28 tex-common
drwxr-xr-x 8 root root 4.0K Jan 28 16:44 texmf
drwxr-xr-x 2 tss tss 4.0K Jan 25 2022 tpm
drwxr-xr-x 2 root root 4.0K Jan 28 16:13 ubuntu-release-upgrader
drwxr-xr-x 3 root root 4.0K Jan 28 16:42 ucf
drwx------ 2 root root 4.0K Oct 2 2022 udisks2
drwxr-xr-x 2 root root 4.0K Oct 2 2022 update-manager
drwxr-xr-x 2 root root 4.0K Jan 28 16:41 update-notifier
drwxr-xr-x 2 root root 4.0K Mar 25 2022 usb_modeswitch
drwxr-xr-x 2 root root 4.0K Sep 28 2022 usbutils
drwxr-xr-x 3 root root 4.0K Sep 28 2022 vim
drwxr-xr-x 2 root root 4.0K Jan 28 16:33 xfonts
drwxr-xr-x 2 root root 4.0K Jan 28 16:33 xml-core

I installed libloc-0.9.17.tar.gz

Is that the right file?

drwxr-xr-x 43 root root 4.0K Jan 28 16:43 .
drwxr-xr-x 13 root root 4.0K Sep 28 2022 …
drwxr-xr-x 2 root root 4.0K Oct 2 2022 PackageKit
drwxr-xr-x 3 root root 4.0K Oct 2 2022 apport
drwxr-xr-x 5 root root 4.0K Jan 28 21:40 apt
drwxr-xr-x 2 root root 4.0K Feb 7 2022 boltd
drwxr-xr-x 8 root root 4.0K Jan 28 16:08 cloud
drwxr-xr-x 2 root root 4.0K Jan 28 16:09 command-not-found
drwxr-xr-x 2 root root 4.0K Oct 2 2022 dbus
drwxr-xr-x 2 root root 4.0K Mar 24 2022 dhcp
drwxr-xr-x 7 root root 4.0K Jan 28 21:40 dpkg
drwxr-xr-x 7 root root 4.0K Jan 28 16:42 fwupd
drwxr-xr-x 3 root root 4.0K Jan 28 16:31 gems
drwxr-xr-x 4 root root 4.0K Jan 28 16:30 ghostscript
drwxr-xr-x 2 root root 4.0K Jul 5 2022 git
drwxr-xr-x 4 root root 4.0K Sep 28 2022 grub
drwxr-xr-x 2 root root 4.0K Jan 29 00:00 logrotate
drwxr-xr-x 2 root root 4.0K Sep 28 2022 man-db
drwxr-xr-x 2 root root 4.0K Apr 18 2022 misc
drwxr-xr-x 2 root root 4.0K Mar 24 2022 os-prober
drwxr-xr-x 2 root root 4.0K Jan 28 16:11 pam
drwxr-xr-x 2 root root 4.0K Mar 18 2022 plymouth
drwx------ 3 root root 4.0K Sep 28 2022 polkit-1
drwx------ 2 root root 4.0K Sep 28 2022 private
drwxr-xr-x 2 root root 4.0K Jan 28 16:43 python
drwxr-xr-x 2 root root 4.0K Jan 28 16:44 sgml-base
-rw-r–r-- 1 root root 0 Sep 28 2022 shells.state
drwxr-xr-x 3 root root 4.0K Sep 28 2022 shim-signed
drwxr-xr-x 23 root root 4.0K Jan 29 18:01 snapd
drwxr-xr-x 3 root root 4.0K Sep 28 2022 sudo
drwxr-xr-x 11 root root 4.0K Oct 2 2022 systemd
drwxr-xr-x 5 root root 4.0K Jan 28 16:28 tex-common
drwxr-xr-x 8 root root 4.0K Jan 28 16:44 texmf
drwxr-xr-x 2 tss tss 4.0K Jan 25 2022 tpm
drwxr-xr-x 2 root root 4.0K Jan 28 16:13 ubuntu-release-upgrader
drwxr-xr-x 3 root root 4.0K Jan 28 16:42 ucf
drwx------ 2 root root 4.0K Oct 2 2022 udisks2
drwxr-xr-x 2 root root 4.0K Oct 2 2022 update-manager
drwxr-xr-x 2 root root 4.0K Jan 28 16:41 update-notifier
drwxr-xr-x 2 root root 4.0K Mar 25 2022 usb_modeswitch
drwxr-xr-x 2 root root 4.0K Sep 28 2022 usbutils
drwxr-xr-x 3 root root 4.0K Sep 28 2022 vim
drwxr-xr-x 2 root root 4.0K Jan 28 16:33 xfonts
drwxr-xr-x 2 root root 4.0K Jan 28 16:33 xml-core

way more easy to read, innit?

Sorry, I realise now that you are looking on an Ubuntu machine.

I thought you were doing this on an IPFire system.

Yes that is the correct file to use.

As it looks like you are trying to install it on an Ubuntu system, you will need to do a build/install sequence as follows.
First cd to the location you want to run the build sequence in.

tar xvf libloc-0.9.17.tar.gz
cd libloc-0.9.17
./autogen.sh
./configure \
		--prefix=/usr \
		--libdir=/usr/lib \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--with-database-path=/var/lib/location/database.db
make
sudo make install

Is the above sequence of build steps what you ran when you installed from the tarball?

1 Like

I did this, is this the right thing to do?

.

./autogen.sh
/configure CFLAGS='-g -O2' --disable-perl --without-systemd --prefix=/opt/libloc
  make
  make install

export PATH=/opt/libloc/bin:$PATH
export PYTHONPATH=/opt/libloc/lib/python3.10/site-packages:$PYTHONPATH


  location update
(And im getting error here)

From your autrotools sequence I understand that you want to create an isolated package set of the libloc in /opt.

However your ./configure command does not specify the location of the database.db file. The default value of this is /var/lib/location/ but installation to that location will fail with make install as an unprivileged user.

You should define
--with-database-path=/opt..........
also if you want the bash-completions you will need to define the path for that as well. The bash-completions are set by default with the path
/usr/share/bash-completions/completions
and the unprivileged user will not be able to write there. You either need to define a path under /opt/ or to disable bash-completions.

I suspect with the above there must have been some error messages from the make install stage.

I confirmed the above by running the commands you specified and I initially had a failure writing the /opt/libloc/ directory as on my Arch Linux system the ownership of /opt/ is root:root.
After creating /opt/libloc as my unprivileged user I then got the errors regarding the database location and the bash-completions.

I resolved those and got the database under /opt but Arch Linux does not use the $PYTHONPATH variable and therefore could not find the python location module. I will have to figure out how to overcome that when I get some time tomorrow or the day after.

Maybe the above regarding the database location and bash-completion specifications will enable you to get to a working solution.

2 Likes