Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I started up with a pre-installed OS having this sources.list file:

deb http://archive.ubuntu.com/ubuntu natty main

deb http://ro.archive.ubuntu.com/ubuntu/ oneiric universe
deb-src http://ro.archive.ubuntu.com/ubuntu/ oneiric universe
deb http://ro.archive.ubuntu.com/ubuntu/ oneiric-updates universe
deb-src http://ro.archive.ubuntu.com/ubuntu/ oneiric-updates universe

And I'm trying to upgrade it to this:

###### Ubuntu Main Repos
deb http://ro.archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse 
deb-src http://ro.archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse 

###### Ubuntu Update Repos
deb http://ro.archive.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse 
deb http://ro.archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse 
deb-src http://ro.archive.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse 
deb-src http://ro.archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse

But when I try to run apt-get upgrade it gives me this:

root@syrius:/etc/apt# apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
 libc-dev-bin : Depends: libc6 (> 2.15) but 2.13-20ubuntu5.2 is installed
 libc6 : Depends: libc-bin (= 2.13-20ubuntu5.2)
 libc6-dev : Depends: libc6 (= 2.15-0ubuntu10.4) but 2.13-20ubuntu5.2 is installed
 libnih-dbus1 : Depends: libnih1 (= 1.0.3-4ubuntu9.1) but 1.0.3-4ubuntu2 is installed
E: Unmet dependencies. Try using -f.

And if I try running apt-get -f install, I get the following message:

root@syrius:/etc/apt# apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  nagios-images nagios3-core nagios3-cgi nagios3-common
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  libc6 libnih1
Suggested packages:
  glibc-doc
The following packages will be upgraded:
  libc6 libnih1
2 upgraded, 0 newly installed, 0 to remove and 611 not upgraded.
4 not fully installed or removed.
Need to get 0 B/4708 kB of archives.
After this operation, 58.4 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
locale: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.15' not found (required by locale)
locale: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.14' not found (required by locale)
debconf: DbDriver "config": could not open /var/cache/debconf/config.dat
(Reading database ... 121436 files and directories currently installed.)
Preparing to replace libc6 2.13-20ubuntu5.2 (using .../libc6_2.15-0ubuntu10.4_amd64.deb) ...
locale: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.15' not found (required by locale)
locale: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.14' not found (required by locale)
debconf: DbDriver "config": could not open /var/cache/debconf/config.dat
dpkg: error processing /var/cache/apt/archives/libc6_2.15-0ubuntu10.4_amd64.deb (--unpack):
 subprocess new pre-installation script returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/libc6_2.15-0ubuntu10.4_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I cannot afford reinstalling the server from scratch. Can anyone help me making it work?

Thanks a lot in advance.

Sept. 8 Update:

root@localhost:/etc/apt# cat /etc/debian_version
wheezy/sid
root@localhost:/etc/apt# lsb_release -ac
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 11.10
Release:    11.10
Codename:   oneiric
root@localhost:/etc/apt# cat /etc/issue.net
Ubuntu 11.1

Updated sources list back to

deb http://old-releases.ubuntu.com/ubuntu natty main
deb http://old-releases.ubuntu.com/ubuntu/ oneiric universe
deb-src http://old-releases.ubuntu.com/ubuntu/ oneiric universe
deb http://old-releases.ubuntu.com/ubuntu/ oneiric-updates universe
deb-src http://old-releases.ubuntu.com/ubuntu/ oneiric-updates universe

Ran: http://pastebin.com/3Z2GZ347 (@admins: I do not have reputation to post links => apt-get update has links and even in tag they're taken in consideration)

Still can't get rid of this error. Should I create the pinning file myself?

share|improve this question
    
Please, stop mixing the natty with the oneiric. That sources.list is TOTALLY WRONG, DO NOT USE IT, follow my guide and your sources.list should look like this. Follow my guide at the letter and don't modify your sources.list at hand! –  Braiam Sep 8 '13 at 20:23
add comment

2 Answers

You appear to be attempting to upgrade Ubuntu from one release to another by manually editing sources.list and running apt-get commands. Please don't do that, especially if it's important to you to be able to upgrade successfully without having to reinstall. That technique is the recommended way to upgrade a Debian system (though not quite the way you did it), but it is neither supported nor likely to work for an Ubuntu system.

Fortunately, nothing much appears to have happened when you tried to upgrade. So you system is probably not broken, and can probably still be upgraded the right way.

The right way to upgrade from one release of Ubuntu to another is to run sudo do-release-upgrade. But there are some things that have to be taken care of first in your case.

Consider making a backup.

