Solving errors when updating linux-cloud-tools-common

Jacco Techniek

When doing a regular periodical update of a webserver, some packages remain ‘not fully installed’.

I searched for a way to complete the update of a webserver and specifically the packages afflicted, which are:

  • linux-cloud-tools-common
  • linux-cloud-tools-3.13.0-100
  • linux-cloud-tools-3.13.0-100-generic
  • linux-cloud-tools-virtual
  • hv-kvp-daemon-init

tl;dr

The solution I finally came up with is to run:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
ln -s /usr/sbin/hv_kvp_daemon.hv-kvp-daemon-init /usr/sbin/hv_kvp_daemon
ln -s /usr/sbin/hv_kvp_daemon.hv-kvp-daemon-init /usr/sbin/hv_kvp_daemon
ln -s /usr/sbin/hv_kvp_daemon.hv-kvp-daemon-init /usr/sbin/hv_kvp_daemon

After that run

apt upgrade
apt upgrade again to complete the installation of the updates.

I’d like to tell you a bit more about how I came to this solution.

More information about the issue

The issue turned up after a regular

sudo apt-get update && sudo apt-get upgrade
sudo apt-get update && sudo apt-get upgrade. The server involved is a Ubuntu 14.04 Virtual Machine on Azure.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# sudo apt upgrade
...
Setting up linux-cloud-tools-common (3.13.0-100.147) ...
start: Job failed to start
invoke-rc.d: initscript hv-kvp-daemon, action "start" failed.
dpkg: error processing package linux-cloud-tools-common (--configure):
subprocess installed post-installation script returned error exit status 1
...
Errors were encountered while processing:
linux-cloud-tools-common
linux-cloud-tools-3.13.0-100
linux-cloud-tools-3.13.0-100-generic
linux-cloud-tools-virtual
hv-kvp-daemon-init
E: Sub-process /usr/bin/dpkg returned an error code (1)
# sudo apt upgrade ... Setting up linux-cloud-tools-common (3.13.0-100.147) ... start: Job failed to start invoke-rc.d: initscript hv-kvp-daemon, action "start" failed. dpkg: error processing package linux-cloud-tools-common (--configure): subprocess installed post-installation script returned error exit status 1 ... Errors were encountered while processing: linux-cloud-tools-common linux-cloud-tools-3.13.0-100 linux-cloud-tools-3.13.0-100-generic linux-cloud-tools-virtual hv-kvp-daemon-init E: Sub-process /usr/bin/dpkg returned an error code (1)
# sudo apt upgrade 
...
Setting up linux-cloud-tools-common (3.13.0-100.147) ...
start: Job failed to start
invoke-rc.d: initscript hv-kvp-daemon, action "start" failed.
dpkg: error processing package linux-cloud-tools-common (--configure):
subprocess installed post-installation script returned error exit status 1
...
Errors were encountered while processing:
linux-cloud-tools-common
linux-cloud-tools-3.13.0-100
linux-cloud-tools-3.13.0-100-generic
linux-cloud-tools-virtual
hv-kvp-daemon-init
E: Sub-process /usr/bin/dpkg returned an error code (1)

The first thing I tried was running apt upgrade again. It showed that five packages are not fully installed.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
5 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
# sudo apt upgrade Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 5 not fully installed or removed. After this operation, 0 B of additional disk space will be used. Do you want to continue? [Y/n]
# sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
5 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]

And after confirmation, the same errors as listed above are generated again and the situation is unchanged.

Finding others with the same issue

​This is the point where I used Google to find out if others encountered the same error and if so, if they found a solution. At first I only found generic possible solutions that are applicable to every apt package issue. One that I tried is this  recommendation.

