Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Howto: Simple tuning of Debian systems

Share your HowTo, Documentation, Tips and Tricks. Not for support questions!.
Message
Author
Lavene
Site admin
Site admin
Posts: 4958
Joined: 2006-01-04 04:26
Location: Oslo, Norway

Howto: Simple tuning of Debian systems

#1 Post by Lavene »

This HOWTO describes some simple and easy things you can do to 'tune' your Debian system. The methods described in this HOWTO is just some of several approaches one can use and does not claim neither to be the best nor the most effective way to tune your system, but contain things the author has found to be useful. Although the described method should be safe it's always a good idea to make a backup of important data before doing major changes to the system. This HOWTO is licensed under the terms of the GNU Free Documentation License. It has been written in the hope that it will be useful to the community but it comes with no warranty; use it at your own risk.

Assumptions:
This HOWTO assume you have the following:
Pure Debian.
Standard install of Stable or Testing.
(Most of this HOWTO will however apply to most Debian based systems)

Before you start:
A standard Debian install contains a huge number of packages in order to provide a good system for everyone. But for most users a lot of these packages will never be used and they end up just taking up space on your hard-drive. So if you have limited space on your HD, and you don't want to embark on a minimal reinstall, it is a good idea to remove the things you don't need. But before you start to randomly remove packages you should try to define what you actually use your system for. Then you should go through your menu taking notice of what applications you never use. Then it's time to prepare the leaning of your system. First make sure you have the latest package list:

Open a terminal, su to root (At the prompt type su, hit enter, type your root password, it enter), then:

Code: Select all

# apt-get update
It's also a good idea to make sure the systems database is up to date:

Code: Select all

# updatedb
Next you want to install the following tools (which may or may not be installed on your system already):

Code: Select all

# apt-get install deborphan rcconf synaptic
Slimming the system:
First we want to remove any unused locales and system documents in languages we don't use. The tool for that is 'Localepurge'. Note that when you install 'Localepurge' it will start right away:

Code: Select all

# apt-get install localepurge
Go through the configuration as you are prompted making sure to select the locales you want to KEEP. When done the program will remove the unnecessary files and report the amount of disc space freed. Note that localepurge will execute and remove any new locales that may be installed on your system in the future. Very handy...

Removing unwanted software:
Now we will start the one task that will have the most impact on our system; removing unwanted software. The perfect tool for this is the 'Synaptic' package manager. You can start it either from the menu or from the commandline, and when it's up and running, click the 'Status' button and select the 'installed' option. You then get a complete list, in alphabetical order, of the packages that is installed on our system. Left-click on an entry and select 'Mark for complete removal'. (This is the equivalent 'to apt-get remove –purge package').

Important!!
If the selected package has any dependencies it will present you with a list. READ IT CAREFULLY! Some packages that seem trivial has some very DANGEROUS dependencies like your kernel package, entire desktop environments or other necessities. If you don't know what all of the dependencies are, leave the package alone for now.


Now it's just a matter of going through the list of installed packages and marking the ones you want to remove. When you are all done you click the 'Apply' button, review the list presented by Synaptic and confirm by hitting 'Apply' again. It will then start the remove process. Please note that this process can take quite some time depending on the number of packages you remove.

When it's done, do an 'updatedb' again for good measure.

Orphaned libraries:
Orphaned libraries are libs that has no packages depending on them. Orphaned libs serves no purpose and can safely be removed. For details see deborphan's man page.

Code: Select all

# orphaner
Note that when done the first time around it may present you with another list of orphans. Just keep going until there are no more orphaned libs left.
A word of caution: If you have installed a lot of programs from source you should be a bit careful with this as it might break something since your system is not aware of these programs.

Memory:
Another limited resource is memory. Keeping as much available memory as possible means a faster, more efficient system. A standard install of pretty much every mainstream Linux distro installs deamons and services that runs constantly in the background, using valuable memory. But most users don't need all of the default services running so it's a good idea to only have what you need running. The tool of choice is

