Unable to create file /etc/rc.conf

I had occasion to make an additional entry in /etc/rc.conf, but due to an unterminated syntax error Fbsd would not save the file throwing up the error 'unable to create file'. When I rebooted (@ root) and corrected the error I still received the same error message & still could not reboot the system.
Is there a workaround to fix the problem ie., without reinstalling the whole system?

Thank You for any help.
 
Hello dalpets,

how do you edit the file? Also, i think you should describe your problem more precise.
Editing has been done with ee editing software. The reason for the attempted editing is that I have a problem whereby the 'startup', 'restart' & 'shutdown' widgets on the Plasma desktop are grayed out, so shutdown can only be achieved via the terminal or the 3 finger shutdown salute.
malavon in the kde desktop forum suggested a fix might be to add sysrc hald_enable="YES" to /etc/rc.conf. Unfortunately when editing the file I made a syntax error & that resulted in the 'unable to create file "/etc/rc.conf" ' message, .
This has happened a few times with other versions of Fbsd requiring complete reinstallation. Hopefully someone knows how to fix the problem without the need to do so now or in future.
 
Last edited:
Unfortunately I caused a syntax error when doing so that resulted in the 'unable to create file "/etc/rc.conf" ' failure message when trying to reboot or save the file.
I suspect you're stuck in single user mode due to the error. In single user mode the root filesystem is mounted but is read-only. You need to remount it before you can make changes.

For UFS:
Code:
fsck -y
mount -u /
mount -a -t ufs
swapon -a

For ZFS it's a little easier:
Code:
zfs set readonly=no zroot/ROOT/default
 
I had occasion to make an additional entry in /etc/rc.conf, but due to an unterminated syntax error Fbsd would not save the file throwing up the error 'unable to create file'. When I rebooted (@ root) and corrected the error I still received the same error message & still could not reboot the system.

The same thing happened to me last night, after I had "carefully" looked to make sure I had not missed commenting a line. I became root and tried to edit it from there but got the same "unable to create file" error and had to mount it first as SirDice outlined for the UFS filesystem.
 
As others have said, it's probably because you're in single user mode. There might have a way to prevent that from happening in the future though.
Unfortunately I caused a syntax error when doing so that resulted in the 'unable to create file "/etc/rc.conf" ' failure message when trying to reboot or save the file.
sysrc hald_enable=YES
This does the same as editing /etc/rc.conf, but the chances of making a syntax mistake are smaller. The most important thing is that only that single line is added or modified.
 
I boot automatically to the desktop & then log in as user with my password.
Would it be easier to just delete the file as root (in the bootup domain) then reinstall it there with all correct lines with ee?
 
If you are able to boot your machine normally, you can use tools like su(1) or sudo(8) to get root access, and edit any files with any editor you are comfortable with.
My point is that I can get to the root prompt in the failing bootup process & then access the file, whilst in the same failed circumstance I can't fully boot to the single user desktop mode. Single user issues aside, being able to access root there does not allow the error to be fixed. It seems an intractible error, hence my question about whether or not in the bootup mode it is practical to delete & reinstall the full file without other repercussions.
 
The system should boot up in a fully functional multi-user console mode without a /etc/rc.conf file.
I would rename (not delete) the existing file to give you something to work from when re-creating it.
 
My point is that I can get to the root prompt in the failing bootup process & then access the file, whilst in the same failed circumstance I can't fully boot to the single user desktop mode. Single user issues aside, being able to access root there does not allow the error to be fixed.

When you get to the initial point of failure, where it stops the normal boot process, then you need to enter the commands laid out by SirDice for the file system you use to mount it. Then you will be able to use ee /etc/rc.conf to fix it from there:
 
As others have said, it's probably because you're in single user mode. There might have a way to prevent that from happening in the future though.

sysrc hald_enable=YES
This does the same as editing /etc/rc.conf, but the chances of making a syntax mistake are smaller. The most important thing is that only that single line is added or modified.
Why does the system stop access to multi user mode when there is a file error?
 
Back
Top