0

I am trying to install qemu-kvm on my VMware with Ubuntu 16.04 x64 bit.
While trying to do so with this command: apt-get install qemu-kvm, it failed with the following errors:

root@ubuntu:~/Desktop/# apt-get install qemu-kvm 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 qemu-kvm : Depends: qemu-common (>= 1.0+noroms-0ubuntu14.31) but it is not going to be installed
            Depends: qemu-utils (>= 1.0+noroms-0ubuntu14.31) but it is not going to be installed
            Depends: upstart-job
E: Unable to correct problems, you have held broken packages.

I tried the solution from this forum but they didn't help:

sudo sed -i s/pk.archive.ubuntu.com/archive.ubuntu.com/ /etc/apt/sources.list
sudo apt-get update

These are the sources installed on my system:

root@ubuntu:~/Desktop/# grep -n "^[^#]" /etc/apt/sources.list{,.d/*}

/etc/apt/sources.list:6:deb http://us.archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse 
/etc/apt/sources.list:7:deb-src http://us.archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse 

/etc/apt/sources.list:10:deb http://us.archive.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse 
/etc/apt/sources.list:11:deb http://us.archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse 
/etc/apt/sources.list:12:deb http://us.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse 
/etc/apt/sources.list:13:deb-src http://us.archive.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse 
/etc/apt/sources.list:14:deb-src http://us.archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse 
/etc/apt/sources.list:15:deb-src http://us.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse 

/etc/apt/sources.list:18:deb http://archive.canonical.com/ubuntu precise partner
/etc/apt/sources.list:19:deb-src http://archive.canonical.com/ubuntu precise partner

/etc/apt/sources.list:22:deb http://extras.ubuntu.com/ubuntu precise main
/etc/apt/sources.list:23:deb-src http://extras.ubuntu.com/ubuntu precise main
/etc/apt/sources.list.d/docker.list:1:deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial edge
/etc/apt/sources.list.d/kubernetes.list:1:deb https://apt.kubernetes.io/ kubernetes-xenial main
/etc/apt/sources.list.d/notepadqq-team-ubuntu-notepadqq-xenial.list:1:deb http://ppa.launchpad.net/notepadqq-team/notepadqq/ubuntu xenial main
/etc/apt/sources.list.d/sublime-text.list:1:deb https://download.sublimetext.com/ apt/stable/

This is my OS (VMware Ubuntu 16.04 x64 bit) information:

Linux ubuntu 4.15.0-45-generic #48~16.04.1-Ubuntu SMP Tue Jan 29 18:03:48 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux  

EDIT:
comparing to @Christian Ehrhardt answer.

root@ubuntu:~/Desktop# apt-cache policy qemu-kvm qemu-common qemu-utils
qemu-kvm:
  Installed: (none)
  Candidate: 1.0+noroms-0ubuntu14.31
  Version table:
     1.0+noroms-0ubuntu14.31 500
        500 http://us.archive.ubuntu.com/ubuntu precise-security/main amd64 Packages
        500 http://us.archive.ubuntu.com/ubuntu precise-updates/main amd64 Packages
     1.0+noroms-0ubuntu13 500
        500 http://us.archive.ubuntu.com/ubuntu precise/main amd64 Packages
qemu-common:
  Installed: (none)
  Candidate: 1.0+noroms-0ubuntu14.31
  Version table:
     1.0+noroms-0ubuntu14.31 500
        500 http://us.archive.ubuntu.com/ubuntu precise-security/main amd64 Packages
        500 http://us.archive.ubuntu.com/ubuntu precise-security/main i386 Packages
        500 http://us.archive.ubuntu.com/ubuntu precise-updates/main amd64 Packages
        500 http://us.archive.ubuntu.com/ubuntu precise-updates/main i386 Packages
     1.0+noroms-0ubuntu13 500
        500 http://us.archive.ubuntu.com/ubuntu precise/main amd64 Packages
        500 http://us.archive.ubuntu.com/ubuntu precise/main i386 Packages
