apt-get fails to install package, but due to a non-existent file?

Asked by Raubvogel

I am running 12.04

root@testbox:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.04.3 LTS
Release: 12.04
Codename: precise
root@testbox:~# uname -a
Linux logger 3.2.0-57-virtual #87-Ubuntu SMP Tue Nov 12 21:53:49 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
root@testbox:~#

and had problems upgrading logrotate. So, I decided to apt-get remove --purge it and then reinstall. But, when I try to install I get:

root@testbox:~# apt-get install logrotate
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  logrotate
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 36.0 kB of archives.
After this operation, 188 kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu/ precise/main logrotate amd64 3.7.8-6ubuntu5 [36.0 kB]
Fetched 36.0 kB in 0s (217 kB/s)
(Reading database ... 75153 files and directories currently installed.)
Unpacking logrotate (from .../logrotate_3.7.8-6ubuntu5_amd64.deb) ...
dpkg: error processing /var/cache/apt/archives/logrotate_3.7.8-6ubuntu5_amd64.deb (--unpack):
 trying to overwrite `/etc/cron.daily/logrotate', which is the diverted version of `/etc/cron.disabled/logrotate'
Processing triggers for man-db ...
Errors were encountered while processing:
 /var/cache/apt/archives/logrotate_3.7.8-6ubuntu5_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@testbox:~#

But, none of those files exist

root@testbox:~# ls /etc/cron.*/logrotate
root@testbox:~#

Also, shouldn't the package be downloaded to /var/cache/apt/archives/ before applied? ?

root@testbox:~# ls -l /var/cache/apt/archives/
total 4
-rw-r----- 1 root root 0 Dec 7 2011 lock
drwxr-xr-x 2 root root 4096 Dec 16 09:01 partial
root@testbox:~# ls -l /var/cache/apt/archives/partial/
total 0
root@testbox:~#

Just to be sure, logrotate is still being reported as not there:

root@testbox:~# dpkg -l | grep logrotate
root@testbox:~#

Just to make sure I did not screwed up the config file,

root@testbox:~# cat /etc/apt/sources.list

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://us.archive.ubuntu.com/ubuntu/ precise main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ precise main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ precise-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ precise-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://us.archive.ubuntu.com/ubuntu/ precise universe
deb-src http://us.archive.ubuntu.com/ubuntu/ precise universe
deb http://us.archive.ubuntu.com/ubuntu/ precise-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ precise-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://us.archive.ubuntu.com/ubuntu/ precise multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ precise multiverse
deb http://us.archive.ubuntu.com/ubuntu/ precise-updates multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ precise-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://us.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu precise-security main restricted
deb-src http://security.ubuntu.com/ubuntu precise-security main restricted
deb http://security.ubuntu.com/ubuntu precise-security universe
deb-src http://security.ubuntu.com/ubuntu precise-security universe
deb http://security.ubuntu.com/ubuntu precise-security multiverse
deb-src http://security.ubuntu.com/ubuntu precise-security multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu precise partner
# deb-src http://archive.canonical.com/ubuntu precise partner

## This software is not part of Ubuntu, but is offered by third-party
## developers who want to ship their latest software.
# deb http://extras.ubuntu.com/ubuntu precise main
# deb-src http://extras.ubuntu.com/ubuntu precise main

root@testbox:~#

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu apt Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Manfred Hampl (m-hampl) said :
#1

What is the output of

sudo updatedb
locate logrotate

Revision history for this message
Raubvogel (raubvogel) said :
#2

root@testbox:~# updatedb
root@testbox:~# locate logrotate
/etc/logrotate.d
/etc/aide/aide.conf.d/31_aide_logrotate
/etc/logrotate.d/apache2.disabled
/etc/logrotate.d/apache2.dpkg-dist
/etc/logrotate.d/apport
/etc/logrotate.d/apt
/etc/logrotate.d/aptitude
/etc/logrotate.d/dpkg
/etc/logrotate.d/fail2ban
/etc/logrotate.d/ppp.disabled
/etc/logrotate.d/rsyslog
/etc/logrotate.d/ufw.disabled
/etc/logrotate.d/ufw.dpkg-dist
/etc/logrotate.d/upstart
/etc/logrotate.d/wpa_action.disabled
/etc/logrotate.d/wpa_supplicant.disabled
/usr/share/aide/config/aide/aide.conf.d/31_aide_logrotate
/usr/share/doc/rsync/examples/logrotate.conf.rsync
/var/cache/apt/archives/logrotate_3.7.8-6ubuntu5_amd64.deb
/var/crash/logrotate.0.crash
/var/lib/ucf/cache/:etc:aide:aide.conf.d:31_aide_logrotate
root@testbox:~# ls -l /var/cache/apt/archives/
total 40
-rw-r----- 1 root root 0 Dec 7 2011 lock
-rw-r--r-- 1 root root 35980 Oct 4 2011 logrotate_3.7.8-6ubuntu5_amd64.deb
drwxr-xr-x 2 root root 4096 Dec 16 09:23 partial
root@testbox:~#

