?New/changed behavior on apt upgrade

45 views
Skip to first unread message

Peter Fletcher

unread,
Jun 21, 2026, 2:46:13 PM (14 hours ago) Jun 21
to weewx-user
When I upgraded my workhorse Pi 3 to Trixie, I apt installed weewx (5.3.01), using a working 5.0 .conf file from a Bookworm installation, and it has been working fine for a month or so. Today, when I did my periodic sudo apt update/sudo apt full-upgrade sequence, one of the upgrades pulled in was weewx (to 5.4.01 - not 100% sure about the last digit). As usual, when weewx is involved, in the course of the running of the apt upgrade, I was asked which version of weewx.conf to use - there are three or four options, includng the default 'keep existing version', which, again as usual, I accepted. However, when weewx was restarted by apt, I noticed that it was using a differently named .conf file (weewx.conf-5.0.0b16-5.4.0). weewx started up normally, and the 'new' .conf file turns out to be a copy of my original, with a change in the version parameter from 5.0.0b16 to 5.4.0 and a couple of minor changes in some commented text.
In one sense, it can be argued that the upgrade did keep my old version of weewx.conf - just under a new name! However, the potential problem with this behavior, if I had not noticed the change, is that I might make a modification to the original weewx.conf in the future and get very confused by its not working!
I think that this represents a change in behavior, but it may not be a recent one, since weewx wasn't apt installed on my bookworm system, and I think that this is the first time it has been upgraded by apt on my Trixie system. Why is "keep my existing weewx.conf" no longer being taken literally?

Vince Skahan

unread,
Jun 21, 2026, 3:38:41 PM (13 hours ago) Jun 21
to weewx-user
https://github.com/weewx/weewx/wiki/faq-questions-apt-get-asks and https://github.com/weewx/weewx/wiki/WeeWX-Frequently-Asked-Questions#should-I-edit-the-weewx-config-file-version-string have more info. There have been other threads here in the distant past but I’m not finding them in a quick search.

Peter Fletcher

unread,
Jun 21, 2026, 5:38:04 PM (11 hours ago) Jun 21
to weewx-user
Thanks!

Your first link shows that this has been happening for a while - but I had not encountered it because I was using a different type of installation which did not get automatically updated. I still think that the plain meaning of 'keep your currently-installed version' is not 'copy your currently-installed version with a new name, update its version number, and make some minor changes to comment text in it'! Your second link is also interesting, since the apt upgrade, in modifying the weewx version number in the file, is doing exactly what the FAQ answer tells you not to do! 

matthew wall

unread,
12:02 AM (5 hours ago) 12:02 AM
to weewx...@googlegroups.com
the behavior for apt, yum, and zypper installs is the same. the only difference is that apt prompts, whereas yum and zypper do not. i am pretty sure that this behavior has not changed since this installation method was first introduced.

when you do an upgrade, these are the possible permutations of a conf file:

original - the 'original' config, i.e., the one before upgrade

dist - the new baseline config, i.e., what you would get if you did a new, clean install

merged - start with the new baseline config, then add in diffs from the original config.

for upgrades using yum/zypper:

weewx.conf - original config
weewx.conf-new - new conf for this weewx version
weewx.conf-old-new - original config 'upgraded' to new version
weewx.conf.rpmnew - new conf from this rpm (created by rpm rules)

for upgrades using apt:

if you choose existing:
weewx.conf - original config
weewx.conf.x.y.z - new config

if you choose new:
weewx.conf.dpkg-old - original config
weewx.conf - new config

when the upgrade happens, all three of these are saved to disk. a copy of one of the three is made and called 'weewx.conf'. that way you can compare in case anything went sideways. the file names should be self-explanatory, but after many upgrades it can be confusing, since there will be files left behind from each upgrade.

it is slightly more complicated with apt because debconf values are applied too.

it is ok for the installer to change the 'version' field, because it ostensibly knows what it is doing.

imho, the 'version' field in weewx.conf should be eliminated. in the best case it can be treated as a hint, as in "this might be the version of weewx that was installed when this config file was created". but it cannot be trusted, and it serves no purpose. the only way to trust a config file is to parse the whole thing and make sure it works.

we go out of our way to make upgrades to weewx *not* break when using an old config file. there *is* an option to 'upgrade' a config file, but that is rarely ever required.

btw, the mangling and insertion of comments when you choose to merge or upgrade a config file is a pain in the ass. any merge or upgrade should leave my comments (or lack thereof) and comment formatting alone. the mangline is largely due to the poor handling of comments by configobj, at various versions of configobj, and the developers' attempts to workaround the poor handling.

m

matthew wall

unread,
12:22 AM (5 hours ago) 12:22 AM
to weewx...@googlegroups.com


> On Jun 21, 2026, at 14:46, 'Peter Fletcher' via weewx-user <weewx...@googlegroups.com> wrote:
>
> However, when weewx was restarted by apt, I noticed that it was using a differently named .conf file (weewx.conf-5.0.0b16-5.4.0).

that would require a change to the systemd unit file, telling weewxd to use weewx.conf-5.0.0b16-5.4.0 instead of weewx.conf. i am pretty sure that your system is still using weewx.conf. if not, please provide more information.


> weewx started up normally, and the 'new' .conf file turns out to be a copy of my original, with a change in the version parameter from 5.0.0b16 to 5.4.0 and a couple of minor changes in some commented text.

if you choose to use the maintainer's version, or if you mess with the 'version' field, then the apt logic will copy the maintainer's version into weewx.conf.


> In one sense, it can be argued that the upgrade did keep my old version of weewx.conf - just under a new name! However, the potential problem with this behavior, if I had not noticed the change, is that I might make a modification to the original weewx.conf in the future and get very confused by its not working!

if you modify weewx.conf, then there should be no confusion. weewx.conf is what your system uses unless you change the systemd configuration.


> I think that this represents a change in behavior, but it may not be a recent one, since weewx wasn't apt installed on my bookworm system, and I think that this is the first time it has been upgraded by apt on my Trixie system. Why is "keep my existing weewx.conf" no longer being taken literally?

it is quite possible that the b16 is messing things up, resulting in you getting a maintainer's version (which could look just like your original conf, but with mangled/reformatted comments).

we have had issues with the operating systems' comparisons of versions. i don't remember if this is true for dpkg, but there were cases where 5.1.0b10 was treated as newer than 5.1.0, for example.

apologies for the previous, lengthy response that did not address your questions directly.

m

Reply all
Reply to author
Forward
0 new messages