Author Topic: Playing with Prelink  (Read 9914 times)

Offline shrinivas

  • Full Member
  • ***
  • Posts: 154
Re: Playing with Prelink
« Reply #75 on: December 06, 2011, 03:13:25 AM »
Can't duplicate.

+1

thank you for a fast response !
I had forgotten to add "export KDE_IS_PRELINKED=1" to the startkde file. I thought the next line in that file made it clear that ' if prelinked ...etc.,' would ensure that it would work !
I installed prelink again, added that line and everything seems to be working well, without any k-crashes !
Regards and thanks and I am sorry for my post.
Shrinivas
AMD ATHLON 64X2 5200, 2 GB RAM, nVidia 7600GT 256 RAM, HD0 320GB,HD1 80GB Triple-boot PCLinuxOs Zen Mini/WinXp/E17

Offline AndrzejL

  • PCLinuxOS Tester
  • Super Villain
  • *******
  • Posts: 12802
  • RLU #490933
    • Wordpress On The Wardrobe...
Re: Playing with Prelink
« Reply #76 on: December 06, 2011, 03:27:26 AM »
Isn't life wonderful ;)?

Offline cirrus_minor

  • Full Member
  • ***
  • Posts: 125
  • ☆★ #watp ★☆
    • cirrus minor
Re: Playing with Prelink
« Reply #77 on: December 06, 2011, 03:54:44 AM »
Isn't life wonderful ;)?

Just keeps getting Kbetter :)


$ PCLOS~KDE~ 2011.Kernel:2.6.38.8
CPU:Intel® Pentium D 2x3.GHz
GPU:ASUS® [G92 EN8800 GT TOP] 512MB DDR3.
Memory:3072MB'DDR2 | HDD Size 1TB
Audio:Audigy2 ZS 7.1

Offline Texstar

  • Administrator
  • Super Villain
  • *****
  • Posts: 12525
Re: Playing with Prelink
« Reply #78 on: December 06, 2011, 04:05:13 AM »
Should already be in startkde.

# are we prelinked
if [ -e /usr/sbin/prelink ]; then
export KDE_IS_PRELINKED=1
fi

 ???

Thanks to everyone who donates. You keep the servers running.

Offline AndrzejL

  • PCLinuxOS Tester
  • Super Villain
  • *******
  • Posts: 12802
  • RLU #490933
    • Wordpress On The Wardrobe...
Re: Playing with Prelink
« Reply #79 on: December 06, 2011, 08:01:59 AM »
Should already be in startkde.

# are we prelinked
if [ -e /usr/sbin/prelink ]; then
export KDE_IS_PRELINKED=1
fi

 ???

Maybe startkde has embargo on export :P! System got mad and boom... No more export from startkde to PCLinuxOSLand :P!

Offline shrinivas

  • Full Member
  • ***
  • Posts: 154
Re: Playing with Prelink
« Reply #80 on: December 06, 2011, 09:04:48 AM »
Should already be in startkde.

# are we prelinked
if [ -e /usr/sbin/prelink ]; then
export KDE_IS_PRELINKED=1
fi

 ???

That's what I thought and let it go earlier and had crashes !
Anyway, now the system seems snappier, thanks and regards,
Shrinivas
AMD ATHLON 64X2 5200, 2 GB RAM, nVidia 7600GT 256 RAM, HD0 320GB,HD1 80GB Triple-boot PCLinuxOs Zen Mini/WinXp/E17

Offline melodie

  • Hero Member
  • *****
  • Posts: 5942
  • XMMP=Jabber, free instant messaging protocol !
    • PCLinuxOS Fr
Re: Playing with Prelink
« Reply #81 on: December 16, 2011, 05:28:28 AM »
Hi,

I tried prelink the first time Texstar told us about it, in my Openbox install. I found it strange and bothering to hear the noise of the hard drive when cron restarted prelinking, and running all of a sudden about 2 minutes each night. So at that time I uninstalled it and didn't think about it anymore.

Then recently, the PCLinuxOS Education (non official not supported) in French has been tested by a French user at another forum, and he said Gcompris icon on the desktop, in the Live CD, didn't work.