Code: Select all

# rcconf
It will give you a list of running services with the option to disable them. Since different systems has different things running I can't say what is needed or not. Check the man pages for each service to determine if you need it. The disabled services will stay in the list so it's easy to enable them again if you need to.

Virtual consoles (gettys):
Debian enables six virtual consoles as default but most people doesn't need that many. Unfortunately virtual consoles hog memory so it's a good thing to disable a few that you don't need. As root open the file /etc/inittab in your favorite editor, then look for:
# Note that on most Debian systems tty7 is used by the X Window System,
# so if you want to add more getty's go ahead but skip tty7 if you run X.
#
1:2345:respawn:/sbin/getty 38400 tty1
2:23:respawn:/sbin/getty 38400 tty2
3:23:respawn:/sbin/getty 38400 tty3
# 4:23:respawn:/sbin/getty 38400 tty4
# 5:23:respawn:/sbin/getty 38400 tty5
# 6:23:respawn:/sbin/getty 38400 tty6
Add a # in the beginning of the ones you want to disable, starting with the highest one. This is called “comment out” and make the system ignore what comes after the #. In the above example getty 4, 5 and 6 is disabled. Don't forget to save it when you are done (did you remember to back up the original?)

The Kernel:
The kernels provided by Debian comes with a lot of options enabled. A very good way to save a few bytes is to recompile it with only the things you need enabled. See http://forums.debian.net/viewtopic.php?t=4468 for a kernel compile howto.

Desktop Environment:
If you really need to run a light system it might be a good idea to drop the big desktop environments like KDE or GNOME and opt for a lighter Window Manager. A good place to 'shop' for a WM is http://www.xwinman.org/. Don't be afraid of trying some of them out. They will usually happily coexist with KDE and/ or GNOME and take up almost no space at all on your harddrive. And a bonus is that playing around with various window managers is great fun.

Enjoy
Tina

PS: Got a neat trick on increasing system efficiency? Add to the thread! :)

User avatar
Lux
Posts: 474
Joined: 2006-01-25 13:00
Location: Finland

#2 Post by Lux »

