Results 1 to 10 of 96

Thread: Prelinking Guide- Make Ubuntu Feel Faster

Threaded View

  1. #1
    Join Date
    Nov 2004

    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:

    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: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.
    Last edited by jdong; January 2nd, 2007 at 06:32 PM.
    Those folks who try to impose analog rules on digital content will find themselves on the wrong side of the tidal wave.
    - Mark Shuttleworth


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts