# "my system is slower than it should be" Tip-Thread

## Jinidog

Hello,

many people are asking again and again why their system is too slow.

The first answers to such requests are nearly the same all the time and I never saw a generic thread about this topic here.

This is the reason why I want to collect possible reasons for a system being too slow, so that people can check them through, if they have problems.

Everyone is encouraged to post own suggestions here.

I'll start with the two tips, that are given most often:

Check for DMA-Mode

DMA means that data is transfered directly between RAM and harddisk without using the CPU too much.

A system is really slow when it doesn't work, what can happen if you hardware is too old, your chipset isn't supported or you have the wrong driver in your kernel.

To check for DMA-Mode, use this command:

hdparm -i /dev/hda

(if you want to check other disks, you have to change the part /dev/hda that it is fitting)

The command will print something out like:

 *Quote:*   

> 
> 
> /dev/hda:
> 
>  Model=ST3160023A, FwRev=3.06, SerialNo=3JS2C74Y
> ...

 

Important is the line 

 *Quote:*   

> 
> 
>  UDMA modes: udma0 udma1 udma2 udma3 udma4 *udma5
> 
> 

 

The * shows that I've UDMA5 enabled.

If you have the * two lines above beside one of the pio modes, your system has a good reason for being slow.

Checking your /etc/hosts if KDE is slow

The file /etc/hosts is used to resolve adressnames to IP-addresses.

If you are not working in a network, two lines are enough for a good configuration.

If they are missing or wrong, KDE needs long to resolve adresses, what can significantly slow down your Desktop.

Your /etc/hosts is okay when it looks like that:

```

127.0.0.1       localhost

192.168.2.4     name.domain     name

```

You can choose what you want for name and domain.

That's it from me, I hope many posts will follow.Last edited by Jinidog on Tue Jul 27, 2004 10:59 pm; edited 1 time in total

----------

## kaloyer

This is a good resource. Keep it up!  :Very Happy: 

My Tip:

Edit /etc/conf.d/rc

Edit the following line:

```

RC_PARALLEL_STARTUP="no"

```

change it to

```

RC_PARALLEL_STARTUP="yes"

```

that allows multiple services to start at once.

----------

## Jinidog

To the post above:

As I know parallel startup only works with processes that a started at bootime, but normally most of them are listed in the bootlevel default.

You can check this with the command rc-update -s .

Moving some processes in the boot-bootlevel helps, but it also might cause problems.

This is the (shortened) ut of my rc-update -s (and it works  :Smile:  ):

 *Quote:*   

> 
> 
>  acpid |
> 
>            alsasound | boot
> ...

 

Use prelink

Prelinking is a featuere that does something with your shared libraries.

I don't pretend to have completly understand it, but it links files together staticly, what normaly is done in runtime when you call a program.

So it CAN improve startup-times, but it needn't.

(indeed I never notice a speedup, but others does)

Prelinking is a possibilty to speed up, it won't help you if your system is slow because of misconfiguration.

For using prelinking read the guide in http://www.gentoo.org/doc/en/prelink-howto.xml .

----------

## Jinidog

Use 2.6 Kernels