More simple tuning (for PCs with i686 CPU or better):
-- Install hdparm and make sure that dma is enabled for your hd and cdrom/dvd drive(s).
-- Install libc6-i686.
-- Install prelink, edit /etc/default/prelink, and run (as root) "prelink -a".
-- Install the i686-optimized linux-image (or roll your own kernel from source; in menuconfig go to "Processor type and features" and select a processor family that matches your CPU; install x86info if you don't know your processor type; other interesting menuconfig settings under the same category are "Preemption model" and "Timer frequency").
-- Run "dpkg-reconfigure dash" and use dash as /bin/sh.
-- If you use ext3, check out "man tune2fs" and see if you find some of the following commands useful:

Code: Select all

tune2fs -o journal_data_writeback /dev/your_partition
tune2fs -O dir_index /dev/your_partition
tune2fs -m 0 /dev/your_partition
tune2fs -c 50 /dev/your_partition
-- Afterwards, the "data=writeback" journal mode can be set for ext3 in /etc/fstab, like this:

Code: Select all

/dev/hda1    /    ext3    rw,noatime,data=writeback    0    1
-- Most users will find that disabling IPv6 makes Firefox faster -- type "about:config" in Firefox's address bar, scroll down to "network.dns.disableIPv6" and right-click it to toggle the value.
"Hit the philistines three times over the head with the Elisp reference manual."
-- Michael A. Petonic --

Grifter
Posts: 1554
Joined: 2006-05-04 07:53
Location: Svea Rike

#3 Post by Grifter »

If you run a daemon for something that doesn't generate much traffic, but which you still require (such as a private ftp), start them from inetd instead of running as a daemon, that way they only use resources when someone connects
Eagles may soar, but weasels don't get sucked into jet engines...

User avatar
bluesdog
Posts: 2077
Joined: 2006-02-01 09:02
Location: Similkameen, British Columbia, Canada
Been thanked: 1 time

#4 Post by bluesdog »

If you do not require famd, (File Alteration Monitor Daemon), disable or remove it from your system.

If you ever had trouble unmounting cds, or if some applications seemed to run very sluggishly, or not at all, after/during other disk-intensive ops, check top to see what system resources are being used by fam

On my system, fam was consuming nearly 90% after running Azureus for a while, and wouldn't release the resources even after stopping Azureus!

User avatar
osmo
Posts: 55
Joined: 2006-03-15 14:40
Location: Finland

#5 Post by osmo »

For "Removing unwanted software" I'd recommend using aptitude always when installing and removing packages as it takes note whether a package was installed to satisfy a dependency or if you specified to install that package.

With aptitude you could then review your unautomatically installed packages with

Code: Select all

$ aptitude search . | egrep ^i.[^A]
That should be a lot less than all your installed packages. Remove what you don't need and their no longer used dependencies will be removed as well.

Lavene
Site admin
Site admin
Posts: 4958
Joined: 2006-01-04 04:26
Location: Oslo, Norway

#6 Post by Lavene »

bluesdog wrote:On my system, fam was consuming nearly 90% after running Azureus for a while, and wouldn't release the resources even after stopping Azureus!
To be honest, 'fam' is a real piece of sh*t and the developers seem unable to do anything about it. As an example, here's a few of the outstanding bugreports. Yes they are duplicates but it's a good indication of the level of frustration this package causes:
  • #331413: fam: can't unmount cdrom
    #252896: fam uses 100% of CPU
    #298576: famd busy-looping
    #303108: famd takes over my CPU!
    #304558: famd 100% cpu usage
    #376507: fam seems to loop, causes freeze of system after a while
A real shame.

Tina

User avatar
DeanLinkous
Posts: 1570
Joined: 2006-06-04 15:28

#7 Post by DeanLinkous »

I havent noticed any problems with gamin....
fam sucks
gamin good
or
fam sucks
gamin sucks less?

Lavene
Site admin
Site admin
Posts: 4958
Joined: 2006-01-04 04:26
Location: Oslo, Norway

#8 Post by Lavene »

I did run into a similar problem with gamin a while back when I was using Kanotix but I don't know what caused it back then...

Tina

User avatar
garrincha
Posts: 2335
Joined: 2006-06-02 16:38

#9 Post by garrincha »

Here is another tip - this one is for freeing up disk space under Debian GNU/Linux especially for old PC with low Gigs of memories. I use Etch/Testing, so I presumed that it should be similar for others.

Remove the cached .deb files
When you run the apt-get command, it downloads and caches the package in the /var/cache/apt/archives directory. If you apt-get a lot of stuffs, these .deb binaries will eat up a lot of disk space.

Type (as root) in the terminal:

Code: Select all

# cd /var/cache/apt/archives
# du –ch
Output:

Code: Select all

8.0K    ./partial
832M    .
832M    total
Remove all the *.deb files:

Code: Select all

# rm –f *.deb
et voila! You will get as much space as possible back!

Lavene
Site admin
Site admin
Posts: 4958
Joined: 2006-01-04 04:26
Location: Oslo, Norway

#10 Post by Lavene »

garrincha wrote:Here is another tip - this one is for freeing up disk space under Debian GNU/Linux especially for old PC with low Gigs of memories. I use Etch/Testing, so I presumed that it should be similar for others.
<snip snip>
Actually apt-get already has this covered:

Code: Select all

apt-get clean
For more info:

Code: Select all

man apt-get
Tina :)

User avatar
garrincha
Posts: 2335
Joined: 2006-06-02 16:38

#11 Post by garrincha »

Ah, how could I forget about "apt-get clean"! It was a while since I read the man page on apt-get. :)

Yeah, it does the job as I mentioned in my post above. moreover there the man page has useful info.

