0

I recently installed Ubuntu 14.04 LTS and for some reason the perl command just hangs when a regular user calls it. However, if I use sudo with it, it will work perfectly. I'm thinking the perl program is trying to read/write something that regular users have no permissions to, but how can I be sure or figure out what?

The perl version I have is v5.18.2 and is 64bit.

The reason I'm asking is I'm trying to run a make that apparently uses perl (so it hangs), but if I run it with sudo, I don't have permissions to write over the files the make generates.

If anyone has any suggestions, I'd greatly appreciate it. Thanks!

Edit: This is the output of strace perl -v. It goes on looping this chunk indefinitely.

execve("/apps/jas/bin/perl", ["perl", "-v"], [/* 62 vars */]) = 0 brk(0) = 0x7fe3c41f5000 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe3c207d000 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=87654, ...}) = 0 mmap(NULL, 87654, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fe3c2067000 close(3) = 0 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\37\2\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=1845024, ...}) = 0 mmap(NULL, 3953344, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fe3c1a97000 mprotect(0x7fe3c1c53000, 2093056, PROT_NONE) = 0 mmap(0x7fe3c1e52000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1bb000) = 0x7fe3c1e52000 mmap(0x7fe3c1e58000, 17088, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fe3c1e58000 close(3) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe3c2066000 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe3c2064000 arch_prctl(ARCH_SET_FS, 0x7fe3c2064740) = 0 mprotect(0x7fe3c1e52000, 16384, PROT_READ) = 0 mprotect(0x7fe3c229d000, 8192, PROT_READ) = 0 mprotect(0x7fe3c207f000, 4096, PROT_READ) = 0 munmap(0x7fe3c2067000, 87654) = 0 getpid() = 29478 rt_sigaction(SIGCHLD, {0x7fe3c2094460, ~[RTMIN RT_1], SA_RESTORER, 0x7fe3c1acdff0}, NULL, 8) = 0 geteuid() = 42590 brk(0) = 0x7fe3c41f5000 brk(0x7fe3c4216000) = 0x7fe3c4216000 getppid() = 29475 stat("/lhome/username", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 stat(".", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 open("/apps/jas/bin/perl", O_RDONLY) = 3 fcntl(3, F_DUPFD, 10) = 10 close(3) = 0 fcntl(10, F_SETFD, FD_CLOEXEC) = 0 rt_sigaction(SIGINT, NULL, {SIG_DFL, [], 0}, 8) = 0 rt_sigaction(SIGINT, {0x7fe3c2094460, ~[RTMIN RT_1], SA_RESTORER, 0x7fe3c1acdff0}, NULL, 8) = 0 rt_sigaction(SIGQUIT, NULL, {SIG_DFL, [], 0}, 8) = 0 rt_sigaction(SIGQUIT, {SIG_DFL, ~[RTMIN RT_1], SA_RESTORER, 0x7fe3c1acdff0}, NULL, 8) = 0 rt_sigaction(SIGTERM, NULL, {SIG_DFL, [], 0}, 8) = 0 rt_sigaction(SIGTERM, {SIG_DFL, ~[RTMIN RT_1], SA_RESTORER, 0x7fe3c1acdff0}, NULL, 8) = 0 read(10, "#!/bin/sh\n\nDIRNAME=dirname $0\n"..., 8192) = 207 pipe([3, 4]) = 0 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fe3c2064a10) = 29479 close(4) = 0 read(3, "/apps/jas/bin\n", 128) = 14 read(3, "", 128) = 0 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=29479, si_status=0, si_utime=0, si_stime=0} --- rt_sigreturn() = 0 close(3) = 0 wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 29479 pipe([3, 4]) = 0 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fe3c2064a10) = 29480 close(4) = 0 read(3, "Linux\n", 128) = 6 read(3, "", 128) = 0 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=29480, si_status=0, si_utime=0, si_stime=0} --- rt_sigreturn() = 0 close(3) = 0 wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 29480

7
  • Please do a make -n (shows only what should be done, but it's not doing it) and compare the calls to perl. I doubt that perl gets called with the same arguments with sudo and without. Maybe it gets called with no arguments for normal users, in which case it would just wait on stdin so the user enters a command. Apr 29, 2014 at 19:01
  • Doing a make -n also hangs. Perl also hangs when trying to output perl -v without sudo. In my top I can see it hogging ~43% of the CPU.
    – Mike
    Apr 29, 2014 at 19:08
  • This is stange. Please do a strace perl -v to see where it hangs. Apr 29, 2014 at 19:12
  • Doing an strace perl -v gives me an infinite loop. I've put the chunk that keeps looping in my original post. I can't really make much of it.
    – Mike
    Apr 29, 2014 at 19:55
  • 1
    do a which perl and check that you really call /usr/bin/perl. From the strace it looks like you are calling /apps/jas/bin/perl which tries to find the right perl but finds itself, thus calling itself again and again. And sudo does not have this problem because it does not use the PATH of the normal user. Apr 29, 2014 at 20:05

1 Answer 1

0

My system was using the wrong perl due to the way my PATH was stored. I organized my PATH and it's now working. If you're having a similar problem with another program, try checking your PATH.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .