The trick is "# emerge -auDN --newrepo @world". The '--newrepo' option is crucial.
Update 19 Oct 2017:
The command above works for more than 1000 packages I have installed, except the qt* packages. For these stubborn qt* packages I had to do the following:
emerge -Cav "dev-qt/qt*"
* This action can remove important packages! In order to be safer, use
* `emerge -pv --depclean <atom>` to check for reverse dependencies before
* removing packages.
>>> These are the packages that would be unmerged:
... truncated for clarity ...
All selected packages: =dev-qt/qtwidgets-5.7.1 =dev-qt/qtgui-4.8.7 =dev-qt/qtcore-5.9.2 =dev-qt/qtwebchannel-5.7.1 =dev-qt/qtpositioning-5.9.2 =dev-qt/qtopengl-4.8.7 =dev-qt/qtcore-4.8.7-r2 =dev-qt/qtwebengine-5.7.1-r2 =dev-qt/qtgui-5.7.1 =dev-qt/qtsql-5.9.2 =dev-qt/qtprintsupport-5.7.1 =dev-qt/qtdeclarative-5.7.1 =
dev-qt/qtxmlpatterns-5.9.2 =dev-qt/qtdbus-5.9.2 =dev-qt/qtsvg-4.8.7 =dev-qt/qtopengl-5.7.1 =dev-qt/qtxml-5.9.2 =dev-qt/qttranslations-4.8.7 =dev-qt/qtdbus-4.8.7 =dev-qt/qtchooser-0_p20170803 =dev-qt/qtwebkit-5.7.1 =dev-qt/qttest-5.9.2 =dev-qt/qtnetwork-5.9.2 =dev-qt/qtsvg-5.7.1 =dev-qt/qtscript-4.8.7 =dev-qt/qtconcu
>>> 'Selected' packages are slated for removal.
>>> 'Protected' and 'omitted' packages will not be removed.
Would you like to unmerge these packages? [Yes/No] Yes
Next, run this command:
# Here I have renamed the /usr/portage directory for backup
emerge -av @preserved-rebuild
Hey all, welcome to the new forums! Our old forum software has been upgraded to the latest version and I'm going to be working hard to help make this a really great resource for everyone.
Our "Funtoo Universe" section is set up in a traditional forum style, and "Help Central" is now in a Q&A-style mode. Let me know how you like the Q&A style mode. Both sets of forums allow you to tag posts as being answered and we have the ability to flag the best answer.
This does the trick:
euse -E pulseaudio # enable pulseaudio feature globally
# to be sure I also installed alsa-oss. Don't have time to check if it is really necessary.
emerge -auDN @world # update and recompile all packages that uses pulseaudio
# reboot and run alsamixer to make sure pulseaudio is unmuted.