User avatar
garrincha
Posts: 2335
Joined: 2006-06-02 16:38

#12 Post by garrincha »

A question.

I just checked my Synaptic Package Manager, there are packages in the installed (local or absolute) status section.

I'm wondering whether it is safe to completely remove some of the packages there? Most of these are libraries and I do not really know much about these.
Maurice Green on Usain Bolt's 9.58: "The Earth stopped for a second, and he went to Mars."

Lavene
Site admin
Site admin
Posts: 4958
Joined: 2006-01-04 04:26
Location: Oslo, Norway

#13 Post by Lavene »

It's usually a bad idea to remove stuff you don't know what is ;)
To take care of the libs you don't need you have the 'deborphan' package. See my OP for details. But just quickly:

Code: Select all

# apt-get install deborphan
then

Code: Select all

# orphaner
It will delete all orphaned libs on your system. The rest of them you probably want to keep :)

Tina

mikekgr
Posts: 56
Joined: 2004-12-24 18:25
Location: Greece

#14 Post by mikekgr »

Dear All,

I found this "speed up" tips a very nice add on on my Debian system. Thanks a lot

Best Regards,
Mike Kranidis

User avatar
craigevil
Posts: 5391
Joined: 2006-09-17 03:17
Location: heaven
Has thanked: 28 times
Been thanked: 39 times

#15 Post by craigevil »

Running prelink as # /usr/sbin/prelink -avmR and then setting up a prelink cron job seems a better way to go then just prelink -a.

1. use apt-get or synaptic to install prelink
2. Open /etc/default/prelink with your favorite editor, as sudo/root
3. Change PRELINKING=unknown from unknown to yes
4. Adjust the other options if you know what the heck you're doing. Defaults work well
5. To start the first prelink run as root prelink -avmR(the longest one!),then run su/sudo /etc/cron.daily/prelink

Is there a way that libc6-i686 won't be seen as an orphan?

Debian Reference - Tuning a Debian system
hdparm

* Hard disk access optimization. Very effective.
* Dangerous. You must read hdparm(8) first.
* hdparm -tT /dev/hda to test disk access speed.
* hdparm -q -c3 -d1 -u1 -m16 /dev/hda to speed up a modern IDE system. (It may be dangerous.)
Use rcconf or sysv-rc-conf to edit when services start. The few things that run at boot that you do not really need the fast your system will boot.

Adding this line MOZ_DISABLE_PANGO=1 to /etc/environment supposedly speeds up Mozilla Firefox.
Last edited by craigevil on 2007-03-12 15:38, edited 2 times in total.
Raspberry PI 400 Distro: Raspberry Pi OS Base: Debian Sid Kernel: 5.15.69-v8+ aarch64 DE: MATE Ram 4GB
Debian - "If you can't apt install something, it isn't useful or doesn't exist"
My Giant Sources.list

User avatar
canci
Global Moderator
Global Moderator
Posts: 2502
Joined: 2006-09-24 11:28
Has thanked: 136 times
Been thanked: 136 times

#16 Post by canci »

Nice howto! :)

I have a li'l tip here. Wanna reduce the overhead while starting up X?
Maybe this tool helps:

http://www.hacom.nl/~richard/software/xtoolwait.html

It makes proggies added to your .xsession wait until an acutally loading
prog is consuming memory. This way the startup should be faster.
Instructions are on the site...
Image Stable / Asus VivoBook X421DA / AMD Ryzen 7 3700U / Radeon Vega Mobile Gfx (Picasso) / 8 GB RAM / 512GB NVMe

READ THIS:

* How to Post a Thread Here
* Other Tips and Great Resources

Swynndla
Posts: 58
Joined: 2007-08-15 22:52
Location: New Zealand

#17 Post by Swynndla »

I did some timing tests with prelink, and it did not seem to speed anything up (at least for me), so I removed it again.

What I did was, I booted up, and ran in konsole:

Code: Select all

