LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 11-01-2022, 01:54 PM   #1
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,569

Rep: Reputation: 177Reputation: 177
Alias.pm: Permission denied at /usr/lib64/perl5/Encode.pm line 47.


I'm trying to run the following perl script as a normal user:
Code:
#!/usr/bin/env perl
use open qw(:std :utf8);
use Encode qw(decode);

while (my $line = <STDIN>) {
        print decode("MIME-Header", $line);
}
and I get the error(s):
Code:
Can't locate Encode/Alias.pm:   /usr/local/lib64/perl5/Encode/Alias.pm: Permission denied at /usr/lib64/perl5/Encode.pm line 47.
BEGIN failed--compilation aborted at /usr/lib64/perl5/Encode.pm line 47.
Compilation failed in require at /user/mfoley/bin/decodeUTF8.pl line 3.
BEGIN failed--compilation aborted at /user/mfoley/bin/decodeUTF8.pl line 3.
There is, in fact, no file /usr/local/lib64/perl5/Encode/Alias.pm, but if I create a symlink (or hard link) from /usr/lib64/perl5/Encode/Alias.pm to /usr/local/lib64/perl5/Encode/Alias.pm I get the same "can't locate" error. Permissions are:
Code:
# ls -l /usr/local/lib64/perl5/Encode
total 24
-r--r--r-- 2 root root 12341 2016-04-30 00:42 Alias.pm
if I run perl script as root. It works.

