Restoring all data and dependencies from dpkg --set-selections '*'












44















So I can run on one machine:



dpkg --get-selections '*' > selection.txt


On another machine:



dpkg --set-selections < selection.txt


... followed by either of the following:



aptitude install
apt-get -u dselect-upgrade


... to install the packages that.



However, it appears that some information gets lost in the process, such as whether a package (say xyz) got installed automatically as dependency of another package (abc). You can see that whenever you do something like apt-get --purge remove abc. On the original machine you would be notified that package xyz was installed as dependency of abc and that you may use apt-get autoremove to get rid of it.



Now I am aware of deborphan and debfoster, but they're cumbersome to use given the (simple) task at hand.



It seems saving and restoring the selections as shown above is not sufficient to restore the subtle dependencies of installed packages.



Is there a way to back up the complete set of metadata for package management and restore it then in its entirety?










share|improve this question

























  • I've often wondered the same thing I generate a big shell script with a 'sudo apt-get install' with all my packages (minus libs). Of course, I run into the same problem you're having.

    – Chuck R
    Feb 20 '12 at 18:17











  • I would guess that the best place to start looking would be to check if dpkg is in fact responsible for that information. If it isn't then maybe that is apt's job.

    – Huckle
    Feb 20 '12 at 19:03






  • 3





    If you're going the manual way, you may be interested in apt-mark for saving/restoring information about automatic vs manually installed packages

    – Lekensteyn
    Feb 24 '12 at 18:37











  • It's not in the 10.04 package repo, is it? Is this part of the Canonical repos or third-party?

    – 0xC0000022L
    Feb 24 '12 at 19:59






  • 2





    No, that's just a "for your information" comment. I'd use apt-mark (it's part of apt, so it should already be installed) to get and set the marks for the packages (see its manpage for details).

    – htorque
    Feb 27 '12 at 12:07
















44















So I can run on one machine:



dpkg --get-selections '*' > selection.txt


On another machine:



dpkg --set-selections < selection.txt


... followed by either of the following:



aptitude install
apt-get -u dselect-upgrade


... to install the packages that.



However, it appears that some information gets lost in the process, such as whether a package (say xyz) got installed automatically as dependency of another package (abc). You can see that whenever you do something like apt-get --purge remove abc. On the original machine you would be notified that package xyz was installed as dependency of abc and that you may use apt-get autoremove to get rid of it.



Now I am aware of deborphan and debfoster, but they're cumbersome to use given the (simple) task at hand.



It seems saving and restoring the selections as shown above is not sufficient to restore the subtle dependencies of installed packages.



Is there a way to back up the complete set of metadata for package management and restore it then in its entirety?










share|improve this question

























  • I've often wondered the same thing I generate a big shell script with a 'sudo apt-get install' with all my packages (minus libs). Of course, I run into the same problem you're having.

    – Chuck R
    Feb 20 '12 at 18:17











  • I would guess that the best place to start looking would be to check if dpkg is in fact responsible for that information. If it isn't then maybe that is apt's job.

    – Huckle
    Feb 20 '12 at 19:03






  • 3





    If you're going the manual way, you may be interested in apt-mark for saving/restoring information about automatic vs manually installed packages

    – Lekensteyn
    Feb 24 '12 at 18:37











  • It's not in the 10.04 package repo, is it? Is this part of the Canonical repos or third-party?

    – 0xC0000022L
    Feb 24 '12 at 19:59






  • 2





    No, that's just a "for your information" comment. I'd use apt-mark (it's part of apt, so it should already be installed) to get and set the marks for the packages (see its manpage for details).

    – htorque
    Feb 27 '12 at 12:07














44












44








44


26






So I can run on one machine:



dpkg --get-selections '*' > selection.txt


On another machine:



dpkg --set-selections < selection.txt


... followed by either of the following:



aptitude install
apt-get -u dselect-upgrade


... to install the packages that.



However, it appears that some information gets lost in the process, such as whether a package (say xyz) got installed automatically as dependency of another package (abc). You can see that whenever you do something like apt-get --purge remove abc. On the original machine you would be notified that package xyz was installed as dependency of abc and that you may use apt-get autoremove to get rid of it.



Now I am aware of deborphan and debfoster, but they're cumbersome to use given the (simple) task at hand.



It seems saving and restoring the selections as shown above is not sufficient to restore the subtle dependencies of installed packages.



Is there a way to back up the complete set of metadata for package management and restore it then in its entirety?










share|improve this question
















So I can run on one machine:



dpkg --get-selections '*' > selection.txt


On another machine:



dpkg --set-selections < selection.txt


... followed by either of the following:



aptitude install
apt-get -u dselect-upgrade


... to install the packages that.



However, it appears that some information gets lost in the process, such as whether a package (say xyz) got installed automatically as dependency of another package (abc). You can see that whenever you do something like apt-get --purge remove abc. On the original machine you would be notified that package xyz was installed as dependency of abc and that you may use apt-get autoremove to get rid of it.



Now I am aware of deborphan and debfoster, but they're cumbersome to use given the (simple) task at hand.



It seems saving and restoring the selections as shown above is not sufficient to restore the subtle dependencies of installed packages.



Is there a way to back up the complete set of metadata for package management and restore it then in its entirety?







package-management dpkg aptitude






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 17 '13 at 15:25









belacqua

15.9k1473103




15.9k1473103










asked Feb 6 '12 at 17:33









0xC0000022L0xC0000022L

3,00353770




3,00353770













  • I've often wondered the same thing I generate a big shell script with a 'sudo apt-get install' with all my packages (minus libs). Of course, I run into the same problem you're having.

    – Chuck R
    Feb 20 '12 at 18:17











  • I would guess that the best place to start looking would be to check if dpkg is in fact responsible for that information. If it isn't then maybe that is apt's job.

    – Huckle
    Feb 20 '12 at 19:03






  • 3





    If you're going the manual way, you may be interested in apt-mark for saving/restoring information about automatic vs manually installed packages

    – Lekensteyn
    Feb 24 '12 at 18:37











  • It's not in the 10.04 package repo, is it? Is this part of the Canonical repos or third-party?

    – 0xC0000022L
    Feb 24 '12 at 19:59






  • 2





    No, that's just a "for your information" comment. I'd use apt-mark (it's part of apt, so it should already be installed) to get and set the marks for the packages (see its manpage for details).

    – htorque
    Feb 27 '12 at 12:07



















  • I've often wondered the same thing I generate a big shell script with a 'sudo apt-get install' with all my packages (minus libs). Of course, I run into the same problem you're having.

    – Chuck R
    Feb 20 '12 at 18:17











  • I would guess that the best place to start looking would be to check if dpkg is in fact responsible for that information. If it isn't then maybe that is apt's job.

    – Huckle
    Feb 20 '12 at 19:03






  • 3





    If you're going the manual way, you may be interested in apt-mark for saving/restoring information about automatic vs manually installed packages

    – Lekensteyn
    Feb 24 '12 at 18:37











  • It's not in the 10.04 package repo, is it? Is this part of the Canonical repos or third-party?

    – 0xC0000022L
    Feb 24 '12 at 19:59






  • 2





    No, that's just a "for your information" comment. I'd use apt-mark (it's part of apt, so it should already be installed) to get and set the marks for the packages (see its manpage for details).

    – htorque
    Feb 27 '12 at 12:07

















I've often wondered the same thing I generate a big shell script with a 'sudo apt-get install' with all my packages (minus libs). Of course, I run into the same problem you're having.

– Chuck R
Feb 20 '12 at 18:17





I've often wondered the same thing I generate a big shell script with a 'sudo apt-get install' with all my packages (minus libs). Of course, I run into the same problem you're having.

– Chuck R
Feb 20 '12 at 18:17













I would guess that the best place to start looking would be to check if dpkg is in fact responsible for that information. If it isn't then maybe that is apt's job.

– Huckle
Feb 20 '12 at 19:03





I would guess that the best place to start looking would be to check if dpkg is in fact responsible for that information. If it isn't then maybe that is apt's job.

– Huckle
Feb 20 '12 at 19:03




3




3





If you're going the manual way, you may be interested in apt-mark for saving/restoring information about automatic vs manually installed packages

– Lekensteyn
Feb 24 '12 at 18:37





If you're going the manual way, you may be interested in apt-mark for saving/restoring information about automatic vs manually installed packages

– Lekensteyn
Feb 24 '12 at 18:37













It's not in the 10.04 package repo, is it? Is this part of the Canonical repos or third-party?

– 0xC0000022L
Feb 24 '12 at 19:59





It's not in the 10.04 package repo, is it? Is this part of the Canonical repos or third-party?

– 0xC0000022L
Feb 24 '12 at 19:59




2




2





No, that's just a "for your information" comment. I'd use apt-mark (it's part of apt, so it should already be installed) to get and set the marks for the packages (see its manpage for details).

– htorque
Feb 27 '12 at 12:07





No, that's just a "for your information" comment. I'd use apt-mark (it's part of apt, so it should already be installed) to get and set the marks for the packages (see its manpage for details).

– htorque
Feb 27 '12 at 12:07










2 Answers
2






active

oldest

votes


















39














Backup:



apt-mark showauto > pkgs_auto.lst
apt-mark showmanual > pkgs_manual.lst


Restore:



sudo apt-mark auto $(cat pkgs_auto.lst)
sudo apt-mark manual $(cat pkgs_manual.lst)





share|improve this answer
























  • Thanks, was about to ask that you or Lekensteyn write that up as an answer.

    – 0xC0000022L
    Feb 29 '12 at 17:51











  • Does these commands allow you to reinstall the programs from that list?

    – Svetlana Belkin
    Dec 30 '13 at 14:35











  • can this remove packages that are installed extra, at restoration?

    – n611x007
    May 22 '14 at 11:56






  • 1





    Can you explain the difference between auto and manual ? Thanks.

    – Anto
    Jan 7 '15 at 16:33











  • I accidentally marked as manual a bunch of other packages... is there a way to revert? Thanks

    – dentex
    Oct 5 '16 at 10:49



















0














The selected answer to this question is incomplete and does not (or no longer) works. The painful fix is to use a bash for-loop to parse the output *.lst files and feed them to apt install. Bad choice, though, so will not be illustrated here.



A better choice is to use apt-clone, as seen in this answer on the Unix & Linux Stackexchange. This creates a small file (around 100K or less for my system). Allegedly, it will clone the packages with little effort or pain.



So, in short, on the original machine:



apt-clone clone `uname -n`


Then, on the machine to clone to, copy the clone file and run:



apt-clone restore original-machine-name.apt-clone.tar.gz


I include this answer here since this page turned up in initial web searches, but the other answer did not. This method looks way easier.






share|improve this answer








New contributor




casualcoder is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















    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',
    autoActivateHeartbeat: false,
    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%2f101931%2frestoring-all-data-and-dependencies-from-dpkg-set-selections%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    39














    Backup:



    apt-mark showauto > pkgs_auto.lst
    apt-mark showmanual > pkgs_manual.lst


    Restore:



    sudo apt-mark auto $(cat pkgs_auto.lst)
    sudo apt-mark manual $(cat pkgs_manual.lst)





    share|improve this answer
























    • Thanks, was about to ask that you or Lekensteyn write that up as an answer.

      – 0xC0000022L
      Feb 29 '12 at 17:51











    • Does these commands allow you to reinstall the programs from that list?

      – Svetlana Belkin
      Dec 30 '13 at 14:35











    • can this remove packages that are installed extra, at restoration?

      – n611x007
      May 22 '14 at 11:56






    • 1





      Can you explain the difference between auto and manual ? Thanks.

      – Anto
      Jan 7 '15 at 16:33











    • I accidentally marked as manual a bunch of other packages... is there a way to revert? Thanks

      – dentex
      Oct 5 '16 at 10:49
















    39














    Backup:



    apt-mark showauto > pkgs_auto.lst
    apt-mark showmanual > pkgs_manual.lst


    Restore:



    sudo apt-mark auto $(cat pkgs_auto.lst)
    sudo apt-mark manual $(cat pkgs_manual.lst)





    share|improve this answer
























    • Thanks, was about to ask that you or Lekensteyn write that up as an answer.

      – 0xC0000022L
      Feb 29 '12 at 17:51











    • Does these commands allow you to reinstall the programs from that list?

      – Svetlana Belkin
      Dec 30 '13 at 14:35











    • can this remove packages that are installed extra, at restoration?

      – n611x007
      May 22 '14 at 11:56






    • 1





      Can you explain the difference between auto and manual ? Thanks.

      – Anto
      Jan 7 '15 at 16:33











    • I accidentally marked as manual a bunch of other packages... is there a way to revert? Thanks

      – dentex
      Oct 5 '16 at 10:49














    39












    39








    39







    Backup:



    apt-mark showauto > pkgs_auto.lst
    apt-mark showmanual > pkgs_manual.lst


    Restore:



    sudo apt-mark auto $(cat pkgs_auto.lst)
    sudo apt-mark manual $(cat pkgs_manual.lst)





    share|improve this answer













    Backup:



    apt-mark showauto > pkgs_auto.lst
    apt-mark showmanual > pkgs_manual.lst


    Restore:



    sudo apt-mark auto $(cat pkgs_auto.lst)
    sudo apt-mark manual $(cat pkgs_manual.lst)






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Feb 29 '12 at 8:35









    htorquehtorque

    47.4k32174212




    47.4k32174212













    • Thanks, was about to ask that you or Lekensteyn write that up as an answer.

      – 0xC0000022L
      Feb 29 '12 at 17:51











    • Does these commands allow you to reinstall the programs from that list?

      – Svetlana Belkin
      Dec 30 '13 at 14:35











    • can this remove packages that are installed extra, at restoration?

      – n611x007
      May 22 '14 at 11:56






    • 1





      Can you explain the difference between auto and manual ? Thanks.

      – Anto
      Jan 7 '15 at 16:33











    • I accidentally marked as manual a bunch of other packages... is there a way to revert? Thanks

      – dentex
      Oct 5 '16 at 10:49



















    • Thanks, was about to ask that you or Lekensteyn write that up as an answer.

      – 0xC0000022L
      Feb 29 '12 at 17:51











    • Does these commands allow you to reinstall the programs from that list?

      – Svetlana Belkin
      Dec 30 '13 at 14:35











    • can this remove packages that are installed extra, at restoration?

      – n611x007
      May 22 '14 at 11:56






    • 1





      Can you explain the difference between auto and manual ? Thanks.

      – Anto
      Jan 7 '15 at 16:33











    • I accidentally marked as manual a bunch of other packages... is there a way to revert? Thanks

      – dentex
      Oct 5 '16 at 10:49

















    Thanks, was about to ask that you or Lekensteyn write that up as an answer.

    – 0xC0000022L
    Feb 29 '12 at 17:51





    Thanks, was about to ask that you or Lekensteyn write that up as an answer.

    – 0xC0000022L
    Feb 29 '12 at 17:51













    Does these commands allow you to reinstall the programs from that list?

    – Svetlana Belkin
    Dec 30 '13 at 14:35





    Does these commands allow you to reinstall the programs from that list?

    – Svetlana Belkin
    Dec 30 '13 at 14:35













    can this remove packages that are installed extra, at restoration?

    – n611x007
    May 22 '14 at 11:56





    can this remove packages that are installed extra, at restoration?

    – n611x007
    May 22 '14 at 11:56




    1




    1





    Can you explain the difference between auto and manual ? Thanks.

    – Anto
    Jan 7 '15 at 16:33





    Can you explain the difference between auto and manual ? Thanks.

    – Anto
    Jan 7 '15 at 16:33













    I accidentally marked as manual a bunch of other packages... is there a way to revert? Thanks

    – dentex
    Oct 5 '16 at 10:49





    I accidentally marked as manual a bunch of other packages... is there a way to revert? Thanks

    – dentex
    Oct 5 '16 at 10:49













    0














    The selected answer to this question is incomplete and does not (or no longer) works. The painful fix is to use a bash for-loop to parse the output *.lst files and feed them to apt install. Bad choice, though, so will not be illustrated here.



    A better choice is to use apt-clone, as seen in this answer on the Unix & Linux Stackexchange. This creates a small file (around 100K or less for my system). Allegedly, it will clone the packages with little effort or pain.



    So, in short, on the original machine:



    apt-clone clone `uname -n`


    Then, on the machine to clone to, copy the clone file and run:



    apt-clone restore original-machine-name.apt-clone.tar.gz


    I include this answer here since this page turned up in initial web searches, but the other answer did not. This method looks way easier.






    share|improve this answer








    New contributor




    casualcoder is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.

























      0














      The selected answer to this question is incomplete and does not (or no longer) works. The painful fix is to use a bash for-loop to parse the output *.lst files and feed them to apt install. Bad choice, though, so will not be illustrated here.



      A better choice is to use apt-clone, as seen in this answer on the Unix & Linux Stackexchange. This creates a small file (around 100K or less for my system). Allegedly, it will clone the packages with little effort or pain.



      So, in short, on the original machine:



      apt-clone clone `uname -n`


      Then, on the machine to clone to, copy the clone file and run:



      apt-clone restore original-machine-name.apt-clone.tar.gz


      I include this answer here since this page turned up in initial web searches, but the other answer did not. This method looks way easier.






      share|improve this answer








      New contributor




      casualcoder is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.























        0












        0








        0







        The selected answer to this question is incomplete and does not (or no longer) works. The painful fix is to use a bash for-loop to parse the output *.lst files and feed them to apt install. Bad choice, though, so will not be illustrated here.



        A better choice is to use apt-clone, as seen in this answer on the Unix & Linux Stackexchange. This creates a small file (around 100K or less for my system). Allegedly, it will clone the packages with little effort or pain.



        So, in short, on the original machine:



        apt-clone clone `uname -n`


        Then, on the machine to clone to, copy the clone file and run:



        apt-clone restore original-machine-name.apt-clone.tar.gz


        I include this answer here since this page turned up in initial web searches, but the other answer did not. This method looks way easier.






        share|improve this answer








        New contributor




        casualcoder is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.










        The selected answer to this question is incomplete and does not (or no longer) works. The painful fix is to use a bash for-loop to parse the output *.lst files and feed them to apt install. Bad choice, though, so will not be illustrated here.



        A better choice is to use apt-clone, as seen in this answer on the Unix & Linux Stackexchange. This creates a small file (around 100K or less for my system). Allegedly, it will clone the packages with little effort or pain.



        So, in short, on the original machine:



        apt-clone clone `uname -n`


        Then, on the machine to clone to, copy the clone file and run:



        apt-clone restore original-machine-name.apt-clone.tar.gz


        I include this answer here since this page turned up in initial web searches, but the other answer did not. This method looks way easier.







        share|improve this answer








        New contributor




        casualcoder is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        share|improve this answer



        share|improve this answer






        New contributor




        casualcoder is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        answered 2 hours ago









        casualcodercasualcoder

        101




        101




        New contributor




        casualcoder is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.





        New contributor





        casualcoder is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






        casualcoder is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






























            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.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f101931%2frestoring-all-data-and-dependencies-from-dpkg-set-selections%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

            GameSpot

            日野市

            Tu-95轟炸機