Does not work I wondered ? How come it does not work ? In fact it was working, but you could have eaten a whole meal before the display starts. So I thought first I would leave the configuration files in the system, home of school, and in /etc/skel, but it appeared not to be doing the trick. I thought that there are too many libs necessary to run it, so I thought I would try prelink. I installed prelink, used the command as root "prelink -avmR", and remastered again. It was better, but yet it was still taking 27 seconds in the LIve CD, which is very very long, when you are demonstrating and getting people to try.

Then I looked at the links in the present threads, seeking for options. At the end, I went to google and found a nice tutorial, here: http://crast.us/james/articles/prelink.php

I did 4 more remasters for tests and came to this:
It is possible to prelink only one or a few programs;
After I prelinked only gcompris, the /etc/prelink.cache fell from about 364 KB to 5.5 KB;
The following remaster was able to let me launch Gcompris, from the icon on the desktop, in the Live CD : in 3 seconds only !!! HOURRA !!! :D :D :D

To switch from the full prelinking to only one, I was not sure and first uninstalled, then found I could use as root "prelink -au" which unprelinks all, then do a "rm -f" on the file /etc/prelink.cache (but this may not be useful), then "prelink -vmR /usr/bin/gcompris". I had thoughts about the "-m" option, tried without and with it, found that it seems to work better with it. (fixed address for memory, if I understood well the man and the howto).

I have a question : I thought it is not necessary for it to be run each day : I moved /etc/cron.daily/prelink to /etc/cron.weekly : is that enough to make it run only once a week ?

In the file /etc/sysconfig/prelink I changed this part:
Quote
# How often should full prelink be run (in days)
# Normally, prelink will be run in quick mode, every
# $PRELINK_FULL_TIME_INTERVAL days it will be run
# in normal mode.  Comment it out if it should be run
# in normal mode always.
PRELINK_FULL_TIME_INTERVAL=14


by commenting
Code: [Select]
# PRELINK_FULL_TIME_INTERVAL=14
I have one more question : The above comments look to me like it says if the "PRELINK_FULL_TIME_INTERVAL=14" was commented, then it would be run on quick mode only : have I understood correctly ?

So to sum up : prelinking all makes Gcompris start in 27 seconds (same machine, with a Live CD), prelink only the heavy Gcompris allows getting it to start in 3 seconds.

Other tests I tried :
* in a full Openbox, I tried to prelink Libreoffice. That didn't work, it ended with messages saying that some of the related libs could not be prelinked due to some other lib missing, or something like that;

* In my personal Openbox install, (a Nec M160 which has a small celeron 1.46 Ghz and 1 GB ram, quite slow for some apps) I prelinked Firefox and Inkscape only. It seems to help them start faster, but not instant.

And last trick about prelink : if only one or a few programs are prelinked, and we want to prelink one more later, it is possible to do so, just by running the command for one program (prelink -options /path/to/program), and the program and list of libs is added to the /etc/prelink.cache file.

Now in my personal machine, the cache file has gone from 11 kb to 12 kb after I tried to add another program to the list. The option -p allows displaying the content of the prelink.cache file : "prelink -p".

I don't know yet how to un prelink only one program. Maybe something such as ? "prelink -vu /path/to/program" ?

So, for the PCLinuxOS Education, prelink is adopted.

Thanks if you have answers to the 2 questions I asked.

Regards,
Mélodie

« Last Edit: December 16, 2011, 05:33:58 AM by melodie »
melodie at swissjabber dot ch - IRC #pclinuxos-fr sur freenode

Offline hav

  • New Friend
  • *
  • Posts: 2
