LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-25-2007, 12:34 AM   #1
vadirajcs
LQ Newbie
 
Registered: Jun 2004
Location: India
Distribution: Red Hat
Posts: 20

Rep: Reputation: 1
Error 126


Hey folks,

I get an error 126 for the command " mkdir -p" this command fails( as far as I'm aware) if the path already exists and is a file or a link.

On further digging into error.h and google. found that this is ENOKEY number. Thrown when kernel gets invalid key for a shared memory access.

And what happens to me is not consistent. You try to execute the command again everything works fine. I do hit this sometime.
Any geeks here to help me out on this?

Thanks in advance.
 
Old 09-25-2007, 04:24 AM   #2
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
Can you reliably replicate the problem? If so, please post your procedure here so that others can replicate it. Can you copy-paste the exact output of mkdir when the error occurs (and the command which caused it)?
 
Old 09-25-2007, 04:37 AM   #3
vadirajcs
LQ Newbie
 
Registered: Jun 2004
Location: India
Distribution: Red Hat
Posts: 20

Original Poster
Rep: Reputation: 1
Unhappy

Quote:
Originally Posted by matthewg42 View Post
Can you reliably replicate the problem? If so, please post your procedure here so that others can replicate it. Can you copy-paste the exact output of mkdir when the error occurs (and the command which caused it)?


Actually this step is part of script. It does not print any message. Modified the script to capture the return status and
also put an strace command.

When this is hit, strace too fails with output too man arguments.

this is how my script is.

mkdir -p /var/run/tmp
if [ $? -ne 0 ];
then
echo " unable to create dir. Return status $?";
strace -o /tmp/mkdir.debug mkdir -p /var/run/tmp;
exit -1;
fi

tweek the code to just see if strace is a problem.. it executes properly. For my bad luck this error is causing strace to throw and error too
 
Old 09-25-2007, 05:18 AM   #4
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
When I try to create a directory which already exists as a file, I get error level = 1 and error message:
Code:
mkdir: `a/test/file' exists but is not a directory
According to the EXIT STATUS section of the bash manual page,
Quote:
If a command is found but is not executable, the return status is 126.
This might also explain which strace is not executing.

Find out where mkdir and strace are being found using these commands:
Code:
which mkdir
which strace
Check the permissions of the files is such that your user can read and execute the files. If they ar not executable then I think you have a serious system state issue - your files have been messed up somehow, and you are probably going to be glad of that full system backup you made.

Another (easier to fix, but less likely) possibility is that the filesystem on which the files reside is mounted with the noexec flag set. In this case, you really need to find out why and resolve the issue.
 
Old 09-25-2007, 05:40 AM   #5
vadirajcs
LQ Newbie
 
Registered: Jun 2004
Location: India
Distribution: Red Hat
Posts: 20

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by matthewg42 View Post
When I try to create a directory which already exists as a file, I get error level = 1 and error message:
Code:
mkdir: `a/test/file' exists but is not a directory
According to the EXIT STATUS section of the bash manual page,


This might also explain which strace is not executing.

Find out where mkdir and strace are being found using these commands:
Code:
which mkdir
which strace
Check the permissions of the files is such that your user can read and execute the files. If they ar not executable then I think you have a serious system state issue - your files have been messed up somehow, and you are probably going to be glad of that full system backup you made.

Another (easier to fix, but less likely) possibility is that the filesystem on which the files reside is mounted with the noexec flag set. In this case, you really need to find out why and resolve the issue.

Thanks a lot matt that was helpful.

1. Its not mounted filesystem.
2. which mkdir is /bin/mkdir
3. This does not fail everytime. Run the script again and it succeeds. Have no clue why at that perticular time it fails.


4. Another point, this directory /var/run/tmp does contain files
these files are socket file and fifo files. Does this make a difference.

5. And one more thing, mkdir -p on other directories have not been throwing. I have same command for different directory path.. ex mkdir -p /var/run/log and they dont crib any time.
 
Old 09-25-2007, 05:51 AM   #6
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
Perhaps your system is operating near capacity, and sometimes a new process cannot be spawned because of some system limit (max number of processes or max number of files open or something like that)?

I would expect a more meaningful error message in this case however.

Apart from that I'm out of ideas, sorry - it's hard without access to the system to get inspiration.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Mandriva Linux Community Newsletter #126 LXer Syndicated Linux News 0 06-02-2007 06:32 PM
Suse CUPS error: cups(File)DoRequest error:client-error-bad-request smdonelan Linux - Hardware 6 04-17-2007 06:46 PM
DIABLO II ISSUE Error 126? smhendricks Linux - Newbie 1 10-10-2006 08:15 PM
LXer: Linux Gazette #126 is out! LXer Syndicated Linux News 0 05-03-2006 02:03 PM
updating new installation of 9.3 ERROR...ERROR...ERROR Morbid SUSE / openSUSE 3 08-15-2005 11:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:25 PM.

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