Gramps 4.2.8 Linux Mint - restoring connections

I have a Gramps database which connected to “external” (to Gramps) folders of media and html files.

Undoubtedly due to my trying to reorganize my computer, I have managed to lose the connections and, despite what seems like endless playing around, have not managed to restore the linkages.

If anyone has a “plan of attack” on how to do this, I would be VERY grateful.

Thanks in advance for your indulgence.

1 Like

Since you are using an older version of Gramps, i hope that you are aware you can surf to the older version wiki pages?

You have probably changed the “Base path for relative media paths” in the General tab of Settings:
https://gramps-project.org/wiki/index.php/Gramps_4.2_Wiki_Manual_-_Settings#General

4.2.x Media Manager :
https://gramps-project.org/wiki/index.php/Gramps_4.2_Wiki_Manual_-_Tools#Media_Manager

Thank you for your response.

No, I do not believe I have changed the “Base path …”. But, that said, what should it be?

What I have done is changed where the folders with media and pages are.

I guess the question is ‘where SHOULD they be?’

Within Gramps the path to a web page is, for example " …/…/…/Manual/webpage1.html.

Where does that mean I need to locate the ‘Manual’ folder?

Even more baffling is the Paths reported by the Media side bar. I have put my ‘Media’ folder there … and they are not found. Perhaps the link(s) need refreshing. But how do you do that?

The Base path should be the location where you store all your raw media files for Gramps. You can have subfolders within this main folder.

the .../.../.../ in the Path field indicates that the folder /Manual/ is/was not under your original Base path. Think old DOS where the dots indicate back 3 directories back to a common directory on the path where /Manual/ can be found.

If you point the Relative base media path to the folder holding your media files, then using the Media Manager tool to search and replace parts of the Path field to have the path point to your files. It may take some manual edits to have Gramps know where the raw media is located on your hard drive.

1 Like

Thanks so much for taking the time for a full run down.‘’

Sorry to say I am still a bit discombobulated.

It seems to me that when Gramps is started from “anywhere”, it creates a folder named after the gpkg package opened (e.g.Untitled_1.gpkg) viz. Untitled_1.gpkg.media as the Base path in, in my case, home/allan.

And three levels up from that is … ???

Apologies for dragging this out … and thanks for your forbearance…

If you start Gramps, from the menu, it will show a list of databases (trees), or open the last one used, depending on your settings. And if you start it that way, it will never create a folder. Your trees are in a hidden folder named grampsdb, and on Linux that’s hidden, because it’s in ~/.gramps

Opening a .gramps or .gpkg file is not a proper way to start Gramps, ever, meaning that it’s not like good old PAF in Windows, or Word for that matter, where opening a .PAF or .DOC file would mean that you’d start PAF, or Word, to edit that specific tree, or document. That’s not how Gramps works, and it’s not how you should use Gramps, normally.

If you DO try to start Gramps this way, and I know that you can, because it’s associated with both file types, Gramps will create a new database, a ‘numbered’ folder inside ~/.gramps/grampsdb, and import the .gramps file, which includes compressed Grams XML, in that database. And when you do that with a .gpkg file, it will also create a new .media folder, named after the .gpkg file, where it unzips (Gzip) all media files found in that .gpkg file, with their paths as stored in the .gpkg file, adapting paths on the fly, so that files with absolute paths don’t end up in their original location, where they could overwrite other files, like the originals. This way of starting Gramps is nice if you want to inspect the contents of a specific backup file, with or without media, and are aware that it will create a new database on the fly, but is NOT a proper way to start Gramps, EVER!

Importing a .gpkg file may be your only option if you have no access to your original media, but in all other cases, you are way better off importing a .gramps file, because that will address the media files in their original locations. And if they aren’t there, restoring those from a backup is the best way to avoid reorganizing media, and messing with weird base paths.

To restate this:

.gramps and .gpkg files are not the working files for Gramps. They are archives (aka backups) in XML and typically compressed. So opening them restores the archive to a new workable Tree.

The working files for Gramps are database format. (In SQLite, by default).

1 Like

Thank you for your response. I was blissfully unaware of the repercussions of opening Gramps “the wrong way”.

But, alas, I am still unclear about a couple of things.

1 - I take it I can, and in fact should, delete any and all .gpkg and .gramps files that I have. Yes?

2 - It seems that, in Gramps family tree “name”, it chooses /home/allan/name.gpkg.media as the Base path. And it seems that it contains a bunch of empty folders. Should I wonder what this/these are for? Or is just a Gramps processing artifact?

In further confusion a typical media file path per the Media manager is home/allan/Desktop/Media.filenam.jpg. How does that relate to the Base path?

And in even more confusion, Gramps Media lists AND SHOWS hundreds of media files which are NOT where it says but in a different folder. Does this mean that the media files are also in ~/.gramps? Or just what might be going on?

3 - And finally (at least for now!) given the above Base path, where does /…/…/…/ lead us?

They say there’s no such thing as a dumb question. I hope I have not demonstrated otherwise.

These are exports and backups. You should keep some backups.

The folder /home/allan/name.gpkg.media is where the media from a backup will be unpacked.

If the filename is home/allan/Desktop/Media.filenam.jpg and the base path is /, then Gramps will expect to find the file at /home/allan/Desktop/Media.filenam.jpg.

If the base path is /home/allan/name.gpkg.media then the expected path is /home/allan/name.gpkg.media/home/allan/Desktop/Media.filenam.jpg.

I take it this would be because of a “Make Backup” from within Gramps.

If the filename is home/allan/Desktop/Media.filenam.jpg and the base path is /, then Gramps will expect to find the file at /home/allan/Desktop/Media.filenam.jpg.

This suggests to me that making the base path “/.” makes sense. Or am I missing something?