Re: Playing with Prelink
« Reply #82 on: January 14, 2012, 10:04:13 PM »
Hi,
 I just thought I would throw in my two cents in case someone else might have the same problem I did.
 I just discovered prelink in this forum and thought to try it. I am using an older PC which is seeming slower and slower with KDE. I was getting ready to ditch KDE (which I didn't want to do because I really like it), or buy some hardware upgrades.
I followed Texstar's directions and after rebooting KCMinit would crash. I was thinking about setting it to blacklist  in /etc/prelink.conf, but being lazy and not being sure exactly which file to blacklist I decided to try something else.

I used the command /usr/sbin/prelink -au to put everything back and rebooted. No more crashing.
I updated with synaptic. It didn't update much as it hadn't been too long since the last one. Then I logged out and logged in to safe mode so KDE was not running and tried it again. This time when I rebooted and logged in to KDE there were no errors. No problems with dropbox either, so far.

This makes my PC feel like a new machine. ;) Well, not quite but it is noticeably faster. I used to click the firefox link and go get a cup of coffee. Now it loads and loads the PClinuxos home page in about 4 or 5 seconds and dolphin and konqueror load almost instantaneously.

Thanks for this great tip.

Offline melodie

  • Hero Member
  • *****
  • Posts: 5942
  • XMMP=Jabber, free instant messaging protocol !
    • PCLinuxOS Fr
Re: Playing with Prelink
« Reply #83 on: January 20, 2012, 03:37:53 AM »
I used the command /usr/sbin/prelink -au to put everything back and rebooted. No more crashing.

Hi,
the '-au' switch un-prelinks all prelinks, but when I used it the /etc/prelink.cache was still there with all it's lines in it. I wonder if you still have this file in the machine after this time ? I suppose you didn't uninstall prelink did you ? If you haven't, could you look if you still have the cache file in the system ? If you have it, how large is it ?

BTW, just above I asked 2 questions to which I didn't have an answer. I would be glad to get one, because the comment in the file I said is not clear to me... I may have not understood correctly what it states correctly ?
melodie at swissjabber dot ch - IRC #pclinuxos-fr sur freenode

Offline hav

  • New Friend
  • *
  • Posts: 2
Re: Playing with Prelink
« Reply #84 on: January 20, 2012, 09:05:04 AM »
Hi Melodie,
 Sorry. I don't have answers to your questions as I am not well informed on the subject.
 You raised a question for me that I had not thought of though.
I had not thought to create a cron job to run prelink periodically. I guess I am not too bad off as I upgrade manually and not on a schedule.
I can run it after I upgrade.
From the Wikipedia article: "Afterward, the program only needs to spend time finding the relevant libraries on being run if, for some reason (perhaps an upgrade), the libraries have changed since being prelinked."

 My /etc/prelink.cache is 629k.
I didn't uninstall prelink.
I don't know for sure but I assume that prelink.cache gets rebuilt when you run with the -a switch.
I backed up my prelink.cache and when I get a chance I will update and rerun prelink with -a and see if the prelink.cache differs from the backup.
Unfortunately I don't have a lot of time to play.

 On another note: I guess my dropbox does not have issues because it appears to be blacklisted by default in /etc/prelink.conf.

Regards,
HAV

Online TerryN

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 728
Re: Playing with Prelink
« Reply #85 on: January 20, 2012, 09:51:10 AM »

I had not thought to create a cron job to run prelink periodically. I guess I am not too bad off as I upgrade manually and not on a schedule.


prelink is run daily by cron (see /etc/cron.daily/prelink)
Dell E521 - AMD 64 X2 5000+, 4GB RAM, ATI X1300 graphics
PCLinuxOS 2013 (KDE)
|Twitter|

Offline melodie

  • Hero Member
  • *****
  • Posts: 5942
  • XMMP=Jabber, free instant messaging protocol !
    • PCLinuxOS Fr
Re: Playing with Prelink
« Reply #86 on: January 20, 2012, 01:17:05 PM »

 My /etc/prelink.cache is 629k.
I didn't uninstall prelink.
I don't know for sure but I assume that prelink.cache gets rebuilt when you run with the -a switch.
I backed up my prelink.cache and when I get a chance I will update and rerun prelink with -a and see if the prelink.cache differs from the backup.


http://linux.die.net/man/8/prelink
Quote
-a --all
    Prelink all binaries and dependent libraries found in directory hierarchies specified in /etc/prelink.conf. Normally, only binaries specified on the command line and their dependent libraries are prelinked.


