dpkg-query placeholders “Filename”, “MD5sum” and “Size” are always empty

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
3
down vote

favorite












I'm currently trying to get some info about the installed pakages und systems that use dpkg. So I tried to use dpkg-query. Most placeholders work fine and I get what I need, however I noticed that the placeholders Filename, MD5sum and Size are always empty.



Simple command to see the issue:



dpkg-query -W -f '"location":"$Filename","md5":"$MD5sum","size":"$Size"\n'


This will result in loads of lines of just



"location":"","md5":"","size":""






share|improve this question


























    up vote
    3
    down vote

    favorite












    I'm currently trying to get some info about the installed pakages und systems that use dpkg. So I tried to use dpkg-query. Most placeholders work fine and I get what I need, however I noticed that the placeholders Filename, MD5sum and Size are always empty.



    Simple command to see the issue:



    dpkg-query -W -f '"location":"$Filename","md5":"$MD5sum","size":"$Size"\n'


    This will result in loads of lines of just



    "location":"","md5":"","size":""






    share|improve this question
























      up vote
      3
      down vote

      favorite









      up vote
      3
      down vote

      favorite











      I'm currently trying to get some info about the installed pakages und systems that use dpkg. So I tried to use dpkg-query. Most placeholders work fine and I get what I need, however I noticed that the placeholders Filename, MD5sum and Size are always empty.



      Simple command to see the issue:



      dpkg-query -W -f '"location":"$Filename","md5":"$MD5sum","size":"$Size"\n'


      This will result in loads of lines of just



      "location":"","md5":"","size":""






      share|improve this question














      I'm currently trying to get some info about the installed pakages und systems that use dpkg. So I tried to use dpkg-query. Most placeholders work fine and I get what I need, however I noticed that the placeholders Filename, MD5sum and Size are always empty.



      Simple command to see the issue:



      dpkg-query -W -f '"location":"$Filename","md5":"$MD5sum","size":"$Size"\n'


      This will result in loads of lines of just



      "location":"","md5":"","size":""








      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 22 at 13:00









      Stephen Kitt

      143k22312377




      143k22312377










      asked Aug 22 at 12:52









      BrainStone

      1,10371940




      1,10371940




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          4
          down vote



          accepted










          As mentioned in the manpage, these fields are “internal, front-end related”. In fact they’re only used in dselect.



          This means you can’t rely on them in dpkg-query, by default. They correspond to values stored in the “available” database, /var/lib/dpkg/available; dpkg-query by default only considers /var/lib/dpkg/status nowadays. You can add the --load-avail option to merge the information from the “available” database, in theory — but that requires using dselect as your package installation tool, since /var/lib/dpkg/available is only kept up-to-date by dselect. If you use APT this won’t work, as described in the documentation for the -p command:




          Users of APT-based frontends should use apt-cache show package-name instead as the available file is only kept up-to-date when using dselect.




          It might help if I expand a bit on the meaning of the fields: Filename, MD5sum and Size (and MSDOS-Filename) all give information on the file containing a package (its filename, checksum and size). They aren’t germane to the packages themselves, so the status database doesn’t need them and doesn’t store them. A package, installed or otherwise, remains the same regardless of where its package file lives and what its characteristics are. That information is only useful for front-ends which retrieve packages and provide them to dpkg.






          share|improve this answer






















          • I saw these in the manpages, however could not find any reference as to what internal and front-end related mean. Also according to said mainpage they should be available.
            – BrainStone
            Aug 22 at 13:02







          • 1




            That isn't really clear from the man page. The man states that (emphasis mine) "The following fields are recognized but they are not necessarily available in the status file (only internal fields or fields stored in the binary package end up in it)" which would suggest that, contrary to what your answer states, it's the internal fields that will be included.
            – terdon♦
            Aug 22 at 13:03






          • 1




            @terdon right, I wrote my answer based on the source code, not the documentation ;-).
            – Stephen Kitt
            Aug 22 at 13:19










          • @StephenKitt is there a format option for apt-cache show too? Else the manipulation of the texts is gonna be a nightmare...
            – BrainStone
            Aug 22 at 13:25






          • 1




            @BrainStone not with apt-cache, but the output follows RFC 822 and is designed to be parsed. If you want a controllable format using APT-based tools, look at aptitude search and its -F option.
            – Stephen Kitt
            Aug 22 at 13:28

















          up vote
          4
          down vote













          You can use grep-available tool instead (or more better grep-aptavail as mentioned @Stephen Kitt) :



          grep-available -s Filename,MD5sum,size -PX <package_name>


          Example:



          grep-available -s Filename,MD5sum,size -PX dpkg


          sample output:



          Filename: pool/main/d/dpkg/dpkg_1.18.24_amd64.deb
          MD5sum: 5553b3fac608f5c4f9fa3ddbff18c2c5
          Size: 2106696





          share|improve this answer


















          • 1




            Or better yet in most cases, grep-aptavail.
            – Stephen Kitt
            Aug 22 at 13:37






          • 1




            I think this is a great answer for the general public, but not for me, as I need a portable solution. (That's why I won't accept it)
            – BrainStone
            Aug 22 at 13:42










          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f464117%2fdpkg-query-placeholders-filename-md5sum-and-size-are-always-empty%23new-answer', 'question_page');

          );

          Post as a guest






























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          4
          down vote



          accepted










          As mentioned in the manpage, these fields are “internal, front-end related”. In fact they’re only used in dselect.



          This means you can’t rely on them in dpkg-query, by default. They correspond to values stored in the “available” database, /var/lib/dpkg/available; dpkg-query by default only considers /var/lib/dpkg/status nowadays. You can add the --load-avail option to merge the information from the “available” database, in theory — but that requires using dselect as your package installation tool, since /var/lib/dpkg/available is only kept up-to-date by dselect. If you use APT this won’t work, as described in the documentation for the -p command:




          Users of APT-based frontends should use apt-cache show package-name instead as the available file is only kept up-to-date when using dselect.




          It might help if I expand a bit on the meaning of the fields: Filename, MD5sum and Size (and MSDOS-Filename) all give information on the file containing a package (its filename, checksum and size). They aren’t germane to the packages themselves, so the status database doesn’t need them and doesn’t store them. A package, installed or otherwise, remains the same regardless of where its package file lives and what its characteristics are. That information is only useful for front-ends which retrieve packages and provide them to dpkg.






          share|improve this answer






















          • I saw these in the manpages, however could not find any reference as to what internal and front-end related mean. Also according to said mainpage they should be available.
            – BrainStone
            Aug 22 at 13:02







          • 1




            That isn't really clear from the man page. The man states that (emphasis mine) "The following fields are recognized but they are not necessarily available in the status file (only internal fields or fields stored in the binary package end up in it)" which would suggest that, contrary to what your answer states, it's the internal fields that will be included.
            – terdon♦
            Aug 22 at 13:03






          • 1




            @terdon right, I wrote my answer based on the source code, not the documentation ;-).
            – Stephen Kitt
            Aug 22 at 13:19










          • @StephenKitt is there a format option for apt-cache show too? Else the manipulation of the texts is gonna be a nightmare...
            – BrainStone
            Aug 22 at 13:25






          • 1




            @BrainStone not with apt-cache, but the output follows RFC 822 and is designed to be parsed. If you want a controllable format using APT-based tools, look at aptitude search and its -F option.
            – Stephen Kitt
            Aug 22 at 13:28














          up vote
          4
          down vote



          accepted










          As mentioned in the manpage, these fields are “internal, front-end related”. In fact they’re only used in dselect.



          This means you can’t rely on them in dpkg-query, by default. They correspond to values stored in the “available” database, /var/lib/dpkg/available; dpkg-query by default only considers /var/lib/dpkg/status nowadays. You can add the --load-avail option to merge the information from the “available” database, in theory — but that requires using dselect as your package installation tool, since /var/lib/dpkg/available is only kept up-to-date by dselect. If you use APT this won’t work, as described in the documentation for the -p command:




          Users of APT-based frontends should use apt-cache show package-name instead as the available file is only kept up-to-date when using dselect.




          It might help if I expand a bit on the meaning of the fields: Filename, MD5sum and Size (and MSDOS-Filename) all give information on the file containing a package (its filename, checksum and size). They aren’t germane to the packages themselves, so the status database doesn’t need them and doesn’t store them. A package, installed or otherwise, remains the same regardless of where its package file lives and what its characteristics are. That information is only useful for front-ends which retrieve packages and provide them to dpkg.






          share|improve this answer






















          • I saw these in the manpages, however could not find any reference as to what internal and front-end related mean. Also according to said mainpage they should be available.
            – BrainStone
            Aug 22 at 13:02







          • 1




            That isn't really clear from the man page. The man states that (emphasis mine) "The following fields are recognized but they are not necessarily available in the status file (only internal fields or fields stored in the binary package end up in it)" which would suggest that, contrary to what your answer states, it's the internal fields that will be included.
            – terdon♦
            Aug 22 at 13:03






          • 1




            @terdon right, I wrote my answer based on the source code, not the documentation ;-).
            – Stephen Kitt
            Aug 22 at 13:19










          • @StephenKitt is there a format option for apt-cache show too? Else the manipulation of the texts is gonna be a nightmare...
            – BrainStone
            Aug 22 at 13:25






          • 1




            @BrainStone not with apt-cache, but the output follows RFC 822 and is designed to be parsed. If you want a controllable format using APT-based tools, look at aptitude search and its -F option.
            – Stephen Kitt
            Aug 22 at 13:28












          up vote
          4
          down vote



          accepted







          up vote
          4
          down vote



          accepted






          As mentioned in the manpage, these fields are “internal, front-end related”. In fact they’re only used in dselect.



          This means you can’t rely on them in dpkg-query, by default. They correspond to values stored in the “available” database, /var/lib/dpkg/available; dpkg-query by default only considers /var/lib/dpkg/status nowadays. You can add the --load-avail option to merge the information from the “available” database, in theory — but that requires using dselect as your package installation tool, since /var/lib/dpkg/available is only kept up-to-date by dselect. If you use APT this won’t work, as described in the documentation for the -p command:




          Users of APT-based frontends should use apt-cache show package-name instead as the available file is only kept up-to-date when using dselect.




          It might help if I expand a bit on the meaning of the fields: Filename, MD5sum and Size (and MSDOS-Filename) all give information on the file containing a package (its filename, checksum and size). They aren’t germane to the packages themselves, so the status database doesn’t need them and doesn’t store them. A package, installed or otherwise, remains the same regardless of where its package file lives and what its characteristics are. That information is only useful for front-ends which retrieve packages and provide them to dpkg.






          share|improve this answer














          As mentioned in the manpage, these fields are “internal, front-end related”. In fact they’re only used in dselect.



          This means you can’t rely on them in dpkg-query, by default. They correspond to values stored in the “available” database, /var/lib/dpkg/available; dpkg-query by default only considers /var/lib/dpkg/status nowadays. You can add the --load-avail option to merge the information from the “available” database, in theory — but that requires using dselect as your package installation tool, since /var/lib/dpkg/available is only kept up-to-date by dselect. If you use APT this won’t work, as described in the documentation for the -p command:




          Users of APT-based frontends should use apt-cache show package-name instead as the available file is only kept up-to-date when using dselect.




          It might help if I expand a bit on the meaning of the fields: Filename, MD5sum and Size (and MSDOS-Filename) all give information on the file containing a package (its filename, checksum and size). They aren’t germane to the packages themselves, so the status database doesn’t need them and doesn’t store them. A package, installed or otherwise, remains the same regardless of where its package file lives and what its characteristics are. That information is only useful for front-ends which retrieve packages and provide them to dpkg.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Aug 22 at 13:25

























          answered Aug 22 at 13:00









          Stephen Kitt

          143k22312377




          143k22312377











          • I saw these in the manpages, however could not find any reference as to what internal and front-end related mean. Also according to said mainpage they should be available.
            – BrainStone
            Aug 22 at 13:02







          • 1




            That isn't really clear from the man page. The man states that (emphasis mine) "The following fields are recognized but they are not necessarily available in the status file (only internal fields or fields stored in the binary package end up in it)" which would suggest that, contrary to what your answer states, it's the internal fields that will be included.
            – terdon♦
            Aug 22 at 13:03






          • 1




            @terdon right, I wrote my answer based on the source code, not the documentation ;-).
            – Stephen Kitt
            Aug 22 at 13:19










          • @StephenKitt is there a format option for apt-cache show too? Else the manipulation of the texts is gonna be a nightmare...
            – BrainStone
            Aug 22 at 13:25






          • 1




            @BrainStone not with apt-cache, but the output follows RFC 822 and is designed to be parsed. If you want a controllable format using APT-based tools, look at aptitude search and its -F option.
            – Stephen Kitt
            Aug 22 at 13:28
















          • I saw these in the manpages, however could not find any reference as to what internal and front-end related mean. Also according to said mainpage they should be available.
            – BrainStone
            Aug 22 at 13:02







          • 1




            That isn't really clear from the man page. The man states that (emphasis mine) "The following fields are recognized but they are not necessarily available in the status file (only internal fields or fields stored in the binary package end up in it)" which would suggest that, contrary to what your answer states, it's the internal fields that will be included.
            – terdon♦
            Aug 22 at 13:03






          • 1




            @terdon right, I wrote my answer based on the source code, not the documentation ;-).
            – Stephen Kitt
            Aug 22 at 13:19










          • @StephenKitt is there a format option for apt-cache show too? Else the manipulation of the texts is gonna be a nightmare...
            – BrainStone
            Aug 22 at 13:25






          • 1




            @BrainStone not with apt-cache, but the output follows RFC 822 and is designed to be parsed. If you want a controllable format using APT-based tools, look at aptitude search and its -F option.
            – Stephen Kitt
            Aug 22 at 13:28















          I saw these in the manpages, however could not find any reference as to what internal and front-end related mean. Also according to said mainpage they should be available.
          – BrainStone
          Aug 22 at 13:02





          I saw these in the manpages, however could not find any reference as to what internal and front-end related mean. Also according to said mainpage they should be available.
          – BrainStone
          Aug 22 at 13:02





          1




          1




          That isn't really clear from the man page. The man states that (emphasis mine) "The following fields are recognized but they are not necessarily available in the status file (only internal fields or fields stored in the binary package end up in it)" which would suggest that, contrary to what your answer states, it's the internal fields that will be included.
          – terdon♦
          Aug 22 at 13:03




          That isn't really clear from the man page. The man states that (emphasis mine) "The following fields are recognized but they are not necessarily available in the status file (only internal fields or fields stored in the binary package end up in it)" which would suggest that, contrary to what your answer states, it's the internal fields that will be included.
          – terdon♦
          Aug 22 at 13:03




          1




          1




          @terdon right, I wrote my answer based on the source code, not the documentation ;-).
          – Stephen Kitt
          Aug 22 at 13:19




          @terdon right, I wrote my answer based on the source code, not the documentation ;-).
          – Stephen Kitt
          Aug 22 at 13:19












          @StephenKitt is there a format option for apt-cache show too? Else the manipulation of the texts is gonna be a nightmare...
          – BrainStone
          Aug 22 at 13:25




          @StephenKitt is there a format option for apt-cache show too? Else the manipulation of the texts is gonna be a nightmare...
          – BrainStone
          Aug 22 at 13:25




          1




          1




          @BrainStone not with apt-cache, but the output follows RFC 822 and is designed to be parsed. If you want a controllable format using APT-based tools, look at aptitude search and its -F option.
          – Stephen Kitt
          Aug 22 at 13:28




          @BrainStone not with apt-cache, but the output follows RFC 822 and is designed to be parsed. If you want a controllable format using APT-based tools, look at aptitude search and its -F option.
          – Stephen Kitt
          Aug 22 at 13:28












          up vote
          4
          down vote













          You can use grep-available tool instead (or more better grep-aptavail as mentioned @Stephen Kitt) :



          grep-available -s Filename,MD5sum,size -PX <package_name>


          Example:



          grep-available -s Filename,MD5sum,size -PX dpkg


          sample output:



          Filename: pool/main/d/dpkg/dpkg_1.18.24_amd64.deb
          MD5sum: 5553b3fac608f5c4f9fa3ddbff18c2c5
          Size: 2106696





          share|improve this answer


















          • 1




            Or better yet in most cases, grep-aptavail.
            – Stephen Kitt
            Aug 22 at 13:37






          • 1




            I think this is a great answer for the general public, but not for me, as I need a portable solution. (That's why I won't accept it)
            – BrainStone
            Aug 22 at 13:42














          up vote
          4
          down vote













          You can use grep-available tool instead (or more better grep-aptavail as mentioned @Stephen Kitt) :



          grep-available -s Filename,MD5sum,size -PX <package_name>


          Example:



          grep-available -s Filename,MD5sum,size -PX dpkg


          sample output:



          Filename: pool/main/d/dpkg/dpkg_1.18.24_amd64.deb
          MD5sum: 5553b3fac608f5c4f9fa3ddbff18c2c5
          Size: 2106696





          share|improve this answer


















          • 1




            Or better yet in most cases, grep-aptavail.
            – Stephen Kitt
            Aug 22 at 13:37






          • 1




            I think this is a great answer for the general public, but not for me, as I need a portable solution. (That's why I won't accept it)
            – BrainStone
            Aug 22 at 13:42












          up vote
          4
          down vote










          up vote
          4
          down vote









          You can use grep-available tool instead (or more better grep-aptavail as mentioned @Stephen Kitt) :



          grep-available -s Filename,MD5sum,size -PX <package_name>


          Example:



          grep-available -s Filename,MD5sum,size -PX dpkg


          sample output:



          Filename: pool/main/d/dpkg/dpkg_1.18.24_amd64.deb
          MD5sum: 5553b3fac608f5c4f9fa3ddbff18c2c5
          Size: 2106696





          share|improve this answer














          You can use grep-available tool instead (or more better grep-aptavail as mentioned @Stephen Kitt) :



          grep-available -s Filename,MD5sum,size -PX <package_name>


          Example:



          grep-available -s Filename,MD5sum,size -PX dpkg


          sample output:



          Filename: pool/main/d/dpkg/dpkg_1.18.24_amd64.deb
          MD5sum: 5553b3fac608f5c4f9fa3ddbff18c2c5
          Size: 2106696






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Aug 22 at 13:47

























          answered Aug 22 at 13:34









          GAD3R

          22.7k154895




          22.7k154895







          • 1




            Or better yet in most cases, grep-aptavail.
            – Stephen Kitt
            Aug 22 at 13:37






          • 1




            I think this is a great answer for the general public, but not for me, as I need a portable solution. (That's why I won't accept it)
            – BrainStone
            Aug 22 at 13:42












          • 1




            Or better yet in most cases, grep-aptavail.
            – Stephen Kitt
            Aug 22 at 13:37






          • 1




            I think this is a great answer for the general public, but not for me, as I need a portable solution. (That's why I won't accept it)
            – BrainStone
            Aug 22 at 13:42







          1




          1




          Or better yet in most cases, grep-aptavail.
          – Stephen Kitt
          Aug 22 at 13:37




          Or better yet in most cases, grep-aptavail.
          – Stephen Kitt
          Aug 22 at 13:37




          1




          1




          I think this is a great answer for the general public, but not for me, as I need a portable solution. (That's why I won't accept it)
          – BrainStone
          Aug 22 at 13:42




          I think this is a great answer for the general public, but not for me, as I need a portable solution. (That's why I won't accept it)
          – BrainStone
          Aug 22 at 13:42

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f464117%2fdpkg-query-placeholders-filename-md5sum-and-size-are-always-empty%23new-answer', 'question_page');

          );

          Post as a guest













































































          Comments

          Popular posts from this blog

          What does second last employer means? [closed]

          Installing NextGIS Connect into QGIS 3?

          One-line joke