Instead, I followed a stack-overflow post (which I can’t find anymore):

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
sudo apt-get update
sudo apt-get clean
sudo apt-get autoremove
sudo apt-get update && sudo apt-get upgrade
sudo dpkg --configure -a
sudo apt-get install -f
sudo apt-get update sudo apt-get clean sudo apt-get autoremove sudo apt-get update && sudo apt-get upgrade sudo dpkg --configure -a sudo apt-get install -f
sudo apt-get update
sudo apt-get clean
sudo apt-get autoremove
sudo apt-get update && sudo apt-get upgrade
sudo dpkg --configure -a
sudo apt-get install -f

However, when running upgrade, configure and/or force install, the same error occurs: ‘initscript hv-kpv daemon, action “start” failed’, just like the first time.

Even completely removing and reinstalling the package with the following commands gave the same issue.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
apt-get --purge remove linux-cloud-tools-common
apt-get install linux-cloud-tools-common
apt-get --purge remove linux-cloud-tools-common apt-get install linux-cloud-tools-common
apt-get --purge remove linux-cloud-tools-common
apt-get install linux-cloud-tools-common

Direct cause

I found the following blog, which correctly found the issue to be with /etc/init/hv-kvp-daemon.conf. After installation the linux-cloud-tools-common package is configured by running this specific config file. On the last line it runs /usr/sbin/hv_kvp_daemon, however, this file does not exist.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# ls /usr/sbin/hv_kvp_daemon
ls: cannot access /usr/sbin/hv_kvp_daemon: No such file or directory
# ls /usr/sbin/hv_kvp_daemon ls: cannot access /usr/sbin/hv_kvp_daemon: No such file or directory
# ls /usr/sbin/hv_kvp_daemon
ls: cannot access /usr/sbin/hv_kvp_daemon: No such file or directory

The blog then suggests to simply not run the script by replacing the location to the script with /bin/true. This didn’t sound like a good suggestion to me, scripts are there for a reason (ok, maybe I’m a little naive). The blog also recommends to revert the config file afterwards, but this would only bring the issue back every time the linux-cloud-tools-common package is updated.

Looking for the file

I remembered that when upgrading a package, the previous configuration file is saved with an extra extension in the file name. So I went looking for such files.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# ls /usr/sbin/hv_kvp_daemon*
/usr/sbin/hv_kvp_daemon_3.2.0-67-virtual
/usr/sbin/hv_kvp_daemon.hv-kvp-daemon-init
# ls /usr/sbin/hv_kvp_daemon* /usr/sbin/hv_kvp_daemon_3.2.0-67-virtual /usr/sbin/hv_kvp_daemon.hv-kvp-daemon-init
# ls /usr/sbin/hv_kvp_daemon*
/usr/sbin/hv_kvp_daemon_3.2.0-67-virtual
/usr/sbin/hv_kvp_daemon.hv-kvp-daemon-init

The last modification date of the file hv_kvp_daemon_3.2.0-67-virtual was in 2014, which I believed to be too old to be applicable. However, the file hv_kvp_daemon.hv-kvp-daemon-init was actually installed at the same time as other files that begin with ‘hv_’, part of the same package. But this file was not listed in the packages file list, so I wasnt certain that this was the file that I was looking for.

On APT Browse, I found what the contents of /usr/sbin/hv_kvp_daemon should be (although it is not the lastest version), which seems to be the same as hv_kvp_daemon.hv-kvp-daemon-init.

Solution: so I made a symbolic link from hv_kvp_daemon.hv-kvp-daemon-init to hv_kvp_daemon, and when running apt upgrade the packages all updated correctly and everything was fully installed and fully up to date again.

After some thinking, I remembered that I recently upgraded the server. The underlying issue might have started by an earlier upgrade from Ubuntu 12.04 to 14.04 and only shown itself after the first update of linux-cloud-tools-common.

Note: after posting this article I found out that the solution had already been mentioned on this bug report, so much for thinking I was the awesome pioneer in this solution.

Een afspraak maken bij ons op kantoor of wil je even iemand spreken? Stuur ons een mail of geef een belletje.