apt_install() fails, no previous apt_update or repo out of date

Bug #1455235 reported by Andreas Hasenack
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Charm Helpers
Fix Released
Medium
Chris Glass
Landscape Server
Fix Released
Medium
Unassigned
15.07
Fix Released
Medium
Chris Glass
Cisco-odl
Fix Released
Medium
Chris Glass
keystone (Juju Charms Collection)
Fix Released
Undecided
Chris Glass
nova-cloud-controller (Juju Charms Collection)
Fix Released
Undecided
Chris Glass

Bug Description

The charm tried to install python-netaddr, but apt-get failed:
2015-05-14 20:38:04 INFO unit.keystone/2.juju-log cmd.go:247 Installing python-netaddr with options: ['--option=Dpkg::Options::=--force-confold']
2015-05-14 20:38:04 INFO unit.keystone/2.install logger.go:40 Reading package lists...
2015-05-14 20:38:04 INFO unit.keystone/2.install logger.go:40 Building dependency tree...
2015-05-14 20:38:04 INFO unit.keystone/2.install logger.go:40 Reading state information...
2015-05-14 20:38:05 INFO unit.keystone/2.install logger.go:40 The following packages were automatically installed and are no longer required:
2015-05-14 20:38:05 INFO unit.keystone/2.install logger.go:40 libfreetype6 os-prober
2015-05-14 20:38:05 INFO unit.keystone/2.install logger.go:40 Use 'apt-get autoremove' to remove them.
2015-05-14 20:38:05 INFO unit.keystone/2.install logger.go:40 Suggested packages:
2015-05-14 20:38:05 INFO unit.keystone/2.install logger.go:40 ipython python-netaddr-docs
2015-05-14 20:38:05 INFO unit.keystone/2.install logger.go:40 The following NEW packages will be installed:
2015-05-14 20:38:05 INFO unit.keystone/2.install logger.go:40 python-netaddr
2015-05-14 20:38:05 INFO unit.keystone/2.install logger.go:40 0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
2015-05-14 20:38:05 INFO unit.keystone/2.install logger.go:40 Need to get 849 kB of archives.
2015-05-14 20:38:05 INFO unit.keystone/2.install logger.go:40 After this operation, 4216 kB of additional disk space will be used.
2015-05-14 20:38:05 INFO unit.keystone/2.install logger.go:40 WARNING: The following packages cannot be authenticated!
2015-05-14 20:38:05 INFO unit.keystone/2.install logger.go:40 python-netaddr
2015-05-14 20:38:05 INFO unit.keystone/2.install logger.go:40 E: There are problems and -y was used without --force-yes
2015-05-14 20:38:05 INFO unit.keystone/2.install logger.go:40 Traceback (most recent call last):
2015-05-14 20:38:05 INFO unit.keystone/2.install logger.go:40 File "/var/lib/juju/agents/unit-keystone-2/charm/hooks/install", line 44, in <module>
2015-05-14 20:38:05 INFO unit.keystone/2.install logger.go:40 from charmhelpers.contrib.openstack.utils import (
2015-05-14 20:38:05 INFO unit.keystone/2.install logger.go:40 File "/var/lib/juju/agents/unit-keystone-2/charm/hooks/charmhelpers/contrib/openstack/utils.py", line 31, in <module>
2015-05-14 20:38:05 INFO unit.keystone/2.install logger.go:40 from charmhelpers.contrib.network import ip
2015-05-14 20:38:05 INFO unit.keystone/2.install logger.go:40 File "/var/lib/juju/agents/unit-keystone-2/charm/hooks/charmhelpers/contrib/network/ip.py", line 42, in <module>
2015-05-14 20:38:05 INFO unit.keystone/2.install logger.go:40 import netaddr
2015-05-14 20:38:05 INFO unit.keystone/2.install logger.go:40 ImportError: No module named netaddr
2015-05-14 20:38:05 ERROR juju.worker.uniter.operation runhook.go:86 hook "install" failed: exit status 1

That's an odd error, it's almost as if apt-get update wasn't run, or failed. But I don't see either in the log (attached).

After that was logged, I ssh'ed into the system, and indeed, apt-get complains that python-netaddr cannot be authenticated:
root@juju-machine-2-lxc-5:~# apt-get install python-netaddr
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libfreetype6 os-prober
Use 'apt-get autoremove' to remove them.
Suggested packages:
  ipython python-netaddr-docs
The following NEW packages will be installed:
  python-netaddr
0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
Need to get 849 kB of archives.
After this operation, 4,216 kB of additional disk space will be used.
WARNING: The following packages cannot be authenticated!
  python-netaddr
Install these packages without verification? [y/N] n
E: Some packages could not be authenticated

Policy shows it comes from the ubuntu archive:
root@juju-machine-2-lxc-5:~# apt-cache policy python-netaddr
python-netaddr:
  Installed: (none)
  Candidate: 0.7.10-1ubuntu1.1
  Version table:
     0.7.10-1ubuntu1.1 0
        500 http://archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
     0.7.10-1build1 0
        500 http://archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
root@juju-machine-2-lxc-5:~#

After I manually ran apt-get update, apt-get install was happy:
root@juju-machine-2-lxc-5:~# apt-get update
Ign http://security.ubuntu.com trusty-security InRelease
Get:1 http://security.ubuntu.com trusty-security Release.gpg [933 B]
Get:2 http://security.ubuntu.com trusty-security Release [63.5 kB]
Get:3 http://security.ubuntu.com trusty-security/main Sources [80.6 kB]
Get:4 http://security.ubuntu.com trusty-security/universe Sources [23.7 kB]
Get:5 http://security.ubuntu.com trusty-security/main amd64 Packages [268 kB]
Get:6 http://security.ubuntu.com trusty-security/universe amd64 Packages [102 kB]
Ign http://archive.ubuntu.com trusty InRelease
Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Ign http://archive.ubuntu.com trusty-updates InRelease
Hit http://archive.ubuntu.com trusty Release.gpg
Get:7 http://archive.ubuntu.com trusty-updates Release.gpg [933 B]
Hit http://archive.ubuntu.com trusty Release
Get:8 http://archive.ubuntu.com trusty-updates Release [63.5 kB]
Hit http://archive.ubuntu.com trusty/main Sources
Hit http://archive.ubuntu.com trusty/universe Sources
Hit http://archive.ubuntu.com trusty/main amd64 Packages
Hit http://archive.ubuntu.com trusty/universe amd64 Packages
Hit http://archive.ubuntu.com trusty/main Translation-en
Hit http://archive.ubuntu.com trusty/universe Translation-en
Get:9 http://archive.ubuntu.com trusty-updates/main Sources [202 kB]
Get:10 http://archive.ubuntu.com trusty-updates/universe Sources [116 kB]
Get:11 http://archive.ubuntu.com trusty-updates/main amd64 Packages [516 kB]
Get:12 http://archive.ubuntu.com trusty-updates/universe amd64 Packages [279 kB]
Get:13 http://archive.ubuntu.com trusty-updates/main Translation-en [245 kB]
Get:14 http://archive.ubuntu.com trusty-updates/universe Translation-en [146 kB]
Ign http://archive.ubuntu.com trusty/main Translation-en_US
Ign http://archive.ubuntu.com trusty/universe Translation-en_US
Fetched 2,106 kB in 4s (469 kB/s)
Reading package lists... Done
root@juju-machine-2-lxc-5:~# apt-get install python-netaddr
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libfreetype6 os-prober
Use 'apt-get autoremove' to remove them.
Suggested packages:
  ipython python-netaddr-docs
The following NEW packages will be installed:
  python-netaddr
0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
Need to get 849 kB of archives.
After this operation, 4,216 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu/ trusty-updates/main python-netaddr all 0.7.10-1ubuntu1.1 [849 kB]
Fetched 849 kB in 0s (22.8 MB/s)
Selecting previously unselected package python-netaddr.
(Reading database ... 26045 files and directories currently installed.)
Preparing to unpack .../python-netaddr_0.7.10-1ubuntu1.1_all.deb ...
Unpacking python-netaddr (0.7.10-1ubuntu1.1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up python-netaddr (0.7.10-1ubuntu1.1) ...
root@juju-machine-2-lxc-5:~#

Tags: landscape

Related branches

Revision history for this message
Andreas Hasenack (ahasenack) wrote :
summary: - python-netaddr failed to install
+ python-netaddr failed to install; missing apt-get update?
Revision history for this message
Andreas Hasenack (ahasenack) wrote : Re: python-netaddr failed to install; missing apt-get update?

I think it's just a missing apt-get update. The code does:

try:
    import netaddr
except ImportError:
    apt_install('python-netaddr')
    import netaddr

And apt_install() does not call apt_update(). Also see https://bugs.launchpad.net/charm-helpers/+bug/1397808

Revision history for this message
David Britton (dpb) wrote :

Saw this same issue in neutron-api, which uses the charm-helpers library.

Changed in keystone (Juju Charms Collection):
status: New → Confirmed
Revision history for this message
James Page (james-page) wrote :

I'm pretty sure that Juju used todo a update/upgrade as part of the installation process; can you see in the logs for the unit whether this is the case?

As all of this is coming from the main Ubuntu archive the message:

WARNING: The following packages cannot be authenticated!

is a bit concerning :-)

Revision history for this message
Adam Collard (adam-collard) wrote :

One can disable Juju's automatic apt-get update through use of enable-os-refresh-update environments.yaml switch.

I don't think it's safe for charms to assume an up to date APT index.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :
Download full text (3.5 KiB)

Same thing happened again at a customer, this time with nova-cloud-controller:
unit-nova-cloud-controller-0[1012]: 2015-09-10 22:09:21 INFO unit.nova-cloud-controller/0.install logger.go:40 The following packages were automatically installed and are no longer required:
unit-nova-cloud-controller-0[1012]: 2015-09-10 22:09:21 INFO unit.nova-cloud-controller/0.install logger.go:40 libfreetype6 os-prober
unit-nova-cloud-controller-0[1012]: 2015-09-10 22:09:21 INFO unit.nova-cloud-controller/0.install logger.go:40 Use 'apt-get autoremove' to remove them.
unit-nova-cloud-controller-0[1012]: 2015-09-10 22:09:21 INFO unit.nova-cloud-controller/0.install logger.go:40 The following NEW packages will be installed:
unit-nova-cloud-controller-0[1012]: 2015-09-10 22:09:21 INFO unit.nova-cloud-controller/0.install logger.go:40 python-netifaces
unit-mongodb-0[1005]: 2015-09-10 22:09:21 INFO unit.mongodb/0.install logger.go:40 Selecting previously unselected package python-bson.
unit-nova-cloud-controller-0[1012]: 2015-09-10 22:09:21 INFO unit.nova-cloud-controller/0.install logger.go:40 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
unit-nova-cloud-controller-0[1012]: 2015-09-10 22:09:21 INFO unit.nova-cloud-controller/0.install logger.go:40 Need to get 11.3 kB of archives.
unit-nova-cloud-controller-0[1012]: 2015-09-10 22:09:21 INFO unit.nova-cloud-controller/0.install logger.go:40 After this operation, 63.5 kB of additional disk space will be used.
unit-nova-cloud-controller-0[1012]: 2015-09-10 22:09:21 INFO unit.nova-cloud-controller/0.install logger.go:40 WARNING: The following packages cannot be authenticated!
unit-nova-cloud-controller-0[1012]: 2015-09-10 22:09:21 INFO unit.nova-cloud-controller/0.install logger.go:40 python-netifaces
unit-nova-cloud-controller-0[1012]: 2015-09-10 22:09:21 INFO unit.nova-cloud-controller/0.install logger.go:40 E: There are problems and -y was used without --force-yes
unit-nova-cloud-controller-0[1012]: 2015-09-10 22:09:21 INFO unit.nova-cloud-controller/0.install logger.go:40 Traceback (most recent call last):
unit-nova-cloud-controller-0[1012]: 2015-09-10 22:09:21 INFO unit.nova-cloud-controller/0.install logger.go:40 File "/var/lib/juju/agents/unit-nova-cloud-controller-0/charm/hooks/install", line 45, in <module>
unit-nova-cloud-controller-0[1012]: 2015-09-10 22:09:21 INFO unit.nova-cloud-controller/0.install logger.go:40 from charmhelpers.contrib.openstack.utils import (
unit-nova-cloud-controller-0[1012]: 2015-09-10 22:09:21 INFO unit.nova-cloud-controller/0.install logger.go:40 File "/var/lib/juju/agents/unit-nova-cloud-controller-0/charm/hooks/charmhelpers/contrib/openstack/utils.py", line 31, in <module>
unit-nova-cloud-controller-0[1012]: 2015-09-10 22:09:21 INFO unit.nova-cloud-controller/0.install logger.go:40 from charmhelpers.contrib.network import ip
unit-nova-cloud-controller-0[1012]: 2015-09-10 22:09:21 INFO unit.nova-cloud-controller/0.install logger.go:40 File "/var/lib/juju/agents/unit-nova-cloud-controller-0/charm/hooks/charmhelpers/contrib/network/ip.py", line 36, in <module>
unit-nova-cloud-controller-0[1012]: 2015-09-10 22:09:21 INFO unit.nova-cloud-controller/...

Read more...

summary: - python-netaddr failed to install; missing apt-get update?
+ apt_install() fails, no previous apt_update or repo out of date
affects: keystone (Juju Charms Collection) → charm-helpers
Chris Glass (tribaal)
Changed in charm-helpers:
assignee: nobody → Chris Glass (tribaal)
Chris Glass (tribaal)
Changed in charm-helpers:
status: Confirmed → In Progress
importance: Undecided → Medium
Chris Glass (tribaal)
Changed in charm-helpers:
status: In Progress → Fix Committed
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Adding bug tasks for charms that need to grab this fix from charm-helpers

Changed in landscape:
importance: Undecided → Medium
Chris Glass (tribaal)
Changed in keystone (Juju Charms Collection):
assignee: nobody → Chris Glass (tribaal)
Changed in nova-cloud-controller (Juju Charms Collection):
assignee: nobody → Chris Glass (tribaal)
Changed in keystone (Juju Charms Collection):
status: New → In Progress
Changed in nova-cloud-controller (Juju Charms Collection):
status: New → In Progress
Revision history for this message
Chris Glass (tribaal) wrote :

The relevant bits were synced to all charms by script once the changes landed in charm-helpers stable.

Changed in keystone (Juju Charms Collection):
status: In Progress → Fix Committed
Changed in nova-cloud-controller (Juju Charms Collection):
status: In Progress → Fix Committed
Changed in landscape:
status: New → Fix Committed
Changed in landscape:
milestone: none → 15.08
Changed in keystone (Juju Charms Collection):
status: Fix Committed → Fix Released
Changed in nova-cloud-controller (Juju Charms Collection):
status: Fix Committed → Fix Released
David Britton (dpb)
tags: added: kanban-cross-team
David Britton (dpb)
tags: removed: kanban-cross-team
Changed in landscape:
status: Fix Committed → Fix Released
milestone: 15.08 → 15.07
Changed in charm-helpers:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.