Upgrading our Spring Cloud Config server from Spring Cloud 2020.0.3 to 2021.0.0 caused a seemingly benign error reported in the logs when deploying to kubernetes.

2022-01-03 20:04:02,892 [tributeWriter-2] ERROR org.eclipse.jgit.util.FS$FileStoreAttributes.saveToConfig - Cannot save config file 'FileBasedConfig[/.config/jgit/config]'
java.io.IOException: Creating directories for /.config/jgit failed
  at org.eclipse.jgit.util.FileUtils.mkdirs(FileUtils.java:412)
  at org.eclipse.jgit.internal.storage.file.LockFile.lock(LockFile.java:138)
  at org.eclipse.jgit.storage.file.FileBasedConfig.save(FileBasedConfig.java:219)
  at org.eclipse.jgit.util.FS$FileStoreAttributes.saveToConfig(FS.java:740)
  at org.eclipse.jgit.util.FS$FileStoreAttributes.lambda$4(FS.java:426)
  at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
  at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
  at java.base/java.lang.Thread.run(Thread.java:829)

I found this stackoverflow describing the problem and solution. I can add the XDG_CONFIG_HOME environment variable, however I think it would be great if a solution was provided in SCC.

Comment From: ryanjbaxter

Interesting, IDK what we can do about it as it appears to be something JGit is doing.

Does everything still work despite the exception?

Comment From: mpkorstanje

Having found myself in a similar situation, it would appear that everything is working as expected.

Comment From: ryanjbaxter

Thanks @mpkorstanje. I will try and take a look at it, but it will be low priority since everything is working.

Comment From: mpkorstanje

No problem!

I don't think this a problem for Spring to solve. It's up to the OS that runs the application to set XDG_CONFIG_HOME correctly.

In my case this variable was set correctly but the filesystem was mounted as read-only and so the user dir was not writable.

I'll file an issue with JGit to more gracefully handle read-only file systems.

Comment From: ryanjbaxter

Could you post a comment to the JGit issue here?

Comment From: mpkorstanje

It already existed:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=560555

Thomas Wolf 2021-02-08 03:14:23 EST Two possible solutions:
1. Do provide a user with a writeable home directory inside the Docker container. 2. Set environment variable XDG_CONFIG_HOME inside the Docker container to point to a directory where the Java process has write permissions.

Sounds like a doc fix to me.

Comment From: ryanjbaxter

Thanks!

Comment From: ryanjbaxter

We probably need to document this

Comment From: ryanjbaxter

I just added a note to the docs