Unable to open /cf/conf/config.xml for writing in write_config()



  • Hello.

    I am running 2.0.1-RELEASE on Alix 3d3 and 1G CF card. It was running fine for 4 months now, but suddenly after turning the device on today I got a notification email that said "Unable to open /cf/conf/config.xml for writing in write_config()".

    On investigating further, when I tried to save a change I see following message in the logs:

    
    Jul 24 08:30:49 hopbox php: /diag_logs_settings.php: WARNING: Config contents could not be save. Could not open file!
    Jul 24 08:30:49 hopbox php: /diag_logs_settings.php: New alert found: Unable to open /cf/conf/config.xml for writing in write_config()
    Jul 24 08:30:53 hopbox php: /diag_logs_settings.php: Message sent to xxx@yyy.zzz OK
    
    

    And this is what I saw on the GUI near the top menu:

    
    Warning: copy(/cf/conf/backup/config-1343097676.xml): failed to open stream: Read-only file system in /etc/inc/config.lib.inc on line 834 Warning: fopen(/cf/conf/backup/backup.cache): failed to open stream: Read-only file system in /etc/inc/config.lib.inc on line 841 Warning: fwrite(): supplied argument is not a valid stream resource in /etc/inc/config.lib.inc on line 842 Warning: fclose(): supplied argument is not a valid stream resource in /etc/inc/config.lib.inc on line 843 Warning: fopen(/cf/conf/config.xml.58401): failed to open stream: Read-only file system in /etc/inc/config.lib.inc on line 445
    
    

    This is the output of mount command. The difference from a perfectly fine alix box with this is "read-only" on the faulty box's mounts

    
    /dev/ufs/pfsense0 on / (ufs, local, noatime, read-only, synchronous)
    devfs on /dev (devfs, local)
    /dev/md0 on /tmp (ufs, local)
    /dev/md1 on /var (ufs, local)
    /dev/ufs/cf on /cf (ufs, local, noatime, read-only, synchronous)
    devfs on /var/dhcpd/dev (devfs, local)
    
    

    There is no further information I could find in the logs or forums, but that's for sure that I am not able to make any configuration changes and save them. Does this error mean my CF card has gone kaput or there is something else?

    The device is treated as a usual embedded router or modem which is not shutdown properly, but switched off directly from the powerstrip.


  • Netgate Administrator

    If you are running the Nanobsd install, and you should be, it's supposed to be mounted read only. It will temporarily remount read-write when it saves the config. The fact that it's unable to do that is a bad sign.

    Steve



  • @stephenw10:

    If you are running the Nanobsd install, and you should be, it's supposed to be mounted read only. It will temporarily remount read-write when it saves the config. The fact that it's unable to do that is a bad sign.

    Yes I am running a nanoBSD install on alix.


  • Netgate Administrator

    Where are you running the mount command?

    From a shell (ssh or console) it should appear read-only. If you are running it via the web diagnostics page it will show as read-write as the the php code remounts it before running the command.

    Steve



  • @stephenw10:

    Where are you running the mount command?

    I ran the command from a shell.

    Miraculously, the error has gone away after a reboot today morning and output of mount command is back to normal:

    
    /dev/ufs/pfsense0 on / (ufs, local, noatime, synchronous)
    devfs on /dev (devfs, local)
    /dev/md0 on /tmp (ufs, local)
    /dev/md1 on /var (ufs, local)
    /dev/ufs/cf on /cf (ufs, local, noatime, synchronous)
    devfs on /var/dhcpd/dev (devfs, local)
    
    

    Could this error be because of dirty filesystem which got fixed on the reboot?


  • Netgate Administrator

    There was a glitch a while back that prevented the remounting command functioning but I thought that had been fixed with 2.0.1.
    The / and /cf should be mounted read only in Nanobsd.

    [2.0.1-RELEASE][root@pfsense.fire.box]/root(27): mount -p
    /dev/ufs/pfsense0       /                       ufs     ro,sync,noatime         1 1
    devfs                   /dev                    devfs   rw                      0 0
    /dev/md0                /tmp                    ufs     rw                      2 2
    /dev/md1                /var                    ufs     rw                      2 2
    /dev/ufs/cf             /cf                     ufs     ro,sync,noatime         1 1
    devfs                   /var/dhcpd/dev          devfs   rw                      0 0
    
    

    You can try remounting it RO manually:

    /etc/rc.conf_mount_ro
    

    Steve


Log in to reply