Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to remove a file when rc.sysinit is executing I've written something like following :

yes | rm /etc/anImportantFileWhichBelongsToSystem

I guess the parent user for executing rc.sysinit is "root" which means it can do whatever he wants but in my case I can't remove a simple file from hard disk and the error is not shown the attribute of file is : 700

what should I do?

share|improve this question
1  
Why not use rm -f instead of the yes pipe? –  Daniel Beck Apr 5 '13 at 18:26
1  
or use /bin/rm instead of the the alias rm ? –  MelBurslan Apr 5 '13 at 18:40
    
@Mel_Burslan if he's running a script as startup (hinted by rc.sysinit context) he's running original Bourne shell (comaptible) which doesn't have aliases. –  Rich Homolka Apr 5 '13 at 20:33

3 Answers 3

up vote 1 down vote accepted
  1. as @Daniel Beck said, you really should use rm -f for this. You don't need the odd (but working) yes-pipe hack.

  2. The filesystem may not be writable at that point. Have you tested to see if you can create a file at that point in the script? touch /etc/testfile or so, just to make sure it's mounted and writable.

  3. There may be extended attributes on the file. Extended attributes are things that override root privileges. What does lsattr file say.

share|improve this answer

try moving it to /dev/null or unlink or echo :> /etc/anImportantFileWhichBelongsToSystem

share|improve this answer

Possible problem is that the filesystem might not be mounted and/or not mounted as R/W at that point. You may have to do this later after rc.sysinit has completed.

share|improve this answer
    
rc.sysinit is usually in /etc, so it's probably mounted. you may want to add "not mounted writable" –  Rich Homolka Apr 5 '13 at 20:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.