LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-23-2007, 06:51 AM   #1
rimvydazas
Member
 
Registered: Dec 2006
Posts: 44

Rep: Reputation: 15
anyone Perl guru??


I just installed Perl and DBI on my Suse box. When I test my DBI (perl -e 'use DBI;') from command line using regular account I get this message:

Code:
cdruser1@cdr1:~> perl -e 'use DBI;'
Can't locate loadable object for module DBI in @INC (@INC contains: /usr/lib/perl5/5.8.8/i586-linux-thread-multi /usr/lib/perl5/5.8.8 /usr/lib/perl5/site_perl/5.8.8/i586-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i586-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl .) at /usr/lib/perl5/site_perl/5.8.8/i586-linux-thread-multi/DBI.pm line 266
BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.8.8/i586-linux-thread-multi/DBI.pm line 266.
Compilation failed in require at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
However, the same command run as root works just fine. I assume that this is file permissions problems, isn't it? cdruser1 belongs to "users" group and permissions for DBI.pm file reads like that:

cdruser1@cdr1:/usr/lib/perl5/site_perl/5.8.8/i586-linux-thread-multi> la
total 309
drwxr-xr-x 8 root root 312 2007-11-28 12:29 .
drwxr-xr-x 3 root root 88 2007-10-17 16:12 ..
drwx------ 4 root root 96 2007-11-28 12:29 auto
drwx------ 2 root root 72 2007-11-28 12:27 Bundle
drwx------ 3 root root 104 2007-11-28 12:29 Date
drwx------ 3 root root 256 2007-11-28 12:27 DBD
drwx------ 8 root root 536 2007-11-28 12:27 DBI
-r--r--r-- 1 root root 289975 2007-10-16 08:42 DBI.pm
-r--r--r-- 1 root root 1533 2007-07-16 07:04 dbixs_rev.pl
-r--r--r-- 1 root root 15161 2005-03-25 15:57 Roadmap.pod
-r--r--r-- 1 root root 1048 2006-09-04 17:33 TASKS.pod
drwx------ 2 root root 80 2007-11-28 12:27 Win32

Any ideas what would fix the problem? change file permissions, or primary group for cdruser1? any ideas are appreciated. Thanks
 
Old 11-23-2007, 08:03 AM   #2
terrio
LQ Newbie
 
Registered: Jan 2007
Location: Halifax, NS
Distribution: Linux Mint
Posts: 29

Rep: Reputation: 15
I think you just answered your own question.
Quote:
However, the same command run as root works just fine. I assume that this is file permissions problems, isn't it?
Yes it is, change the permissions on the file so that your user (cdruser1) is able to read the file. Currently the user and group permissions are both set to root.

So as root, use chown to change the owner to cdruser1. or chgrp to give a group that cdruser1 is in permission to read the file.

Here is info on chown - http://en.wikipedia.org/wiki/Chown
Here is info on chgrp - http://en.wikipedia.org/wiki/Chgrp
Here is some info on another command to alter the read/write/execute permissions on a file - http://en.wikipedia.org/wiki/Chmod
 
Old 11-23-2007, 08:57 AM   #3
rimvydazas
Member
 
Registered: Dec 2006
Posts: 44

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by terrio View Post
I think you just answered your own question.


Yes it is, change the permissions on the file so that your user (cdruser1) is able to read the file. Currently the user and group permissions are both set to root.

So as root, use chown to change the owner to cdruser1. or chgrp to give a group that cdruser1 is in permission to read the file.

Here is info on chown - http://en.wikipedia.org/wiki/Chown
Here is info on chgrp - http://en.wikipedia.org/wiki/Chgrp
Here is some info on another command to alter the read/write/execute permissions on a file - http://en.wikipedia.org/wiki/Chmod
Thank you for fast reply. I tried doing something else before your suggestion, and I am surprised that it didn't work. I added cdruser1 to wheel group and enabled %wheel ALL=(ALL) ALL in sudoers file. But I still got the same error. Anyway, about permissions of DBI.pm. As soon as I changed the owner, the DBI test worked out fine. But I still have question. When you look at the permissions -r--r--r-- 1 root root 289975 2007-10-16 08:42 DBI.pm, why cdruser1 can't read DBI.pm during the test if "others" do have read permission. Does DBI.pm must be executed, but not just read? Thanks for your help.

Oh, another weird problem. Maybe someone will know that. I exported two variables in /etc/profile:
Code:
export ORACLE_HOME=/home/cdruser1/cdr/orcl_root
export LD_LIBRARY_PATH=/home/cdruser1/cdr/orcl_root/lib
When I login as cdruser1, both variables exit. When I "su" to root, LD_LIBRARY_PATH just disappears even though ORACLE_HOME still works. Switching back to cdruser1 with "su" doesn't solve the problem; LD_LIBRARY_PATH still doesn't work. Again, after reboot everything works just fine until the first "su". Does it have something to do with wrong file for loading variables? But I still don't get how only one of those variables disappears... Unless there is some other place where ORACLE_HOME is exported. By the way, I use TWM (tab windows manager) if that makes any difference...
 
Old 11-23-2007, 11:36 AM   #4
Alien_Hominid
Senior Member
 
