Pack Manager Fail to Upgrade / Un-install / Install / Re-install


  • Hi All,

    Hope all are doing very good. Take care all of you.

    Sorry to say while upgrading 2.4.3 to 2.4.5 not checked any package update is available & forgot to take backup too.
    alt text

    Now couple of package upgrade is available still I can't make upgrade. It is hanging in package re-installing page.
    alt text
    alt text

    I tried using ssh - 13) Update from console & ran few shell commands but no luck.

    <pre>7) Ping host 16) Restart PHP-FPM
    8) Shell

    Enter an option: 13

    Another instance is already running... Aborting!
    pfSense - Netgate Device ID: 7783eef791997d71aaef

    *** Welcome to pfSense 2.4.5-RELEASE (amd64) on LEP2FW1 ***</pre>

    Anything can be done now? or re-installation is only the option?

    Can anyone help me to solve this invisible error?

    Few screenshots attached for your understanding.

    Thanks in advance.

    Lokesh Kamath



  • Thanks for your reply.

    I tried that before posting here.

    <pre>pkg-static clean -ay; pkg-static install -fy pkg pfSense-repo pfSense-upgrade
    Nothing to do.
    Updating pfSense-core repository catalogue...
    pfSense-core repository is up to date.
    Updating pfSense repository catalogue...
    pfSense repository is up to date.
    All repositories are up to date.
    process with pid 15653 still holds the lock
    process with pid 15653 still holds the lock
    process with pid 15653 still holds the lock
    process with pid 15653 still holds the lock
    process with pid 15653 still holds the lock
    process with pid 15653 still holds the lock
    pkg-static: Cannot get an advisory lock on a database, it is locked by another process
    </pre>

    <pre>pkg-static upgrade -f
    Updating pfSense-core repository catalogue...
    pfSense-core repository is up to date.
    Updating pfSense repository catalogue...
    pfSense repository is up to date.
    All repositories are up to date.
    process with pid 15653 still holds the lock
    process with pid 15653 still holds the lock
    process with pid 15653 still holds the lock
    process with pid 15653 still holds the lock
    process with pid 15653 still holds the lock
    process with pid 15653 still holds the lock
    pkg-static: Cannot get an advisory lock on a database, it is locked by another process
    </pre>


  • @slkamath said in Pack Manager Fail to Upgrade / Un-install / Install / Re-install:

    Nothing to do.

    More clear should be :
    Can't do.

    Because :

    @slkamath said in Pack Manager Fail to Upgrade / Un-install / Install / Re-install:

    pkg-static: Cannot get an advisory lock on a database, it is locked by another process

    A pkg-xxx instance is already running, which locks out any subsequent update processes.

    Try this :
    Reboot.
    After reboot, do not visit the GUI, go direcly to the console SSH access.
    Then use the commands from https://docs.netgate.com/pfsense/en/latest/install/upgrade-troubleshooting.html


  • @Gertjan Thank you very much for your kind information. Much appreciated.

    My issue resolved. Can see the images in below links

    Pic 1
    Pic 2

    I have done the few things. Thanks to Joshua Smith who given the info 5 years back in the below link

    starts with https - redmine(dot)ixsystems(dot)com/issues/7599

    Quick info: this may help for someone in near future.

    Command to run in Shell Prompt:

    fstat /var/db/pkg/local.sqlite

    procstat -c (process number)

    pstree (disply if any partial listing)

    kill (process number)

    pkg upgrade -n

    after this please refer below link.

    https://docs.netgate.com/pfsense/en/latest/install/upgrade-troubleshooting.html

    Once again thanks to everyone who helped me to resolve my issue.โœŒ ๐Ÿ‘ ๐Ÿ™ ๐Ÿ˜Š ๐Ÿ˜… ๐Ÿ˜„

    Lokesh Kamath


  • Hi all,
    I've run into this problem as well and appreciate the suggested fixes. The fixes suggested, by themselves, however did not fix my package hang problem. I was, however, able to find additional information, when augmented to these fixes, solved the hang problem in package manager. The root of the problem for me was that everytime I restored a backup configuration, the package manager would hang when trying to reinstall or update packages. The cause of the problem was due to a known problem with the squid package. Unless the squid service is stopped (disabled) prior to a package reinstall, the package manager will hang on a squid reinstall. My guess is that squid may not be the only package service where this may happen. To fix the problem, I performed the following steps:

    1. Stop (disable) all package services to be reinstalled or updated.
    2. Open command prompt from the Diagnostics Menu item.
    3. Execute the following command to see which process has the database locked:
      โ€œ fstat /var/db/pkg/local.sqlite โ€
    4. Confirm process is locking database by executing the following command:
      โ€œ procstat -c (process number) โ€
    5. Look for partial listing (e.g., child processes) by executing the following command:
      โ€œ pstree (disply if any partial listing) โ€
    6. Kill processes, starting with child processes, by executing the following command:
      โ€œ kill (process number) โ€.
    7. Repeat steps 1 through 5 until until there are no longer any processes locking the database.
    8. Ensure that the package database directory exists by executing the following command:
      โ€œ /bin/mkdir -p /var/db/pkg/ /root/var/db/pkg/ โ€
    9. Force an update of the package repository data by executing the following command:
      โ€œ /usr/local/sbin/pkg-static update -f โ€
    10. Force a reinstall of the pfSenseยฎ base package and kernel by executing the following command:
      โ€œ /usr/local/sbin/pkg-static install -yf pkg pfSense pfSense-kernel-pfSense โ€
    11. Refresh the php.ini and other files to ensure they are loading the correct modules by executing the following command:
      โ€œ /etc/rc.php_ini_setup โ€
    12. If any additional packages were installed, reinstall them manually using the GUI if possible, or by using pkg-static install from the command line using the following command:
      โ€œ /usr/local/sbin/pkg-static install -yf <additional-package> <another-additional-package> โ€