Using Gramps under Windows and Linux with same DB and media

Hello, I’m a Gramps newbie, have used MyHeritage for long time.

The main reason for switching is that I have extended my computer with dual boot and now I have Windows 10 and Linux Mint 20.03 and myHeritage sucks. Have installed Gramps 5.1.5 on both systems.

I have a QNAP NAS and want to store the databases and the media files on it.

The SQLite databases are working fine, I only need to import the GEDCOM on one system and can use it under both systems.

But the media folder is the problem.

At first I thought that all will be good with the setting “Base path for relative media paths”. But then I discovered that this setting is not saved to user settings, but it is saved into the the SQLite DB. So we have only one setting that must work under Windows and Linux.

I have searched for a solution, but did not find a working one.

Tried to use a environment variable or to create a symbolic link under linux for “P:” (network drive under windows), but no success.

I see two possibilities to fix it:

  1. Give the program two media path settings, one for Linux and one for Windows and detect the system
  2. Give the dialog a checkbox with the functionality: “When checked the setting is saved to program-(user-) settings and not in the database”

Or has anyone another working solution?

You might want to look at a scripted launcher using Command Line Interface (CLI) switches. Use a different configuration override for Windows & Linux

The Configuration example in the wiki is for setting the database path. (But the CLI option for setting the media path is likely similar.):

  1. Set a value:


-c behavior.database-path:'/media/mydb'

I do not use a dual boot, so I don’t have the practical experience. However, the wiki reads like the GRAMPSHOME environmental variable was made for this exact situation.

GRAMPSHOME does not point to the media folder.
I have created an environment variable GRAMPSMEDIA on both systems and filled it with the appropriate path:
Windows: \\QNAPSRV\data\genealogy\media
Linux: /home/thomas/mountpoints/QNAPSRV/data/genealogy/media

The settings for the folder of 2 genealogy trees:
This saved in SQLite DB. It works under Linux, but not under Windows, because Windows needs:
(backslash )

So I could create environment variables for each tree, this should be work, but is not universal.

The --config option seems to be a good idea, but I cannot find an option for the media path.

If I were you, I would simply use Linux Mint for genealogy work, and Windows for other things … and upgrade to Mint 21.

Nope, that isn’t working either. It looks like the CLI configuration switches are executed before the Tree database is loaded, then the Relative media path is reset as the Tree database loads.

IT is not possible… same problem when using Linux on WSL with Gramps installed and a Gramps Windows version…

I have been trying to find a solution for this problem the last two years and have given up…

So, if you actually find a good permanent solution, please tell.

I have made environment variables for the complete media path, for every tree one environment variable.
That works.


I have two laptops and a desktop, the latter and one laptop are running Linux Mint 20.02 the other laptop is running Windows 11 and I have access to the same Gramps databases and images on all three systems.

This is achieved by having a SSD attached to the USB port of my Router.

I then created, with a great deal of help from Nick Hall; to whom I am vert grateful, a mount point, called Samba, on both Limux devices to the root directory of the SSD.

To auto mount the network SSD drive at start-up, create a mount point:
sudo mkdir /mnt/Samba
and then add an entry to your /etc/fstab file:
// /mnt/Samba cifs user=username,pass=password,file_mode=0777,dir_mode=0777,uid=1000,gid=1000,vers=1.0 (Where // is the URL for the router and /usb_storage is the name of the SSD
To change the default permissions it seems that you can add an entry to the samba configuration file:
/etc/samba/smb.conf file
I used the following wiki page as a reference:

I then set the database path as /mnt/Samba/Gramps and the image path as /mnt/Aamba/Gramps/images

I then Mapped the root folder of the SSD as drive Z: on the Windows Laptop.

I then set the datapath for the Database on the Windows laptop is set as Z:/Gramps and the images datapath is set as Z:/Gramps/Images

This has now been working for over two years without an issue and I hope it will help others.


Hi Keith,

I do not know how this can work.
Gramps writes the media path into the database for each tree.
So if you set a media path under Linux the Windows computers try to read the media from this path, if they open the same database.

So you set Z:/Gramps/Images as media path under Windows the Linux computers can not use this.
By the way…this path also Windows computers cannot read, it must be Z:\Gramps\Images.

If you set /mnt/Aamba/Gramps/images as media path under Linux the Windows computers cannot read this path.

So you must switch the media path every time you switch the OS.

Yes I had forgotten that but it only requires reaffirming the media path in the preferences each time and as I don’t use have a lot of images displayed then it is not really a problem.

Yes, I know about Samba and the use of external network drives… but it still does not solve the problem, we still need to change the MediaPath on the different clients every time we open it.

I was talking about just using a local installation, where you in an easy and simple way could use both a Linux and a Windows version of Gramps.

It is not a problem to use the same database, all that is needed is a separate “database folder” with the .ini files pointing to the same database, but to get the media link to work, without some scripting or manually configuring some kind of hybrid softlinks/hardlinks/ have not been sucessfull.

IT is also possible to make a Python or PowerShell script that you run and at the end starts Gramps, but I think that is a little over even “superuser”-knowledge.

It might be possible to solve this with UNC-paths, but I stopped researching this problem before I got that far, I still think the only way to permanently solve this is with some code that read the path written and convert it to a fully qualifying UNC-path…

Do you make them both in WSL and on Windows?

Could you provide a few examples, because I tried that, but still had problems on the WSL side when using Windows Paths… Still had to change the media path in Gramps when using the Linux version, and reenter it when opening the Windows version…

I started to look into a script that automatically run when starting Gramps, that changed it directly in the database, but only managed to do it on mongodb, think I just dropped the idea before I tried doing it on sqlite… its start to be a long time ago now.

I’m used to working with Windows where this sort of thing is held in a .ini file, which the best solution IMHO

Hello Keith,

in the ini file there is no setting for the media path, how did you solve this?

No I didn’t resolve it, I ment that this would be the best place for the media path to be written.

Or taken from the preferences on opening Gramps.

The Media path is not stored in the gramps.ini file. The path is stored in the database allowing for different trees/databases to have unique media folders.

Hello StoltHD,

for me the solution is with the two environment variables for my two trees.
I think you can also create Environment variables for Windows and the Linux inside the WSL.
Example for the Environment variables with my QNAP:

And in the media path settings in Gramps you write:
{GRAMPSTREE1} for tree1 and
{GRAMPSTREE2} for tree2.

1 Like

Thanks, I will test out this on Windows and WSL2, it should be possible to set for a local file path to…

But it will be a mess when having 10-15 databases and 3-4 different Linux distros in WSL2, and some extra work, but if it works, it should be possible to create a PowerShell script that set the variables both in Windows and WSL2 at the same time.

Appreciate your time and the information, thanks

Now I need to figure out how I can use different locations for my images and documents and my attached markdown research documents to be able to open them in both Windows and WSL or Linux…
Since all my Markdown Research notes is not places in the same root folder as my Document storage and Photography, Video and Sound Record storage…

But maybe it would be possible to use Folder softlinks or hardlinks for that.