Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Other Community Discussions > Tutorials & Tips
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Tutorials & Tips
The place to find Ubuntu related Tips & Tricks.

 
Thread Tools Display Modes
Old October 11th, 2005   #1
poofyhairguy
SADFL's Commando
 
poofyhairguy's Avatar
 
Join Date: Nov 2004
Location: Texas
Beans: 2,351
Send a message via AIM to poofyhairguy
Prelinking Guide- Make Ubuntu Feel Faster

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.


Originally written by Jdong.

UPDATE 1/2/07: 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

Reason to use Prelinking

(from the Gentoo Linux Prelinking Guide)

Most common applications make use of shared libraries. These shared libraries need to be loaded into memory at runtime and the various symbol references need to be resolved. For most small programs this dynamic linking is very quick. But for programs written in C++ and that have many library dependencies, the dynamic linking can take a fair amount of time.

On most systems, libraries are not changed very often and when a program is run, the operations taken to link the program are the same every time. Prelink takes advantage of this by carrying out the linking and storing it in the executable, in effect prelinking it.

Prelinking can cut the startup times of applications. For example, a typical KDE program's loading time can be cut by as much as 50%. The only maintenance required is re-running prelink every time a library is upgraded for a pre-linked executable.

Yet there is a chance that prelinking might mess up something, so use at your own risk.

How to enable prelink

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

Quote:
sudo apt-get install prelink


3. Now put this command into the terminal:

Quote:
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:

Quote:
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:

Quote:
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):

Quote:
DPkg:ost-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.
__________________
Quote:
Those folks who try to impose analog rules on digital content will find themselves on the wrong side of the tidal wave.
- Mark Shuttleworth

Last edited by jdong; January 2nd, 2007 at 01:32 PM..
poofyhairguy is offline   Reply With Quote
Old October 11th, 2005   #2
mlomker
Skinny Extra Sweet Ubuntu
 
mlomker's Avatar
 
Join Date: Aug 2005
Location: Saint Paul, MN
Beans: 2,903
Re: Prelinking Guide- Make Ubuntu Feel Faster

Quote:
sudo gedit /etc/apt/apt.conf
Thanks for the guide! I had installed prelinking but didn't know about the apt configuration.

Breezy amd64 does not appear to have an apt.conf file. I did, however, find a /etc/apt/apt.conf.d directory that has similar scripts. I created a new script called S99prelink and that appears to do the trick.

Last edited by mlomker; October 11th, 2005 at 08:43 PM..
mlomker is offline   Reply With Quote
Old October 13th, 2005   #3
ubunxpm
5 Cups of Ubuntu
 
Join Date: Jun 2005
Beans: 18
Ubuntu 9.04 Jaunty Jackalope
Question Re: Prelinking Guide- Make Ubuntu Feel Faster

I have a question. Eventhough prelinking sonds like a miracle tweak that would speed up most applications; since you noted to use this prelinking at one's own risk, I was wondering if prelinking would affect the stability of the whole operating system negatively? I remember reading a similar thread for hoary but didn't perform the changes. I am asking this because if it can speed up the system why isn't the ubuntu gets installed prelinking enabled off the bat and I would prefer the stability of ubuntu over the performance under any condition. So please comment about this if you have experience from hoary or breezy's preview release. Thanks

Last edited by ubunxpm; October 13th, 2005 at 10:39 AM..
ubunxpm is offline   Reply With Quote
Old October 13th, 2005   #4
mlomker
Skinny Extra Sweet Ubuntu
 
mlomker's Avatar
 
Join Date: Aug 2005
Location: Saint Paul, MN
Beans: 2,903
Re: Prelinking Guide- Make Ubuntu Feel Faster

Quote:
So please comment about this if you have experience from hoary or breezy's preview release. Thanks
I ran prelinking on Hoary and now Breezy. To be honest, I haven't noticed any performance difference...other than the few seconds delay while waiting for the prelinking to finish when I install packages now. I certainly didn't run disk benchmarks before and after, but it doesn't seem like much to me.
mlomker is offline   Reply With Quote
Old October 13th, 2005   #5
ubunxpm
5 Cups of Ubuntu
 
