When should I change system.stateVersion?

Sorry to revive this topic, but when I read all the answers, I was thinking that stateVersion is very minor and is just used to make sure that, basically, “path” matches, and that having an old number is not a problem at all:

However, I think that the above statement is confusing. Indeed, I just checked on my system and in the nix code (not so hard to read for that, just grep stateVersion), and keeping an old version number will actually have an impact on the system, since it will use older packages.

For example after an upgrade on which I forgot to specify system.stateVersion, my system was using postgresql 11.1 (and it also lost the old database since it uses the path /var/lib/postgresql/11.1 to store the database). But when I realized that my webserver was unable to access the database, I added:

system.stateVersion = "18.09";

and then the version of postgresql used by the system was suddently 9.6 (and it also changed the path of the database to /var/lib/postgresql/9.6, so my database came back to life !). So if people care about having recent software, I think that it does make sense to update the stateVersion from time to time, but the user needs to make sure to apply manually all the changes given in the release, or/and be prepared to breakages.

I just created a new post here for people interested by an automatic script.

1 Like