Advanced checks

Check log files

Check for errors and warnings

dmesg or dmesg -H for the kernel messages

dmesg | grep 'Error\|error\|Fail\|fail\|Warn\|warn\|not' to get something quick


Not every error is critical. As example the kernel tries to load firmware but fails since it does not find it on the location and produces an error. Then it tries an other location with success

Most of the log files are under /var/log. Using grep with error warn fail helps finding the problems quicker.

cat /var/log/messages | grep 'Error\|error\|Warn\|warn\|Fail\|fail\|not'

cat /var/log/Xorg.0.log | grep 'WW\|EE'

cat /var/log/user.log | grep 'Error\|error\|Warn\|warn\|Fail\|fail\|not'

To see the kernel messages and have them in a file dmesg > dmesg.txt

Instead of checking log files manually logcheck could be installed. The setup of logcheck is not easy since it requires other packages as ssmtp to send mail.

Check the disk health

Type dmesg | grep orphan to see if orphan i-nodes are around or cat /var/log/messages | grep orphan if such things have occurred.

To see info about your hard disk: tune2fs -l /dev/sda<n>

Check for clean status. If not unmount it (if possible) and e2fsck /dev/sda<n>

For FAT partition unmount them (when mounted the dirty but appears set) and run fsck.vfat <device> to see if the dirty bit is set.

Check dangling symlinks is a tool to find missing symlinks. It is quite a small nicely written c program so man symlinks gives probably all the documentation available (which is not bad). symlinks -r ~ checks dangling symlinks in the users home directory. It is also wise to run it just on certain directories, otherwise it takes too long and too much stuff will be found and added to the output. symlinks -r /lib should look quite clean, but symlink just claims that the links are absolute and symlink would prefer relative links. Checks on the root directory as the following should report mainly nothing:

symlinks -r /etc | grep dangling

symlinks -r /lib | grep dangling

Check init scripts

Emerge does not automatically install the init scripts located in /etc/init.d, this has to be manually using the rc-update command. Open two console windows ls -l /etc/init.d shows you what init scripts you have and rc-update -s (after typing su) shows you what is running. If you type it with the verbose option rc-update -sv all init scripts are shown also the not configured ones. Check out what the ones are that are not running and if you know what they are about install them when necessary. The command rc-status shows what is running.

Check old files

The package managers do good work, but the can just remove things that are known to them. If you install the kernel source and compile and then install a kernel, the package manager knows just bout the files of the source it does not know about the files produced during compilation and then what you installed.

Similar things happen with regular programs, when they run they produce files luckily in Linux there are some write restrictions so programs write this stuff often under ~/.<name of the program> a hidden directory in the users home directory. When you remove the program using the package manager some leftover remain.

There is no easy way to know about those files, one thing could be done find ~ -mtime +365 shows the files produced more than 1 year ago and find ~ -atime +365 the files accessed longer than one year ago. It is then up to you to decide if you want to delete them manually.

Check user accounts

Have the users the same UID numbers assigned among the different computers in the network?

Have the users the same primary GID assigned among the different computes in the network? /etc/passwd contains the the primary GID

Is the user added to its GID in /etc/groups

Clean user account

Programs save data in ~. If they are nice they save the data in a directory containing the program name. Since emerge is not aware of those files they remain after a package gets unmerged. Therefore deleting those directories manually makes sense. It can also happen that those directory contain incompatible data to contain a version conflict after an update. Files that should not be deleted since creating a fresh user account produces them are; .bash_logout, .bash_profile, .bashrc

Using Portage tools


Missing files or don't know who installed (emerge gentoolkit first)

equery belongs /usr/bin/<filename> to get the path whereis <filename>

equery belongs<filename-for-files-in-the-path>

equery depends<packet-name>

equery depgraph<packet-name>

Example: equery depgraph =clanlib-0.6.5-r4

equery files <packetname> lists files belonging to an ebuild

equery hasuse<useflag-name> files having used this use flag

equery uses <packetname> what use flags have been used.

Is as emerge -pv<packagename> but more verbose.


emerge portage-utils (faster because in c written but more limited than gentoolkit)

How to find a package to which a file belongs


or if you do not know where it is

qfile $(which<command>)

Listing packages which depend on some package

qdepends -a <packetname>

Listing files that belong to an ebuild

qlist vim

Looking for packages with the 'firefox' USE flag quse firefox or with description quse firefox -D

Linurs startpage