Ubuntu Prelinking


A lot of Ubuntu software relies on other pieces of code to work. These are sometimes referred to as libraries, which is a good indicator of their purpose: to provide functions that programs can check in and out whenever they need them, as if they were borrowing books from a library.

Whenever a program starts, it must look for these other libraries and load them into memory, so they’re ready for use. This can take some time, particularly with larger and more complicated programs. Because of this, the concept of prelinking was invented. By a series of complicated tricks, the prelink program makes each bit of software you might run aware of the libraries it needs, so that memory can be better allocated.

Prelinking claims to boost program startup times by up to 50% or more, but the problem is that it’s a hack—a programming trick designed to make your system work in a nonstandard way. Because of this, some programs are incompatible with prelinking. In fact, some might simply refuse to work unless prelinking is deactivated. At the time of this writing, such programs are in the minority. However, keep in mind that prelinking can be easily reversed if necessary. Alternatively, you might want to weigh whether it’s actually worth setting up prelinking in the first place.

Configuring Prelinking
If you decide to go ahead with prelinking, you’ll need to download the relevant software from the Ubuntu software repositories. Open the Synaptic Package Manager (System ->
Administration -> Synaptic Package Manager), click the Search button, and type prelink into the search box. Mark prelink for installation, and then click Apply.

Before you can run a prelinking sweep of your system, you need to enable it in one of its configuration files. To do this, type the following in a terminal window:

gksu gedit /etc/default/prelink

Change the line that reads PRELINKING=unknown to PRELINKING=yes. Then save the file and quit Gedit.

To run a prelinking scan of your system, simply issue this command:

sudo prelink -a

This will prelink practically all the binary files on your system, and may take some time to complete. You may also see some error output, but you don’t need to pay attention to it. Prelinking was automatically added as a daily cron job when you installed it, so any new programs you add will be automatically prelinked.

Deactivating Prelinking
Should you find prelinking makes a particular application malfunction or simply stop working, you can try undoing prelinking. To do this, find out where the main binary for the program resides, and issue the prelink command with the --undo command option. For example, to remove prelinking from the Gedit text editor program, you could type the following:

whereis gedit

This command will show that the gedit binary is found at the location /usr/bin/gedit in the file system. Next, attempt to undo prelinking on the binary:

sudo prelink --undo /usr/bin/gedit

However, this may not work, because some programs might rely on additional binaries on the system. Therefore, the solution might be to undo prelinking for the entire system, which you can do by typing the following:

sudo prelink -ua

After this, you should remove the prelink package, via the Synaptic Package Manager, to stop it from running again in the future (or manually remove its cron entry).

Source of Information : Apress Beginning Ubuntu Linux 3rd Edition


Subscribe to Computing Tech

Enter your email address:

Delivered by FeedBurner

Add to Technorati Favorites Top Blogs