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

    Upgrade deletes custom scripts in /usr/local/etc/rc.d/

    Problems Installing or Upgrading pfSense Software
    4
    10
    2.8k
    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.
    • P
      pgorman
      last edited by

      After upgrading to 2.1.1 and after upgrading to 2.1.2, the shell scripts I had added to /usr/local/etc/rc.d/ were gone. I would expect things in /usr/local/ to be preserved.

      I'm not sure if this is a regression of the same bug from issue #1612 or not (https://redmine.pfsense.org/issues/1612).

      1 Reply Last reply Reply Quote 0
      • D
        doktornotor Banned
        last edited by

        It is not really the same bug, plus I frankly cannot see how you expect things to survive this:

        
        dd if=/dev/zero of=/dev/${TOFLASH} bs=1m count=1 >> /conf/upgrade_log.txt 2>&1
        /usr/bin/gzip -dc $IMG | /bin/dd of=/dev/${TOFLASH} obs=64k >> /conf/upgrade_log.txt 2>&1
        
        

        If you want any scripts preserved across upgrades, then upload them via Filer package so that they are saved in config.xml. Otherwise, obviously they will NOT survive.

        1 Reply Last reply Reply Quote 0
        • P
          pgorman
          last edited by

          Thanks, doktornotor, but I don't think that's my issue. Are you quoting from /etc/rc.firmware? I don't think we fall under the pfSenseNanoBSDupgrade case.

          Anyhow, custom files in /usr/local/etc/ do survive an upgrade for me.

          EDITED to add that the messages in /conf/upgrade_log.txt indicate I'm under the pfSenseupgrade case in /etc/rc.firmware.

          1 Reply Last reply Reply Quote 0
          • D
            doktornotor Banned
            last edited by

            Do as you wish. Regardless what case you are under, stuff not tracked anywhere will get lost sooner or later.

            1 Reply Last reply Reply Quote 0
            • P
              pgorman
              last edited by

              I acknowledge that Filer is a good suggestion. Thank you.

              I still think this should be fixed. Admins will not expect /usr/local/etc/rc.d/ to get hosed by a routine upgrade, particularly since the pfSense docs mention it as a valid option (https://doc.pfsense.org/index.php/Executing_commands_at_boot_time).

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

                On a full install it is not touched. On NanoBSD every upgrade is like a wipe+reload+restore. nothing is spared that isn't in the config or in /conf/ or that has specific code checks (e.g. DHCP leases, RRD)

                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!

                1 Reply Last reply Reply Quote 0
                • B
                  bryan.paradis
                  last edited by

                  @jimp:

                  On a full install it is not touched. On NanoBSD every upgrade is like a wipe+reload+restore. nothing is spared that isn't in the config or in /conf/ or that has specific code checks (e.g. DHCP leases, RRD)

                  Would be good to have that added to the wiki

                  Shell script option

                  You can also place any shell script in the /usr/local/etc/rc.d/ directory. The filename must end in .sh and it must be marked as executable (chmod +x myscript.sh). Every shell script ending in .sh in this directory will be executed at boot time.
                  The first two options are preferable as they are retained in the config file and hence do not require additional modifications should you have to replace the storage medium and reinstall, or restore the configuration to a different piece of hardware.

                  1 Reply Last reply Reply Quote 0
                  • P
                    pgorman
                    last edited by

                    @jimp:

                    On a full install it is not touched. On NanoBSD every upgrade is like a wipe+reload+restore. nothing is spared that isn't in the config or in /conf/ or that has specific code checks (e.g. DHCP leases, RRD)

                    That's the thing. I'm on a full install (unless I'm very much mistaken), and custom scripts in /usr/local/etc/rc.d/ still got deleted on upgrade.

                    [2.1.2-RELEASE][admin@angus.example.com]/etc(29): uname -a
                    FreeBSD angus.hartmantyner.com 8.3-RELEASE-p15 FreeBSD 8.3-RELEASE-p15 #1: Thu Apr 10 05:44:36 EDT 2014    root@pf2_1_1_i386.pfsense.org:/usr/obj.pfSense/usr/pfSensesrc/src/sys/pfSense_SMP.8  i386
                    [2.1.2-RELEASE][admin@angus.example.com]/etc(30): cat /etc/platform
                    pfSense

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

                      It looks like a full install. But unless you overwrote a package script and a package (re)install clobbered yours, it would not be removed.

                      There is no code in the upgrade process to wipe those out, and they do stay.

                      : touch /usr/local/etc/rc.d/nodissassemblejohnny5.sh
                      [forced a firmware upgrade to 2.1.2]
                      [reboot]
                      : ls -l /usr/local/etc/rc.d/nodissassemblejohnny5.sh
                      -rwxr-xr-x  1 root  wheel  0 Apr 15 12:30 /usr/local/etc/rc.d/nodissassemblejohnny5.sh
                      

                      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!

                      1 Reply Last reply Reply Quote 0
                      • P
                        pgorman
                        last edited by

                        Yes, fixed. I suspect a package installer was to blame.

                        We have Squid and SquidGuard installed. I had originally named the script that was getting deleted '/usr/local/etc/rc.d/squidguard_setup.sh'. When I renamed it to '/usr/local/etc/rc.d/blacklist.sh', it survived upgrades.

                        I suspect either the Squid or SquidGuard package installer is doing something like 'rm /usr/local/etc/rc.d/squid*'.

                        Thanks for the help, everyone.

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