Re: Package lists with state and extended state
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 > > > > per line, so that a line now has the following form: > > > > 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 > > > > hat, noch eine dritte Spalte mit dem erweiterten Status hinzugefügt, so dass > eine Zeile folgende Form hat: > > > > 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 -
Creating custom rspberry image using ansible
Hello, I am trying to create a custom raspberry image starting from the code here https://salsa.debian.org/raspi-team/image-specs I added the ansible step in this file raspi_master.yaml: - apt: install packages: - ansible - python3 - ca-certificates - dosfstools - iw - parted - ssh - wpasupplicant - systemd-timesyncd - __LINUX_IMAGE__ - raspi-firmware - __WIRELESS_FIRMWARE__ - __BLUETOOTH_FIRMWARE__ tag: tag-root unless: rootfs_unpacked - ansible: tag-root playbook: ansible/image.yaml - cache-rootfs: tag-root unless: rootfs_unpacked Then I created the folder and file ansible/image.yaml whit this content - hosts: image tasks: - name: "set /etc/hostname" shell: | echo "{{ hostname }}" > /etc/hostname vars: hostname: discworld When I run: make raspi_3_bookworm.img The output is: Exec: ['chroot', '/tmp/tmpz7n89mb7', 'apt-get', 'clean'] Created /tmp/tmpvcwo8eje for Ansible inventory Created /tmp/tmp3achsgue.yaml for Ansible variables Exec: ['ansible-playbook', '-c', 'chroot', '-i', '/tmp/tmpvcwo8eje', '--tags', 'all', '-e', '@/tmp/tmp3achsgue.yaml', 'ansible/image.yaml'] ERROR: Program failed: 1 ERROR: RuncmdError('Program failed: 1') Something went wrong, cleaning up! Removing /tmp/tmp3achsgue.yaml Removing /tmp/tmpvcwo8eje Exec: ['zerofree', '-v', '/dev/mapper/loop0p2'] Exec: ['kpartx', '-dsv', 'raspi_3_bookworm.img'] Exec: ['losetup', '--json', '-l', '/dev/loop0'] Command exited with non-zero status 1 I confirm all the dependencies listed on the remote are installed, also ansible is installed... So what I am doing wrong ?? Thanks in advance Stefano
Re: Debian12 with nginx and php-fpm
Ciao Michael, simply the old-style /etc/init.d "start" that you show in your post did not suffice. I do note that you seem to have a mix of TCP ports here; both 80, 8080 (in the requested URL) and 8090 (in the podman invocation). After your email, I double checked and I reported wrongly the port on the browser url.. of course there were no others containers running a the host Anyway I tested the procedure using * a vm as you did, and I confirm it is working... starting the services using systemd simply works. * a vm, stopping the services using the systemd and restarting them using init.d and it works. * docker running on a debian host, starting the services using init.d and it works. * podman running on a debian host, starting the services using init.d and it works. So case close... because the first try was running on a different distribution, confining all the check to debian do not reproduce the issue. Thanks for your feedback Stefano
Debian12 with nginx and php-fpm
Hello All, I am Stefano from Torino, Italy; I am just new to this list, nice to virtually meet all of you : ) I am writing to you because I need support for a strange issue I' am facing. I am trying to create a debian container to run some php app for a side project, the idea is to use nginx and php-fpm, the procedure I am using is : [host] $ podman run -ti -p 8090:80 debian:12-slim [container]$apt update && apt install vim nginx php-fpm edit`/etc/nginx/sites-enabled/default` de-commenting the php part # pass PHP scripts to FastCGI server # location ~ \.php$ { include snippets/fastcgi-php.conf; # With php-fpm (or other unix sockets): fastcgi_pass unix:/var/run/php/php8.2-fpm.sock; # With php-cgi (or other tcp sockets): #fastcgi_pass 127.0.0.1:9000; } [container]$/etc/init.d/nginx start [container]$ /etc/init.d/php8.2-fpm start edit`/var/www/html/info.php using the content:` connectinghttp://localhost:8080 I get the default nginx page connectinghttp://localhost:8080/info.php I got Access denied. and the logs report : [container]$ tail -n 2 /var/log/nginx/error.log 2024/07/06 13:19:45 [error] 7365#7365: *1 FastCGI sent in stderr: "PHP message: PHP Warning: PHP Request Startup: Failed to open stream: Permission denied in Unknown on line 0; Unable to open primary script: /var/www/html/info.php (Permission denied)" while reading resp onse header from upstream, client: 127.0.0.1, server: _, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.2-fpm.sock:", host: "localhost:8090" 2024/07/06 13:19:45 [error] 7365#7365: *1 FastCGI sent in stderr: "PHP message: PHP Warning: PHP Request Startup: Failed to open stream: Permission denied in Unknown on line 0; Unable to open primary script: /var/www/html/info.php (Permission denied)" while reading resp onse header from upstream, client: 127.0.0.1, server: _, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.2-fpm.sock:", host: "localhost:8090" It is strange because I the file /var/www/html/info.php exists and have to much open permission 0:) [container]$ls -l /var/www/html/info.php -rwxrwxrwx 1 root root 20 Jul 6 13:03 /var/www/html/info.php the socket /var/run/php/php8.2-fpm.sock exist and it seems ok: [container]$ls -l /var/run/php/php8.2-fpm.sock srw-rw 1 www-data www-data 0 Jul 6 13:14 /var/run/php/php8.2-fpm.sock all the workers seem running using the right user: [container]$ps -aux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.0 4188 3216 pts/0 Ss 12:58 0:00 bash root 7255 0.0 0.0 201548 8448 ? Ss 13:14 0:00 php-fpm: master process (/etc/php/8.2/fpm/php-fpm.conf) www-data 7256 0.0 0.0 201548 10792 ? S 13:14 0:00 php-fpm: pool www www-data 7257 0.0 0.0 201548 10664 ? S 13:14 0:00 php-fpm: pool www root 7364 0.0 0.0 10336 1512 ? Ss 13:19 0:00 nginx: master process /usr/sbin/nginx www-data 7365 0.0 0.0 10960 4104 ? S 13:19 0:00 nginx: worker process www-data 7366 0.0 0.0 10960 4244 ? S 13:19 0:00 nginx: worker process www-data 7367 0.0 0.0 10688 2684 ? S 13:19 0:00 nginx: worker process www-data 7368 0.0 0.0 10688 2684 ? S 13:19 0:00 nginx: worker process www-data 7369 0.0 0.0 10688 2684 ? S 13:19 0:00 nginx: worker process www-data 7370 0.0 0.0 10688 2684 ? S 13:19 0:00 nginx: worker process www-data 7371 0.0 0.0 10688 2684 ? S 13:19 0:00 nginx: worker process www-data 7372 0.0 0.0 10688 2684 ? S 13:19 0:00 nginx: worker process www-data 7373 0.0 0.0 10688 2684 ? S 13:19 0:00 nginx: worker process www-data 7374 0.0 0.0 10688 2684 ? S 13:19 0:00 nginx: worker process www-data 7375 0.0 0.0 10688 2684 ? S 13:19 0:00 nginx: worker process www-data 7376 0.0 0.0 10688 2684 ? S 13:19 0:00 nginx: worker process root 7386 0.0 0.0 8060 4248 pts/0 R+ 13:51 0:00 ps -aux So I have the feeling I am missing something stupid... but what ?? Can you help me ? Thanks in advance Stefano