Previously stable box now crashes

I’ve been running Pi Music Box for nearly a year with no problems but last week it stopped working.

I’ve taken a look at mopidy,log and found this…

2016-12-19 08:48:15,029 - ERROR    Uncaught exception
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/mopidy/", line 272, in run
backends = self.start_backends(config, backend_classes, audio)
File "/usr/local/lib/python2.7/dist-packages/mopidy/", line 343, in start_backends
config=config, audio=audio).proxy()
File "/usr/lib/python2.7/dist-packages/pykka/", line 93, in start
obj = cls(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/mopidy/local/", line 40, in __init__
self.library = LocalLibraryProvider(backend=self, library=library)
File "/usr/local/lib/python2.7/dist-packages/mopidy/local/", line 19, in __init__
File "/usr/local/lib/python2.7/dist-packages/mopidy/local/", line 29, in refresh
num_tracks = self._library.load()
File "/usr/local/lib/python2.7/dist-packages/mopidy_local_sqlite/", line 58, in load
version = schema.load(connection)
File "/usr/local/lib/python2.7/dist-packages/mopidy_local_sqlite/", line 158, in load
user_version = c.execute('PRAGMA user_version').fetchone()[0]
OperationalError: unable to open database file

Any ideas what could be wrong and why it would just suddenly stop working?

I don’t think we’ve seen this issue before. My guess is that the sqlite database file is corrupt. Could you try to force a full rescan? I think there is a --force option or something. Otherwise, try deleting the database file and doing a clean scan. @tkem any ideas?


What would the full command be?

mopidy --force


Yes, probably a corrupt database file. SD cards, you know :wink:
Deleting the database file should do the trick, a rescan will probably not change anything, since the user_version query happens at initialization time, AFAICR.

Thanks both.

Where is the database? What command do I need to use to delete it?


Not quite sure about Pi MusicBox, but usually

sudo rm /var/lib/mopidy/local-sqlite/library.db

should work, IIRC.

Thanks tkem. I’ll give it a try.

Interestingly, I made an image of the 1GB SD card, wrote it to a new 2GB card, rebooted then edited the settings file to resize the card, rebooted and now it’s working again.

Interesting. Any chance your 1 GB card was simply “full”? IIRC Sqlite tries to create some file(s) when opening a database (journals, etc), so if there wasn’t any space left for these, this could also trigger an error.

There was 100Mb of free space on the 1Gb card so maybe?