1

I'm running Ubuntu 12.04 on DigitalOcean server.

I would like to upgrade it to later releases (12.04->14.04->16.04), but fail to do so due to the mentioned mistake. DigitalOcean provides a tutorial for upgrade, but it is not helpful because it doesn't explain how to solve the issue. I've also tried all answers in similar questions, that use command line. The problem is essentially the same as here and here:

"An unresolvable problem occurred while calculating the upgrade: E:Unable to correct problems, you have held broken packages. This can be caused by:
* Upgrading to a pre-release version of Ubuntu
* Running the current pre-release version of Ubuntu
* Unofficial software packages not provided by Ubuntu"
  • I have no ppa added
  • I didn't add any extra sources to /etc/apt/sources.list. But I must mention that there are listed only DigitalOcean mirrors, no ubuntu default servers.
  • I have > 900 packages listed as broken in /var/log/dist-upgrade/apt.log. (It seems like they all are broken)
  • I tried these commands (in proper order) apt-get update, apt-get upgrade, apt-get dist-upgrade, apt-get --purge autoremove, apt-get autoclean, apt-get purge $(dpkg -l | awk '/^rc/ { print $2 }'), etc that are listed in answers to similar questions, but they do nothing as they think everything is OK.

Do you have any more suggestions on how to fix the problem?

UPDATE: I thought an issue with DigitalOcean servers in sources.list might be an issue, so I changed them to original Ubuntu ones. Now I get only 2 errors in apt.log:

ERROR getting the encoding failed
Traceback (most recent call last):
  File "/tmp/update-manager-cwZhf2/DistUpgrade/DistUpgradeView.py", line 40, in <module>
    locale.setlocale(locale.LC_ALL, "")
  File "/usr/lib/python2.7/locale.py", line 539, in setlocale
    return _setlocale(category, locale)
Error: unsupported locale setting
ERROR Dist-upgrade failed: 'E:Unable to correct problems, you have held broken packages.

I don't know if locale error causes it. I tried to fix it by exporting LANG, LANGUAGE and LC_ALL to "en_US.utf8", but didn't help. I will try to fix it and update the question if it helps.

UPDATE 2: Output of locale command:

$locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8

UPDATE 3: After setting locale to "C" (thanks to Gunnar Hjalmarsson), the locale error is gone from apt.log, but invoking do-release-upgrade still the leads to error:

DEBUG /openCache(), new cache size 47033
DEBUG need_server_mode(): can not find a desktop meta package or key deps, running in server mode
DEBUG Installing 'locales' (priority in required set 'required' but not scheduled for install)
ERROR Dist-upgrade failed: 'E:Unable to correct problems, you have held broken packages.'

and still no upgrade.

  • Can you run the locale command and show us the output by editing the question. – Gunnar Hjalmarsson Jul 18 '16 at 16:56
  • @GunnarHjalmarsson, updated the question with locale output – rightaway717 Jul 18 '16 at 17:01
  • You need to generate the locale: sudo locale-gen en_US.UTF-8 – Gunnar Hjalmarsson Jul 18 '16 at 17:12
  • @GunnarHjalmarsson, yes, I tried it, but I've got another error - locale-gen is missing. SO I tried to install it, but it gives error: locales : Depends: libc6 (>= 2.9-0ubuntu10) but it is not going to be installed or libc6.1 (>= 2.9-0ubuntu10) but it is not installable. So now I'm solving this issue. It also bothers me, whether this exact error prevents me from upgrading. Otherwise I would solve the issue, but this won't help. – rightaway717 Jul 18 '16 at 17:15
  • locale-gen is a script belonging to the locales package. Isn't locales installed?? – Gunnar Hjalmarsson Jul 18 '16 at 17:17
  • @GunnarHjalmarsson, no, it is not installed. Hence in the previous comment I posted the error that pops up when installing locales by "apt-get install locales" – rightaway717 Jul 18 '16 at 17:18
  • This is weird. Maybe: sudo update-locale LANG=C LC_ALL=C (and a relogin/reboot). – Gunnar Hjalmarsson Jul 18 '16 at 17:22
  • Sorry, update-locale is also a script in the locales package. So my suggestion is that you again edit /etc/default/locale manually and change LANG and LC_ALL to C. – Gunnar Hjalmarsson Jul 18 '16 at 17:33
  • @GunnarHjalmarsson thank you for the help. "locale" error is gone, though this didn't solve the upgrade issue. Please see update #3 – rightaway717 Jul 18 '16 at 17:34
  • Which command results in that error message? – Gunnar Hjalmarsson Jul 18 '16 at 17:36
  • @GunnarHjalmarsson do-release-upgrade command fails. I check apt.log for details – rightaway717 Jul 18 '16 at 17:40
  • You may want to check out the file /etc/update-manager/release-upgrades. Is there a line Prompt=lts? – Gunnar Hjalmarsson Jul 18 '16 at 17:51
  • @GunnarHjalmarsson yes, there is Prompt=lts. I also issued dpkg --get-selections | grep hold and it outputs: linux-image-3.8.0-29-generic hold – rightaway717 Jul 18 '16 at 17:55
  • Missed your latest edit. Seems that you must have locales. You'd better keep trying to install it. Try by installing the dependencies it complains about individually. – Gunnar Hjalmarsson Jul 18 '16 at 17:56
  • One last thing: It also seems to complain because the ubuntu-desktop meta package is missing. – Gunnar Hjalmarsson Jul 18 '16 at 18:23
  • @GunnarHjalmarsson, thank you for your help once more! I really appreciate it. I was able to finally solve it by installing locales using aptitude. Compared to apt it suggested several solutions, that helped me install locales and after that system upgrade ran smoothly. Will not use apt any longer. If you make an answer from our discussion, I will accept it. – rightaway717 Jul 18 '16 at 21:29

1 Answers1

1

Summary of long discussion in comments:

do-release-upgrade failed to run because the locales package was not present. So the solution was to install locales, which is a required package.

The OP handled a dependency problem when attempting to install locales via apt-get install by using aptitude instead, which suggested solutions rather than just refusing to install.

Gunnar Hjalmarsson
  • 33,540
  • 3
  • 64
  • 94