Saturday, March 24, 2007

Tweaking Ubuntu Xubuntu

Got it from

http://tvease.net/wiki/index.php?title=Tweak_ubuntu_for_speed

Description

You want your Ubuntu desktop to be more responsive? It will take less than a half hour to perform all these tweaks. These tweaks will make your system faster and more responsive without a doubt. Read on to perform the tweaks and enjoy your faster system.

From what I understand these tweaks will work with all forms of Linux. They are not Ubunut Specific. I have only tried them on Ubuntu though, so if you use them on other Linux Distro's you do at your own risk.

Speed up your File System

About

Ubuntu Linux, unless you have set it up otherwise, uses the EXT3 system by default. It's a pretty good system. There are 3 journaling methods for EXT3 system.

  • Journal Data Writeback
  • Journal Data Ordered
  • Journal Data

By default Ubuntu chooses "journal data ordered". In data=ordered mode, ext3 only officially journals metadata, but it logically groups metadata and data blocks into a single unit called a transaction. When it's time to write the new metadata out to disk, the associated data blocks are written first. data=ordered mode effectively solves the corruption problem found in data=writeback mode and most other journaled filesystems, and it does so without requiring full data journaling. In general, data=ordered ext3 filesystems perform slightly slower than data=writeback filesystems, but significantly faster than their full data journaling counterparts.

To speed it up, we are going to change it to the data=writeback system.

Tweak

  • Open your Grub boot menu.
sudo nano -w /boot/grub/menu.lst
  • Look for the Defoptions and Altoptions and make them look like the entry below.
# defoptions=quiet splash rootflags=data=writeback
# altoptions=(recovery mode) single rootflags=data=writeback
  • You need to update your Grub since you have altered it.
sudo update-grub
  • Now we are going to edit the Fstab because it will be expecting these options.
sudo nano -w /etc/fstab
  • Now you are going to want to add the (data=writeback and noatime=0) flags to your hard drive. It might be a little confusing because of the new naming system. Look for the (,errors=remount-ro) and add it afterwards to make it look like our example.
defaults,errors=remount-ro,data=writeback,noatime 0
  • Now you tell your system to use them both.
sudo tune2fs -o journal_data_writeback /dev/yourdrive 

And you're done.


Concurrent Booting

About

Concurrent booting allows Ubuntu to take advantage of dual-core processors, as well as processors that hyperthread or multithread or what ever the different companies call it now.

Tweak

  • These settings are located in your /etc/init.d/rc file. Lets open it up.
sudo gedit /etc/init.d/rc
  • Look through the file and you will find CONCURRENCY=none. You want to change it to:
CONCURRENCY=shell

And you're done.


Swapping

About

Swappiness takes a value between 0 and 100 to change the balance between swapping applications and freeing cache. At 100, the kernel will always prefer to find inactive pages and swap them out; in other cases, whether a swapout occurs depends on how much application memory is in use and how poorly the cache is doing at finding and releasing inactive items.

The default swappiness is 60. A value of 0 gives something close to the old behavior where applications that wanted memory could shrink the cache to a tiny fraction of RAM. For laptops which would prefer to let their disk spin down, a value of 20 or less is recommended.

Tweak

  • First we have to gain access to your /etc/sysctl.conf file.
sudo gedit /etc/sysctl.conf
  • Just scroll to the bottom of the page and add the tag listed below. The number you want depends on how much ram you have and what you do with your system. Please read the about above this to make your decision. I have mine set to 0 on a dual core laptop with 1 gig of ram and have seen no issues and a good performance gain.
vm.swappiness=0

And you're done.


Broadband Internet

About

These are various tweaks taken from various places. Here is an article that explains them all if you would like to read it in depth. http://www.santa-li.com/linuxonbb.html

Tweak

  • You have to open your /etc/sysctl.conf file back up again.
sudo gedit /etc/sysctl.conf
  • Then again, scroll to the bottom and just add these lines to it.
net.core.rmem_default = 524288
net.core.rmem_max = 524288
net.core.wmem_default = 524288
net.core.wmem_max = 524288
net.ipv4.tcp_wmem = 4096 87380 524288
net.ipv4.tcp_rmem = 4096 87380 524288
net.ipv4.tcp_mem = 524288 524288 524288
net.ipv4.tcp_rfc1337 = 1
net.ipv4.ip_no_pmtu_disc = 0
net.ipv4.tcp_sack = 1
net.ipv4.tcp_fack = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_ecn = 0
net.ipv4.route.flush = 1
  • You have to reset your sysctl for these to take effect.
sudo sysctl -p

And you're done.