I uninstalled all perl packages, both standard slackpkg (I'm running 14.2) and all SlackBuilds perl packages and reinstalled slackpkg perl and a few from SlackBuilds needed by spamassassin. That didn't help.

How can I fix this?

Last edited by mfoley; 11-01-2022 at 02:05 PM.
 
Old 11-01-2022, 02:34 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,147

Rep: Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264
Your code compiles fine for me, which suggests the problem is your Perl installation.

If Encode.pm is in /usr/lib64/perl5/, then there should be a /usr/lib64/perl5/Encode directory containing Alias.pm and 28 other files and subdirectories. On my Fedora system (Perl v5.34.1), the directory has permissions
Code:
drwxr-xr-x. 1 root root    482 Jul  1 06:41 Encode
 
Old 11-01-2022, 04:15 PM   #3
kjhambrick
Senior Member
 
Registered: Jul 2005
Location: Round Rock, TX
Distribution: Slackware64 15.0 + Multilib
Posts: 2,159

Rep: Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512
mfoley --

I've got /usr/lib64/perl5/Encode/Alias.pm on my Slackware64 15.0 System

It was originally provided by ~/d/perl-5.34.0-x86_64-1.txz

Then it was later updated with ~/patches/packages/perl-5.34.0-x86_64-2_slack15.0.txz

Edit: I don't have a SymLink /usr/local/lib64/perl/ but I do have Slackware64 14.2 on my BackUp Box and your script runs as root or as myself

HTH

-- kjh

Code:
# ls -lad /usr/lib64/perl5/Encode/*

-r--r--r-- 1 root root 12545 Jul 25 13:01 /usr/lib64/perl5/Encode/Alias.pm
-r--r--r-- 1 root root  2430 Jul 25 13:01 /usr/lib64/perl5/Encode/Byte.pm
-r--r--r-- 1 root root  1683 Jul 25 13:01 /usr/lib64/perl5/Encode/CJKConstants.pm
drwxr-xr-x 2 root root  4096 Jul 26 07:09 /usr/lib64/perl5/Encode/CN
-r--r--r-- 1 root root  2042 Jul 25 13:01 /usr/lib64/perl5/Encode/CN.pm
-r--r--r-- 1 root root  6065 Jul 25 13:01 /usr/lib64/perl5/Encode/Config.pm
-r--r--r-- 1 root root   865 Jul 25 13:01 /usr/lib64/perl5/Encode/EBCDIC.pm
-r--r--r-- 1 root root  6316 Jul 25 13:01 /usr/lib64/perl5/Encode/Encoder.pm
-r--r--r-- 1 root root  9063 Jul 25 13:01 /usr/lib64/perl5/Encode/Encoding.pm
-r--r--r-- 1 root root 12865 Jul 25 13:01 /usr/lib64/perl5/Encode/GSM0338.pm
-r--r--r-- 1 root root 10114 Jul 25 13:01 /usr/lib64/perl5/Encode/Guess.pm
drwxr-xr-x 2 root root  4096 Jul 26 07:09 /usr/lib64/perl5/Encode/JP
-r--r--r-- 1 root root  2682 Jul 25 13:01 /usr/lib64/perl5/Encode/JP.pm
drwxr-xr-x 2 root root  4096 Jul 26 07:09 /usr/lib64/perl5/Encode/KR
-r--r--r-- 1 root root  1960 Jul 25 13:01 /usr/lib64/perl5/Encode/KR.pm
drwxr-xr-x 3 root root  4096 Jul 25 13:01 /usr/lib64/perl5/Encode/MIME
-r--r--r-- 1 root root   847 Jul 25 13:01 /usr/lib64/perl5/Encode/Symbol.pm
-r--r--r-- 1 root root  2292 Jul 25 13:01 /usr/lib64/perl5/Encode/TW.pm
drwxr-xr-x 2 root root  4096 Jul 26 07:09 /usr/lib64/perl5/Encode/Unicode
-r--r--r-- 1 root root  8928 Jul 25 13:01 /usr/lib64/perl5/Encode/Unicode.pm
Code:
# whatprovides /usr/lib64/perl5/Encode/Alias.pm

# Package: /dld/15.0/slackware/slackware-15.0-64/slackware64/packages/perl-5.34.0-x86_64-2_slack15.0.txz      # /var/log/packages/perl-5.34.0-x86_64-2_slack15.0
-r--r--r-- root/root     12545 2022-07-25 13:01 /usr/lib64/perl5/Encode/Alias.pm

# REMOVED: /dld/15.0/slackware/slackware-15.0-64/slackware64/d/perl-5.34.0-x86_64-1.txz      # *** not installed ***
-r--r--r-- root/root     12545 2021-05-21 11:47 /usr/lib64/perl5/Encode/Alias.pm
Code:
# find /var/log/packages/ /var/log/removed_packages/ -type f -name "perl-5*"

/var/log/packages/perl-5.34.0-x86_64-2_slack15.0
/var/log/removed_packages/perl-5.34.0-x86_64-1-upgraded-2022-07-26,07:09:26

Last edited by kjhambrick; 11-01-2022 at 04:42 PM.
 
Old 11-01-2022, 04:19 PM   #4
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Post output with
Code:
perl -e 'print "$_\n" for @INC' | xargs ls -ld
[edit] not needed sorry, I didn't read previous post

Running this as user, is there any permission error?
Code:
head -n 1 /usr/lib64/perl5/Encode/Alias.pm

Last edited by keefaz; 11-01-2022 at 04:26 PM.
 
Old 11-06-2022, 10:04 AM   #5
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,569

Original Poster
Rep: Reputation: 177Reputation: 177
kjhambrick: I can run as normal user on Slackware 15, just not on 14.2.

Quote:
Originally Posted by smallpond View Post
Your code compiles fine for me, which suggests the problem is your Perl installation.

If Encode.pm is in /usr/lib64/perl5/, then there should be a /usr/lib64/perl5/Encode directory containing Alias.pm and 28 other files and subdirectories. On my Fedora system (Perl v5.34.1), the directory has permissions
Code:
drwxr-xr-x. 1 root root    482 Jul  1 06:41 Encode
Yes, I have the /usr/lib64/perl5/Encode directory and it has 20 files and subdirectories (not counting the files in the subdirectories). My permissions on the Encode directory are the same as yours.
Quote:
Originally Posted by keefaz View Post
Post output with
[code]
Running this as user, is there any permission error?
Code:
head -n 1 /usr/lib64/perl5/Encode/Alias.pm
No, I get "package Encode::Alias;"
 
Old 11-06-2022, 11:29 AM   #6
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Quote:
Originally Posted by mfoley View Post

No, I get "package Encode::Alias;"

Could you post output with:
Code:
perl -e 'print qx/ls -ld $_/ for @INC'
and with
Code:
perl -e 'use Encode qw(decode);' && echo ok
and
Code:
perl -e 'use Encode::Alias;' && echo ok
and
Code:
which perl
(all commands run as user)

Last edited by keefaz; 11-06-2022 at 11:41 AM.
 
1 members found this post helpful.
Old 11-09-2022, 12:49 PM   #7
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,569

Original Poster
Rep: Reputation: 177Reputation: 177
Quote:
Originally Posted by keefaz View Post
Could you post output with:
Code:
perl -e 'print qx/ls -ld $_/ for @INC'
[code]
$ perl -e 'print qx/ls -ld $_/ for @INC'
drwxr-xr-x 10 root root 4096 Apr 30 2016 /usr/local/lib64/perl5
drwxr-xr-x 24 root root 4096 Apr 30 2016 /usr/local/share/perl5
drwxr-xr-x 22 root root 4096 Nov 1 14:26 /usr/lib64/perl5/vendor_perl
drwxr-xr-x 27 root root 4096 Nov 1 14:27 /usr/share/perl5/vendor_perl
drwxr-xr-x 29 root root 4096 Nov 1 14:26 /usr/lib64/perl5
drwxr-xr-x 57 root root 4096 Nov 1 14:27 /usr/share/perl5
drwxr-x--x 55 mfoley develop 12288 Nov 9 13:40 .
/code]
Quote:
and with
Code:
perl -e 'use Encode qw(decode);' && echo ok
Code:
$ perl -e 'use Encode qw(decode);' && echo ok
Can't locate Encode/Alias.pm:   /usr/local/lib64/perl5/Encode/Alias.pm: Permission denied at /usr/lib64/perl5/Encode.pm line 47.
BEGIN failed--compilation aborted at /usr/lib64/perl5/Encode.pm line 47.
Compilation failed in require at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
Quote:
and
Code:
perl -e 'use Encode::Alias;' && echo ok
Code:
$ perl -e 'use Encode::Alias;' && echo ok
Can't locate Encode/Alias.pm:   /usr/local/lib64/perl5/Encode/Alias.pm: Permission denied at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
Quote:
and
Code:
which perl
(all commands run as user)
Code:
$ which perl
/usr/bin/perl
Thanks, I hope this tells you something.
 
