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

    Prevent packages uninstall & reinstall after restoring a config?

    Scheduled Pinned Locked Moved pfSense Packages
    5 Posts 4 Posters 3.7k 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
      carlm
      last edited by

      pfSense nanoBSD 2.2.5

      Is there a way to prevent pfSense from uninstalling and reinstalling all packages when it reboots after a config restore?
      I'm not talking about a pfSense version upgrade or a fresh install of a new pfSense version – just a simple config restore.
      I have good reasons for wanting to skip package reinstallation.

      One thought I had was to restore a config.xml with 'installedpackages' removed. On reboot, boot single user and replace with the normal config.xml.

      Would that work? Is there a simpler way? What tells pfSense, when it reboots, to uninstall and reinstall all packages? Is there a flag file I could delete if I booted single user on reboot?

      Thanks!

      EDIT:

      Messing with config.xml as proposed above is obsolete because Jim's suggestion in the following post is simpler and it works (tested).
      However, for the record, I didn't describe the process correctly.
      First reboot: Boot normally. pfSense finds no installed packages (I think, not tested), so no uninstall/reinstall.
      Second reboot: Boot single-user and replace the no-package config.xml with the normal config.xml with 'installedpackages'.
      THIS IS NOT TESTED. USE PROCEDURE IN FOLLOWING POST.

      1 Reply Last reply Reply Quote 0
      • jimpJ
        jimp Rebel Alliance Developer Netgate
        last edited by

        From the shell:

        # /etc/rc.conf_mount_rw
        # rm /conf/needs_package_sync
        

        Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

        Need help fast? Netgate Global Support!

        Do not Chat/PM for help!

        A 1 Reply Last reply Reply Quote 0
        • C
          carlm
          last edited by

          @jimp:

          From the shell:

          # /etc/rc.conf_mount_rw
          # rm /conf/needs_package_sync
          

          Thanks!
          Booting single-user and deleting /conf/needs_package_sync did the trick.
          I can now restore a config without having 30+ minutes of downtime.

          I did it slightly differently, though.
          I didn't know if using PHP would have worked in single-user mode.
          Instead, at the shell prompt:

          /sbin/mount -w -o sync,noatime /dev/ufs/cf /cf

          rm /conf/needs_package_sync

          /sbin/umount /cf

          exit

          After exiting the single-user shell the system proceeds to boot multi-user.

          WARNING: Do not use this trick if the pfSense version to which you are restoring config.xml is not the same as the pfSense version from which the config.xml backup was made.

          1 Reply Last reply Reply Quote 0
          • A
            alivdel @jimp
            last edited by

            @jimp
            hi Jimp,

            is there a similar way on pfSense 2.6.0 to prevent packages unistall & reinstall after restoring a config in background?

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

              Still works. 6 years later. 😉

              If you're running ZFS though you need different commands to remount /conf:

              https://docs.netgate.com/pfsense/en/latest/troubleshooting/single-user-mode.html#single-user-mode-zfs

              Steve

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