IPv6

About

IPv6 is an internet protocol. Most of your software uses IPv4 though and it causes conflicts.

Tweak

  • We are going to create a file. Paste this into a terminal.
sudo gedit /etc/modprobe.d/bad_list
  • Then paste this into the file and save and exit the file.
alias net-pf-10 off

And you're done.


Boot Profile

About

You have just made a lot of changes to your system. Re profiling your boot will reorganize it and make it faster on boots afterwards.

Tweak

  • Reboot your PC.
  • When you come to your grub list, hit escape to see your grub menu.
  • Edit the topmost line and add the word below to the end of it.
profile
  • Then just reboot the system.


Now you are done and you can enjoy your faster Ubuntu System.

Friday, March 23, 2007

gmplayer aspect

For all the different types of monitor. and use the video output of xv, when open gmplayer, user:
gmplayer -monitoraspect 1920/1200

Wednesday, March 21, 2007

installing firefox32 into amd64 in xubuntu / ubuntu

Taken from ubuntu forum:

sudo apt-get install ia32-libs lib32asound2 lib32ncurses5 ia32-libs-sdl ia32-libs-gtk gsfonts gsfonts-x11 linux32

The script installs onto herd4 but the browser and other 32bit applications cant access the internet. This is because of ipv6 support. It is possible to disable ipv6 and everything will work (to me it seems faster to).

for ubuntu

1. gksudo gedit /etc/modprobe.d/aliases
2.Comment out this line: alias net-pf-10 ipv6
3.Save the file
4.gksudo gedit /etc/modprobe.d/blacklist
5.Add this line: blacklist ipv6
6.Save the file and restart your computer

for kubuntu

1.kdesu kate /etc/modprobe.d/aliases
2.Comment out this line: alias net-pf-10 ipv6
3.Save the file
4.kdesu kate /etc/modprobe.d/blacklist
5.Add this line: blacklist ipv6
6.Save the file and restart your computer

You must reboot for changes to take effect.

Then create a calling script (+x)
#!/bin/sh
export GTK_PATH=/usr/lib32/gtk-2.0
export PANGO_RC_FILE=/etc/pango32/pangorc
export GDK_PIXBUF_MODULE_FILE=/etc/gtk-2.0/gdk-pixbuf.loaders.32
linux32 /usr/lib32/firefox32/firefox $@

Sunday, March 04, 2007

Ultimate Ubuntu performance tweaking guide

Taken from http://linuxmonitor.blogspot.com/2007/03/ultimate-ubuntu-performance-tweaking.html


Lets start first with the kernel:


apt-get install build-essential libncurses-dev kernel-package
cd /usr/src
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.20.tar.bz2

This will download the latest sources available, in my case linux-2.6.20.tar.bz2

cd /usr/src
tar -xjf
linux-2.6.20.tar.bz2
cd linux-2.6.20

Now lets apply the Con Kolivas patches, these are patches designed to improve system responsiveness with specific emphasis on the desktop, but suitable to any workload.

wget www.kernel.org/pub/linux/kernel/people/ck/patches/2.6/2.6.20/2.6.20-ck1/patch-2.6.20-ck1.bz2
bzcat patch-2.6.20-ck1.bz2 |patch -p1

Copy the current kernel config and configuring the kernel

cp /boot/config-`uname -r` .config
make menuconfig

In "General Setup" activate:
- Support for paging of anonymous memory (swap)
- Support for prefetching swapped memory

In "Processor type and features":
- Processor family Choose the model of your processor.
- set Preemption Model to Voluntary Kernel Preemption (Desktop)
- High Memory Support
- off - if you have less than 1 GB of RAM
- 1GB Low Memory Support - if you have 1GB of RAM
- 4GB - if you have more than 1GB of RAM
- set Timer frequency to 1000 Hz

In "Kernel hacking" uncheck "Kernel debugging".

Now exit and save the configuration.


Making the new kernel package:
make-kpkg -initrd --revision=LinuxMonitor1 kernel_image kernel_headers modules_image

Installing the new kernel
dpkg -i *.deb


HDParm

sudo gedit /etc/hdparm.conf

at the bottom add:

/dev/hda {
dma = on
io32_support = 1
}

/dev/cdroms/cdrom0 {
dma = on
interrupt_unmask = on
io32_support = 0
}

Concurrent Booting

Concurrent booting allows Ubuntu to take advantage of dual-core processors, as well as processors that hyperthread or multithread or what ever the different companies call it now.

sudo gedit /etc/init.d/rc

Look through the file and you will find CONCURRENCY=none.
You must change it to:
CONCURRENCY=shell

