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

    pkg update -f and pkf upgrade -f

    Scheduled Pinned Locked Moved General pfSense Questions
    23 Posts 3 Posters 2.0k 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.
    • bmeeksB
      bmeeks @kevindd992002
      last edited by bmeeks

      @kevindd992002
      Everything you should need to understand the arguments fo pkg are here. The pkg utility is ignorant of disk partitions themselves. It just references whatever partitions are mounted at the time it runs. pkg is all about simply updating binary and text files on the mounted filesystem. Perhaps you are confusing the pfSense-upgrade program with pkg?

      K 1 Reply Last reply Reply Quote 0
      • K
        kevindd992002 @bmeeks
        last edited by

        @bmeeks said in pkg update -f and pkf upgrade -f:

        @kevindd992002
        Everything you should need to understand the arguments fo pkg are here. The pkg utility is ignorant of disk partitions themselves. It just references whatever partitions are mounted at the time it runs. pkg is all about simply updating binary and text files on the mounted filesystem. Perhaps you are confusing the pfSense-upgrade program with pkg?

        No. If you read the thread I referenced, they're saying that if you set the zfs copies to 2, only new files will have 2 copies. The existing files will need to be modified for them to be duplicated. Here's the specific post I'm referring to:

        https://forum.netgate.com/post/731585

        NollipfSenseN 1 Reply Last reply Reply Quote 0
        • NollipfSenseN
          NollipfSense @kevindd992002
          last edited by

          @kevindd992002 You may need to manually create two GPT partitions of equal size on the single then see whether the installer recognizes both...you'll need to still press the space to select the second partition. You're really on your own...the thread you link in the original provided the how to.

          pfSense+ 23.09 Lenovo Thinkcentre M93P SFF Quadcore i7 dual Raid-ZFS 128GB-SSD 32GB-RAM PCI-Intel i350-t4 NIC, -Intel QAT 8950.
          pfSense+ 23.09 VM-Proxmox, Dell Precision Xeon-W2155 Nvme 500GB-ZFS 128GB-RAM PCIe-Intel i350-t4, Intel QAT-8950, P-cloud.

          K 1 Reply Last reply Reply Quote 0
          • K
            kevindd992002 @NollipfSense
            last edited by

            @NollipfSense said in pkg update -f and pkf upgrade -f:

            @kevindd992002 You may need to manually create two GPT partitions of equal size on the single then see whether the installer recognizes both...you'll need to still press the space to select the second partition. You're really on your own...the thread you link in the original provided the how to.

            There isn't really a need for two partitions. You simply do zfs set copies=2 yourpoolname to set two copies on the same partition. I just want to know the best way to modify existing files to trigger the process of duplicating themselves to the 2nd zfs copy on the same partition on the same SSD. And then setup a cron schedule to scrub the files every now and then.

            NollipfSenseN 1 Reply Last reply Reply Quote 0
            • NollipfSenseN
              NollipfSense @kevindd992002
              last edited by

              @kevindd992002 So, you're saying you already setup the ZFS on the single and installed pfSense? If that's the case, then run zfs set copies=2 yourpoolname at the CLI, then do the cron job...I take it your pool name is pool1.

              pfSense+ 23.09 Lenovo Thinkcentre M93P SFF Quadcore i7 dual Raid-ZFS 128GB-SSD 32GB-RAM PCI-Intel i350-t4 NIC, -Intel QAT 8950.
              pfSense+ 23.09 VM-Proxmox, Dell Precision Xeon-W2155 Nvme 500GB-ZFS 128GB-RAM PCIe-Intel i350-t4, Intel QAT-8950, P-cloud.

              K 1 Reply Last reply Reply Quote 0
              • K
                kevindd992002 @NollipfSense
                last edited by

                @NollipfSense said in pkg update -f and pkf upgrade -f:

                @kevindd992002 So, you're saying you already setup the ZFS on the single and installed pfSense? If that's the case, then run zfs set copies=2 yourpoolname at the CLI, then do the cron job...I take it your pool name is pool1.

                1. Reinstalled pfsense with ZFS
                2. After installation, you have the option to go the shell and set the zfs copies to 2. My pool name is the default zroot.
                3. Since the setting of the copies was done practically after the installation of pfsense, the system files are not duplicated until they get modified.
                4. The cron job is for the scrubbing part and that is not my concern here. My concern is how to get most of the files in the system modified so that zfs creates a duplicate for all of them. As per the post I linked to, he says and I quote:

                "Just wait for the next update to your pfSense system, the update will rewrite almost all of the base system files and then you can do the 'pkg upgrade -f' trick to reinstall the rest."

                The next update will modify/rewrite most of the files, I understand that. What I don't understand is why the need to do a pkg upgrade -f after the upgrade. What does this accomplish?

                NollipfSenseN bmeeksB 2 Replies Last reply Reply Quote 0
                • NollipfSenseN
                  NollipfSense @kevindd992002
                  last edited by

                  @kevindd992002 It seems to be upgrading a pkg text file in the system; however, I'll link
                  @stephenw10 in the hope that he could explain better.

                  pfSense+ 23.09 Lenovo Thinkcentre M93P SFF Quadcore i7 dual Raid-ZFS 128GB-SSD 32GB-RAM PCI-Intel i350-t4 NIC, -Intel QAT 8950.
                  pfSense+ 23.09 VM-Proxmox, Dell Precision Xeon-W2155 Nvme 500GB-ZFS 128GB-RAM PCIe-Intel i350-t4, Intel QAT-8950, P-cloud.

                  1 Reply Last reply Reply Quote 0
                  • bmeeksB
                    bmeeks @kevindd992002
                    last edited by bmeeks

                    @kevindd992002 said in pkg update -f and pkf upgrade -f:

                    The next update will modify/rewrite most of the files, I understand that. What I don't understand is why the need to do a pkg upgrade -f after the upgrade. What does this accomplish?

                    Ah, I understand your question a bit better now. All pkg upgrade -f does is force the pkg utility to reinstall all the concurrently installed package files whether they are "current" or not. Normally the utility will only install (or download and write files to disk) when there are newer versions posted on whatever remote repository pkg is pointed at. The "-f" flag just tells pkg to download and rewrite all of the installed package files regardless if they are already current.

                    So the effect with that switch is everything pkg initially installed is installed again. This would touch all of those files and rewrite their physical content to disk. The normal behavior of pkg upgrade would be to only download and rewrite files to disk when the remote repository contains newer versions of those files. This is explained in that link I provided earlier.

                    K 1 Reply Last reply Reply Quote 0
                    • K
                      kevindd992002 @bmeeks
                      last edited by

                      @bmeeks said in pkg update -f and pkf upgrade -f:

                      @kevindd992002 said in pkg update -f and pkf upgrade -f:

                      The next update will modify/rewrite most of the files, I understand that. What I don't understand is why the need to do a pkg upgrade -f after the upgrade. What does this accomplish?

                      Ah, I understand your question a bit better now. All pkg upgrade -f does is force the pkg utility to reinstall all the concurrently installed package files whether they are "current" or not. Normally the utility will only install (or download and write files to disk) when there are newer versions posted on whatever remote repository pkg is pointed at. The "-f" flag just tells pkg to download and rewrite all of the installed package files regardless if they are already current.

                      So the effect with that switch is everything pkg initially installed is installed again. This would touch all of those files and rewrite their physical content to disk.

                      Yeah, I figured that that's what it will do by reading this ☺

                      Now, as I understand it you also need to update the catalogue before doing an upgrade. That's where pkg update -f comes in. This says that the -f switch will force a full download of the repository. Without it, does it just do a differential download of some sort?

                      bmeeksB 1 Reply Last reply Reply Quote 0
                      • bmeeksB
                        bmeeks @kevindd992002
                        last edited by bmeeks

                        @kevindd992002 said in pkg update -f and pkf upgrade -f:

                        @bmeeks said in pkg update -f and pkf upgrade -f:

                        @kevindd992002 said in pkg update -f and pkf upgrade -f:

                        The next update will modify/rewrite most of the files, I understand that. What I don't understand is why the need to do a pkg upgrade -f after the upgrade. What does this accomplish?

                        Ah, I understand your question a bit better now. All pkg upgrade -f does is force the pkg utility to reinstall all the concurrently installed package files whether they are "current" or not. Normally the utility will only install (or download and write files to disk) when there are newer versions posted on whatever remote repository pkg is pointed at. The "-f" flag just tells pkg to download and rewrite all of the installed package files regardless if they are already current.

                        So the effect with that switch is everything pkg initially installed is installed again. This would touch all of those files and rewrite their physical content to disk.

                        Yeah, I figured that that's what it will do by reading this ☺

                        Now, as I understand it you also need to update the catalogue before doing an upgrade. That's where pkg update -f comes in. This says that the -f switch will force a full download of the repository. Without it, does it just do a differential download of some sort?

                        Yes, it always attempts to minimize the amount of downloaded/installed data when possible. The -f switch overrides that behavior. If you are familiar with how the Linux package managers work (apt, rpm, etc.) it's the same idea. The normal behavior downloads the smallest bits possible to accomplish the task.

                        pkg on FreeBSD is the equivalent of apt on Ubuntu.

                        K 1 Reply Last reply Reply Quote 0
                        • K
                          kevindd992002 @bmeeks
                          last edited by

                          @bmeeks said in pkg update -f and pkf upgrade -f:

                          @kevindd992002 said in pkg update -f and pkf upgrade -f:

                          @bmeeks said in pkg update -f and pkf upgrade -f:

                          @kevindd992002 said in pkg update -f and pkf upgrade -f:

                          The next update will modify/rewrite most of the files, I understand that. What I don't understand is why the need to do a pkg upgrade -f after the upgrade. What does this accomplish?

                          Ah, I understand your question a bit better now. All pkg upgrade -f does is force the pkg utility to reinstall all the concurrently installed package files whether they are "current" or not. Normally the utility will only install (or download and write files to disk) when there are newer versions posted on whatever remote repository pkg is pointed at. The "-f" flag just tells pkg to download and rewrite all of the installed package files regardless if they are already current.

                          So the effect with that switch is everything pkg initially installed is installed again. This would touch all of those files and rewrite their physical content to disk.

                          Yeah, I figured that that's what it will do by reading this ☺

                          Now, as I understand it you also need to update the catalogue before doing an upgrade. That's where pkg update -f comes in. This says that the -f switch will force a full download of the repository. Without it, does it just do a differential download of some sort?

                          Yes, it always attempts to minimize the amount of downloaded/installed data when possible. The -f switch overrides that behavior. If you are familiar with how the Linux package managers work (apt, rpm, etc.) it's the same idea. The normal behavior downloads the smallest bits possible to accomplish the task.

                          pkg on FreeBSD is the equivalent of apt on Ubuntu.

                          Yes, I do have a Debian system and I use apt update and apt upgrade. The only difference is that they don't have a -f switch which got me confused.

                          bmeeksB 1 Reply Last reply Reply Quote 0
                          • bmeeksB
                            bmeeks @kevindd992002
                            last edited by

                            @kevindd992002 said in pkg update -f and pkf upgrade -f:

                            @bmeeks said in pkg update -f and pkf upgrade -f:

                            @kevindd992002 said in pkg update -f and pkf upgrade -f:

                            @bmeeks said in pkg update -f and pkf upgrade -f:

                            @kevindd992002 said in pkg update -f and pkf upgrade -f:

                            The next update will modify/rewrite most of the files, I understand that. What I don't understand is why the need to do a pkg upgrade -f after the upgrade. What does this accomplish?

                            Ah, I understand your question a bit better now. All pkg upgrade -f does is force the pkg utility to reinstall all the concurrently installed package files whether they are "current" or not. Normally the utility will only install (or download and write files to disk) when there are newer versions posted on whatever remote repository pkg is pointed at. The "-f" flag just tells pkg to download and rewrite all of the installed package files regardless if they are already current.

                            So the effect with that switch is everything pkg initially installed is installed again. This would touch all of those files and rewrite their physical content to disk.

                            Yeah, I figured that that's what it will do by reading this ☺

                            Now, as I understand it you also need to update the catalogue before doing an upgrade. That's where pkg update -f comes in. This says that the -f switch will force a full download of the repository. Without it, does it just do a differential download of some sort?

                            Yes, it always attempts to minimize the amount of downloaded/installed data when possible. The -f switch overrides that behavior. If you are familiar with how the Linux package managers work (apt, rpm, etc.) it's the same idea. The normal behavior downloads the smallest bits possible to accomplish the task.

                            pkg on FreeBSD is the equivalent of apt on Ubuntu.

                            Yes, I do have a Debian system and I use apt update and apt upgrade. The only difference is that they don't have a -f switch which got me confused.

                            They have a --force switch or something similar. Been a while since I've needed to use either from the command line.

                            1 Reply Last reply Reply Quote 0
                            • K
                              kevindd992002
                              last edited by

                              apt-get does, but not apt. Anyway, will doing a pkg update -f do any potential damage compared to just letting its thing do without the switch?

                              bmeeksB 1 Reply Last reply Reply Quote 0
                              • bmeeksB
                                bmeeks @kevindd992002
                                last edited by bmeeks

                                @kevindd992002 said in pkg update -f and pkf upgrade -f:

                                apt-get does, but not apt. Anyway, will doing a pkg update -f do any potential damage compared to just letting its thing do without the switch?

                                No, so long as you have not manually monkeyed with the repo.conf file and say pointed it at some other remote repository that might contain different versions of stuff. But with a stock pfSense installation there is no harm in using the -f switch other than just downloading and rewriting data that strictly does not require such.

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