1

I downloaded a fresh copy of ubuntu 18.04.2 installation disc (yes I did the md5 checksum of the image before making the bootable USB disk).

I then installed it on an old laptop.

I had an old installation of 14.04 on it, but I formatted the / partition (but not /home /opt/ partition), so there was no old libraries or binaries around, and install the new ubuntu 18.04 on the formatted / partition, but then mounted the old /home and /opt. Pretty standard stuff. When installing, I chose "download all updates" after installing, which I take is just doing apt-get update && apt-get dist-upgrade.

I then boot into the new installation. I did a

apt-get update
apt-get install build-essential

The following packages have unmet dependencies:
build-essential : Depends: gcc (>= 4:7.2) but it is not going to be installed
Depends: g++ (>= 4:7.2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

This is a fresh installation and I could not install build essential! aptitude install build-essential throw up some none-sense errors like this

Depends: gcc-8-base (= 8-20180414-1ubuntu2) but 8.2.0-1ubuntu2~18.04 is installed

Not to be daunted, I tried a simpler fare:

apt-get install gcc
Depends: gcc-7 (>= 7.3.0-12~) but it is not going to be 

installed E: Unable to correct problems, you have held broken packages.

But of course, I have gcc-8 installed!

aptitude install gcc
libtsan0 : Depends: gcc-8-base (= 8-20180414-1ubuntu2) but 8.2.0-1ubuntu2~18.04 is installed
liblsan0 : Depends: gcc-8-base (= 8-20180414-1ubuntu2) but 8.2.0-1ubuntu2~18.04 is installed
libatomic1 : Depends: gcc-8-base (= 8-20180414-1ubuntu2) but 8.2.0-1ubuntu2~18.04 is installed

I tried to install the basic numerical package lapack

aptitude install liblapack3
libquadmath0 : Depends: gcc-8-base (= 8-20180414-1ubuntu2) but 8.2.0-1ubuntu2~18.04 is installed

There must be something really broken in ubuntu's end. My /etc/apt/sources.list is pristine, and has only these lines not commented off:

deb http://archive.ubuntu.com/ubuntu bionic main restricted
deb http://archive.ubuntu.com/ubuntu bionic universe
deb http://archive.ubuntu.com/ubuntu bionic multiverse
deb http://archive.ubuntu.com/ubuntu bionic partner

I've been using Ubuntu as my primary os for over 14 years, since 5.04 days, but never seen anything like this before. I thought by doing a fresh installation (rather than upgrade) on a LTS version would be relatively safe...

Any help would be greatly appreciated by this very confused user.

j-money
  • 2,382

2 Answers2

0

Try this:

sudo apt-get update to update your package list. Then

sudo apt-get autoclean to clean up any partial packages. Then

sudo apt-get clean to clean up the apt cache.

sudo apt-get autoremove will clean up any unneeded dependencies.

If while doing this you can identify the broken package this code will very forcefully remove it.

sudo dpkg --remove -force --force-remove-reinstreq build-essential

source

Cody
  • 364
  • 1
  • 3
  • 12
0

Well, I figure out my own mistake. The problem is my /etc/apt/sources.list Somehow when I was trying editing the settings, the bionic-updates section got commented out! Now I restored them and did an apt-get update &apt-get upgrade and everything is fine now. I can install all the build-essentials just fine.