Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 315770

Summary: Simplify oprofile installation procedure
Product: z_Archived Reporter: Roland Grunberg <rgrunber>
Component: LinuxToolsAssignee: OProfile Inbox <linux.oprofile-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: kksebasti, sgehwolf, wainersm
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Patch (add opxml compilation/installation to install script)
none
Patch (add opxml compilation/installation to install script)
none
Patch (add opxml compilation/installation to install script)
none
Patch (add opxml compilation/installation to install script) none

Description Roland Grunberg CLA 2010-06-04 10:35:23 EDT
It would be nice if the install.sh script in org.eclipse.linuxtools.oprofile.core/natives/linux/scripts could handle the building/setup of opxml, along with what is already done.
Comment 1 Severin Gehwolf CLA 2010-06-15 17:16:28 EDT
It seems that there are too many (inconsistent) instructions around regarding installation of native parts. For example here's an excerpt of the README file in org.eclipse.linuxtools.oprofile.core_*

---->8--------------------

An extra step is required to install the plugin (due to OProfile's lack of a user-space mode):

* Run the install script in the natives/linux/scripts directory (must be as root):

                # ./install

  * This will ensure all the necessary programs are installed, and create a wrapper for opcontrol
    which prompts for the root password (since OProfile must be run as root). It will also load the
    OProfile kernel module, however it is not loaded persistently. Hence, after the computer is
    restarted and any functions of the plugin are used, there will be an extra prompt to run
    opcontrol that would not normally appear.

------->8------------------

1.) There is no ./install (it's "install.sh")
2.) It doesn't seem to be doing what it claims it's doing. E.g. if you run that script without compiling (make) and installing (make install) opxml in native/linux/opxml first, it'll error out and claim that oprofile is not installed (or some such).
3.) There's also a README file in native/linux/opxml
4.) When oprofile is run and doesn't find a proper opxml installation, a giant error message pops up also providing instructions as to how to set things up properly.


Suggestion:
We should identify a *single* place where installation/configuration instructions are found (and merge both READMEs). Maybe the giant error message could also point to the single source of wisdom. I think that would be easier to maintain.

The whole problem goes away, though, if we could automate installation of those components as a whole.

Thoughts?
Comment 2 Charley Wang CLA 2010-06-15 17:20:04 EDT
Automation would be awesome! Having a single location would also be really useful, and a good backup plan regardless of whether we do automation or not.

If we're moving to a single location for the documentation, maybe it's a good opportunity to also look at using the Mylyn wikitexts and setting the wiki page as our single source?
Comment 3 Andrew Overholt CLA 2010-06-15 20:36:38 EDT
I agree with single-sourcing these instructions and having it more automated.  I like the idea of having the instructions show up in your face, but having a click-able button that says "Click here to build and install the native intermediary" would be even better.  There are a few cases we need to worry about:  NFS installation with root squash, no sudo, etc.  We should also make it clear that the user will need their machine's root password to complete the installation.

Perhaps we should split this bug into some separate, actionable bugs?
Comment 4 Severin Gehwolf CLA 2010-06-16 09:46:34 EDT
(In reply to comment #3)
> I agree with single-sourcing these instructions and having it more automated. 
> I like the idea of having the instructions show up in your face, but having a
> click-able button that says "Click here to build and install the native
> intermediary" would be even better.  There are a few cases we need to worry
> about:  NFS installation with root squash, no sudo, etc.  We should also make
> it clear that the user will need their machine's root password to complete the
> installation.

Sounds like an interesting task (or tasks?) to get my hands dirty and dive a little deeper into oprofile. :-)

There's one more case to worry about (I think): Currently, oprofile uses consolehelper to do tasks as root. We should probably investigate what to use instead when consolehelper is not available on a Linux distro.

> Perhaps we should split this bug into some separate, actionable bugs?

I'm all for it. Makes sense to me.
Comment 5 Roland Grunberg CLA 2010-06-22 11:25:07 EDT
Created attachment 172428 [details]
Patch (add opxml compilation/installation to install script)

This should perform the opxml compilation and installation along with the install script. Maybe in the future something could call this from within eclipse-oprofile so the user doesn't have to drop to the command-line.
Comment 6 Roland Grunberg CLA 2010-06-24 10:13:49 EDT
Created attachment 172616 [details]
Patch (add opxml compilation/installation to install script)

Fix uninstall to work for all archs.
Comment 7 Severin Gehwolf CLA 2010-06-24 10:40:34 EDT
Cool stuff :-)

>+  echo Attempting to compile the opxml binary
>+  user=`ls -l ../ | grep opxml | awk '{print $3}'`
>+  su ${user} -c 'make -C ../opxml && make -C ../opxml install'

I wonder if it would make sense to change this to (since su defaults to root and it's not necessarily what you want if somebody happens to change the opxml directory name):

if [ "${user}_" == "_" ]; then
   # Do something
else
   su ${user} -c 'make -C ../opxml && make -C ../opxml install'
fi

Thoughts?

Also, user=... could probably also be shortened to:
user=`ls -ld ../opxml | awk '{print $3}'`
Comment 8 Roland Grunberg CLA 2010-06-24 11:54:31 EDT
I could just drop the user=... part and just run make as root (su). The make just generates the opxml and moves it into the right directory so as long as the user has execute privileges, it shouldn't matter who runs make.
Comment 9 Roland Grunberg CLA 2010-06-24 16:48:47 EDT
Created attachment 172688 [details]
Patch (add opxml compilation/installation to install script)

make as root.
Comment 10 Andrew Overholt CLA 2010-07-05 13:22:14 EDT
It's better not to compile as root.
Comment 11 Roland Grunberg CLA 2010-07-19 10:26:03 EDT
Created attachment 174622 [details]
Patch (add opxml compilation/installation to install script)

Runs the installation as the user who owns the opxml directory. If for some reason the directory can't be found, installation is aborted.
Comment 12 Roland Grunberg CLA 2010-08-26 15:50:46 EDT
Building opxml is now unnecessary as of Revision #25379, due to Bug #273337 , simplying the installation process a bit.
Comment 13 Roland Grunberg CLA 2012-04-11 15:05:22 EDT
Marking this as fixed. With the usage of PolicyKit and no reliance on opxml, we have simplified the installation.