and
Quote
-u --undo


From there the switch -au undo all.

If you want to redo it all:

-avmR

v verbose
m keeps the same number address for each lib prelinked
R is a good stuff for security. See man prelink:
Quote
-R --random
    When assigning addresses to libraries, start with a random address within the architecture-dependent virtual address space range. This can make some buffer overflow attacks slightly harder to exploit, because libraries are not present on the same addresses across different machines. Normally, assigning virtual addresses starts at the bottom of the architecture-dependent range.


If you want to prelink, not all, but just a few programs, then type:

Code: [Select]
prelink -vmR /path/to/program /path/to/another_program
For example:
Code: [Select]
prelink -vmR /usr/bin/firefox /usr/bin/dolphin
I tried with libreoffice but this failed, with a message error about some things missing. I didn't take more time on that one.

To TerryN: no idea about the exact meaning of that sentence in the comment I said ?

Quote
In the file /etc/sysconfig/prelink I changed this part:

# How often should full prelink be run (in days)
# Normally, prelink will be run in quick mode, every
# $PRELINK_FULL_TIME_INTERVAL days it will be run
# in normal mode.  Comment it out if it should be run
# in normal mode always.
PRELINK_FULL_TIME_INTERVAL=14



by commenting
# PRELINK_FULL_TIME_INTERVAL=14

The above comments look to me like it says if the "PRELINK_FULL_TIME_INTERVAL=14" was commented, then it would be run on quick mode only : have I understood correctly ?


melodie at swissjabber dot ch - IRC #pclinuxos-fr sur freenode

Online TerryN

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 728
Re: Playing with Prelink
« Reply #87 on: January 22, 2012, 09:47:41 AM »

To TerryN: no idea about the exact meaning of that sentence in the comment I said ?

Quote
In the file /etc/sysconfig/prelink I changed this part:

# How often should full prelink be run (in days)
# Normally, prelink will be run in quick mode, every
# $PRELINK_FULL_TIME_INTERVAL days it will be run
# in normal mode.  Comment it out if it should be run
# in normal mode always.
PRELINK_FULL_TIME_INTERVAL=14


by commenting
# PRELINK_FULL_TIME_INTERVAL=14

The above comments look to me like it says if the "PRELINK_FULL_TIME_INTERVAL=14" was commented, then it would be run on quick mode only : have I understood correctly ?

I think not.
If PRELINK_FULL_TIME_INTERVAL is commented out (i.e. not defined) then prelink is ALWAYS run in FULL/normal mode.

Terry
Dell E521 - AMD 64 X2 5000+, 4GB RAM, ATI X1300 graphics
PCLinuxOS 2013 (KDE)
|Twitter|

Offline melodie

  • Hero Member
  • *****
  • Posts: 5942
  • XMMP=Jabber, free instant messaging protocol !
    • PCLinuxOS Fr
Re: Playing with Prelink
« Reply #88 on: January 22, 2012, 10:57:08 AM »
Hi,
Is this:
# PRELINK_FULL_TIME_INTERVAL=14

commented and this:

PRELINK_FULL_TIME_INTERVAL=14

commented out ? (me and some subtleties of the English language... :-/ )
melodie at swissjabber dot ch - IRC #pclinuxos-fr sur freenode

Online TerryN

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 728
Re: Playing with Prelink
« Reply #89 on: January 22, 2012, 11:29:26 AM »
LOL  ;D

"Commented out" == "removed by adding a comment #"

So:

# PRELINK_FULL_TIME_INTERVAL=14

means the variable PRELINK_FULL_TIME_INTERVAL does not get defined (has been commented out) and therefore prelink will ALWAYS run in FULL/normal mode.

PRELINK_FULL_TIME_INTERVAL=14

means the variable is defined as therefore prelink will only run in FULL/normal mode after 14 days.

Terry.
Dell E521 - AMD 64 X2 5000+, 4GB RAM, ATI X1300 graphics
PCLinuxOS 2013 (KDE)
|Twitter|