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

    Restore previus configuration from USB

    Scheduled Pinned Locked Moved Off-Topic & Non-Support Discussion
    10 Posts 5 Posters 3.3k 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.
    • R
      Reeko
      last edited by

      I was working around with the file editor over web GUI (Pfsense version 2.3.5) make it some changes. I make a mistake and the system show me a error and i couldn't enter again. So, i tryed to fix the problem by restore a backup made it previusly before start working on the config file (this is important guys, do a backup everytime you want to change some in any system  :)). Several minutes later and trying many methods i couldn't restore my system, mostly becouse the backup file was in a usb drive and the installation program show me several errors trying to restore the config.xml. By the way, even using the Restore to factory default i wasn't able to restore my box. After think for a minute, this was the method that work for me. Maybe is not the most elegant but, it works pretty good :)
      1-. Conect your usb drive with the file .xml. Then enter the shell (option 8 )
      2-. Find out the device with ls /dev/da*. Probably it's looks like da(x)s(x).
      3-. Mount the drive. I created a directory on /home with mkdir (something  like mkdir /home/usbdrive)
      4-. Go to the USB drive via cd /home/usbdrive/ <directory_where_the_file_is>5-. Type cp <name_of_the_file>.xml /cf/conf
      6-. Go to /cf/conf/ and using vi open the file config.xml. "vi config.xml"
      7-. Press Shift + q. When the ":" appears type "write config_old.xml" (This make a copy of the original config.xml, just in case)
      8-. Now open the backup file with vi. Press Shift + q, and when the ":" appears type "write! config.xml". (Overwrite the config.xml)
      9-. Then reboot the system with "reboot" command.

      And thats it. Your system should run normaly again.

      I would like to know is there is a more easly way to restore a config.xml.

      PS: As you probably notice, i'm not a Linux/Unix user. I toke some minutes to find out the commands to do this.
      PS2:  This method allow you to enter to configuration web gui. But, i saw that if you try to change anything using edit file and click on "save", the changes are not saved. So, once you successfuly log in in the configuration gui, you may make a restore using a previus backup.

      Greetings</name_of_the_file></directory_where_the_file_is>

      1 Reply Last reply Reply Quote 0
      • KOMK
        KOM
        last edited by

        Perhaps you should post your question in one of the support forums, General Questions maybe?

        1 Reply Last reply Reply Quote 0
        • R
          Reeko
          last edited by

          Is not a question really, i'm just sharing a solution to a problem i haved. But, if any one want to share a better idea how to solve this kind of issues are welcome.  :)

          1 Reply Last reply Reply Quote 0
          • johnpozJ
            johnpoz LAYER 8 Global Moderator
            last edited by

            "I would like to know is there is a more easly way to restore a config.xml. "

            If your at the console or ssh you can just restore previous config from there.. It will list time and date of config change and pick one before you messed up the config… I would not suggest editing the xml file directly btw..

            restoreconfig.png
            restoreconfig.png_thumb

            An intelligent man is sometimes forced to be drunk to spend time with his fools
            If you get confused: Listen to the Music Play
            Please don't Chat/PM me for help, unless mod related
            SG-4860 24.11 | Lab VMs 2.8, 24.11

            1 Reply Last reply Reply Quote 0
            • R
              Reeko
              last edited by

              In fact i tried that method, but the error in the config file would't let me use it.

              And yes, is a very good advice dont work around with the config.xml. But, is important know the file and know how to work with it, because in some scenarios, is the best way to achive time saving.  :)

              1 Reply Last reply Reply Quote 0
              • johnpozJ
                johnpoz LAYER 8 Global Moderator
                last edited by

                Yes it is possible to edit the xml - but I sure wouldn't edit it with the web editor on pfsense itself ;)  download, modify whatever you need and then restore that section or all of it, etc.

                Well yeah if you corrupted the xml then you might have a problem ;)  You really shouldn't be messing with config of pfsense outside of the gui, unless you really know what your doing and have a backup ready ;)

                An intelligent man is sometimes forced to be drunk to spend time with his fools
                If you get confused: Listen to the Music Play
                Please don't Chat/PM me for help, unless mod related
                SG-4860 24.11 | Lab VMs 2.8, 24.11

                1 Reply Last reply Reply Quote 0
                • NogBadTheBadN
                  NogBadTheBad
                  last edited by

                  notepad++ makes things easier, it understands xml

                  Andy

                  1 x Netgate SG-4860 - 3 x Linksys LGS308P - 1 x Aruba InstantOn AP22

                  1 Reply Last reply Reply Quote 0
                  • johnpozJ
                    johnpoz LAYER 8 Global Moderator
                    last edited by

                    I have edited xml and restored it.. I just use pspad on windows - like it better than notepad++ Just did this to restore all my host overrides on a move from my VM to the sg4860.. Real time saver, etc.. even though I had to edit the interfaces in the xml, etc.

                    I have moved certs this way from cert manager, etc. It is a viable solution - but would never think to try and edit the xml on the fly with the web editor ;)  Then again I have been using pfsense for 10 years and fairly familiar with its workings ;)

                    An intelligent man is sometimes forced to be drunk to spend time with his fools
                    If you get confused: Listen to the Music Play
                    Please don't Chat/PM me for help, unless mod related
                    SG-4860 24.11 | Lab VMs 2.8, 24.11

                    1 Reply Last reply Reply Quote 0
                    • DerelictD
                      Derelict LAYER 8 Netgate
                      last edited by

                      Whatever you do, have a backup from before you started editing it.

                      Chattanooga, Tennessee, USA
                      A comprehensive network diagram is worth 10,000 words and 15 conference calls.
                      DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
                      Do Not Chat For Help! NO_WAN_EGRESS(TM)

                      1 Reply Last reply Reply Quote 0
                      • johnpozJ
                        johnpoz LAYER 8 Global Moderator
                        last edited by

                        Exactly - that is a given on anything you edit.. Be it a word doc or a excel spreadsheet, or a config from your cisco router or your html, etc. etc.. Never directly edit the original - that is asking for trouble… Always work with a copy..

                        An intelligent man is sometimes forced to be drunk to spend time with his fools
                        If you get confused: Listen to the Music Play
                        Please don't Chat/PM me for help, unless mod related
                        SG-4860 24.11 | Lab VMs 2.8, 24.11

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