Read full dpkg database state without dpkg program











up vote
1
down vote

favorite












From a Live USB, and without using the installed Ubuntu's programs like dpkg, dpkg-query, dselect, aptitude, apt-get, or any other (as they are all broken Illegal instruction), how do I read the package lists that apt reads, as a list in order to catalogue the installed packages, to reinstall later?



Reading package lists... Done
Building dependency tree
Reading state information... Done


where is local package database? is almost a perfect answer:




/var/lib/dpkg/status is modified by dpkg if you change the state of a package, i.e. install it, remove it, mark it for some action, ...






  • I don't want just to list "changed" packages, but also depended packages, the entire state of the system, etc. Is that contained by dpkg/status?




    • On another healthy system, that file has ~3800 Package: entries; on the target system it has 3600 Package: entries, and on the Live USB it has only 2000 entries. That sounds right except I worry it doesn't list all the packages.



  • I am not looking for the downloaded .deb cache, nor the cache for dpkg / apt which holds temporary data files -- these do not give the full system state.


  • /var/lib/apt/lists seems to contain a list of package sources and packages, which is almost perfect except a lot of parsing is involved in getting a list of package names from it. Is this the best option?



The file /var/cache/apt/pkgcache.bin exists but since it's a generated binary, I don't think copying it to a fresh install will be sufficient.










share|improve this question


























    up vote
    1
    down vote

    favorite












    From a Live USB, and without using the installed Ubuntu's programs like dpkg, dpkg-query, dselect, aptitude, apt-get, or any other (as they are all broken Illegal instruction), how do I read the package lists that apt reads, as a list in order to catalogue the installed packages, to reinstall later?



    Reading package lists... Done
    Building dependency tree
    Reading state information... Done


    where is local package database? is almost a perfect answer:




    /var/lib/dpkg/status is modified by dpkg if you change the state of a package, i.e. install it, remove it, mark it for some action, ...






    • I don't want just to list "changed" packages, but also depended packages, the entire state of the system, etc. Is that contained by dpkg/status?




      • On another healthy system, that file has ~3800 Package: entries; on the target system it has 3600 Package: entries, and on the Live USB it has only 2000 entries. That sounds right except I worry it doesn't list all the packages.



    • I am not looking for the downloaded .deb cache, nor the cache for dpkg / apt which holds temporary data files -- these do not give the full system state.


    • /var/lib/apt/lists seems to contain a list of package sources and packages, which is almost perfect except a lot of parsing is involved in getting a list of package names from it. Is this the best option?



    The file /var/cache/apt/pkgcache.bin exists but since it's a generated binary, I don't think copying it to a fresh install will be sufficient.










    share|improve this question
























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      From a Live USB, and without using the installed Ubuntu's programs like dpkg, dpkg-query, dselect, aptitude, apt-get, or any other (as they are all broken Illegal instruction), how do I read the package lists that apt reads, as a list in order to catalogue the installed packages, to reinstall later?



      Reading package lists... Done
      Building dependency tree
      Reading state information... Done


      where is local package database? is almost a perfect answer:




      /var/lib/dpkg/status is modified by dpkg if you change the state of a package, i.e. install it, remove it, mark it for some action, ...






      • I don't want just to list "changed" packages, but also depended packages, the entire state of the system, etc. Is that contained by dpkg/status?




        • On another healthy system, that file has ~3800 Package: entries; on the target system it has 3600 Package: entries, and on the Live USB it has only 2000 entries. That sounds right except I worry it doesn't list all the packages.



      • I am not looking for the downloaded .deb cache, nor the cache for dpkg / apt which holds temporary data files -- these do not give the full system state.


      • /var/lib/apt/lists seems to contain a list of package sources and packages, which is almost perfect except a lot of parsing is involved in getting a list of package names from it. Is this the best option?



      The file /var/cache/apt/pkgcache.bin exists but since it's a generated binary, I don't think copying it to a fresh install will be sufficient.










      share|improve this question













      From a Live USB, and without using the installed Ubuntu's programs like dpkg, dpkg-query, dselect, aptitude, apt-get, or any other (as they are all broken Illegal instruction), how do I read the package lists that apt reads, as a list in order to catalogue the installed packages, to reinstall later?



      Reading package lists... Done
      Building dependency tree
      Reading state information... Done


      where is local package database? is almost a perfect answer:




      /var/lib/dpkg/status is modified by dpkg if you change the state of a package, i.e. install it, remove it, mark it for some action, ...






      • I don't want just to list "changed" packages, but also depended packages, the entire state of the system, etc. Is that contained by dpkg/status?




        • On another healthy system, that file has ~3800 Package: entries; on the target system it has 3600 Package: entries, and on the Live USB it has only 2000 entries. That sounds right except I worry it doesn't list all the packages.



      • I am not looking for the downloaded .deb cache, nor the cache for dpkg / apt which holds temporary data files -- these do not give the full system state.


      • /var/lib/apt/lists seems to contain a list of package sources and packages, which is almost perfect except a lot of parsing is involved in getting a list of package names from it. Is this the best option?



      The file /var/cache/apt/pkgcache.bin exists but since it's a generated binary, I don't think copying it to a fresh install will be sufficient.







      apt package-management software-installation dpkg






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Dec 1 at 5:00









      cat

      8911238




      8911238






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          See man dpkg:




          The other files listed below are in their default directories, see
          option --admindir to see how to change locations of these files.




          • /var/lib/dpkg/available List of available packages.



          • /var/lib/dpkg/status Statuses of available packages.



            This file contains information about whether a package is marked for
            removing or not, whether it is installed or not, etc. See section
            INFORMATION ABOUT PACKAGES for more info. The status file is backed up
            daily in /var/backups. It can be useful if it's lost or corrupted due
            to filesystems troubles.






          You can quit worrying. If the package isn't in status, dpkg doesn't know about it. At all.





          By the way, the "package lists" that apt is taking about is a different thing: those are the lists it downloaded from the sources in /etc/apt/sources.list, etc. and are in /var/lib/apt/lists. These contain information about packages in the repositories, and have nothing about the local system.





          About your current problem, you can use the live system's dpkg to read that file, using the --admindir option mentioned above.






          share|improve this answer





















            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "89"
            };
            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: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1097582%2fread-full-dpkg-database-state-without-dpkg-program%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            2
            down vote



            accepted










            See man dpkg:




            The other files listed below are in their default directories, see
            option --admindir to see how to change locations of these files.




            • /var/lib/dpkg/available List of available packages.



            • /var/lib/dpkg/status Statuses of available packages.



              This file contains information about whether a package is marked for
              removing or not, whether it is installed or not, etc. See section
              INFORMATION ABOUT PACKAGES for more info. The status file is backed up
              daily in /var/backups. It can be useful if it's lost or corrupted due
              to filesystems troubles.






            You can quit worrying. If the package isn't in status, dpkg doesn't know about it. At all.





            By the way, the "package lists" that apt is taking about is a different thing: those are the lists it downloaded from the sources in /etc/apt/sources.list, etc. and are in /var/lib/apt/lists. These contain information about packages in the repositories, and have nothing about the local system.





            About your current problem, you can use the live system's dpkg to read that file, using the --admindir option mentioned above.






            share|improve this answer

























              up vote
              2
              down vote



              accepted










              See man dpkg:




              The other files listed below are in their default directories, see
              option --admindir to see how to change locations of these files.




              • /var/lib/dpkg/available List of available packages.



              • /var/lib/dpkg/status Statuses of available packages.



                This file contains information about whether a package is marked for
                removing or not, whether it is installed or not, etc. See section
                INFORMATION ABOUT PACKAGES for more info. The status file is backed up
                daily in /var/backups. It can be useful if it's lost or corrupted due
                to filesystems troubles.






              You can quit worrying. If the package isn't in status, dpkg doesn't know about it. At all.





              By the way, the "package lists" that apt is taking about is a different thing: those are the lists it downloaded from the sources in /etc/apt/sources.list, etc. and are in /var/lib/apt/lists. These contain information about packages in the repositories, and have nothing about the local system.





              About your current problem, you can use the live system's dpkg to read that file, using the --admindir option mentioned above.






              share|improve this answer























                up vote
                2
                down vote



                accepted







                up vote
                2
                down vote



                accepted






                See man dpkg:




                The other files listed below are in their default directories, see
                option --admindir to see how to change locations of these files.




                • /var/lib/dpkg/available List of available packages.



                • /var/lib/dpkg/status Statuses of available packages.



                  This file contains information about whether a package is marked for
                  removing or not, whether it is installed or not, etc. See section
                  INFORMATION ABOUT PACKAGES for more info. The status file is backed up
                  daily in /var/backups. It can be useful if it's lost or corrupted due
                  to filesystems troubles.






                You can quit worrying. If the package isn't in status, dpkg doesn't know about it. At all.





                By the way, the "package lists" that apt is taking about is a different thing: those are the lists it downloaded from the sources in /etc/apt/sources.list, etc. and are in /var/lib/apt/lists. These contain information about packages in the repositories, and have nothing about the local system.





                About your current problem, you can use the live system's dpkg to read that file, using the --admindir option mentioned above.






                share|improve this answer












                See man dpkg:




                The other files listed below are in their default directories, see
                option --admindir to see how to change locations of these files.




                • /var/lib/dpkg/available List of available packages.



                • /var/lib/dpkg/status Statuses of available packages.



                  This file contains information about whether a package is marked for
                  removing or not, whether it is installed or not, etc. See section
                  INFORMATION ABOUT PACKAGES for more info. The status file is backed up
                  daily in /var/backups. It can be useful if it's lost or corrupted due
                  to filesystems troubles.






                You can quit worrying. If the package isn't in status, dpkg doesn't know about it. At all.





                By the way, the "package lists" that apt is taking about is a different thing: those are the lists it downloaded from the sources in /etc/apt/sources.list, etc. and are in /var/lib/apt/lists. These contain information about packages in the repositories, and have nothing about the local system.





                About your current problem, you can use the live system's dpkg to read that file, using the --admindir option mentioned above.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Dec 1 at 5:22









                muru

                135k19289491




                135k19289491






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Ask Ubuntu!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1097582%2fread-full-dpkg-database-state-without-dpkg-program%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Ellipse (mathématiques)

                    Quarter-circle Tiles

                    Mont Emei