Prelink

Disclaimer: Prelinking might break your system! Only consider for use if you can risk the chance that your install might mess up. Most of all make sure that it gets to run the whole thing through the first time you prelink. Stopping in the middle can lead to system failure. Prelinking is a powerful device and needs to be used with care.

Prelink is no longer necessary in Feisty. Feisty uses a new linking mechanism called DT_GNU_HASH which dramatically speeds up the linking process without the need for continuously running this prelink program. Again, prelink is NOT useful starting from Feisty

How to enable prelink

1. Activate Ubuntu universe sources
2. Put this command into terminal to install Prelink:

sudo apt-get install prelink

3. Now put this command into the terminal:

sudo gedit /etc/default/prelink


4. Change where it says "PRELINKING=unknown" from unknown to "yes"
5. Adjust the other options if you know what the heck you're doing. If it looks foreign to you, the defaults work well.
6. To start the first prelink (the longest one!), put this in terminal:

sudo /etc/cron.daily/prelink

Automatic Prelinking After Program Are Installed

One problem with prelinking in that when you install new programs those programs are not prelinked. So to avoid this problem when installing programs with apt-get or synaptic, use the directions below.

1. Put this in terminal:


sudo gedit /etc/apt/apt.conf


2. When the file opens in Gedit, put this line at the end of the file and save (even if the file has no content before you add the line):

DPkg::Post-Invoke {"echo Running prelink, please wait...;/etc/cron.daily/prelink";}

General Notes About Prelinking

In the future, prelink performs a quick prelink (a less-than-1-minute procedure on most systems) daily, usually at midnight. Every 14 days, or whatever you changed it to be, a full prelink will run.

If you just did a major apt-get upgrade that changed systemwide libraries (i.e. libc6, glibc, major gnome/X libs, etc etc etc) and experience cryptic errors about libs, rerun step 6.

To undo prelink, change step 4 from yes to no, then rerun step 6.

Prelinking will make the binaries it prelinks change, so it's not appropriate if you have tripwire or another checksum-based IDS system, or if you do incremental or differential backups to save on space.

Services


*Note you might not have all these services on your box.

To enable/disable services go to System -> Administration -> Services