Join Date: Jun 2005
Beans: 18
Ubuntu 9.04 Jaunty Jackalope
Re: Prelinking Guide- Make Ubuntu Feel Faster

Quote:
Originally Posted by poofyhairguy
Yet there is a chance that prelinking might mess up something, so use at your own risk.
Well, then it does not make a major difference in performance. Obviously a memory upgrade would do a whole lot more to the performance than prelinking. Did anything go wrong because of it where normally it wouldn't have?

Last edited by ubunxpm; October 13th, 2005 at 10:49 AM..
ubunxpm is offline   Reply With Quote
Old October 13th, 2005   #6
poofyhairguy
SADFL's Commando
 
poofyhairguy's Avatar
 
Join Date: Nov 2004
Location: Texas
Beans: 2,351
Send a message via AIM to poofyhairguy
Re: Prelinking Guide- Make Ubuntu Feel Faster

Quote:
Originally Posted by ubunxpm
Well, then it does not make a major difference in performance. Obviously a memory upgrade would do a whole lot more to the performance than prelinking.
Yes. Prelinking can help decrease the start up times for some applications. Its not a miracle tweak that makes everything faster, its just a way to get some applications to load faster.
__________________
Quote:
Those folks who try to impose analog rules on digital content will find themselves on the wrong side of the tidal wave.
- Mark Shuttleworth
poofyhairguy is offline   Reply With Quote
Old October 13th, 2005   #7
PsyberOneZero
Way Too Much Ubuntu
 
PsyberOneZero's Avatar
 
Join Date: Aug 2005
Location: Chicago, IL
Beans: 114
Ubuntu 7.10 Gutsy Gibbon
Send a message via AIM to PsyberOneZero
Re: Prelinking Guide- Make Ubuntu Feel Faster

I started prelinking a few weeks ago in Breezy, the major differnece I felt was in opening OO.org apps for the first time, Writer went from ~10sec to 3-4sec, same for the rest OO.org, and Gimp.

Great tutorial poofyhairguy/jdong.
__________________
Ubuntu Gutsy Gibbon 7.10
AMD 64 3000+ / 2 GB RAM / nVidia 6200 @ 1600*1200 on ViewSonic E790
Storage: (120+200+[400+400]+400+750) GB = 2270 GB
PsyberOneZero is offline   Reply With Quote
Old October 13th, 2005   #8
Kebabji
A Carafe of Ubuntu
 
Join Date: Sep 2005
Beans: 42
Re: Prelinking Guide- Make Ubuntu Feel Faster

i can def see a dif in oo.org yayy thanks for the great tutorial
Kebabji is offline   Reply With Quote
Old October 13th, 2005   #9
Saiboogu
5 Cups of Ubuntu
 
Join Date: Sep 2005
Location: MD
Beans: 20
Re: Prelinking Guide- Make Ubuntu Feel Faster

Same here - improvement in apps like OOo and Gimp. That's enough for me - I don't need gaim to load faster, for example, because its already pretty quick - what makes this worthwhile is the savings on the larger apps. Great guide, thanks.
Saiboogu is offline   Reply With Quote
Old October 16th, 2005   #10
merlyn
Gee! These Aren't Roasted!
 
merlyn's Avatar
 
Join Date: Apr 2005
Location: Brisbane, Qld. Australia
Beans: 207
Kubuntu 9.10 Karmic Koala
Send a message via ICQ to merlyn
Re: Prelinking Guide- Make Ubuntu Feel Faster

Quote:
Originally Posted by mlomker
Thanks for the guide! I had installed prelinking but didn't know about the apt configuration.

Breezy amd64 does not appear to have an apt.conf file. I did, however, find a /etc/apt/apt.conf.d directory that has similar scripts. I created a new script called S99prelink and that appears to do the trick.
Could the steps you followed to do this be added to the original 'Howto'.

Cheers.
__________________
"I'm just sittin' here watchin' the wheels go 'round and 'round"
John Lennon
merlyn is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:32 AM.


vBulletin ©2000 - 2010, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. bilberry