3

How do I upgrade to a newer version of Ubuntu? does a great job of explaining how to do a version upgrade. It also says "Upgrading Ubuntu works 99 times out of 100" which has not been my experience - I've had issues about 6 out of 6 times (I don't blame Ubuntu - I think my messing with my installation without a deep understanding of what I'm doing creates atypical problems). So I always image my entire system before I attempt an upgrade. Then I attempt the upgrade, and if it doesn't go well and my attempts to resolve the issues fail, I restore the system back to where I started. All of which takes a fairly long time.

So I'm wondering if there is a way to simulate a version upgrade so I can find out if there are going to be trouble areas and potentially address them prior to the actual upgrade.

For example, on my current 14.04.3 installation, apt-get check and apt-get -f install report no issues. But after I performed an upgrade to 14.10 last night, 3 or 4 packages were broken and I couldn't resolve the conflicts. Is there a way, before attempting an upgrade, to see what's wrong with an installation that might cause a problem when upgrading?

I imagine this could be useful information even if one doesn't upgrade - these "hidden" issues might be causing stability or performance issues...

Ron
  • 20,638
  • Upgrading to 14.10 from an LTS release wasn't smart. 14.10 reached end of life, and is no longer supported. ...just a few more thoughts: upgrading may not work for reasons other then "something it wrong with an installation", a few broken packages is not catastrofic, and I rather doubt upgrading from 14.04.3 to 14.10 has ever been supported. – mikewhatever Aug 15 '15 at 18:56
  • A while ago I noticed a friend had never updated her iPhone and was still on some flavor of iOS 6. So I went to Settings/whatever on the iPhone, pressed "update", and it downloaded the latest iOS 8. Then it bricked her phone. So I asked a friend who works as an Apple "Genius" what I should do, and he said "That was dumb of you - I don't think Apple even supports upgrading to 8 from an OS that old." Same thing here. If it's not supported then it shouldn't be the ONLY version upgrade offered by the Software Updater app. It doesn't offer 15.04, it doesn't say "no", it just has "14.10". – Fred Hamilton Aug 15 '15 at 23:45
  • Too bad we do not live in an ideal world... – mikewhatever Aug 16 '15 at 21:37
  • ??? I'm not whining because products aren't perfect (of course they're not), I'm pointing out that it's unproductive to blame the user for choosing an option that is suggested or even being actively pushed for (in the iPhone example) by the software. – Fred Hamilton Aug 17 '15 at 02:31
  • ...but no one has blamed you, not sure why you feel the blame. – mikewhatever Aug 17 '15 at 17:12

2 Answers2

6

do-release-upgrade will carry out a release upgrade but do-release-upgrade doesn't have a dry run option. But, it does have a --sandbox option.

From the point of running in --sandbox mode, any changes made to your system will actually be written to a ramdisk, and reset upon reboot via the magic os Aufs. This lets you test your machine thoroughly in a fully functioning state, without risking breaking it.

From the original mailing list;

"The idea...was to create a writable overlay into /tmp on top the systemdirs in "/" and then run the release upgrade. This way we can test easily if the system would upgrade cleanly (if no dpkg errors/maintainer script failures happen). All writes go into /tmp so after the upgrade and on the next reboot the system is back to its pre-upgraded state again (modulo /home, that is not overlayed)."

For more information on this refer to the original mailing list or this post.

For dist-upgrades, you can use the --dry-run with sudo apt-get dist-upgrade to simulate running this command without actually performing the upgrade.

   -s, --simulate, --just-print, --dry-run, --recon, --no-act
       No action; perform a simulation of events that would occur but do not actually change the
       system. Configuration Item: APT::Get::Simulate.

       Simulate prints out a series of lines each one representing a dpkg operation, Configure (Conf),
       Remove (Remv), Unpack (Inst). Square brackets indicate broken packages with and empty set of
       square brackets meaning breaks that are of no consequence (rare).


   -u, --show-upgraded
       Show upgraded packages; Print out a list of all packages that are to be upgraded. Configuration
       Item: APT::Get::Show-Upgraded.
Ron
  • 20,638
  • 5
    Release Upgrade != dist-upgrade – heemayl Aug 15 '15 at 18:37
  • @heemayl thanks for pointing out. Edited my answer. – Ron Aug 15 '15 at 19:10
  • 2
    The --sandbox option is probably as close as we're gonna get, but IIRC most of my problems appeared after the post-upgrade reboot, which I wouldn't see with --sandbox. Appreciate the fast response. – Fred Hamilton Aug 16 '15 at 00:11
  • 1
    In case anyone comes across this in Dec 2016 or later, the --sandbox option does not work any more. https://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+bug/1605259 – Organic Marble Dec 19 '16 at 21:36
1

The do-release-upgrade script has a --sandbox option which performs the upgrade on an aufs overlay filesystem. This means that all changes are written to a separate filesystem overlaying the original files. Throw away the overlay and you are back with your original filesystem. Disclaimer: I don't have first hand experience with this feature.

Regardless of your approach, do make sure your pre-upgrade system is consistent. So run sudo apt-get update && sudo apt-get dist-upgrade and resolve any issues showing up before running do-release-upgrade.

zwets
  • 12,354
  • 1
    In the post 2020's... there is no longer a --sandbox option for do-release-upgrade. From everything I find you just back everything up and pray that it works. – beep_check Feb 02 '24 at 20:43