(konqueror &) && (kcontrol &) && (kprinter &) && (kinfocenter &) && (xterm &) && (kate &) && (kwrite &) && (iceweasel &) && (oowriter &)
... and timed how long everything took to open.

Then I rebooted to clear the memory, and apt-got prelink, and ran /usr/sbin/prelink -avmR, and then ran the same command as above again, but everything took just as long to open up.

User avatar
craigevil
Posts: 5391
Joined: 2006-09-17 03:17
Location: heaven
Has thanked: 28 times
Been thanked: 39 times

#18 Post by craigevil »

Unfortunately deborphan doesn't play nice with Sid.

Gentoo Linux Prelink Guide
http://www.gentoo.org/doc/en/prelink-howto.xml

Although written for Gentoo most of what is there seems to work well and not cause any issues in Debian.

A decent guide for tweaking a Sid system , other than the deborphan part, (which really needs to be edited out), is:
System tweaking
http://sidux.com/index.php?module=pnWikka&tag=Tweaking

Prelinking along with preload and AND seem to keep things running nice as smooth.
Raspberry PI 400 Distro: Raspberry Pi OS Base: Debian Sid Kernel: 5.15.69-v8+ aarch64 DE: MATE Ram 4GB
Debian - "If you can't apt install something, it isn't useful or doesn't exist"
My Giant Sources.list

User avatar
rickh
Posts: 3434
Joined: 2006-06-29 02:13
Location: Albuquerque, NM USA

#19 Post by rickh »

Unfortunately deborphan doesn't play nice with Sid.
Hmmm! I've never heard that, and I do use it every now and then (deborphan | xargs dpkg --purge). Guess I'll study it a little more before I do it again.
Debian-Lenny/Sid 32/64
Desktop: Generic Core 2 Duo, EVGA 680i, Nvidia
Laptop: Generic Intel SIS/AC97

User avatar
craigevil
Posts: 5391
Joined: 2006-09-17 03:17
Location: heaven
Has thanked: 28 times
Been thanked: 39 times

#20 Post by craigevil »

Code: Select all

craigevil:/home/craig# deborphan
libpqxx-2.6.8
kdelibs
libexif-gtk5
libcurl4-openssl
libflac++5
libpoppler0c2-qt
libstlport5.1
libcdaudio1
libgpod1
libboost-filesystem1.33.1
libsdl-sound1.2
libbind9-0
libnotify1
libmpeg3-1
libcrypto++6
libsvnqt3
libsnmp9
libxapian13
gstreamer0.10-gnomevfs
libkpathsea4
libpanel-applet2-0
plib1.8.4c2
libotr2
libgd2-noxpm
libpostproc0d
libxt-java
libgnome-desktop-2
liblwres9
libjasper-1.701-1
libmagick++9c2a
libmetacity0
gstreamer0.10-fluendo-mp3
libgtksourceview1.0-0
libarts1-audiofile
libcal3d11c2a
libxul0d
libode0c2
libmyspell3c2
libdb4.2
libgail17
libiw28
liboggflac3
libpostproccvs51
libavformat0d
libept0
libx264-54
libmcrypt4
libgksu1.2-0
libglu1-xorg
guile-1.6-libs
libnautilus-burn4
libnautilus-burn3
libzvbi0
libmdbtools
libc6-i686
libdvdnav4
libkexif1
libqt4-qt3support
guile-1.8-libs
libk9copy0
libgdl-1-0
libexiv2-0.10
libwnck18
libid3-3.8.3c2a
libaldmb1
libgksuui1.0-1
libwine-twain
libarts1-xine
Probably 90% of the above belong to packages that I have installed and use.
Raspberry PI 400 Distro: Raspberry Pi OS Base: Debian Sid Kernel: 5.15.69-v8+ aarch64 DE: MATE Ram 4GB
Debian - "If you can't apt install something, it isn't useful or doesn't exist"
My Giant Sources.list

Post Reply