Visit Our UNIX and Linux User Community


Segmentation fault on basic linux commands


 
Thread Tools Search this Thread
Operating Systems Linux Red Hat Segmentation fault on basic linux commands
# 1  
Old 08-10-2009
Lightbulb Segmentation fault on basic linux commands

Hello out there!!!

I have a Red Hat Entreprise Linux 4 server and I am encountering this error

# grep
Segmentation Fault

I know it is not the right use of grep command, but I did that just for testing purpose,then I did

# which grep
/bin/grep
# ls -l /bin/grep
-rwxr-xr-x 1 root root 79800 Aug 10 11:45 /bin/grep

Notice that Aug 10,11:45 it's the current server's date, and when i do cat /bin/grep, it seems I am rewriting this file each time.

This same thing happens with some other commads (like cp for example).
My question is how can I stop segmentation fault to happen again? I've also updated grep
command using rpm package that came with the recovery CD,but it only works for a while.
And also, I would like to know where can I find an rpm package repository for RHEL 4?, on the web, because my CD's (4) don't have all the rpms.

Thanks in advance for your help.
Any comments would be greatly appreciated.
# 2  
Old 08-10-2009
Are you running as root? It sounds like cat is changing the executable somehow.

First rule of thumb - only run as root when you absolutely have to.

ls -ld /bin does this show as a link like this:
Code:
ls -ld /bin
lrwxrwxrwx   1 root     root           9 Jun 16  2008 /bin -> ./usr/bin

# 3  
Old 08-10-2009
For me it is not a link:
there you have it.

ls -ld /bin
drwxr-xr-x 2 user dba 4096 Aug 7 16:03 /bin

One more thing I tried to update grep package again, and I couldn't.
It says grep is already installed, (I know that) and then tried

rpm -Uf grep-2.5.1-32.2.i386.rpm
and it's the same. I was able to update the package using the line above,
but now I can't.
# 4  
Old 08-11-2009
Is it just me or are these permissions way off? Why is the user 'user' the owner of the /bin directory?

I'd suggest doing a md5sum and sha1sum against the /bin directory on a known clean machine and compare the values against what you have here (ideally from a rescue disk/recovery CD)
# 5  
Old 08-12-2009
I agree, you ran with elevated permissions and trashed your distribution.
/bin IS a link RHEL 4. It is not owned by user. Ever.

Consider learning unix commands while running as a user with minimum permissions next time.

Previous Thread | Next Thread
Test Your Knowledge in Computers #153
Difficulty: Easy
Novell sold their Unix business operations to Microsoft in 1995.
True or False?

8 More Discussions You Might Find Interesting

1. Programming

C. To segmentation fault or not to segmentation fault, that is the question.

Oddities with gcc, 2.95.3 for the AMIGA and 4.2.1 for MY current OSX 10.14.1... I am creating a basic calculator for the AMIGA ADE *NIX emulator in C as it does not have one. Below are two very condensed snippets of which I have added the results inside the each code section. IMPORTANT!... (11 Replies)
Discussion started by: wisecracker
11 Replies

2. Debian

Linux, Debian - Segmentation Fault problem.

Hi guys, first of all apologize for my English... I have a big problem with "Segmentation fault", when running my game server. Console: (gdb) bt full #0 0x0000000000000000 in ?? () No symbol table info available. #1 0x00007ffff702aca4 in std::basic_ostream<char,... (1 Reply)
Discussion started by: Arson.
1 Replies

3. Programming

Using gdb, ignore beginning segmentation fault until reproduce environment segmentation fault

I use a binary name (ie polo) it gets some parameter , so for debugging normally i do this : i wrote script for watchdog my app (polo) and check every second if it's not running then start it , the problem is , if my app , remain in state of segmentation fault for a while (ie 15 ... (6 Replies)
Discussion started by: pooyair
6 Replies

4. Shell Programming and Scripting

Segmentation fault in Unix shell (linux OS)

Hi, I am trying to run an online downloaded tool but I am having an eror segmentation fault. ./multicoil test.seq Config file /home/kmohanas/MULTICOIL/multicoil_config window length 0 = 28 window length 1 = 28 multi_lib = 3 4 5 multi_lib = 2 3 4 pair_lib = 1 2 4 printfile =... (6 Replies)
Discussion started by: kaav06
6 Replies

5. UNIX for Dummies Questions & Answers

Segmentation fault

#include<stdio.h> #include<malloc.h> #include<unistd.h> #include<stdlib.h> void *start_1(void *argv) { printf("thread 0x%x\n",(unsigned int)pthread_self()); pthread_exit((void*)1); } void *start_2(void *argv) { printf("thread 0x%x\n",(unsigned int)pthread_self()); return (void*)2; }... (2 Replies)
Discussion started by: vincent__tse
2 Replies

6. Programming

Segmentation fault.

I'm getting a segmentation fault. I'm new to Linux programming. Thanks so much for all of your input.:eek: #include </usr/include/mysql++/mysql++.h> #include <stdio.h> #include <iostream> #include <sstream> #include <string.h> using namespace std; int outputToImport(const char*... (1 Reply)
Discussion started by: sepoto
1 Replies

7. UNIX for Dummies Questions & Answers

Segmentation Fault

Hi, While comparing primary key data of two tables thr bteq script I am getting this Error. This script is a shell script. *** Error: The following error was encountered on the output file. Script.sh: 3043492 Segmentation fault(coredump) Please let me know how to get through it. ... (5 Replies)
Discussion started by: monika
5 Replies

8. UNIX for Dummies Questions & Answers

Segmentation Fault

hello all, I tried a program on an array to intialise array elements from the standard input device.it is an integer array of 5 elements.but after entering the 4th element it throws a message called "Segmentation Fault" and returns to the command prompt without asking for the 5th element. ... (3 Replies)
Discussion started by: compbug
3 Replies

Featured Tech Videos