• Package lists with state and extended state

    From Christoph Pleger@21:1/5 to All on Tue Jul 23 14:00:01 2024
    Hello,

    I would like to install many computers with largely the same package
    list. To do this, I can use

    dpkg --get-selections > packages.lst

    to create a list of the installed packages from a computer on which I
    have previously installed the standard packages I want, which I can
    then implement on other computers with

    cat packages.lst | dpkg --set-selections

    and

    apt-get dselect-upgrade

    .

    In addition, the extended status of the packages should be adopted,
    i.e. whether a package was installed automatically as a dependency of
    another, or manually. Therefore, I added a third column with the
    extended status to the packages.lst, which normally has the form

    <package> <install_status>

    per line, so that a line now has the following form:

    <package> <install_status> <extended_status>

    For a concrete example, it looks like this:

    virt-viewer install auto

    This works wonderfully when installing a computer, first the packages
    are installed as desired and then the extended status is set as desired
    - the reverse is not possible because apt-mark does not allow to set
    the extended state of a package that is not installed.

    However, the packages.lst that is used on computers to be installed
    sometimes does not consist of just one file that was created on another computer, but of several concatenated files which were either created automatically with dpkg --set-selections or manually. So, it can
    happen, for example, that the overall packages.lst created from several individual packages.lst contains:

    .
    .
    .
    virt-manager install manual
    .
    .
    .
    virt-viewer install auto
    .
    .
    .
    virt-manager purge

    (the third column does not have to be present).

    This leads to virt-viewer (as a dependency of virt-manager) being
    installed and then uninstalled again and again. It would of course be
    better if packages with "auto" in the third column are not even
    installed, if not needed by another package - does anyone have an idea
    how this can be done?

    Regards
    Christoph




    Hallo,

    ich möchte viele Rechner mit weitgehend gleicher Paketliste installieren. Dafür kann ich von einem Rechner, auf dem ich vorher von mir gewünschte Standardpakete installiert habe, mit Hilfe von

    dpkg --get-selections > packages.lst

    eine Liste der installierten Pakete erstellen, die ich dann auf anderen Rechnern mit

    cat packages.lst | dpkg --set-selections

    und

    apt-get dselect-upgrade

    realisieren kann.

    Zusätzlich soll aber der erweiterte Status der Pakete übernommen werden, also ob ein Paket automatisch als Abhängigkeit von einem anderen installiert wurde, oder manuell. Daher habe ich in der packages.lst, die normalerweise pro Zeile die Form

    <package> <install_status>

    hat, noch eine dritte Spalte mit dem erweiterten Status hinzugefügt, so dass eine Zeile folgende Form hat:

    <package> <install_status> <extended_status>

    Im konkreten Fall sieht das zum Beispiel so aus:

    virt-viewer install auto


    Das funktioniert bei der Installation eines Rechners so weit auch ganz wunderbar, erst werden die Pakete werden wie gewünscht installiert und dann die erweiterten Status wie gewünscht gesetzt - umgekehrt ist es nicht möglich, weil apt-mark das Setzen
    des erweiterten Status eines nicht installierten Pakets nicht erlaubt.

    Nur besteht die packages.lst, die auf zu installierenden Rechnern angewendet wird, manchmal gar nicht nur aus einer Datei, die auf einem anderen Rechner erstellt wurde, sondern aus mehreren, hintereinander gehängten Dateien, die entweder automatisch mit
    dpkg --set-selections oder manuell angelegt wurden. Dabei kann es z.B. vorkommen, dass in der aus mehreren einzelnen packages.lst entstandenen Gesamt-packages.lst steht:

    .
    .
    .
    virt-manager install manual
    .
    .
    .
    virt-viewer install auto
    .
    .
    .
    virt-manager purge

    (die dritte Spalte muss nicht vorhanden sein).

    Das führt dazu, dass virt-viewer immer wieder installiert und dann wieder deinstalliert wird. Besser wäre natürlich, wenn Pakete mit "auto" in der dritten Spalte und nicht benötigter Abhängigkeit durch ein anderes Paket gar nicht erst installiert wü
    rden - hat jemand eine Idee, wie sich das bewerkstelligen lässt?

    Gruß
    Christoph


    -----BEGIN PGP SIGNATURE-----

    iQIzBAABCgAdFiEEHeqYcooFjlnR4zwFcOXIip7d3fEFAmafmuEACgkQcOXIip7d 3fGR0xAAp4Ix9sb1E04AMSHDSyCWxDXjTOEg07qy0vAPcJny97bdwxxJLcDiUD78 /L0+1c6DM6z7p+wn3LZ5DNEhyJXubZswWdTOb2h22ZCGYj42H/Ok2ct3gjr6+pn+ 9/qkyIzkpu4B/TXMAS4N0Jv0gVIxeTCMLPxzO7lVEArawFk6MCQhqCWlhBzx2nEC eW45clPz4fqgmia4aRdHB3Gb7jkFeSZnd0H6we0rIP/zuG2v8mJ0iPbem6TEgbxI l1fpau9sqpXEXCd/l7tHiCPmLss5LQgAnlZ08fz3iwwPoM4L9NTqt9VIiVSJ0FPG fjtkzuhcUfhMQD4+IqVjy4XgM5hhjHvIrAhZ2QxDBCwL+RQqYExDnGW+/6PGbtua 30rruoKh/9jOYK/GWqrEvNZgxgDNlYGWV+wWjX0ZEdyjbm32uuwtxuWdY6MlQbXF vmzBd3kC/QMr2ojD/LdoCUDhzqIz8MNzzdDxjaK92zh683SyBPFEkQHMSln1stTh zQ4MX2F0mbYFTTxqrSErA8jnKl5MIBCUsAngOuCAI8mnh1P93V3pdiO+fjL4dqrR k8kHZwc4Y6g3GdUOpbGVpqQ9MCB8rFFH2VxP0ol0DqcYBYBiNKZKbY6IkMyJEczF MEIp61OBNujbZcP2tw908YxOf8JXnZqvZsSlYfVRbQsY/PH7PPE=
    =X1hK
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From stefano prina@21:1/5 to All on Tue Jul 23 15:50:01 2024
    On Tuesday, July 23, 2024 1:58:25 PM CEST Christoph Pleger wrote:
    Hello,

    I would like to install many computers with largely the same package
    list. To do this, I can use

    dpkg --get-selections > packages.lst

    to create a list of the installed packages from a computer on which I
    have previously installed the standard packages I want, which I can
    then implement on other computers with

    cat packages.lst | dpkg --set-selections

    and

    apt-get dselect-upgrade

    .

    In addition, the extended status of the packages should be adopted,
    i.e. whether a package was installed automatically as a dependency of another, or manually. Therefore, I added a third column with the
    extended status to the packages.lst, which normally has the form

    <package> <install_status>

    per line, so that a line now has the following form:

    <package> <install_status> <extended_status>

    For a concrete example, it looks like this:

    virt-viewer install auto

    This works wonderfully when installing a computer, first the packages
    are installed as desired and then the extended status is set as desired
    - the reverse is not possible because apt-mark does not allow to set
    the extended state of a package that is not installed.

    However, the packages.lst that is used on computers to be installed
    sometimes does not consist of just one file that was created on another computer, but of several concatenated files which were either created automatically with dpkg --set-selections or manually. So, it can
    happen, for example, that the overall packages.lst created from several individual packages.lst contains:

    .
    .
    .
    virt-manager install manual
    .
    .
    .
    virt-viewer install auto
    .
    .
    .
    virt-manager purge

    (the third column does not have to be present).

    This leads to virt-viewer (as a dependency of virt-manager) being
    installed and then uninstalled again and again. It would of course be
    better if packages with "auto" in the third column are not even
    installed, if not needed by another package - does anyone have an idea
    how this can be done?

    Regards
    Christoph




    Hallo,

    ich möchte viele Rechner mit weitgehend gleicher Paketliste installieren. Dafür kann ich von einem Rechner, auf dem ich vorher von mir gewünschte Standardpakete installiert habe, mit Hilfe von

    dpkg --get-selections > packages.lst

    eine Liste der installierten Pakete erstellen, die ich dann auf anderen Rechnern mit

    cat packages.lst | dpkg --set-selections

    und

    apt-get dselect-upgrade

    realisieren kann.

    Zusätzlich soll aber der erweiterte Status der Pakete übernommen werden,
    also ob ein Paket automatisch als Abhängigkeit von einem anderen
    installiert wurde, oder manuell. Daher habe ich in der packages.lst, die normalerweise pro Zeile die Form

    <package> <install_status>

    hat, noch eine dritte Spalte mit dem erweiterten Status hinzugefügt, so dass eine Zeile folgende Form hat:

    <package> <install_status> <extended_status>

    Im konkreten Fall sieht das zum Beispiel so aus:

    virt-viewer install auto


    Das funktioniert bei der Installation eines Rechners so weit auch ganz wunderbar, erst werden die Pakete werden wie gewünscht installiert und dann die erweiterten Status wie gewünscht gesetzt - umgekehrt ist es nicht möglich, weil apt-mark das Setzen des erweiterten Status eines nicht installierten Pakets nicht erlaubt.

    Nur besteht die packages.lst, die auf zu installierenden Rechnern angewendet wird, manchmal gar nicht nur aus einer Datei, die auf einem anderen Rechner erstellt wurde, sondern aus mehreren, hintereinander gehängten Dateien, die entweder automatisch mit dpkg --set-selections oder manuell angelegt
    wurden. Dabei kann es z.B. vorkommen, dass in der aus mehreren einzelnen packages.lst entstandenen Gesamt-packages.lst steht:

    .
    .
    .
    virt-manager install manual
    .
    .
    .
    virt-viewer install auto
    .
    .
    .
    virt-manager purge

    (die dritte Spalte muss nicht vorhanden sein).

    Das führt dazu, dass virt-viewer immer wieder installiert und dann wieder deinstalliert wird. Besser wäre natürlich, wenn Pakete mit "auto" in der dritten Spalte und nicht benötigter Abhängigkeit durch ein anderes Paket
    gar nicht erst installiert würden - hat jemand eine Idee, wie sich das bewerkstelligen lässt?

    Gruß
    Christoph

    Hello Christoph,

    In the past I solved this kind of problem using ansible: https://www.ansible.com/how-ansible-works/

    The power of this tool is : you write once the recipe and than you can reproduce easily the installation or keep a system updated.....

    This is a short example for the workstation.yaml I used:
    ```
    - hosts: localhost
    connection: local
    become: true

    # install base packages
    tasks:
    - name: Install Base Packages
    apt:
    pkg:
    - gufw
    - ufw
    - remmina
    - clipit
    - zim
    - unzip
    - p7zip-full
    - wine
    - winetricks
    - putty
    - cntlm
    - xz-utils
    - ca-certificates
    - curl
    - gnupg
    state: latest
    update_cache: true

    - name: Update apt and install libvirt and quemu
    apt:
    pkg:
    - qemu-kvm
    - virt-manager
    - virtinst
    - libvirt-clients
    - bridge-utils
    - libvirt-daemon-system
    - qemu-system
    - qemu-system-gui
    - qemu-system-arm
    state: latest
    update_cache: true
    ```

    this is the doc page for the apt module: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/ apt_module.html

    Let me know if you need more info :)

    Regards
    Stefano

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)