Registered: Oct 2005
Location: Lithuania
Distribution: Hybrid
Posts: 2,247

Rep: Reputation: 53
When you su, you don't take root environment variables (user environment variables are preserved). You need to use su - or sudo -s so user environment variables will be read from his .bash_profile or .bashrc. To exit from the user (in this case root) environment to your normal account just type exit or logout.
 
Old 11-23-2007, 01:09 PM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Code:
drwx------ 4 root root 96 2007-11-28 12:29 auto
drwx------ 2 root root 72 2007-11-28 12:27 Bundle
drwx------ 3 root root 104 2007-11-28 12:29 Date
drwx------ 3 root root 256 2007-11-28 12:27 DBD
drwx------ 8 root root 536 2007-11-28 12:27 DBI
Really, those should all have
Code:
drwxr-xr-x
permissions ...



Cheers,
Tink
 
Old 11-25-2007, 03:33 AM   #6
rimvydazas
Member
 
Registered: Dec 2006
Posts: 44

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Tinkster View Post
Code:
drwx------ 4 root root 96 2007-11-28 12:29 auto
drwx------ 2 root root 72 2007-11-28 12:27 Bundle
drwx------ 3 root root 104 2007-11-28 12:29 Date
drwx------ 3 root root 256 2007-11-28 12:27 DBD
drwx------ 8 root root 536 2007-11-28 12:27 DBI
Really, those should all have
Code:
drwxr-xr-x
permissions ...



Cheers,
Tink
all I did I changed the owner for all files and folders in perl directory to my regular user. I assume it should work in this way.
 
Old 11-25-2007, 10:51 AM   #7
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally Posted by rimvydazas View Post
all I did I changed the owner for all files and folders in perl directory to my regular user. I assume it should work in this way.
Errrh. It's going to work for this one user. Should there be
any system tasks that require these they may fail. Bad move.

I recommend you read a chapter or two on Linux file-systems,
ownerships and permissions.


Cheers,
Tink
 
Old 11-26-2007, 03:08 AM   #8
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
how did you install?

it seems odd that the file permissions are so pants.
the last thing you want is them to be root only.

personally I would just uninstall and reinstall them using your distro
package manager.
 
Old 11-26-2007, 03:34 AM   #9
rimvydazas
Member
 
Registered: Dec 2006
Posts: 44

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Tinkster View Post
Errrh. It's going to work for this one user. Should there be
any system tasks that require these they may fail. Bad move.

I recommend you read a chapter or two on Linux file-systems,
ownerships and permissions.


Cheers,
Tink
Since my PC is dedicated for one task only, there is no any other users to run Perl, which is I would say not bad, but even better move considering security. In addition, I've read all the chapters necessary before I got linux+ certified.
 
Old 11-26-2007, 03:38 AM   #10
rimvydazas
Member
 
Registered: Dec 2006
Posts: 44

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by bigearsbilly View Post
how did you install?

it seems odd that the file permissions are so pants.
the last thing you want is them to be root only.

personally I would just uninstall and reinstall them using your distro
package manager.
I installed perl through yast, and all other modules from tarballs. Anyway, since changing owner seemed to work, I should be fine because I have only this user in addition to root. Thanks for reply though.
 
Old 11-26-2007, 11:13 AM   #11
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally Posted by rimvydazas View Post
Since my PC is dedicated for one task only, there is no any other users to run Perl, which is I would say not bad, but even better move considering security. In addition, I've read all the chapters necessary before I got linux+ certified.
Awesome ... and you understood them, too? :}
I don't mean memorised.


Cheers,
Tink
 
Old 11-27-2007, 03:27 AM   #12
rimvydazas
Member
 
Registered: Dec 2006
Posts: 44

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Tinkster View Post
Awesome ... and you understood them, too? :}
I don't mean memorised.


Cheers,
Tink
 
Old 11-27-2007, 01:27 PM   #13
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally Posted by rimvydazas View Post
:rolleyes:
No ... :/



Cheers,
Tink
 
Old 11-28-2007, 01:09 PM   #14
rimvydazas
Member
 
Registered: Dec 2006
Posts: 44

Original Poster
Rep: Reputation: 15
Thank you for you all It's good to find a place where people can help It's time to read some chapters now ...
 
Old 11-30-2007, 09:53 PM   #15
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,662
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
Actually, it probably isn't a permissions-problem: it is more likely to be the case that Perl cannot find the libraries that you intend to use.

The '@INC' array is where Perl looks. Such things as the PERL5LIB environment-variable, the use lib pragma, and the original list hard-coded into Perl when it was compiled, can all affect that list.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I need a guru... fatblueduck Linux - Software 6 04-04-2005 01:11 AM
Perl guru needed J_Szucs Programming 1 10-11-2004 03:05 AM
perl(Cwd) perl(File::Basename) perl(File::Copy) perl(strict)....What are those? Baldorg Linux - Software 1 11-09-2003 08:09 PM
Welcome new guru! MasterC General 17 05-20-2003 12:50 PM
Now this has been a while, there's a New Guru! finegan General 3 02-28-2003 03:10 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration