Prevent packages uninstall & reinstall after restoring a config?



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


  • Rebel Alliance Developer Netgate

    From the shell:

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


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


Log in to reply