When you system feels a little bit slow in responsetimes, it might help to switch to the 2.6 Kernel series. (if you haven't already)

Beside other features it uses a new (better) CPU-scheduler, which can split the CPU-power better between the tasks that has do be done.

A full occupied system was a little bit slow with drawing windows and menues when I used the 2.4 Kernel, after switching I never notice any slowdown in my normal work, even if there are several compiles running in the background.

Switching costs some time because you might have to reconfigure some parts of your system (perhaps alsa), but it's doable quite easy.

Just make sure that you compile in devfs and pty.

If you don't know what kernel to emerge, use the gentoo-dev-sources.

They are stable and are using the gentoo-patchsets, which give a good performance.

Kernel-Option

Check Preemptible Kernel in the processor-feature site of menuconfig. It should make the system running smother as it allows the kernel to stop system-calls and continue with them later. (this improves responsivness)

I have heard of this causing trouble, so keep a kernel backup.

Kernel-Option

Make sure that MTRR (Memory Type Range Register) support is checked in the processor-feature site of menuconfig.

I don't know what this does (somebody might explain) but it slows down your system if it is not checked.

I haven't heard of getting into trouble using this option.

bennettp was so nice to explain this option:

 *Quote:*   

> 
> 
> When used with your videocard, it allows multiple write operactions to be combined into one transfer, and then bursted over the agp (or pci) bus. 
> 
> Basically, it speeds up your graphics a lot (2.5x or more). In fact, IIRC, the nvidia kernel drivers fail to compile if this is not enabled. 
> ...

 

EVIL: Use your own CFLAGS for the kernel

Some guys might blame me for giving this tip, but I'm using it and haven't run into problems on four PCs.

Normaly the kernel is compiled with very conservative CFLAGS and the CFLAGS in the make.conf are ignored.

If you use the enviromnent-variable CFLAGS_KERNEL, you use your own CFLAGS.

Do that by typing in this command each time you compile your kernel:

 *Quote:*   

> export CFLAGS_KERNEL="<YOUR CFLAGS>"

 

Keep an update of your kernel ready for the case that this causes problems.

Little Helper

I've mentioned much about the kernel above.

If you have to compile the kernel often, then you will get tired of typing in the same commands over and over again.

The following command helps because it does things you normaly do with seperate commands. 

It will call make and copy the new kernel to /boot/vmlinuz.

Before that it makes a backup of the old vmlinuz (if there is one name like that) and saves it in boot with a timestamp appended to the filename.

 *Quote:*   

> 
> 
> make && make modules_install install

 

----------

## Jinidog

Make sure, that net.lo has started

This goes onto the same direction as checking your /etc/hosts.

If net.lo isn't started, it can slowdown KDE.

You can check with rc-update -s wether it is loaded at a runlevel.

If it is not, add it to one.

Make sure that iftables don't block

If you are working with iptables a misconfiguration can cause that packets send to net.lo are dropped.

This can make KDE very slow, too.

When you don't know, what iptables are, you probably haven't installed them.

They are a kernelfeature that supports routing and firewall-functions.

You can check if they are installed and loaded again with rc-update -s | grep iptables  .

CFLAGS

Again and again there is the topic about CFLAGS and CXXFLAGS.

CFLAGS are options that the compiler uses when it compiles a C-program (CXXFLAGS for C++).

The gcc-compiler supports various optimizations which you can access via CFLAGS.

I won't give any CFLAGS-recommandations here as it is a very difficult topic and is discussed again and again in this forum.

So, if you are new to this topic or want to know you did it right, search for your processor-typ together with CFLAGS.

You should get many hits.[/b]

----------

## Jinidog

Are there no other tips and tricks out there?

I hoped to read about some tricks I don't know.

If you know something but don't want to write an essay about it, send me a message with only a short description, I will post it in here as most understandable as I can make it.

----------

## bennettp

 *Jinidog wrote:*   

> 
> 
> Kernel-Option
> 
> Make sure that MTRR (Memory Type Range Register) support is checked in the processor-feature site of menuconfig.
> ...

 

When used with your videocard, it allows multiple write operactions to be combined into one transfer, and then bursted over the agp (or pci) bus.

Basically, it speeds up your graphics a lot (2.5x or more). In fact, IIRC, the nvidia kernel drivers fail to compile if this is not enabled.

see Documentation/mtrr.txt (in the kernel docs) for more info.

----------

## Kioshen

As for your little helper, it has been already impletented in the 2.6 kernel

```

make && make modules_install install
```

It will compile all that there is to do and will the current kernel as vmlinuz-<kernel-ver> and do a symlink as vmlinuz. If you have already this one up it will mv the old one as vmlinuz-xxx.old and make the new kernel as vmlinuz. It does the same thing for .config and System.Map.

----------

## radonsg

try running reiserfs or xfs instead of ext2/3 cos the former 2 offer better performance.

----------

## neurolabs

if you have slow startup times only under x, your font cache might be broken/missing. A simple call of fc-cache fixes this. In a normal setup this is done automatically though...

----------

## RealNitro

 *Jinidog wrote:*   

> Check for DMA-Mode
> 
> DMA means that data is transfered directly between RAM and harddisk without using the CPU too much.
> 
> A system is really slow when it doesn't work, what can happen if you hardware is too old, your chipset isn't supported or you have the wrong driver in your kernel.
> ...

 

What is the command for SCSI devices? I have a SATA hd, and I would like to see how fast it is. (chipset: ICH5, the hd is sda)

----------

## Jinidog

I'll collect your tricks and post it with your nickname in the first post.

Please post no questions here or start a long discussion, this blows up the thread so that nobody wants to read it in the end.

If you have questions, make a new thread somewhere else.

----------

## regeya

If you use ext3 and have large directories (or at least dirs with lots of small files)

```

tune2fs -O dir_index /dev/hdXX

```

This enables btree hash dirs, which gives a significant performance boost when dealing with large numbers of small files.

And if you want to go ahead and "optimize" your old directories on those ext3 partitions, umount the partition (you might need to boot from a LiveCD or something) and do:

```

fsck -fvDy /dev/hdXX

```

I've done it, and I lost the bug to switch to reiser.   :Cool: Last edited by regeya on Fri Jul 30, 2004 1:42 am; edited 1 time in total

----------

## Jinidog

Do you mind to explain, what your tip does?

----------

## MighMoS

Schedual cron jobs for a better time.  This one is for those late night freaks like me, who happen to be awake at 12:00 AM when the cron job would normally go off.  So I set my nightly jobs to go off at 4:00.  Edit /etc/crontab.

```
0  *  * * *     root    rm -f /var/spool/cron/lastrun/cron.hourly

1  4  * * *     root    rm -f /var/spool/cron/lastrun/cron.daily

15 4  * * 6     root    rm -f /var/spool/cron/lastrun/cron.weekly

30 4  1 * *     root    rm -f /var/spool/cron/lastrun/cron.monthly

*  *  * * *     root    test -x /usr/sbin/run-crons && /usr/sbin/run-crons

```

----------

## mike4148

 *Quote:*   

> What is the command for SCSI devices? I have a SATA hd, and I would like to see how fast it is. (chipset: ICH5, the hd is sda)

 

Same one. hdparm will test anything, but it only lets you tweak IDE HDs.

----------

## RealNitro

 *mike4148 wrote:*   

>  *Quote:*   What is the command for SCSI devices? I have a SATA hd, and I would like to see how fast it is. (chipset: ICH5, the hd is sda) 
> 
> Same one. hdparm will test anything, but it only lets you tweak IDE HDs.

 

```
root@dell jens # hdparm -d /dev/sda

 

/dev/sda:

 operation not supported on SCSI disks

root@dell jens # hdparm -I /dev/sda

 

/dev/sda:

 operation not supported on SCSI disks

root@dell jens # hdparm -Q /dev/sda

 

/dev/sda:

 operation not supported on SCSI disks

root@dell jens # hdparm -i /dev/sda

 

/dev/sda:

 operation not supported on SCSI disks
```

The only thing that gives me a result is:

```
root@dell jens # hdparm /dev/sda

 

/dev/sda:

 readonly     =  0 (off)

 geometry     = 14589/255/63, sectors = 234375000, start = 0

```

----------

## castorilo

I made a patch that improves boot times by avoiding running modules-update

Get it here

----------

## BlindSpy

1. Check /usr/portage/distfiles. You can delete everything in there as long as your not doing an emerge at the time.

2. Also, check out the cruft cleaner:

https://forums.gentoo.org/viewtopic.php?t=152618

That can clean your system up quite a bit too.

3. Something else I do to clean my system is '# emerge -av depclean' to clean up all the unneaded dependancies. After that run '# revdep-rebuild' to rebuild anything that depclean may have broken.

----------

## GenKreton

 *regeya wrote:*   

> If you use ext3 and have large directories (or at least dirs with lots of small files)
> 
> ```
> 
> tune2fs -O dir_index /dev/hdXX
> ...

 

This is an old thread but i recently stumbled across it and saw this trick posted.

Are there any reasons not to do this? I saw problems with corruptions in earlier kernels, are these all fixed now? Is there anything I should know before I try this?

----------

## ahubu

Well, I recently found out something NOT to do: changing your user nice value hard limit to -19. Reluctant to speed up my computer as I was, I was fiddling with these limits in /etc/security/limits.conf

```
myuser             soft    priority        -5

myuser             hard    priority        -19

```

Now, all your users processes will be started with priority -19, the highest. BAD THING, even a single browserclick will make movies stutter, games will slow down to a crawl (Americas army becomes unplayable, especially in the menus).

Anyway, what DID help was changing the hard priority back to 0, and soft to -19 (so you can make a process more important if you want to, not all the time):

```
myuser             soft    priority        -19

myuser             hard    priority        0

```

There, all responsive again  :Smile:  took me a while to figure it out as I changed the value a while ago and didn't immediately mention the slowdown. Anyway, the -19 soft setting is not standard, but I think it's very useful.

----------

## jamiethehutt

 *paulpach wrote:*   

> I made a patch that improves boot times by avoiding running modules-update
> 
> Get it here

 

Erm I'm a little stuck as to what to do with this patch, I'd love to use it as modules-update is a good few seconds on my otherwise fast boot but I'm not sure how to apply it. Have I missed some documentation some place that covers this?  :Embarassed: 

----------

## yngwin

Reiser4   :Razz: 

----------

## ahubu

If you find that emerge is getting slower (i.e. calculating dependencies), you might want to consider putting the portage tree on its own partition.

Anyway you probably have way too many packages installed!   :Twisted Evil: 

You als might want to check your worldfile for redundant packages (packages that already are dependancy of another package).

There are some great scripts for that actually.

----------

## z4Rilla

 *kaloyer wrote:*   

> This is a good resource. Keep it up! 
> 
> My Tip:
> 
> Edit /etc/conf.d/rc
> ...

 

doesnt work for me... eth0 tries to start twice

----------

## Dhaki

 *z4Rilla wrote:*   

> doesnt work for me... eth0 tries to start twice

 

Yes I've a problem me too with this option, this isn't safe   :Rolling Eyes: 

----------

## Jinidog

Oh, in fact it is quite useless anyway.

I read somewhere here, that the process are not really started parallel.

There was a patch for that, but it didn't work for me.

Sometimes perhaps the bootscripts will be updated, sometimes.

----------

## darkfolk

Don't install stuff you don't need

Use USE flags correctly to control that. If you want to compile something, and it tries to install KDE or something else not needed, look at /usr/portage/profiles/use.desc to see if there is a USE flag, then, for example, do this:

```

#/etc/make.conf

...

USE="bla blah blah... -kde"

```

----------

## Arkham

use NPTL threads (for the many "non Stage1" users)

only for 2.6 kernels

```

add "nptl" to the USE flags

emerge -C linuxheaders

emerge linuxheaders26

emerge glibc

```

have fun

What does this do? I'm not really sure, but after that, I had to glue my PC to the table   :Very Happy: 

?

----------

## gargan

I jsut checked out emerge -avp depclean..   basically to see the difference between the gentoo-own emerge cleaning and the dupecleaner I just upped (https://forums.gentoo.org/viewtopic.php?t=15032). I think the depclean is extremely dangerous... it actually wanted to remove my par2cmdline, hotplug, openoffice, and much more I use every single day.  I wonder how emerge comes to think these progs are useless? - 

nevertheless i was able to free quite a lot of space (about 2gigs/30 packages) which where complete useless because they were older versions of packages I have currently installed with the script from https://forums.gentoo.org/viewtopic.php?t=15032 (or http://www.gargan.org/linux/#mozTocId100001 ) ... oh and make sure you check out thi util https://forums.gentoo.org/viewtopic.php?t=260866 (cleaned some other packages for me...)

A little warning: ALL TOOLS MAY DAMAGE YOUR GENTOO BE CAREFUL! better you have some lost space than you ruin your whole system...

----------

## dhewton

 *BlindSpy wrote:*   

> 1. Check /usr/portage/distfiles. You can delete everything in there as long as your not doing an emerge at the time.
> 
> 2. Also, check out the cruft cleaner:
> 
> https://forums.gentoo.org/viewtopic.php?t=152618
> ...

 

I am of course an idiot.  I rean emerge -av depclean and stupidly assumed that the command revdep-rebuild would exist.  Where do I get this command?  I am terrified to turn my computer off for fear I have REALLY screwed it up.. My fault, but if you could pease assist me in this I would really appreciate it.

Thanks

Dan

----------

## ryceck

 *dhewton wrote:*   

>  *BlindSpy wrote:*   1. Check /usr/portage/distfiles. You can delete everything in there as long as your not doing an emerge at the time.
> 
> 2. Also, check out the cruft cleaner:
> 
> https://forums.gentoo.org/viewtopic.php?t=152618
> ...

 

emerge the gentoolkit package and then run revdep-rebuild  :Smile: 

----------

## dhewton

This is the error I get when I try to emerge the gentoolkit.  Should I start sweating?

Dan

>>> md5 src_uri  :Wink:  gentoolkit-0.2.0.tar.gz

install: error while loading shared libraries: libacl.so.1: cannot open shared object file: No such file or directory

!!! ERROR: app-portage/gentoolkit-0.2.0 failed.

!!! Function dyn_unpack, Line 678, Exitcode 127

!!! Failed to create dir '/var/tmp/portage/gentoolkit-0.2.0/work'

!!! If you need support, post the topmost build error, NOT this status message.

emerge the gentoolkit package and then run revdep-rebuild  :Smile: [/quote]

----------

## dhewton

In fact, now when ever I try to emerge ANYTHING this comes up.  Any help would be REALLY appreciated.

Thanks

Dan

quote="dhewton"]This is the error I get when I try to emerge the gentoolkit.  Should I start sweating?

Dan

>>> md5 src_uri  :Wink:  gentoolkit-0.2.0.tar.gz

install: error while loading shared libraries: libacl.so.1: cannot open shared object file: No such file or directory

!!! ERROR: app-portage/gentoolkit-0.2.0 failed.

!!! Function dyn_unpack, Line 678, Exitcode 127

!!! Failed to create dir '/var/tmp/portage/gentoolkit-0.2.0/work'

!!! If you need support, post the topmost build error, NOT this status message.

emerge the gentoolkit package and then run revdep-rebuild  :Smile: [/quote][/quote]

----------

## Phob

See that thread

https://forums.gentoo.org/viewtopic.php?t=281608&highlight=libacl

----------

## linux_girl

 *yngwin wrote:*   

> Reiser4  

 

yeah but how ? i was unable to find this in my kernel menuconfig (2.6.10)

sys-fs/reiser4progs was easy to merge but after u mkfs.reiser4 /dev/hdaXX how do u mount it ?

----------

## Jinidog

You need a patched kernel for that.

----------

## jamiethehutt

 *dhewton wrote:*   

> 
> 
> install: error while loading shared libraries: libacl.so.1: cannot open shared object file: No such file or directory

 

Basically you've removed an important library, and I think almost everyone has done this at least once.  Fire up the LiveCD and copy the missing libs across until you stop getting the error, then emerge acl and finally add "acl" to your USE flags so it's not removed again. 

Now why acl isn't in the default USE flags to begin with I have NO idea... :Wink: 

----------

## roger55

For your acl problem:

http://dev.gentoo.org/~avenj/bins/

holds binaries of important system packages that you may use to repair your system.

There is a README at that location that you should read and follow.

acl and probably attr are what you will probably have unmerged by that depclean.

once your system is repaired add acl to your USEflags in make.conf.

I hope this helps.

Regards 

roger55

----------

## lightvhawk0

I say try using the CFQ schedular in the kernel it made a huge difference for me i was emerging 6 things at once with very little slow down.

If xorg is alittle slow call fc-cache some times the font cache get messed up this will fix it most of the time.

----------

## COiN3D

How-to slightly improve 3D-Acceleration in games and/or X (NVIDIA-Cards)

First check what your current graphic card supports:

```
$ cat /proc/driver/nvidia/agp/host-bridge

Host Bridge:     PCI device 10de:01e0

Fast Writes:     Supported

SBA:             Supported

AGP Rates:       8x 4x 

Registers:       0x1f00421b:0x00000312
```

If "Fast Writes" is not supported, but you are sure that your motherboard supports it, this problem is probably caused by a wrong setting in the BIOS. So if necessarily, check your Motherboard's instruction and activate it then in your BIOS. After that, edit /etc/modules.d/nvidia to activate SBA and Fast Writes.

```
nano -w /etc/modules.d/nvidia && modules_update

uncomment this line: options nvidia NVreg_EnableAGPSBA=1 NVreg_EnableAGPFW=1
```

Now we will finally edit the xorg.conf file. Go then to the section "Device" and insert the following three lines:

```
    Option      "AGPMode" "8" 

    Option      "AGPFastWrite" "1" 

    Option      "NVAGP" "2"
```

The first option, "AGPMode", sets your graphic card to 8x AGP instead to 4x, which is default. The second option, "AGPFastWrite" is to play it safe that FastWrites will be used by your X-Server. I'll explain what the option "NVAGP" means in the next step.

NVAGP or AGPGART?

There are two different AGP-Drivers. First, there is NVAGP. It will be installed with the Nvidia-Graphics card driver. The second one, AGPGART, is the Kernel's native AGP Driver. Now you'll ask which of these ones is the faster one. But I don't know it  :Smile: . I tried both of them but my results were the same. In my opinion, I'd advise you to use the Kernel's AGP Driver, especially if you're often compiling the latest, high-patched kernel-sources. NVIDIA's NVAGP is known to (maybe) break then.

The option "NVAGP" accepts four values, these four values mean the following:

```
        Value                            Behavior

        -----------------------------    -----------------------------

        0                                disable agp

        1                                use NVIDIA's internal AGP

                                         support, if possible

        2                                use AGPGART, if possible

        3                                use any agp support (try

                                         AGPGART, then NVIDIA's AGP)

```

In my example on the top I'm using AGPGART. To be sure that the new options have been activated, kill your X-Server and reload your NVIDIA-Module.

```
# /etc/init.d/xdm stop && rmmod nvidia && modprobe nvidia
```

Afterwards start your X-Server again and type this line here into a terminal emulator of your choice to see if your system works with the new options.

```
cat /proc/driver/nvidia/agp/status

```

----------

