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
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.make -n
also hangs. Perl also hangs when trying to outputperl -v
without sudo. In my top I can see it hogging ~43% of the CPU.strace perl -v
to see where it hangs.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.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.