Make sure the system has the right time, since compiling and linking depends on the date and time of the files: Type date
If the time is set wrong, then sooner or later problems occur with no obvious reason. Checkout the time chapter. Many of the following tasks are supported by the program genservice. See: http://www.linurs.org/genservice.html
Before doing the big compilation work, check if you are using newest gcc compiler gcc-config -l and that a gcc profile is selected.
emerge --sync
/etc/make.profile
does it point to the newest profile?
(read gentoo upgrade
guide for updating it). /usr/portage/profiles
is where the profiles are. Where:
eselect profile list shows all profiles available and
eselect profile set <number>
lets change (update) to an other profile
emerge --update --deep world --pretend to see if you have blockages
Check for comments and follow them as emerge -u portage
emerge --update --deep world after that it is wise to read all the warnings and info that it is summarized and put on the screen after having the last ebuild merged.
emerge @live-rebuild for the live ebuilds since once emerged they are frozen regarding future updates. Or make it more clever and update them just if something has changed smart-live-rebuild
If /etc/portage/make.conf
is configured to save the elog (and this is strongly recommended) read the post install messages and consider to do what is reported. The post install messages are summarized on the screen when emerge finishes. If you do not have a gui, the elogs can be read in /var/log/portage/elog
. Using mc is a good tool for that on the side on the left the files are listed and on the left side the quick view shows the content. elogv is a text based tool for it and a graphical tool is elogviewer.
To check if some news got emerged: eselect news list. If you have something eselect news read 1 and to delete all the ones eselect news purge
Check /usr/src
or eselect kernel list for latest kernel source and verify it type uname -r in the console.
To update the kernel go to the kernel
compilation section.
Check perl using perl-cleaner --all or perl-cleaner --reallyall
/etc/portage/package.keywords
holds packages that got installed when they were not stable. As time goes by they might be stable or even
outdated. Therefore it is always wise to put packages with their version number into
/etc/portage/package.keywords
.
As an example the following entry uses a not stable version:
=media-tv/mtvg-6.2.18-r1 ~x86
So check what you have installed, if newer wipe out the above. If no version number is present then check what you have installed and define a range up to the installed version:
<=media-tv/xmltv-0.5.50 ~x86
/etc/portage/package.mask
holds the packages where
you have decided to not install them. In meantime they might be outdated by newer version and therefore this
file should be cleaned. It is wise to just mask certain versions.
/etc/portage/package.unmask
holds packages that are
hard masked and you have unmasked them. Verify if they are still hard masked and unmask them.
To do it automatically emerge portpeek and then run portpeek -arf. If it complains about some files not found, then check if those files are really missing and do something as touch /etc/portage/package.accept_keywords
Check also /etc/conf.d/modules
some of your modules loaded there might now be delivered (as staging drivers or be now stable) within the kernel source.
Backup your data. This is best done to have the data consistent on different PC and an external hard disk. To have the data consistent between all those devices emerge unison.
Store the data to a DVD or CD using tools as k3b is an other option. Unfortunately backup-ed data might become corrupt after some years. CD and DVD's should retain the data for a couple of 10 years and a Hard disk might crash after 10 years. It will be a frustrating moment when you have a hard disk crash and you take the backup thinking you are save but then you notice that the backup is corrupt.
Therefore verify your backup (e.g once a year). After making some tests with:
To verify the data on DVD's and CD's emerge dvdisaster.
To check the data on a hard disk diff (or the graphical diffuse) and cmp can be used.
It is also advisable that you
backup important configuration data as /var/lib/portage/world
, this file holds all ebuilds that you have emerged. The program genservice
can be configured to backup the
important files. See: http://www.linurs.org/genservice.html .
If the disk is full, a crash happens and some data is lost. Therefore be aware about your disk and try to move movies and disk images of virtual PC away from the partition where your work and system resides!
To see how the space is used on the disk use a disk usage analyzer as baobab coming with gnome or filelight or to find the big ones df -T if you are in text mode (when run as root all files are visible otherwise just the ones where you have access). To get size of directories use du :
du -s ~ to see how big is your home directory in kBytes
du -sb ~ to see how big it is in Bytes (1 kByte=1024 Bytes)
Clean data from updates.
Manually delete the files in /usr/portage/distfiles/
or /var/cache/distfiles
and /usr/portage/packages/
is not recommended, since errors could be made easily and it is not obvious what files belong to what ebuild. Additionally under some desktop environments it will
end up in the roots trash bin and therefore not visible.
Use eclean distfiles or eclean packages to delete old files where no ebuild exist anymore (emerge gentoolkit first) or use eclean --destructive distfiles or simply eclean -d distfiles to delete all distfiles except the ones installed (Respectively eclean --destructive packages or eclean -d packages ).
man eclean shows that there are alternative calls for eclean:
eclean-dist, eclean-pkg, eclean -dist or eclean -pkg
Remove old kernel stuff
Kernel sources are slotted packages, so all kind of versions get collected in
/usr/src
. Old kernels get removed during updates as any other packages, however the directories and all files created during compilation remain under /usr/src
. This is also true for the modules
found in /lib/modules
.
If you check with eselect kernel list then not the installed kernel sources pop up but as stated, the existing symlinks to the kernel source directories. Some of them have the source files removed, but the files created during kernel compilation are still there. Those directories are pretty useless, so you can remove them including their modules. To be save run uname -a to see what kernel you use.
To know what kernel sources are installed do: equery list gentoo-sources
Clean up /boot
. To not end up with just one kernel that does not boot, leave more than one kernel there.
In case of having grub legacy update /boot/grub/grub.conf
accordingly.
There is also emerge eclean-kernel that could do it automatically.
Delete no more used python site-packages in /usr/lib/python<n.m>
.
If no emerge command runs, further check the directory: /var/tmp/portage
. It can contain leftovers that emerge did not clean, probably due to emerge errors, so clean it manually.
The logfiles in /var/log/messages
might get huge. So install and use logrotate to limit the size automatically by performing periodic backups as gz files. Under Gentoo the file /etc/cron.daily/logrotate
calls it periodically
Alternatively deleting them manually. Otherwise delete the logs directly manually.
If you run a desktop environment than the trash bin might be full. So remove files from trash bin.
GUI's have trash bins and those can getting full. Also root and the different users have their garbage, you might have to delete it from a shell, since delete via GUI might move garbage around but does not destroy it. For example if you do a lot of kernels, your trash on your boot partition accumulates. As regular user you will not see a full trash that belongs to the root. Use the console or mc for getting rid of it.
Programs add hidden directories in /home/
to save persistent data.
Check if such directories from programs that have been removed still exist and delete them. Sometimes it is also wise to delete them since incompatibilities with old versions can exist and the those directories will be reproduced when the program is re-started.<user>
/.<name of the program>
Just delete directories where you are sure what they are for.
Since your Linux installation is GPL, it consist of many small pieces that all have versions and depend from each other. Usually emerge and its ebuilds handle those very complex situation very well.
/var/lib/portage/world
=> list of all packets that you have manually installed (hopefully intentionally installed). Therefore check if you know all the packages there. See the world file section for details.
To check /var/lib/portage/world
emaint -c world. Or do all checks: emaint -c all.
If it fails with IOError: [Errno 2] No such file or directory: '/usr/portage/packages/Packages'
do
mkdir /usr/portage/packages
To allow emaint to fix the things
emaint -f all
To check the consistency of your installation run first:
emerge --update --deep --newuse world
Or the more complete command (@word means that world is a set and not a single package)
emerge --update --newuse --deep --with-bdeps=y @world
then run:
emerge --depclean --pretend
check what it wants to remove. If it wants to remove something that you like to keep, add them to /var/lib/portage/world
either via regular
editor or
emerge --noreplace <package-name>
and re-check again. Then do the
emerge --depclean
and check if some other packages need to be re-emerged: emerge @preserved-rebuild
Once there was from emerge gentoolkit the program revdep-rebuild that served for similar things.
The file /etc/portage/make.conf
holds useflags set by the user that differ from the default ones. When the installation is old, the number of use flags get longer and longer. And finally many useflags might no more be needed and can be removed. euses <useflag>
shows what packages could use them and emerge -s <package>
shows if those packages are installed.