If you're unwilling to reinstall, you should back up first.

If you're just hoping to avoid reinstalling, then you should just reinstall, because your system could have problems that you don't know about until they appear when you're using it for some important task (see below).

But if you're hoping to avoid reinstalling (but willing to do so) and this system will not be used for anything important, then whether or not you do a full backup first will be determined by whether or not it's worth it to you to take the extra effort of making a backup, to avoid the effort of reinstalling.

Reinstalling from scratch is really not much effort. But backing up is pretty straightforward too.

(Once you've been using a server for some important purpose, then it's usually a very good idea to make a backup before attempting an upgrade to a subsequent release, and to keep regular backups anyway.)

Fix sources.list to represent the currently installed system.

First, edit /etc/apt/sources.list back to being a correct description of the currently installed system.

How to do this is a bit unclear, as it's not clear what system is currently installed. Is it Natty or Oneiric? The pre-existing sources.list file was inconsistent (i.e., wrong). If you know what release it really was, great--make all the release codenames in sources.list point to that release.

Otherwise, you'll have to figure it out. If what you showed wasn't the full sources.list file, please provide that. It should fit in your question, or you can use http://paste.ubuntu.com.

Running lsb_release -a often tells you the release that is currently installed. But with an inconsistent sources.list file, all bets are off--if the packages that provide the files used by lsb_release are from a different Ubuntu release than other packages installed in the system, then the system might not really be running the version of Ubuntu lsb_release reports. Or it might not be running any single well-defined version of Ubuntu.

Therefore--and I know you don't want to hear this: Unless you introduced the Precise/Oneiric inconsistency yourself, you really should just do a fresh install, especially if you want to use this server for anything important where unpredicted, random failures would be a problem.

But, we can try to work with this situation, if you really want to. There will still be no way to know if something is deeply wrong that will cause problems later, of course, even if everything seems like it has spectacularly succeeded. That's generally the case when you get a server from someone else, and its configuration is messed up.

