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?

  • 1
    Why not use rm -f instead of the yes pipe?
    – Daniel Beck
    Apr 5, 2013 at 18:26
  • 1
    or use /bin/rm instead of the the alias rm ?
    – MelBurslan
    Apr 5, 2013 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. Apr 5, 2013 at 20:33

3 Answers 3

  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.


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


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.

  • rc.sysinit is usually in /etc, so it's probably mounted. you may want to add "not mounted writable" Apr 5, 2013 at 20:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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