1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Cannot edit /etc/rc.conf

Discussion in 'General' started by IIjkII, Jul 29, 2009.

  1. IIjkII

    IIjkII New Member

    Messages:
    5
    Thanks Received:
    0
    Hello everyone. I'm new to freebsd and just got my box running and started installing stuff on it. I messed up rc.conf and now when I boot it tells me this.

    Code:
    Loading configuration files.
    apache22_enable: not found
    /etc/rc.conf: 17: Syntax error: Unterminated quoted string
    Enter full pathname of shell or RETURN for /bin/sh:


    I assume that is because I wrote this in rc.conf

    Code:
    apache22_enable = "YES"


    instead of this

    Code:
    apache22_enable="YES"


    or maybe because I forgot a quote on

    Code:
    webmin_enable="yes


    Either way I need to go and edit /etc/rc.conf. I login as root and try to use vim to edit it and I get these errors.

    Code:
    W10: Warning: Changing a readonly file
    E303: Unable to open swap file for "etc/rc.conf", recovery impossible
    Press ENTER or type command to continue.


    Code:
    "/etc/rc.conf" E212: Can't open file for writing
    Press ENTER or type command to continue.


    How can I edit /etc/rc.conf? Thanks in advance.
     
  2. Voltar

    Voltar New Member

    Messages:
    191
    Thanks Received:
    24
    Is your root filesystem mounted read-only? I believe that can/does happen when you have an error in rc.conf. I also remember seeing a similar thread to this not too long ago.
     
  3. IIjkII

    IIjkII New Member

    Messages:
    5
    Thanks Received:
    0
    Thanks for the quick reply. It might be, it's all in grey txt now and I don't know what that meant. I assumed it was some sort of emergency shell. I also tried mounting the disk to /mnt and I got the same errors.
     
  4. SirDice

    SirDice Moderator Staff Member Moderator

    Messages:
    17,523
    Thanks Received:
    2,351
    Boot to single user mode then:
    Code:
    # fsck
    # mount -u /
    # mount -a -t ufs
    


    Now you should be able to edit /etc/rc.conf.
     
    markb, tuckBSD, zokstar and 5 others thank for this.
  5. IIjkII

    IIjkII New Member

    Messages:
    5
    Thanks Received:
    0
    Thank you very much. That worked great. Just out of curosity though, what did that do?
     
  6. lme@

    lme@ Administrator Staff Member Administrator Moderator Developer

    Messages:
    629
    Thanks Received:
    204
    With # fsck you check the filesystems, # mount -u / mounts the root partition read/write, # mount -a -t ufs mounts all UFS partitions, so you can use vi and other tools in /usr.
     
    markb, Disturbo and GuillotinePartition thank for this.
  7. IIjkII

    IIjkII New Member

    Messages:
    5
    Thanks Received:
    0
    Oh, I see. So the problem was that the drive was in read-only mode?
     
  8. lme@

    lme@ Administrator Staff Member Administrator Moderator Developer

    Messages:
    629
    Thanks Received:
    204
    The / partition, yes.
     
  9. pe3sos

    pe3sos New Member

    Messages:
    18
    Thanks Received:
    0
    Thanks again SirDice