1. acpi-support - leave it on.
2. acpid - The acpi daemon. These two are for power management, quite important for laptop and desktop computers, so leave them on.
3. alsa - If you use alsa sound subsystem, yes leave it on. But if you have the service below, its safe to be off. The default is off when alsa-utils is on.
4. alsa-utils - On my system, this service supercedes the alsa, so I turn off the alsa and turn this on at S level.
5. anacron - A cron subsystem that executes any cron jobs not being executed when the time is on. Most likely you've probably turned your computer off when a certain cron job time is ready. For example, updatedb is scheduled at 2am everyday, but at that moment, you computer is off, then if anacron service is on, it will try to catch up that updatedb cron.
6. apmd - If you computer is not that old which can't even support acpi, then you may try to turn this off.
7. atd - like cron, a job scheduler. I turned it off.
8. binfmt-support - Kernel supports other format of binary files. I left it on.
9. bluez-utiles - I turned it off. I don't have any bluetooth devices.
10. bootlogd - Leave it on.
11. cron - Leave it on.
12. cupsys - subsystem to manager your printer. I don't have one so I turned it off, but if you do, just leave it on.
13. dbus - Message bus system. Very important, leave it on.
14. dns-clean - Mainly for cleaning up the dns info when using dial-up connection. I don't use dial up, so I turn it off.
15. evms - Enterprise Volumn Management system. I turned it off.
16. fetchmail - A mail receving daemon. I turned it off.
17. gdm - The gnome desktop manager. I turned it off anyway since I get use to boot to console first. This is up to you if you want to boot directly to GUI.
18. gdomap - You can turn it off.
19. gpm - Mouse support for console. If you feel you'd better have a mouse on console, go turn it on.
20. halt - Don't change it.
21. hdparm - tuning harddisk script, should be on.
22. hibernate - If your system support hibernate, leave it on. Otherwise, its useless for you.
23. hotkey-setup - This daemon setup some hotkey mappings for Laptop. Manufacturers supported are: HP, Acer, ASUS, Sony, Dell, and IBM. If you have a laptop in those brands, you can leave it on, otherwise, this might not have any benefits for you.
24. hotplug and hotplug-net - activating hotplug subsystems takes time. I'd consider to turn them off.
25. hplip - HP printing and Image subsystem. I turned it off.
26. ifrename - network interface rename script. Sounds pretty neat but I turned it off. Mainly for managing multiple network interfaces names. Since I have a wireless card and an ethernet card, they all assigned eth0 and ath0 from kernel, so its not really useful for me.
27. ifupdown and ifupdown-clean - Leave it on. They are network interfaces activation scripts for the boot time.
28. inetd or inetd.real - take a look your /etc/inetd.conf file and comment out any services that you don't need.
29. klogd - Leave it on.
30. laptop-mode - A service to tweak the battery utilization when using laptops. You can leave it on.
31. linux-restricted-modules-common - You need to see if you really have any restricted modules loaded on your system. I'd leave it on.
32. lvm - I don't use it so I turned it off. Leave it on if you *DO* have lvm.
33. makedev - Leave it on.
34. mdamd - Raid management tool. I don't use it so I turned it off.
35. mdamd-raid - Raid tool. If you don't have Raid devices, turn it off.
36. module-init-tools - Load extra modules from /etc/modules file. You can investigate your /etc/modules file and see if there is any modules that you don't need. Normally, this is turned on.
37. mountvirtfs - mount virtual filesystems. Leave it on.
38. networking - bring up network interfaces and config dns info during boot time by scaning /etc/network/interfaces file. Leave it on.
39. ntpdate - Sync time with the ubuntu time server. Leave it on if you want.
40. nvidia-kernel - I compiled the nvidia driver by myself, so its useless for me now. If you use the ubuntu nvidia driver from the restrict modules, just leave it on. 41. pcmcia - pcmcia device - useless if you are using desktop which doesn't have pcmcia card. So in that case, turn it off please.
42. portmap - daemon for managing services like nis, nfs, etc. If your laptop or desktop is a pure client, then turn it off.
43. powernowd - client to manage cpufreq. Mainly for laptops that support CPU speed stepping technology. Normally, you should leave it on if you are configuring a laptop, but for desktop, it might be useless.
44. ppp and ppp-dns - Useless to me. I don't have dial-up.
45. readahead - It seems readahead is a kind of "preloader". It loads at startup some libs on memory, so that some programs will start faster. But it increases startup time for about 3-4 seconds. So, you can keep it... or not. I tested and I just didn't feel difference loading programs. So I decided to turn it off. If you have a reason to keep it on, please do so.
46. reboot - Don't change it.
47. resolvconf - Automatically configuring DNS info according to your network status. I left it on.
48. rmnologin - Remove nologin if it finds it. It wouldn't happen on my laptop, so I got rid of it.
49. rsync - rsync daemon. I don't use it on my laptop, so turned it off.
50. sendsigs - send signals during reboot or shutdown. Leave it as it is.
51. single - Active single user mode. Leave it as it is.
52. ssh - ssh daemon. I need this so I turned it on.
53. stop-bootlogd - stop bootlogd from 2,3,4,5 runlevel. Leave it as it is.
54. sudo - check sudo stauts. I don't see any good to run it everytime on a laptop or desktop client, so I turned it off.
55. sysklogd - Leave it as it is.
56. udev and udev-mab - Userspace dev filesystem. Good stuff, I left them on.
57. umountfs - Leave it as it is.
58. urandom - Random number generator. Might not useful but I left it on.
59. usplash - Well, if you really want to see the nice boot up screen, leave it as it is.
60. vbesave - video card BIOS configuration tool. Its able to save your video card status. I left it on.
61. xorg-common - setup X server ICE socket. Leave it as it is.
62. adjtimex - This is a kernel hw clock time adjusting too. Normally, you shouldn't see this on your boot up list. In very rare case if you do see its on your boot up process, then there might be a reason why it is on, so better leave it that way. In my case, it is off.
63. dirmngr - A certification lists management tool. Work with gnupg. You will have to see if you need it or not. In my case, I turned it off.
64. hwtools - A tool to optimize irqs. Not sure what's the benefits of turning it on. In my case, I turned it off.
65. libpam-devperm - A daemon to fix device files permissions after a system crash. Sounds pretty good, so I left it on.
66. lm-sensors - If you matherboard has builtin some sensor chips, it might be helpful to see hw status via userspace. I ran it and it said "No sensors found", so I turned it off.
67. screen-cleanup - A script to cleanup the boot up screen. Well, turn on or off is up to you. In my case, I left it on.
68. xinetd - A inetd super daemon to manage other damons. In my system, the xinetd is managing chargen, daytime, echo and time (find them from /etc/xinetd.d dir), I care none of them, so I turned it off. If you do have some important services configured under xinetd, then leave it on.

The end! Special thanks to i3dmaster, xXx 0wn3d xXx, poofyhairguy and the rest of the ubuntuforums.org people