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

    Calling stop_packages from system_reboot_cleanup in system.inc

    Scheduled Pinned Locked Moved 2.1 Snapshot Feedback and Problems - RETIRED
    2 Posts 1 Posters 2.1k 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.
    • P
      phil.davis
      last edited by

      When I shutdown the following comes out on the console when stopping services and packages:

      pfSense is rebooting now.
       Stopping package blinkled...done.
       Stopping package pfBlocker...done.
       Stopping rc.backup_dhcpleases.sh...done.
       Stopping rc.backup_rrd.sh...done.
       Stopping rc.update_bogons.sh...done.
      Syntax error: Bad fd number
      

      I am ignoring "Bad fd number" for now - it seems an intractable problem with popen() and pclose().
      The code in pkg-utils.inc function stop_packages really intends to call rc*.sh files in the dir defined by the definition in service-utils.inc:
      $rcfileprefix = "/usr/local/etc/rc.d/";
      But it is actually calling ones it finds in "/etc" - which appears to be it's default dir at the time.
      $rcfileprefix is not getting defined globally in this context. system.inc only does a require_once inside the system_reboot_cleanup routine. That only makes a local scope definition of $rcfileprefix.
      The way that stop_packages is called from /etc/rc.stop_packages works. The require_once is in the very top, in a global context where the definition gets made globally by default.
      This global variable business is quite mixed up - pkg-utils.inc has 3 times:
      require_once("service-utils.inc");
      One way to fix this is to add to the top of service-utils.inc:
      global $rcfileprefix;
      Then the definition straight after will always be global. Everything that uses it would have to also declare it global.
      But I suspect that it would be better to sort out the whole relationship between use of require_once in different places and use of global variables.

      As the Greek philosopher Isosceles used to say, "There are 3 sides to every triangle."
      If I helped you, then help someone else - buy someone a gift from the INF catalog http://secure.inf.org/gifts/usd/

      1 Reply Last reply Reply Quote 0
      • P
        phil.davis
        last edited by

        Fixed by pull request #208 - https://github.com/bsdperimeter/pfsense/pull/208

        As the Greek philosopher Isosceles used to say, "There are 3 sides to every triangle."
        If I helped you, then help someone else - buy someone a gift from the INF catalog http://secure.inf.org/gifts/usd/

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