You didn’t respond to:

Gramps Media lists AND SHOWS hundreds of media files which are NOT where it says but in a different folder. Does this mean that the media files are also in ~/.gramps? Or just what might be going on?

But it seems to me this is central to my problems. How does Gramps find files that exist but are not where it thinks? And what does that do to future additions? Speaking of which how does Gramps respond to a Base path change?

Hello Allan,

From here, my 1st advice to you would be to take an inventory of what you have. You can do that, by seleting the database or tree manager from the menu. I don’t know what it’s called in English, because I run Gramps in Dutch, and I’m too lazy to start it in English. But when I start it, it gives me an overview of what I have, which is this:

On this screen, you can see that I’m currently working on my ‘borg’ tree, which is open, as shown with the open folder icon in the status column. You can also see that I have a couple of other trees, with names chosen by me, and two that I created by opening .gramps files. Those are the ones with a date in their name, and the one with a time stamp was restored from an automatic backup on close. You can also see a few buttons, where Nieuw can be used to create a new empty tree, and Info is also a nice one, because it can tell you the amount of persons, families, events, etc. in any tree without opening it. It will also tell you where that paricular tree is stored.

If you do the same, you will probably see dozens of lines, many with funny names, and the 1st thing that I suggest is that you simply inspect those, by opening them, or using the Info button, so that you know what you have, and can figure out which one is the best to work with. And as long as you don’t run out of disk space, I suggest that you leave them alone for a while, until you know which are safe to delete. You may find some which are locked, and if that’s the case, please let us know.

On my system, I have a base path that looks like this, but in Dutch:

/home/enno/Documents/Archive

And that means that for every media file whose name does NOT start with a slash, Gramps will look in that folder for that file. In other words, if I have a media file like picture.jpg, Gramps will try to open

/home/enno/Documents/Archive/picture.jpg

and when I have a path like family/picture.jpg Gramps will try to open

/home/enno/Documents/Archive/family/picture.jpg

The base path is only applied when the media path does not start with a slash. If it does, meaning that you see a path like /home/allan/…, Gramps will try to open the file in that path. This is what we call an absolute path, because it’s not relative toe the base path.

In either case, Gramps will not look elsewher if the file isn’t there.

When you restore a backup with media, things get a bit nasty, because Gramps always extracts files relative to the media folder created during the restore process, i.e. the folder named after the backup file, with the .media extension. Gramps does this to prevent overwriting any existing file, and it means that for all media files that had an absolute path when you made the backup, like /home/allan/pictures, you will see that they’re unpacked inside /home/allan/tree-name-date.media/home/allan/pictures, or something like that.

In the end, no matter the paths, Gramps should be able to find all files after restoring a backup with media. And moving those, is another chapter, which is not very difficult, but just a bit too much for now, because I’m longing for diner.

Gramps doesn’t search for media files. It constructs a path and expects to find the file there.

You could try using the Media Verify tool. This will try to locate files based on a stored checksum.

1 Like

Nick and especially ennoborg, thank you for all of your help and information. But I have taken far too much of your time.

I think I know what I need to do - just not sure how I need to do it. And I am still somewhat mystified by this found and displayed media in non-existent folders.

I hope I won’t need to be back at you but chances are …

Allan

1 Like

Two other notes:

  1. When I have a base path like ~/Documents/Archive, and add a file from ~/Pictures, with a relative path, Gramps stores its path as …/…/Pictures/filename.jpg. That means that from the base path, you go back (up) two directories, and then select Pictures.

  2. You can say that, if Gramps can’t find a media file, it is ‘always’ your fault, because it was there when you added it to your database with the file selector. That’s a sure thing, because the file selector only shows files that are actually there. Then, if Gramps can’t find it later, it’s most likely because you moved it, or changed the base path, if you use relative paths. And if isn’t there when you create a backup, it can’t be added to that backup either, so it won’t be there when you restore it either. Links in restored backups are only OK if the files were there when you made the backup.

I use the term ‘always’, because there is a small chance that a file disappears after a system crash, but that is quite rare. And the term fault includes situations of which you weren’t aware, like when you move your files to another machine where you have another user name, which affects the name of your home directory. I mention these things, because by experience I know that most of these errors are caused by user doing things, while not being aware of the consequences.

Do you have any idea about the kind of re-organizing that you did?

It was quite a while ago. And that, coupled with an aging brain, alas means no I don’t.

I have a few hundred thousand files which I periodically take a notion to move around - files to other folders and indeed folders to other folders. What made sense at the time blurs with the passage of time …

OK, I get it. And the problem is, that Gramps can’t find the files after moving, unless you use the media verify tool before that to generate checksums. With those, it can find files that were moved, but in all other cases, you may need to reselect moved files one by one.

Moved folders are easier to correct, even without checksums, because you can use another media tool to do a search and replace on the paths. Then, it’s still up to you to figure out what to replace, but you can do that by comparing the paths stored in Gramps with the locations of the actual files. And if you want, the media verify tool can also create a text file showing all files that it couldn’t find.

Search and replace works best if you can see some patterns in the before and after situation, and you haven’t renamed files, so that you can still find them with Nemo.

There have been a number of references to the “Media verify” tool in this thread. And I have tried, unsuccessfully, to find it a number of times.

Where is it? Is it available on 4.2.8?

Yes. The Media Verify tool is available for v4.2

Either download it from the third-party addons repository, or use the link above to copy the files manually.

You can read more about it here:

https://gramps-project.org/wiki/index.php/Addon:Media_Verify_Tool

And please keep in mind, that it can’t correct anything now. It can only list the files that can’t be found. You can use the Media Manager referenced at the bottom of the page to change paths as far as you can detect some sort of a pattern between the before and after moving situations.