qemu-utils:
  Installed: 1:2.5+dfsg-5ubuntu10.34
  Candidate: 1:2.5+dfsg-5ubuntu10.34
  Version table:
 *** 1:2.5+dfsg-5ubuntu10.34 100
        100 /var/lib/dpkg/status
     1.0+noroms-0ubuntu14.31 500
        500 http://us.archive.ubuntu.com/ubuntu precise-security/main amd64 Packages
        500 http://us.archive.ubuntu.com/ubuntu precise-updates/main amd64 Packages
     1.0+noroms-0ubuntu13 500
        500 http://us.archive.ubuntu.com/ubuntu precise/main amd64 Packages

Checking the upstart-job:

root@ubuntu:~/Desktop# apt-cache show upstart | grep '^Prov'
Provides: startup-tasks, system-services, upstart-compat-sysv, upstart-job
Provides: startup-tasks, system-services, upstart-compat-sysv, upstart-job
Provides: startup-tasks, system-services, upstart-compat-sysv, upstart-job
E235
  • 153
  • 1
    Most of your sources seem to be for 12.04 instead of 16.04. I don't see the minimum 16.04 sources (like xenial-security) on there. The packages proposed for install are 12.04 (not 16.04). – user535733 Mar 17 '19 at 15:26
  • @user535733 I have 16.04. ```root@ubuntu:~/Desktop/# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 16.04.5 LTS Release: 16.04 Codename: xenial
    
    
    – E235 Mar 18 '19 at 09:02
  • Can you try installing the listed to be failing components one by one? Sometimes that reveals the offending package/constraint, like apt install qemu-common=1.0+noroms-0ubuntu14.31 (Note: the reporter already found that in his case qemu-utils was the troublemaker) – Christian Ehrhardt Mar 19 '19 at 06:29

1 Answers1

0

As @user535733 already said you seem to have a mix of versions in your apt repositories. Although all I see there are extra PPAs with Xenial, but those might drag in dependencies killing you right now as they are built against Xenial.

The qemu-kvm in precise would be 1.0+noroms-0ubuntu14.31 and is depending on qemu-common/qemu-utils on just the versions you see. But there should be nothing blocking them.

You can check the versions available to your apt by checking apt-cache policy. On a current precise that should look like:

apt-cache policy qemu-kvm qemu-common qemu-utils
qemu-kvm:
  Installed: (none)
  Candidate: 1.0+noroms-0ubuntu14.31
  Version table:
     1.0+noroms-0ubuntu14.31 0
        500 http://archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ precise-security/main amd64 Packages
     1.0+noroms-0ubuntu13 0
        500 http://archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
qemu-common:
  Installed: (none)
  Candidate: 1.0+noroms-0ubuntu14.31
  Version table:
     1.0+noroms-0ubuntu14.31 0
        500 http://archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ precise-security/main amd64 Packages
     1.0+noroms-0ubuntu13 0
        500 http://archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
qemu-utils:
  Installed: (none)
  Candidate: 1.0+noroms-0ubuntu14.31
  Version table:
     1.0+noroms-0ubuntu14.31 0
        500 http://archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ precise-security/main amd64 Packages
     1.0+noroms-0ubuntu13 0
        500 http://archive.ubuntu.com/ubuntu/ precise/main amd64 Packages

Finally upstart-job is provided by the package upstart:

apt-cache show upstart | grep '^Prov'
Provides: startup-tasks, system-services, upstart-compat-sysv, upstart-job

That currently is on 1.5-0ubuntu7.3 btw.

You can compare your system to the above to check what/why it is different to resolve that.

  • After I remove with apt autoremove the qemu-utils. I had some networking problems that I figured out later and fixed them.Reinstall again qemu-utils and then I was able to install qemu-kvm. – E235 Mar 18 '19 at 12:41
  • Ok so it was the hard selected older qemu-utils then that was held by something we don't know - glad you resolved your case. – Christian Ehrhardt Mar 19 '19 at 06:30
  • I think if someone encounters this error "“The following packages have unmet dependencies”, he should check that networking is OK (ping 8.8.8.8 and google.com) and also to check that the source.list file is configured correctly and if not, he should follow the steps here: https://askubuntu.com/questions/124017/how-do-i-restore-the-default-repositories/124024#124024 which are basically generating a new source.list file (based on this site: https://repogen.simplylinux.ch/). – E235 Mar 19 '19 at 07:36