#762743 apt: apt-get update race(?)/issue leading to unexpected upgrades

Package:
apt
Source:
apt
Description:
commandline package manager
Submitter:
Peter Palfrader
Date:
2015-03-06 09:42:05 UTC
Severity:
normal
#762743#5
Date:
2014-09-24 20:58:33 UTC
From:
To:
Package: apt
Version: 0.9.7.9+deb7u5

Hi,

I noticed (a couple times now) that apt-get sometimes ends up trying to
upgrade all my stable packages to their wheezy-backports versions on
debian.org systems.

The default policy is mostly the same over all debian.org systems, but
I've attached one example to this report.

I could reproduce the behavior like this:

| root@arm-arm-02:~# find /var/lib/apt -type f | xargs rm
| root@arm-arm-02:~# apt-get update
| Get:1 http://db.debian.org lenny Release.gpg [198 B]
| Get:2 http://security.debian.org wheezy/updates Release.gpg [836 B]
| Get:3 http://db.debian.org lenny Release [17.8 kB]
| Get:4 http://security.debian.org wheezy/updates Release [102 kB]
| Get:5 http://ftp.uk.debian.org wheezy-backports Release.gpg [836 B]
| Get:6 http://db.debian.org lenny/main armhf Packages [19.3 kB]
| Get:7 http://ftp.uk.debian.org wheezy Release.gpg [1655 B]
| Get:8 http://ftp.uk.debian.org wheezy-updates Release.gpg [836 B]
| Get:9 http://ftp.uk.debian.org wheezy-backports Release [147 kB]
| Get:10 https://buildd.debian.org wheezy Release.gpg [490 B]
| Get:11 https://buildd.debian.org wheezy Release [52.4 kB]
| Get:12 http://security.debian.org wheezy/updates/main armhf Packages [258 kB]
| Ign http://db.debian.org lenny/main Translation-en
| Get:13 https://buildd.debian.org wheezy/main armhf Packages [6131 B]
| Get:14 http://ftp.uk.debian.org wheezy Release [168 kB]
| Get:15 http://ftp.uk.debian.org wheezy-updates Release [124 kB]
| Ign https://buildd.debian.org wheezy/main Translation-en
| Get:16 http://security.debian.org wheezy/updates/contrib armhf Packages [20 B]
| Get:17 http://security.debian.org wheezy/updates/non-free armhf Packages [20 B]
| Get:18 http://security.debian.org wheezy/updates/contrib Translation-en [14 B]
| Get:19 http://security.debian.org wheezy/updates/main Translation-en [122 kB]
| Get:20 http://ftp.uk.debian.org wheezy-backports/main armhf Packages [591 kB]
| Get:21 http://security.debian.org wheezy/updates/non-free Translation-en [14 B]
| Get:22 http://ftp.uk.debian.org wheezy-backports/contrib armhf Packages [5456 B]
| Get:23 http://ftp.uk.debian.org wheezy-backports/non-free armhf Packages [5324 B]
| Get:24 http://ftp.uk.debian.org wheezy-backports/contrib Translation-en [6023 B]
| Get:25 http://ftp.uk.debian.org wheezy-backports/main Translation-en [313 kB]
| Get:26 http://ftp.uk.debian.org wheezy-backports/non-free Translation-en [19.9 kB]
| Get:27 http://ftp.uk.debian.org wheezy/main armhf Packages [7433 kB]
| 58% [27 Packages 3497 kB/7433 kB 47%]                                                                                                           683 kB/s 5s^C
[^C'ed apt-get update]

| root@arm-arm-02:~# apt-get -s dist-upgrade
| Reading package lists... Done
| Building dependency tree... Done
| Calculating upgrade... Done
| The following NEW packages will be installed:
|   init-system-helpers iproute2 libjson-c2 libserf-1-1 libudev1 monitoring-plugins-basic monitoring-plugins-common openssh-sftp-server
| The following packages will be upgraded:
|   debootstrap facter git git-core git-man git-svn iproute ipython libgeoip1 libgpg-error0 libjson0 libldns1 libp11-kit0 libsvn-perl libsvn1 libunbound2
|   libxapian22 mercurial mercurial-common mksh monit nagios-plugins-basic nagios-plugins-common openssh-client openssh-server pdksh rcs ssh subversion
|   subversion-tools tar tmux udev unbound unbound-anchor unbound-host whois
| 37 upgraded, 8 newly installed, 0 to remove and 0 not upgraded.
| Inst tar [1.26+dfsg-0.1] (1.27.1-1~bpo70+1 Debian Backports:/wheezy-backports [armhf])
| Conf tar (1.27.1-1~bpo70+1 Debian Backports:/wheezy-backports [armhf])
...

apt-cache policy tar then reports:
} tar:
}   Installed: 1.26+dfsg-0.1
}   Candidate: 1.27.1-1~bpo70+1
}   Version table:
}      1.27.1-1~bpo70+1 0
}         200 http://ftp.uk.debian.org/debian/ wheezy-backports/main armhf Packages
}  *** 1.26+dfsg-0.1 0
}         100 /var/lib/dpkg/status

