I am using QGIS 3.28. I don't like the name of one of my current .gpkg file ("test"). I've tried saving it a few different ways, but the new versions always seems to point back to the original version, appending the new gpkg name to the front of each of the old layers' names. This is confusing to look at.

I'm assuming that renaming the .gpkg manually (i.e., selecting RENAME in the Windows directory) will break the linkages to the layers it contains.

Is the simplest solution for me to just start over with the Processing Toolbox\Package Layers command?

  • I think you can just rename it the usual way, the tables won't be affected
    – Ian Turton
    May 25, 2023 at 17:26

1 Answer 1


QGIS is built with an implicit assumption of (semi)permanent datastores that are pointed to by the layer tree in a project. This does make it more difficult to simply rename a gpkg file.

Indeed, if you rename a gpkg outside QGIS (e.g. in the OS), links to it in projects will get broken. If a project using those layers is open in QGIS, the gpkg will be open and locked and you won't even be allowed to do so. You can do the following.

  1. Rename the gpkg when QGIS is closed, reopen QGIS and the project, and fix the link for the now-unavailable layer using the "Handle unavailable layers" dialog that will appear, or by manually changing the source for each layer. See https://www.youtube.com/watch?v=b6ldIGxpgfo for a good overview. The good news is that generally once you fix the path/name for one layer in the moved gpkg file, QGIS will fix it for other layers contained in the same file automatically. (Doesn't always work for me, but usually)

  2. Rather than renaming the gpkg, copy it to the new name. Then manually go through layers in the project and right-click and change the data source. This feels like a bit more work, but is less scary than missing all of your layers, and is a good opportunity to fix other things (including layer name in the project) for each layer.

  3. Like 2, but export each layer into its new home rather than copying the gpkg itself. This makes sense if you're not just renaming but consolidating gpkgs.

  • Thank you. I will try the copy function (#2) next time.
    – Jeff Boggs
    May 25, 2023 at 18:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.