Ubuntu – Can you *simulate* an upgrade from one Ubuntu version to the next

dependenciespackage-managementupgrade

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…

Best Answer

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.