Old 11-09-2022, 01:26 PM   #8
henca
Member
 
Registered: Aug 2007
Location: Linköping, Sweden
Distribution: Slackware
Posts: 976

Rep: Reputation: 665Reputation: 665Reputation: 665Reputation: 665Reputation: 665Reputation: 665
Maybe we are getting closer, what about the output from:

Code:
strace -f perl -e 'use Encode::Alias;'  2>&1 | grep Encode.pm
But as others have said, something seems broken with your perl installation.

regards Henrik
 
Old 11-09-2022, 01:29 PM   #9
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Do you have needed stuff in /usr/local/lib64/perl5? I would be tempted to delete all in this directory as it interferes with Slackware perl install
(see @INC, perl searches in /usr/local/lib64/perl5 first...)

See if this code works: (that removes /usr/local/... first entries in @INC)
Code:
perl -e ''BEGIN{splice @INC,0,2} use Encode qw(decode);' && echo ok

Last edited by keefaz; 11-09-2022 at 02:34 PM.
 
1 members found this post helpful.
Old 11-10-2022, 10:29 AM   #10
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,569

Original Poster
Rep: Reputation: 177Reputation: 177
Quote:
Originally Posted by henca View Post
Maybe we are getting closer, what about the output from:

Code:
strace -f perl -e 'use Encode::Alias;'  2>&1 | grep Encode.pm
That command came back with nothing.
Quote:
But as others have said, something seems broken with your perl installation.
Well, that's why I completely uninstalled the standard Slackware perl package and all perl programs from the SlackBuilds repository - then reinstalled from scratch.
Quote:
Originally Posted by keefaz View Post
Do you have needed stuff in /usr/local/lib64/perl5? I would be tempted to delete all in this directory as it interferes with Slackware perl install
(see @INC, perl searches in /usr/local/lib64/perl5 first...)

See if this code works: (that removes /usr/local/... first entries in @INC)
Code:
perl -e ''BEGIN{splice @INC,0,2} use Encode qw(decode);' && echo ok
That code did run giving "ok" (once I removed the extra '), but my Perl script using Encode still gives the Permission denied error.

I did go ahead and delete /usr/local/lib64/perl5, but still the Permission denied error.

Last edited by mfoley; 11-10-2022 at 10:31 AM.
 
Old 11-10-2022, 12:10 PM   #11
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Does the error say something about /usr/local/share/perl5 ? If yes you will need to take care of this directory too...
As /usr/local/share/perl5 and /usr/local/lib64/perl5 are part of standard perl installation, you'll have to recreate them (if they don't exist anymore)
mkdir /usr/local/share/perl5 /usr/local/lib64/perl5

Last, run this command as normal user (not root)
Code:
find /usr/lib64/perl5 ! -readable
See if it returns something
 
Old 11-10-2022, 12:12 PM   #12
henca
Member
 
Registered: Aug 2007
Location: Linköping, Sweden
Distribution: Slackware
Posts: 976

Rep: Reputation: 665Reputation: 665Reputation: 665Reputation: 665Reputation: 665Reputation: 665
Quote:
Originally Posted by mfoley View Post
That command came back with nothing.
If so, it seems as if it hasn't even tried to find any Encode.pm.

Without any clue on what to search for, we might have to resort to the probably noisy result from:

Code:
strace -f perl -e 'use Encode::Alias;'
If you think that gives too much noise you could try:

Code:
strace -f perl -e 'use Encode::Alias;'  2>&1 | grep stat
or

Code:
strace -f perl -e 'use Encode::Alias;'  2>&1 | grep open
regards Henrik
 
Old 06-08-2023, 10:45 AM   #13
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,569

Original Poster
Rep: Reputation: 177Reputation: 177
It's been a while on this thread. I forgot about it until I just now tried using the perl script today and realized I never got this fixed (Slackware 14.2). If y'all are still interested ...
Quote:
Originally Posted by henca View Post
If so, it seems as if it hasn't even tried to find any Encode.pm.

Without any clue on what to search for, we might have to resort to the probably noisy result from:

Code:
strace -f perl -e 'use Encode::Alias;'
Yes, that returned 300+ lines. Probably too much
Quote:
If you think that gives too much noise you could try:

Code:
strace -f perl -e 'use Encode::Alias;'  2>&1 | grep stat
or

Code:
strace -f perl -e 'use Encode::Alias;'  2>&1 | grep open
regards Henrik
You 2nd suggestion returned something more reasonable:
Code:
$ strace -f perl -e 'use Encode::Alias;'  2>&1 | grep stat
stat("/usr/lib64/perl5/CORE/tls/x86_64", 0x7ffe26e9cf10) = -1 ENOENT (No such file or directory)
stat("/usr/lib64/perl5/CORE/tls", 0x7ffe26e9cf10) = -1 ENOENT (No such file or directory)
stat("/usr/lib64/perl5/CORE/x86_64", 0x7ffe26e9cf10) = -1 ENOENT (No such file or directory)
fstat(3, {st_mode=S_IFREG|0555, st_size=1983720, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=231030, ...}) = 0
fstat(3, {st_mode=S_IFREG|0755, st_size=135496, ...}) = 0
fstat(3, {st_mode=S_IFREG|0755, st_size=114320, ...}) = 0
fstat(3, {st_mode=S_IFREG|0755, st_size=18808, ...}) = 0
fstat(3, {st_mode=S_IFREG|0755, st_size=1147632, ...}) = 0
fstat(3, {st_mode=S_IFREG|0755, st_size=44640, ...}) = 0
fstat(3, {st_mode=S_IFREG|0755, st_size=14080, ...}) = 0
fstat(3, {st_mode=S_IFREG|0755, st_size=2076824, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=2638, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=361, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=56095, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=23, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=59, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=155, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=77, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=34, ...}) = 0
fstat(3, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=57, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=286, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=2454, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=54, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=317692, ...}) = 0
fstat(3, {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 3), ...}) = 0
stat("/usr/local/lib64/perl5/Encode/Alias.pmc", 0x7ffe26e9cf40) = -1 ENOENT (No such file or directory)
stat("/usr/local/lib64/perl5/Encode/Alias.pm", 0x7ffe26e9ce70) = -1 ENOENT (No such file or directory)
stat("/usr/local/share/perl5/Encode/Alias.pmc", 0x7ffe26e9cf40) = -1 EACCES (Permission denied)
stat("/usr/local/share/perl5/Encode/Alias.pm", 0x7ffe26e9ce70) = -1 EACCES (Permission denied)
 
Old 06-08-2023, 05:42 PM   #14
jayjwa
Member
 
Registered: Jul 2003
Location: NY
Distribution: Slackware, Termux
Posts: 784

Rep: Reputation: 250Reputation: 250Reputation: 250
Any CPAN flakiness going on under the user but not root? Check ~/.cpan/CPAN/MyConfig.pm and other CPAN related things. Old CPAN entries burned me more than once. Sometimes I've had to recompile modules with 'cpan -r'.
 
Old 06-12-2023, 12:01 AM   #15
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,569

Original Poster
Rep: Reputation: 177Reputation: 177
I have no ~/.cpan, but plenty of stuff in /root/.cpan; much of very old. Some perl stuff going back to 2012. I've tried uninstalling and reinstalling perl (see prior thread postings), but that did not good. Could I do something with cpan? How would I clear that out and start over? (if that would help)
 
  


Reply

Tags
perl, permission denied



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
cannot lock locale archive "/usr/lib64/locale/locale-archive": Permission denied when building Multilib Cross Linux from Scratch Gunnersky2002 Linux - Software 2 06-13-2018 09:28 AM
[SOLVED] perl5.22.1 permission denied end Linux From Scratch 16 09-02-2016 05:23 AM
slackware64 /usr/lib /usr/lib64 question disturbed1 Slackware 29 02-14-2010 08:05 AM
Relocat /usr/lib and /usr/lib64 to a different path schokshi Fedora 3 08-30-2005 09:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 06:11 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