Comment 26 for bug 424643

I found a useful workaround for this bug, at least for my purposes (adding and installing desktops cleanly).

You can start out (on a clean build) by marking everything as automatically installed, then mark your choice of manual packages afterward, checking that everything you want is retained as expected. In my case it looked like this. To mark all current 'manually installed' packages as automatic (don't leave your packages this way, else the next apt-get autoremove will wipe your system) run the following command...

aptitude --display-format '%p' search '~i!~M' | xargs -n100 sudo apt-mark auto

...and after a few iterations of...

sudo apt-get --simulate autoremove

...I verified I could use the following command to retain everything in my Ubuntu Precise system which was installed at the time. The command simply lists a few packages and metapackages to be set as manually installed, causing everything else which they depend upon to be retained.

sudo apt-mark manual ubuntu-desktop ubuntu-standard ubuntu-minimal language-pack-en-base language-pack-gnome-en language-pack-gnome-en-base libreoffice-help-en-gb thunderbird-locale-en-gb thunderbird-locale-en-us libreoffice-gnome libidl0 liborbit2 linux-headers-generic-pae hyphen-en-us installation-report linux-generic-pae mythes-en-au openoffice.org-hyphenation libreoffice-l10n-en-za linux-firmware-nonfree ubuntu-restricted-extras arduino geany gparted chromium-browser google-earth-stable google-chrome-stable synaptic

This includes some elective packages which I had installed beyond the ubuntu-desktop, (all the ones after libreoffice-l10n-en-za) and it may be that there's a better 'dependency tree' than this, especially given how many localisation packages seem to be explicitly set, but it's good enough for me. I now recognise everything in the manually installed status list in Synaptic, and can work from here to the system I explicitly want.