Fallen at the first hurdle ;(

I found beets today and it looks like the answer to all my iTunes hassles (as an aside I hate, really hate, iTunes). I am using an iMac running Mac OS 12 with a large iTunes folder on an external HDD. It’s got really messed up and there are missing songs on lots of albums and I want to find and reinstall these files. This is not an issue with broken links in iTunes, the actual individual files have disappeared.
Anyway I installed beets in an existing XUbuntu virtual machine on the same iMac. I am using Virtualbox. I have set up the XUbuntu virtual machine with shared folders and I can see and access the iTunes folder. I have followed the instructions in the getting started documentation but I get the following error if I try any beet command:
'database file /home/richard/data/musiclibrary.db could not be opened’
Here is my config file:
‘directory: /media/sf_iTunes/Music/
library: ~/data/musiclibrary.db
copy: no
write: no’

~/richard/data exists and is empty.
What I want to do is read and write all my music to the existing external iTunes directory. All assistance appreciated.

small update: I commented out the library path in my config file and beets now works.

OK! If you still want the other path, can you try:

$ touch /home/richard/data/musiclibrary.db

to see if there’s a permissions problem or something else?

Also, any particular reason you’re using a VM instead of running beets directly on your Mac? (That’s what I do; it works great.)

Thanks for your reply. I read the install instructions for osx 10.11+ and decided it would be simpler to just use the VM, which was already set up, so just lazy I guess. Plus I love Xubuntu.
I have followed your suggestion and I am now importing the whole library using the import -A option. Seems to be working.