Note: stable is missing.


In the cases I observed "in the wild", I obviously didn't abort
apt-get's update run.

I suspect the issue there might be something else, like a different apt-get
update run running by somebody else or some monitoring script.


Another way to reproduce this:

} root@bm-bl11:~# while : ; do apt-cache policy tar; sleep 0.2; done

Now run apt-get update in a second shell.

The output is:
...
} tar:
}   Installed: 1.26+dfsg-0.1
}   Candidate: 1.26+dfsg-0.1
}   Version table:
}      1.27.1-1~bpo70+1 0
}         200 http://mirror.bm.debian.org/debian/ wheezy-backports/main amd64 Packages
}  *** 1.26+dfsg-0.1 0
}         500 http://mirror.bm.debian.org/debian/ wheezy/main amd64 Packages
}         100 /var/lib/dpkg/status
} tar:
}   Installed: 1.26+dfsg-0.1
}   Candidate: 1.27.1-1~bpo70+1
}   Version table:
}      1.27.1-1~bpo70+1 0
}         200 http://mirror.bm.debian.org/debian/ wheezy-backports/main amd64 Packages
}  *** 1.26+dfsg-0.1 0
}         100 /var/lib/dpkg/status
} tar:
}   Installed: 1.26+dfsg-0.1
}   Candidate: 1.27.1-1~bpo70+1
}   Version table:
}      1.27.1-1~bpo70+1 0
}         200 http://mirror.bm.debian.org/debian/ wheezy-backports/main amd64 Packages
}  *** 1.26+dfsg-0.1 0
}         100 /var/lib/dpkg/status
} tar:
}   Installed: 1.26+dfsg-0.1
}   Candidate: 1.27.1-1~bpo70+1
}   Version table:
}      1.27.1-1~bpo70+1 0
}         200 http://mirror.bm.debian.org/debian/ wheezy-backports/main amd64 Packages
}  *** 1.26+dfsg-0.1 0
}         100 /var/lib/dpkg/status
} tar:
}   Installed: 1.26+dfsg-0.1
}   Candidate: 1.26+dfsg-0.1
}   Version table:
}      1.27.1-1~bpo70+1 0
}         100 http://mirror.bm.debian.org/debian/ wheezy-backports/main amd64 Packages
}  *** 1.26+dfsg-0.1 0
}         500 http://mirror.bm.debian.org/debian/ wheezy/main amd64 Packages
}         100 /var/lib/dpkg/status
} E: Problem renaming the file /var/cache/apt/pkgcache.bin.cTZxL4 to /var/cache/apt/pkgcache.bin - rename (2: No such file or directory)
} W: You may want to run apt-get update to correct these problems
} tar:
}   Installed: 1.26+dfsg-0.1
}   Candidate: 1.26+dfsg-0.1
}   Version table:
}      1.27.1-1~bpo70+1 0
}         200 http://mirror.bm.debian.org/debian/ wheezy-backports/main amd64 Packages
}  *** 1.26+dfsg-0.1 0
}         500 http://mirror.bm.debian.org/debian/ wheezy/main amd64 Packages
}         100 /var/lib/dpkg/status
} tar:
}   Installed: 1.26+dfsg-0.1
}   Candidate: 1.26+dfsg-0.1
}   Version table:
}      1.27.1-1~bpo70+1 0
}         200 http://mirror.bm.debian.org/debian/ wheezy-backports/main amd64 Packages
}  *** 1.26+dfsg-0.1 0
}         500 http://mirror.bm.debian.org/debian/ wheezy/main amd64 Packages
}         100 /var/lib/dpkg/status
...

So there's a window where wheezy-backports has the most preferred version.

Cheers,
weasel

#762743#10
Date:
2015-03-06 09:38:30 UTC
From:
To:
Hi,

Peter Palfrader wrote on Wed, 24 Sep 2014 22:58:33 +0200:
[...]

I only remember that I run into this once last year or so (can't tell
exactly when) on Unstable, where it tried to upgrade all packages to
Experimental and Aptitude listed thousands of packages as "Obsolete or
locally installed".

But a friend of mine ran into this recently on Squeeze LTS in a very
misleading way:

* Squeeze lists were there
* Squeeze-LTS lists were missing
* Squeeze-Backports lists were there.

This caused upgrades to Squeeze-Backports only for those packages
which already had updates from Squeeze-LTS installed and were
available in Squeeze-Backports too. It made him unfortunately
believe[1], that our LTS release switched Dovecot from 1.2 to 2.0 as
it seemed the only change caused by this bug on his system. :-(

[1] http://www.deimeke.net/dirk/blog/?url=archives/3505-Migration-abgeschlossen-....html#c19512
    (German)

P.S.: I wonder if this is related to https://bugs.debian.org/337157 --
if so, that bug hasn't been fixed in APT 0.7.16 as guessed by Eugene
in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=337157#15

		Regards, Axel