0

I was trying to fix a broken package (libnl-route-3-200) in Ubuntu 16.04. By mistake I did:

sudo apt-get remove libnl-3-200

And didn't realize the importance of Network Library.
Now, my Ubuntu system can't connect to the network.
I get the message:

The system network services are not compatible with this version Ubuntu.

How can I fix the system?

abu_bua
  • 11,313

2 Answers2

1

It seems that you are still able to access the internet, from some other device.

My advice in such a case would be to go to https://packages.ubuntu.com and search for the desired package for the desired ubuntu version. In your case (assuming amd64) this leads to this download link.

Download the file, (optionally but recomended: verify the fingerprint) and copy it to your computer by some means (e.g. flash drive), Finally to install the package run

sudo dpkg -i libnl-3-200_3.2.27-1ubuntu0.16.04.1_amd64.deb

The package is now manually installed, but I assume as soon as an update is available it will be replaced by newer version from the repositories.

mbeyss
  • 1,038
1

If apt removed that package, it would have also removed all packages that depend on it, which is a bigger issue.

First, I'd check /var/log/apt/history.log what actually got removed. There should be a section near the end of that file, with the date and time when you called apt, its command line and what packages were removed:

$ cat /var/log/apt/history.log

This format is a bit annoying to work with, so use:

$ sed -e 's/ ([^)]*)//g' -e 's/, / /g' /var/log/apt/history.log

This removes the version numbers and commas from the log file, for easier copy&paste.

For each of the packages listed in that block under Remove: or Purge:, add them to the command line of ①

# apt --print-uris install libnl-3-200

This will give you a list of URLs to download. Process this list by appending

| sed -ne "/http/s/'\([^']*\)'.*/\1/p"

to remove the quotes around the URLs and the file name and checksum, and redirect this into a file. The full command line should look similar to

# apt --print-uris install libnl-3-200 | sed -ne "/http/s/'\([^']*\)'.*/\1/p" >urls.txt

but with a bunch more packages.

Copy that file onto an USB stick, go to another machine and download these files, e.g. using wget:

$ wget -i urls.txt

Take the USB stick back to the original machine, copy the .deb files to /var/cache/apt/archives/:

# cp *.deb /var/cache/apt/archives/

Then, install by running apt as before under ①, but without the --print-uris option. It should pick up the files from the cache directory and install them.