libc6 is a really important package. (I'd be mentioning this even if it didn't come up in the output of some of the commands you ran.) Another heuristic you can use to figure out what version of Ubuntu is really installed is to check the version of the libc6 package (apt-cache policy libc6) and see what version of Ubuntu it corresponds to. (Searching the web with it is often the best way to figure this out, if it's not necessarily up to date, but you can check it against the version information here.)

Once you've figured out what the currently installed system actually is--and feel free to ask for more help with that and/or post more information in your question that might be relevant too it--then edit sources.list and change all the version codenames to that release's codename.

So every natty, oneiric, precise, or any other version codename will be changed to natty if you've decided the current system is 11.04, or to oneiric if you've decided it's 11.10.

Use the old-releases repositories.

Now that you've fixed the version information in your sources.list file, you have to change the download servers in it to old-releases.ubuntu.com. This is necessary because both Natty and Oneiric are end-of-life releases. (Precise is not, so getting there is a good goal, though I still recommend considering a fresh installation.)

For details on how to switch to the old-releases server, see:

But really you're just going to replace the hostnames in the server URLs in sources.list (the part between http:// and the next / with old-releases.ubuntu.com).

Update your system within its current release, as much as possible.

An upgrade may be more likely to succeed if your system is as fully upgraded as possible within its own release before you attempt upgrading to the next release.

The other benefit of trying to install updates is that if it fails, it may reveal information about problems that are much more easily fixed than if they were discovered while attempting an upgrade to a different release.

So, run:

sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get dist-upgrade

Note that dist-upgrade does not attempt to upgrade to a new release. (In Debian, you can edit your sources.list file and run apt-get dist-upgrade. But this is not Debian; that does not usually work in Ubuntu.)

It may prompt you to install new packages or remove existing ones, though. (That's the difference between upgrade and dist-upgrade.) So be careful--pay attention to what it's asking before you press y.

Try upgrading to the next release.

Upgrades between Ubuntu releases are only supported (and only likely to work):

  • From a (normal or LTS) release to the next release.
  • From an LTS release to the next LTS release.

Neither 11.04 nor 11.10 are LTS releases. So 11.04 Natty can only be upgraded to 11.10 Oneiric, and 11.10 Oneric can only be upgraded to 12.04 LTS Precise.

Therefore, if your system is Natty rather than Oneiric, then you'll need to do this twice.

To attempt the upgrade, run:

sudo do-release-upgrade

That's it. No manual editing of configuration files.

In the unusual event that the do-release-upgrade utility is not installed, you can install it with:

sudo apt-get install update-manager-core

(On 12.10 Quantal and later it's provided by ubuntu-release-upgrader-core, in case someone using a recent release wonders why update-manager-core is the wrong package.)

If you have problems, feel free to edit your question or post a new question (depending on whether or not they seem related to the topic of this question--they probably are). Of course, other people with problems with this should post or edit their own questions. Also you may want to comment on this answer so I can hear about the problems and try to help.

If it works, great! Then:

  • If you just upgraded from Oneiric to Precise, you're done!

  • If you just upgraded from Natty to Oneiric, then attempt do-release-upgrade again. But first, I recommend that you:

    1. Reboot. (sudo reboot) New software like the kernel will be used. You can troubleshoot problems before upgrading, and the next upgrade will be conducted on a system that is fully running the version being upgraded from.
    2. It's probably best to the previous major step ("Update your system within its current release"), then upgrade, just as you did before.
share|improve this answer
    
Please see my last comment. I cannot make a clean reinstall unfortunately. Thank you a lot for your help. –  Dragos Cirjan Sep 8 '13 at 16:38
    
@DragosCirjan please check my answer. –  Braiam Sep 8 '13 at 18:24
add comment

TL;dr: Never ever, modify your sources.list file to upgrade Ubuntu. There are helpers for that (update-manager, do-release-upgrade, etc.). Ubuntu is not a rolling release like Debian. In Debian you can switch from one version to the next just changing the target release, in Ubuntu, not. Now you have a system that is not one version nor the other, and has to employ the following solution:

Ok, since Eliah answer seems too long and complicated, lets try a straight forward:

  1. Lets check what version of Ubuntu you have:

    $ cat /etc/debian_version
    natty
    $ lsb_release -ac
    natty
    $ cat /etc/issue.net
    natty
    $ cat /etc/debian_version
    natty
    

    When running every command that start with $ returns natty, then your version is natty, if it returns oneiric then your version is oneiric if returns a mixture of natty and oneiric then the safest choice is that your system is natty.

  2. Once you are sure which is your version run the following:

    UBUNTU_VERSION="natty"
    

    You should replace natty here with the result of the previous test!

  3. Lets deactivate the old sources.list:

    sudo rename 's/\.list$/\.list\.disable/' /etc/apt/sources.list.d/*.list
    sudo mv /etc/apt/sources.list /etc/apt/sources.list.old
    
  4. Now lets create the good sources.list

    sudo sh -c "echo 'deb http://old-releases.ubuntu.com/ubuntu' $UBUNTU_VERSION 'main universe multiverse restricted' >> /etc/apt/sources.list"
    sudo sh -c "echo 'deb http://old-releases.ubuntu.com/ubuntu' $UBUNTU_VERSION'-updates main universe multiverse restricted' >> /etc/apt/sources.list"
    
  5. Lets downgrade any upgraded packages that isn't of our version of linux

    sudo sh -c "echo 'Package: *' >> /etc/apt/preference.d/pinning"
    sudo sh -c "echo 'Pin: release a='$UBUNTU_VERSION" >> /etc/apt/preference.d/pinning"
    sudo sh -c "echo 'Pin-Priority: 1990' >> /etc/apt/preference.d/pinning"
    sudo apt-get update
    sudo apt-get -f upgrade
    sudo apt-get -t $UBUNTU_VERSION upgrade
    
  6. Now we install and run the upgrade helper:

    sudo apt-get upgrade
    sudo apt-get -y install update-manager-core
    sudo rm /etc/apt/preference.d/pinning
    sudo do-release-upgrade -m server
    

    Only the last command will require your prompt. Please, do copy paste for each command except the first, in which you specify your version of Ubuntu.

share|improve this answer
    
@EliahKagan for that I included every way (that I'm aware of) to know the correct release. If he gets a mixed results then the bet is using the most old version. –  Braiam Sep 8 '13 at 18:40
    
You're right; I did not pay proper attention! Sorry about that. You might consider adding checks for what version provides some important packages (but as you can see, my attempt to do so in my answer was not very easily followed ...maybe a command to parse the output of apt-cache policy ... ...). –  Eliah Kagan Sep 8 '13 at 18:43
1  
@EliahKagan if we part of his libc6 version, he has oneiric. Who knows if the kernel has been upgraded, or base-system. If he had physical access to the server, it would be the best. Or if he can ask Technical Support for doing themself the upgrade. I don't know the circumstances, but if I found myself in that situation, that is what I would do. –  Braiam Sep 8 '13 at 19:01
    
Hello Briam, I can't get rid of the damn libc6 error. Please read my main post update. –  Dragos Cirjan Sep 8 '13 at 19:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.