LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-14-2013, 10:10 AM   #1
sukhdip
Member
 
Registered: Sep 2011
Posts: 54

Rep: Reputation: Disabled
Root/non-user not able to delete files, Read only permission issue


Hi!! one strange problem occurred with my RHEL 5 box.
i'm having logs folder with ownership of non-root user. Created some files with root user under logs folder.
here is the scene:
Code:
-rw-r----- 1 root root  1048227 Feb 28 12:34 SystemOut_13.02.28_12.34.10.log
-rw-r----- 1 root root   415920 Mar 14 16:41 SystemOut.log
-rw-r----- 1 root root 20902127 Mar  2 22:15 trace_13.03.02_22.25.53.log
-rw-r----- 1 root root  2579956 Mar 14 16:41 trace.log
I'm not able to delete the files with both users.
Below error is coming up
Quote:
rm: cannot remove `SystemOut_13.02.28_12.34.10.log': Read-only file system
I tried lsattr and chattr, below the output of both:
Code:
------------- /opt/IBM/WebSphere/AppServer/profiles/xyz/logs/server1/
Code:
chattr: Read-only file system while setting flags on /opt/IBM/WebSphere/AppServer/profiles/xyz/logs/server1/
Chown and chmod not able to work. Again Read-only file system error is coming up.
Help needed also want to understand the reasons why its happening.


Thanks.

Last edited by sukhdip; 03-14-2013 at 10:15 AM.
 
Old 03-14-2013, 01:40 PM   #2
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,630

Rep: Reputation: 495Reputation: 495Reputation: 495Reputation: 495Reputation: 495
those files are owned by root, you must be root to do anything to them. the system is telling you exactly what is wrong.
 
Old 03-14-2013, 01:49 PM   #3
sukhdip
Member
 
Registered: Sep 2011
Posts: 54

Original Poster
Rep: Reputation: Disabled
I tried to delete those files using root only. Same read only file system error.
nothing is working. neither root nor non-root is able to delete. #help
 
Old 03-14-2013, 02:02 PM   #4
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
If even root ain't able to delete, then it seems some pb with the drive or mount issue. You can once reboot your box and then try to remove files.
Also once check where these files are mounted and what are permissions on drive.
 
Old 03-14-2013, 02:56 PM   #5
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 2,962

Rep: Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268
As the messages keep telling you over and over, the filesystem is mounted read-only. No changes are possible. What to do next depends on whether the filesystem was intentionally mounted read-only, or became read-only due to an error. If intentional (seems unlikely for a log directory), it's just a matter of running "mount -o remount,rw /path/to/mount/point" to make it read-write. If an error caused the filesystem to become read-only, then an fsck will be necessary to clean up the problem.

Because of the wide variety of ways filesystems could be laid out and mounted, it's hard to give precise instructions. The output from "mount" and "df /opt/IBM/WebSphere/AppServer/profiles/xyz/logs/server1/" would be helpful.
 
Old 03-14-2013, 08:51 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,241

Rep: Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325
Quote:
rm: cannot remove `SystemOut_13.02.28_12.34.10.log': Read-only file system
What rknichols said++; forget the other advice.
 
Old 03-15-2013, 01:38 AM   #7
sukhdip
Member
 
Registered: Sep 2011
Posts: 54

Original Poster
Rep: Reputation: Disabled
Angry

Quote:
Originally Posted by rknichols View Post
As the messages keep telling you over and over, the filesystem is mounted read-only. No changes are possible. What to do next depends on whether the filesystem was intentionally mounted read-only, or became read-only due to an error. If intentional (seems unlikely for a log directory), it's just a matter of running "mount -o remount,rw /path/to/mount/point" to make it read-write. If an error caused the filesystem to become read-only, then an fsck will be necessary to clean up the problem.

Because of the wide variety of ways filesystems could be laid out and mounted, it's hard to give precise instructions. The output from "mount" and "df /opt/IBM/WebSphere/AppServer/profiles/xyz/logs/server1/" would be helpful.
Thanks! I understand the issue atleast. I tried mounting, but failed. below is the output from df and mount.
Code:
df /opt/IBM/WebSphere/AppServer/profiles/xyz/logs/server1/
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VG01-LogVol04
                      19838052  14518428   4295624  78% /opt
Code:
mount -o remount,rw /opt/
mount: block device /dev/VG01/LogVol04 is write-protected, mounting read-only
Code:
mount -o remount,rw /opt/IBM/WebSphere/AppServer/profiles/xyz/logs/server1/
mount: can't find /opt/IBM/WebSphere/AppServer/profiles/xyz/logs/server1 in /etc/fstab or /etc/mtab


Can you please help with fsck in detail. I never used it. and my server is production server so scared to use it without following precautions.

Last edited by sukhdip; 03-15-2013 at 01:43 AM.
 
Old 03-15-2013, 11:25 AM   #8
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 2,962

Rep: Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268
Quote:
Originally Posted by sukhdip View Post
Code:
mount -o remount,rw /opt/
mount: block device /dev/VG01/LogVol04 is write-protected, mounting read-only
The problem is not with the filesystem, but is due to an LVM logical volume that has been made write-protected. The question now is, "Why?" Again, since this volume contains a log directory, I doubt that it was done deliberately. Look for any LVM-related error messages near the top of /var/log/boot.log or perhaps in /var/log/messages* (which could be quite a way back if this server has not been rebooted in a while). Frankly, I don't know whether there are errors that would cause a logical volume to be made read-only as opposed to being simply deactivated, but it's something to look for.

You can change the volume to read/write by running "lvchange -prw VG01/LogVol04". You can then remount the filesystem read/write, but before doing that it would be a good idea to check it. You can safely run "fsck -n -f /dev/VG01/LogVol04" while the filesystem is still mounted read-only. The "-n" flag will prevent fsck from actually changing anything, but it will still report any problems it finds. A read-only filesystem should not have any problems noted.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
File user permission allow read only on soft-link files. hocheetiong Linux - Newbie 1 05-04-2009 12:20 PM
Able To Delete Files Without Permission using Samba tux75 Linux - Newbie 1 02-10-2009 07:20 PM
To delete root permission files in user trash Ramyashree Linux - General 2 07-09-2008 01:00 AM
Tried to delete file as root but it says I don't have permission to delete it! beejayzed Mandriva 23 03-12-2004 03:46 AM
How do I give users read but not delete permission suse7.1user Linux - General 2 09-03-2003 06:13 PM


All times are GMT -5. The time now is 08:17 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration