Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

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

    Scheduled Pinned Locked Moved General pfSense Questions
    6 Posts 2 Posters 10.6k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      codemarauder
      last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • stephenw10S
        stephenw10 Netgate Administrator
        last edited by

        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

        1 Reply Last reply Reply Quote 0
        • C
          codemarauder
          last edited by

          @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.

          1 Reply Last reply Reply Quote 0
          • stephenw10S
            stephenw10 Netgate Administrator
            last edited by

            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

            1 Reply Last reply Reply Quote 0
            • C
              codemarauder
              last edited by

              @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?

              1 Reply Last reply Reply Quote 0
              • stephenw10S
                stephenw10 Netgate Administrator
                last edited by

                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

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post
                Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.