Ok, I feel better the package *has* been downloaded. Would you like the /var/crash/logrotate.0.crash file?

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#3

What is the output of:

apt-cache policy logrotate

You can get thing moving with:

sudo dpkg --force-all -I /var/cache/apt/archives/logrotate_3.7.8-6ubuntu5_amd64.deb

There is a package overlap and I'd put money on you having a PPA enabled which has a PPA causing a problem. This needs reporting to whoever is causing the issue. Be it a PPA maintainer or Canonical themselves.

Revision history for this message
Raubvogel (raubvogel) said :
#4

apt-cache policy logrotate
logrotate:
  Installed: (none)
  Candidate: 3.7.8-6ubuntu5
  Version table:
     3.7.8-6ubuntu5 0
        500 http://us.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages

thing is I really should not have any PPAs in this machine:

grep ^[^#] /etc/apt/sources.list /etc/apt/sources.list.d/*
/etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ precise main restricted
/etc/apt/sources.list:deb-src http://us.archive.ubuntu.com/ubuntu/ precise main restricted
/etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ precise-updates main restricted
/etc/apt/sources.list:deb-src http://us.archive.ubuntu.com/ubuntu/ precise-updates main restricted
/etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ precise universe
/etc/apt/sources.list:deb-src http://us.archive.ubuntu.com/ubuntu/ precise universe
/etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ precise-updates universe
/etc/apt/sources.list:deb-src http://us.archive.ubuntu.com/ubuntu/ precise-updates universe
/etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ precise multiverse
/etc/apt/sources.list:deb-src http://us.archive.ubuntu.com/ubuntu/ precise multiverse
/etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ precise-updates multiverse
/etc/apt/sources.list:deb-src http://us.archive.ubuntu.com/ubuntu/ precise-updates multiverse
/etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
/etc/apt/sources.list:deb-src http://us.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
/etc/apt/sources.list:deb http://security.ubuntu.com/ubuntu precise-security main restricted
/etc/apt/sources.list:deb-src http://security.ubuntu.com/ubuntu precise-security main restricted
/etc/apt/sources.list:deb http://security.ubuntu.com/ubuntu precise-security universe
/etc/apt/sources.list:deb-src http://security.ubuntu.com/ubuntu precise-security universe
/etc/apt/sources.list:deb http://security.ubuntu.com/ubuntu precise-security multiverse
/etc/apt/sources.list:deb-src http://security.ubuntu.com/ubuntu precise-security multiverse
grep: /etc/apt/sources.list.d/*: No such file or directory

So I ended up using dpkg as you suggested:

root@testbox:~# sudo dpkg --force-all -i /var/cache/apt/archives/logrotate_3.7.8-6ubuntu5_amd64.deb
(Reading database ... 75153 files and directories currently installed.)
Unpacking logrotate (from .../logrotate_3.7.8-6ubuntu5_amd64.deb) ...
dpkg: warning: overriding problem because --force enabled:
 trying to overwrite `/etc/cron.daily/logrotate', which is the diverted version of `/etc/cron.disabled/logrotate'
Setting up logrotate (3.7.8-6ubuntu5) ...

Configuration file `/etc/logrotate.conf', does not exist on system.
Installing new config file as you requested.

Configuration file `/etc/cron.daily/logrotate', does not exist on system.
Installing new config file as you requested.
Processing triggers for man-db ...
root@testbox:~# ls -lh /usr/sbin/logrotate
-rwxr-xr-x 1 root root 55K Oct 4 2011 /usr/sbin/logrotate
root@testbox:~#

It seems to have worked. I still wonder what happened.

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#5

There is a bug in the packages, dpkg doesn't like overlapping files like that. Please run:

ubuntu-bug logrotate

To report the issue, you may want to link this question to clarify the bug

Revision history for this message
Manfred Hampl (m-hampl) said :
#6

What is the output of

ls -l /var/lib/dpkg/diversions*
dpkg-divert --list | grep logrotate

Can you help with this problem?

Provide an answer of your own, or ask Raubvogel for more information if necessary.

To post a message you must log in.