# Using Gramps under Windows and Linux with same DB and media

**URL:** <https://gramps.discourse.group/t/using-gramps-under-windows-and-linux-with-same-db-and-media/2759>\
**Category:** Help\
**Created:** [September 4, 2022, 1:19pm UTC](https://gramps.discourse.group/t/using-gramps-under-windows-and-linux-with-same-db-and-media/2759 "2022-09-04T13:19:00Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![tobohst](https://avatars.discourse-cdn.com/v4/letter/t/59ef9b/32.png) [@tobohst](https://gramps.discourse.group/u/tobohst)\
**Post date:** [September 4, 2022, 1:19pm UTC](https://gramps.discourse.group/t/using-gramps-under-windows-and-linux-with-same-db-and-media/2759/1 "2022-09-04T13:19:00Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![emyoulation](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/emyoulation/32/67_2.png) [@emyoulation](https://gramps.discourse.group/u/emyoulation)\
**Post date:** [September 4, 2022, 3:25pm UTC](https://gramps.discourse.group/t/using-gramps-under-windows-and-linux-with-same-db-and-media/2759/2 "2022-09-04T15:25:20Z")

</div>

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](https://gramps-project.org/wiki/index.php/Gramps_5.1_Wiki_Manual_-_Command_Line#Configuration_.28config.29_option) 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:

```python
--config=behavior.database-path:'/media/mydb' 

```

> or

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

```

---

<div class="post-metadata">

**Author:** ![emyoulation](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/emyoulation/32/67_2.png) [@emyoulation](https://gramps.discourse.group/u/emyoulation)\
**Post date:** [September 4, 2022, 3:29pm UTC](https://gramps.discourse.group/t/using-gramps-under-windows-and-linux-with-same-db-and-media/2759/3 "2022-09-04T15:29:38Z")

</div>

I do not use a dual boot, so I don’t have the practical experience. However, the wiki reads like the [GRAMPSHOME](https://gramps-project.org/wiki/index.php/Gramps_5.1_Wiki_Manual_-_Command_Line#GRAMPSHOME) environmental variable was made for this exact situation.

---

<div class="post-metadata">

**Author:** ![tobohst](https://avatars.discourse-cdn.com/v4/letter/t/59ef9b/32.png) [@tobohst](https://gramps.discourse.group/u/tobohst)\
**Post date:** [September 4, 2022, 4:09pm UTC](https://gramps.discourse.group/t/using-gramps-under-windows-and-linux-with-same-db-and-media/2759/4 "2022-09-04T16:09:37Z")

</div>

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:  
{GRAMPSMEDIA}/Tree1  
{GRAMPSMEDIA}/Tree2  
This saved in SQLite DB. It works under Linux, but not under Windows, because Windows needs:  
{GRAMPSMEDIA}\Tree1  
{GRAMPSMEDIA}\Tree2  
(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.

---

<div class="post-metadata">

**Author:** ![ennoborg](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/ennoborg/32/4659_2.png) [@ennoborg](https://gramps.discourse.group/u/ennoborg)\
**Post date:** [September 4, 2022, 9:11pm UTC](https://gramps.discourse.group/t/using-gramps-under-windows-and-linux-with-same-db-and-media/2759/5 "2022-09-04T21:11:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![emyoulation](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/emyoulation/32/67_2.png) [@emyoulation](https://gramps.discourse.group/u/emyoulation)\
**Post date:** [September 4, 2022, 9:59pm UTC](https://gramps.discourse.group/t/using-gramps-under-windows-and-linux-with-same-db-and-media/2759/6 "2022-09-04T21:59:08Z")

</div>

> [@tobohst](#):
>
> The --config option seems to be a good idea, but I cannot find an option for the media path.

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.

---

<div class="post-metadata">

**Author:** ![StoltHD](https://avatars.discourse-cdn.com/v4/letter/s/db5fbb/32.png) [@StoltHD](https://gramps.discourse.group/u/StoltHD)\
**Post date:** [September 13, 2022, 3:31pm UTC](https://gramps.discourse.group/t/using-gramps-under-windows-and-linux-with-same-db-and-media/2759/7 "2022-09-13T15:31:33Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![tobohst](https://avatars.discourse-cdn.com/v4/letter/t/59ef9b/32.png) [@tobohst](https://gramps.discourse.group/u/tobohst)\
**Post date:** [September 13, 2022, 4:26pm UTC](https://gramps.discourse.group/t/using-gramps-under-windows-and-linux-with-same-db-and-media/2759/8 "2022-09-13T16:26:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![keithjac](https://avatars.discourse-cdn.com/v4/letter/k/82dd89/32.png) [@keithjac](https://gramps.discourse.group/u/keithjac)\
**Post date:** [September 14, 2022, 10:23am UTC](https://gramps.discourse.group/t/using-gramps-under-windows-and-linux-with-same-db-and-media/2759/9 "2022-09-14T10:23:00Z")

</div>

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:  
[//192.168.0.254/usb\_storage](https://192.168.0.254/usb_storage) /mnt/Samba cifs user=_username_,pass=_password_,file\_mode=0777,dir\_mode=0777,uid=1000,gid=1000,vers=1.0 (Where [//192.168.0.254](https://192.168.0.254) 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:  
[https://wiki.archlinux.org/index.php/Samba](https://wiki.archlinux.org/index.php/Samba)

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.

---

<div class="post-metadata">

**Author:** ![tobohst](https://avatars.discourse-cdn.com/v4/letter/t/59ef9b/32.png) [@tobohst](https://gramps.discourse.group/u/tobohst)\
**Post date:** [September 14, 2022, 11:39am UTC](https://gramps.discourse.group/t/using-gramps-under-windows-and-linux-with-same-db-and-media/2759/10 "2022-09-14T11:39:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![keithjac](https://avatars.discourse-cdn.com/v4/letter/k/82dd89/32.png) [@keithjac](https://gramps.discourse.group/u/keithjac)\
**Post date:** [September 14, 2022, 12:38pm UTC](https://gramps.discourse.group/t/using-gramps-under-windows-and-linux-with-same-db-and-media/2759/11 "2022-09-14T12:38:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![StoltHD](https://avatars.discourse-cdn.com/v4/letter/s/db5fbb/32.png) [@StoltHD](https://gramps.discourse.group/u/StoltHD)\
**Post date:** [September 15, 2022, 9:36am UTC](https://gramps.discourse.group/t/using-gramps-under-windows-and-linux-with-same-db-and-media/2759/12 "2022-09-15T09:36:45Z")

</div>

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/sym.link 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…

---

<div class="post-metadata">

**Author:** ![StoltHD](https://avatars.discourse-cdn.com/v4/letter/s/db5fbb/32.png) [@StoltHD](https://gramps.discourse.group/u/StoltHD)\
**Post date:** [September 15, 2022, 9:46am UTC](https://gramps.discourse.group/t/using-gramps-under-windows-and-linux-with-same-db-and-media/2759/13 "2022-09-15T09:46:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![keithjac](https://avatars.discourse-cdn.com/v4/letter/k/82dd89/32.png) [@keithjac](https://gramps.discourse.group/u/keithjac)\
**Post date:** [September 15, 2022, 11:29am UTC](https://gramps.discourse.group/t/using-gramps-under-windows-and-linux-with-same-db-and-media/2759/14 "2022-09-15T11:29:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tobohst](https://avatars.discourse-cdn.com/v4/letter/t/59ef9b/32.png) [@tobohst](https://gramps.discourse.group/u/tobohst)\
**Post date:** [September 15, 2022, 1:18pm UTC](https://gramps.discourse.group/t/using-gramps-under-windows-and-linux-with-same-db-and-media/2759/15 "2022-09-15T13:18:08Z")

</div>

Hello Keith,

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

---

<div class="post-metadata">

**Author:** ![keithjac](https://avatars.discourse-cdn.com/v4/letter/k/82dd89/32.png) [@keithjac](https://gramps.discourse.group/u/keithjac)\
**Post date:** [September 15, 2022, 3:45pm UTC](https://gramps.discourse.group/t/using-gramps-under-windows-and-linux-with-same-db-and-media/2759/16 "2022-09-15T15:45:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![DaveSch](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/davesch/32/40_2.png) [@DaveSch](https://gramps.discourse.group/u/DaveSch)\
**Post date:** [September 15, 2022, 4:11pm UTC](https://gramps.discourse.group/t/using-gramps-under-windows-and-linux-with-same-db-and-media/2759/17 "2022-09-15T16:11:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![tobohst](https://avatars.discourse-cdn.com/v4/letter/t/59ef9b/32.png) [@tobohst](https://gramps.discourse.group/u/tobohst)\
**Post date:** [September 15, 2022, 5:51pm UTC](https://gramps.discourse.group/t/using-gramps-under-windows-and-linux-with-same-db-and-media/2759/18 "2022-09-15T17:51:43Z")

</div>

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:  
Windows:  
GRAMPSTREE1=\QNAP\GrampsPhotos\Tree1  
GRAMPSTREE2=\QNAP\GrampsPhotos\Tree2  
Linux:  
GRAMPSTREE1=/home/mount/QNAP/GrampsPhotos/Tree1  
GRAMPSTREE2=/home/mount/QNAP/GrampsPhotos/Tree2

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

---

<div class="post-metadata">

**Author:** ![StoltHD](https://avatars.discourse-cdn.com/v4/letter/s/db5fbb/32.png) [@StoltHD](https://gramps.discourse.group/u/StoltHD)\
**Post date:** [September 24, 2022, 8:27am UTC](https://gramps.discourse.group/t/using-gramps-under-windows-and-linux-with-same-db-and-media/2759/19 "2022-09-24T08:27:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/gramps/original/1X/2ac1e712b7adf612e31ca08a55419f4cf37c0158.png) [@system](https://gramps.discourse.group/u/system)\
**Post date:** [October 24, 2022, 8:28am UTC](https://gramps.discourse.group/t/using-gramps-under-windows-and-linux-with-same-db-and-media/2759/20 "2022-10-24T08:28:39Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
