I am using KiCad 7.0.8 on Debian and I am running into an environment variable error when starting up KiCad.
I do not know if this is the intended behavior of KiCad and I am using the environment variables incorrectly or if this a bug in KiCad.
I set the KICAD7_3RD_PARTY environment variable to a directory with the behave-dark color theme installed:
$ echo $KICAD7_3RD_PARTY
/gnu/store/avfl4mnyq1xybcfsjpcf9x6nmcsnq99l-profile/share/kicad/3rdparty
$ ls $KICAD7_3RD_PARTY/colors/behave-dark/
behave-dark.json
When starting up KiCad I get the following error:
can't open file
'/home/user/.config/kicad/7.0/colors//gnu/store/avfl4mnyq1xybcfsjpcf9x6nmcsnq99l-profile/share/kicad/3rdparty/colors/behave-dark/behave-dark.json_footprints.json'
(error 2: No such file or directory)
It seems like the default KICAD7_3RD_PARTY value gets prepended to the KICAD7_3RD_PARTY environment variable and “_footprints.json” gets appended to the end.
However, when I look in Preferences/Configure Paths it says:
KICAD7_3RD_PARTY = /gnu/store/avfl4mnyq1xybcfsjpcf9x6nmcsnq99l-profile/share/kicad/3rdparty
I do not think this issue is only with the KICAD7_3RD_PARTY environment variable. Other environment variables seem to concatenate multiple values at times.
Is there a way to force KiCad to use the environment variables exactly as they are without concatenating any other information?
Workaround: Du könntest /../../../../../../../../ vor den Pfad setzen, damit wäre das Problem nicht da.
Bei mir funktioniert es:
KICAD7_3RD_PARTY=/foo/ /tmp/k_7.99/kicad
Setzt KICAD7_3RD_PARTY als /foo/ in KiCad. Intressant ist, wenn ich eine benutzerdefinierte Variable in KiCad gesetzt habe, kann ich diese nicht mehr mit einer Umgebungsvariable überschreiben. Mit Ausnahme der bereits festgelegten Variablen wie KICAD7_3RD_PARTY
Könntest du die Datei ~/.config/kicad/7.0/kicad_common.json hochladen?
Workaround: You could put /../../../../../../../ in front of the path, that would avoid the problem.
For me this works:
KICAD7_3RD_PARTY=/foo/ /tmp/k_7.99/kicad
Set KICAD7_3RD_PARTY as/foo/in Kicad. If I have set a custom variable in Kicad, I can no longer overwrite it with an environment variable. With the exception of the already specified variables such as KICAD7_3RD_PARTY
Could you upload the file ~/.config/kicad/7.0/kicad_comon.json?
10:14:21: can't open file
'/home/user/.config/kicad/7.0/colors//gnu/store/p5mvy3r3jrs4n9sx94yivxxnqq6wi6x5-profile/share/kicad/3rdparty/colors/behave-dark/behave-dark.json_footprints.json'
(error 2: No such file or directory)
I think there must be a bug with the way that KiCad determines the 3rdparty path using the environment variable.
Should I submit an issue for this on gitlab or is that considered double-posting?
Removing these is not a very good idea. If you’re experimenting with KiCad’s configuration it is usually better to rename such directories. This gives you automatically a backup so you can put them back, and you can use text comparison programs to see what sort of things change.
But deleting them is thorough And if it does not solve your issue, then it very likely is a project specific issue. Maybe one of your color themes is misbehaving in some way.
Yes I just deleted those directories to make sure no local configuration settings could be causing KiCad to corrupt the 3rdparty path.
There is no open project, the error occurs while KiCad is starting up and without any local configuration files KiCad does not know of any local projects.
I copied the color themes from https://github.com/pointhi/kicad-color-schemes. I see no reference inside the json files to “_footprints.json” so I am not sure why that would be appended to the end of the search path.
Are there any other local files that KiCad uses on startup that could be causing such errors?
I am not sure what you mean by that. Where would that get set? I would just like the path of the 3rdparty directory to be exactly equal to the KICAD7_3RD_PARTY environment variable value. Are you suggesting prepending that to the environment variable value or setting it somewhere else?
Die Umgebungsvariable, anstatt KICAD7_3RD_PARTY=/gnu/store/avfl4mnyq1xybcfsjpcf9x6nmcsnq99l-profile/share/kicad/3rdparty setze KICAD7_3RD_PARTY=/../../../../../../../../../../../gnu/store/avfl4mnyq1xybcfsjpcf9x6nmcsnq99l-profile/share/kicad/3rdparty . Linux ignoriert ein ../ wenn es bereits im Wurzelverzeichnis ist. So zu viele /../ sollten demnach ignoriert werden (naja, solange PATH_MAX noch gross genug ist).
…
The environmental variable instead of KICAD7_3RD_PARTY=/gnu/store/avfl4mnyq1xybcfsjpcf9x6nmcsnq99l-profile/share/kicad/3rdparty set KICAD7_3RD_PARTY=/../../../../../../../../../../../gnu/store/avfl4mnyq1xybcfsjpcf9x6nmcsnq99l-profile/share/kicad/3rdparty. Linux ignores a ../ if it is already in the root directory. So too many /../ should therefore be ignored (well, as long as PATH_MAX is still big enough).
15:00:19: can't open file
'/home/polidorop/.config/kicad/7.0/colors//../../../../../../../../../../../gnu/store/p5mvy3r3jrs4n9sx94yivxxnqq6wi6x5-profile/share/kicad/3rdparty/colors/behave-dark/behave-dark.json_footprints.json'
(error 30: Read-only file system)
It did change the error, so perhaps it is now finding the correct directory, but it is still appending “_footprints.json” to the end for some reason.
It might be a separate issue, but are we not allowed to use a read-only file system for the 3rdparty directory? I know that using a read-only directory means that the Plugin and Content Manager can no longer save files to that directory, but I want to manage plugin and contents separately from the manager so I hope we can use a read-only directory if we want.
Why are you trying to change KICAD7_3RD_PARTY variable? It is for packages installed from plugin manager.
Also the path you have seems like some sort of generated sandbox, are you running flatpak version of kicad?
You can’t use a read-only directory for KICAD*_3RD_PARTY: the PCM needs to be able to write to that directory.
You can manage python plugins outside of the PCM, by installing them to /usr/share/kicad/scripting or the equivalent on your system, but you can’t yet do this for color themes (you’d need to make a feature request for this).
So the file not found errors occur because the directory is read only?
I will submit a feature request, thank you. I have never done that so I do not know the best approach.
The feature I would like is the ability to use read-only add-ons, plug-ins and content, colors, scripts, etc, in a location specified by an environment variable.
This might be done either by adding a new environment variable to KiCad or by disabling the plug-in and content manager if the KICAD*_3RD_PARTY path is read-only.
Which of those options is more reasonable and more likely to be accepted? Or is there a better option?
I would suggest none of the above: we already have a system data path for scripts, it just isn’t checked for color themes.
We don’t want to add a feature to override or disable the PCM because you should not be setting the 3RD_PARTY directory to a read-only path: that’s not what it is for.
I use a functional package manager that does not install into the typical system directories. It installs all files into an immutable read-only store.
It installs files into typical directories within the store, but the root directories use hash values for directory names and then programs can find these root directories using environment variables. This works really well for the main KiCad program, as well as for the symbols, footprints, documentation, etc. from the other official KiCad repositories.
You would not consider any option for making plugins and other 3rd party content work with this package manager as well? Like letting the system data path optionally be set by an environment variable?
KICAD*_3RD_PARTY is not for system data, it’s for program data, it needs to be writeable by user you run the program under, otherwise kicad’s plugin manager can not function.
The feature I would request, which sounds unlikely to get accepted but I am hoping, would be a new environment variable that could be used as an option to change the root path of system level plugins and content.
A feature like this is necessary for functional package managers like Nix and Guix, but it would also be nice for others to be able to optionally chose their own system path instead of just hardcoding it into the source code.
In addition, it sounds like another feature that needs to be added is the ability to add colors and other content to the system level directories, not just scripts.
Such variable already exists and it’s not kicad specific, it’s called XDG_CONFIG_HOME. You point it to where you want kicad’s configs live and within that there will be colors folder where you can put your theme files.
That is a more generic env variable, standardised on linux etc. but affects more than just KiCad and therefore not recommended to be set for KiCad unless you want to set the config location for many other programs, too. KiCad has its own KICAD_CONFIG_HOME.
KiCad also expects XDG_CONFIG_HOME to be read/write. At the moment it is not possible (I think) to store color themes in a directory that you can also set to be read-only. So that would be the feature request.