Restoring .kodi after mv command

#1

Hi everyone!

After having my Rpb3 being stuck in a boot loop (with the sad face), which wouldn’t get any further than the Splash screen, I followed the commonly given advice, switched over to the command line and did a backup on the .kodi directory (just in case) to reinstall the mediacenter.

sudo systemctl stop mediacenter
sudo cp -r /home/osmc/.kodi /home/osmc/kodi.backup
sudo apt-get update
sudo apt-get install --reinstall rpb2-mediacenter-osmc

All commands worked out perfectly, the re-installation went through however after rebooting the boot loop remained.

I then proceeded to use

sudo systemctl stop mediacenter
sudo mv /home/osmc/.kodi /home/osmc/kodi2

in order have a clean slate.

After sudo systemctl start mediacenter it booted up with default settings. I rebooted once more and accessed the device now more comfortably via SSH and saw that the boot loop was created by a faulty profiles.xml (with 0KB). I deleted the file from the backup.

Now that I had found the culprit, my intention was it to restore the backup (with the deleted profiles.xml).

sudo systemctl stop mediacenter
sudo cp -r /home/osmc/kodi.backup/* /home/osmc/.kodi/
sudo systemctl start mediacenter

All data copied over successfully in its place. After rebooting, I could verify that all data was there, some Kodi settings that I checked over briefly seemed correct and restored, but somehow Addons were not registered (the log mentioned all addons as installed and didn’t throw any error, though). Addons and repos were not installed and ready to use. When trying to install some files for my lightpack, I received a

Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)

which I resolved using

sudo rm /var/lib/dpkg/lock

Also I deleted the /home/osmc/.kodi/userdata/Database/Addons27.db.

Now my question is, where did I go wrong in terms of restoring the .kodi directory? Are different steps necessary or are there perhaps different reasons, why stuff doesn’t seem to be there, even though it is there? Does this have something to do with the ownership of directories?

Any thoughts and help would be appreciated!
Thanks!

#2

Since you know exactly what the issue is I’d ditch the new default Kodi folder you have created and restore the backup folder you made and then correct the issue.

sudo systemctl stop mediacenter
mv /home/osmc/.kodi home/osmc/kodijunk
mv /home/osmc/kodi2 /home/osmc/.kodi

Then correct the issue with profiles.xml
Then either start Kodi again or simply reboot.

If everything works ok then you can probably delete the kodijunk folder and also the kodi.backup folder

#3

Why “sudo mv” when you are working with folders that are owned and should remain owned by osmc user?

1 Like
#4

Very good point. I’ve amended my post.