Package-check usage in a virtual machine?!?

I would like to use package-check without to install it on my main system…

First i tried to install/run it via github actions: https://github.com/YunoHost-Apps/pyinventory_ynh/pull/22 but this doesn’t work, because debian is not available and ubuntu doesn’t work:

image

Crosspost: https://github.com/YunoHost/package_check/issues/93

So i tried to use it in a docker container. But it seems not to work. Maybe LXC isn’t useable in Docker?

I have a local proxmox server running. So i created a fresh debian buster LXC container.

Install doesn’t look good:

jens@ynh-package-check:~/package_check$ ./sub_scripts/lxc_build.sh 
> Update et install lxc lxctl
> Install git, curl and lynx
> Création d'une machine debian buster minimaliste.
> Autoriser l'ip forwarding, pour router vers la machine virtuelle.
> Ajoute un brige réseau pour la machine virtualisée
> Active le bridge réseau
> Configuration réseau du conteneur
./sub_scripts/lxc_build.sh: line 119: lsb_release: command not found
./sub_scripts/lxc_build.sh: line 119: [: !=: unary operator expected
> Configuration réseau de la machine virtualisée
> Configure le parefeu
> Vérification du contenu du resolv.conf
nameserver 192.168.6.1
./sub_scripts/lxc_build.sh: line 145: lsb_release: command not found
./sub_scripts/lxc_build.sh: line 145: [: !=: unary operator expected
> Démarrage de la machine
> Test la configuration dns
>>> The dns isn't working (Current dns = 192.168.6.1)
>>>Force to use the default dns
>>> Try to use the dns address 
>>> The dns isn't working (Current dns = )
>>>Force to use the dns from the config file
nameserver 192.168.6.1
>>> Try to use the dns address 192.168.6.1
>>> The dns isn't working (Current dns = 192.168.6.1)
>>>The dns is still broken, use FDN dns
nameserver 80.67.169.12
>>> Try to use the dns address 192.168.6.1
> Update et install aptitude sudo git
lxc-attach: pchecker_lxc: attach.c: lxc_attach: 1095 Failed to get init pid
lxc-attach: pchecker_lxc: attach.c: lxc_attach: 1095 Failed to get init pid
> Installation des paquets standard et ssh-server
lxc-attach: pchecker_lxc: attach.c: lxc_attach: 1095 Failed to get init pid
> Renseigne /etc/hosts sur l'invité
> Ajoute l'user pchecker
> Autorise pchecker à utiliser sudo sans mot de passe
> Mise en place de la connexion ssh vers l'invité.
write (10.1.4.2): No route to host
write (10.1.4.2): No route to host
write (10.1.4.2): No route to host
ssh: connect to host 10.1.4.2 port 22: No route to host
ssh: connect to host 10.1.4.2 port 22: No route to host
> Installation de Yunohost...
ssh: connect to host 10.1.4.2 port 22: No route to host
> Disable apt-daily to prevent it from messing with apt/dpkg lock
lxc-attach: pchecker_lxc: attach.c: lxc_attach: 1095 Failed to get init pid
lxc-attach: pchecker_lxc: attach.c: lxc_attach: 1095 Failed to get init pid
lxc-attach: pchecker_lxc: attach.c: lxc_attach: 1095 Failed to get init pid
lxc-attach: pchecker_lxc: attach.c: lxc_attach: 1095 Failed to get init pid
lxc-attach: pchecker_lxc: attach.c: lxc_attach: 1095 Failed to get init pid
lxc-attach: pchecker_lxc: attach.c: lxc_attach: 1095 Failed to get init pid
lxc-attach: pchecker_lxc: attach.c: lxc_attach: 1095 Failed to get init pid
lxc-attach: pchecker_lxc: attach.c: lxc_attach: 1095 Failed to get init pid
lxc-attach: pchecker_lxc: attach.c: lxc_attach: 1095 Failed to get init pid
lxc-attach: pchecker_lxc: attach.c: lxc_attach: 1095 Failed to get init pid
> Post install Yunohost
ssh: connect to host 10.1.4.2 port 22: No route to host
ssh: connect to host 10.1.4.2 port 22: No route to host
ssh: connect to host 10.1.4.2 port 22: No route to host
> Ajout du sous domaine de test
ssh: connect to host 10.1.4.2 port 22: No route to host
> Ajout de l'utilisateur de test
ssh: connect to host 10.1.4.2 port 22: No route to host

> Vérification de l'état de Yunohost
ssh: connect to host 10.1.4.2 port 22: No route to host
> Arrêt de la machine virtualisée
> Suppression des règles de parefeu
> Création d'un snapshot

Maybe LXC in LXC doesn’t work, too?
I will try a installation in a proxmox debian buster VM (QEMU/KVM not LXC)…

I guess first you should try to fix this :

./sub_scripts/lxc_build.sh: line 119: lsb_release: command not found

by trying to apt install lsb-release

I will try it and created a PR to install this via lxc_build.sh: Update lxc_build.sh by jedie · Pull Request #94 · YunoHost/package_check · GitHub

After install it looks now:

jens@ynh-package-check:~$ ./package_check/sub_scripts/lxc_build.sh 
> Update et install lxc lxctl
> Install git, curl and lynx
> Suppression du conteneur existant.
lxc-destroy: pchecker_lxc: tools/lxc_destroy.c: main: 271 Destroyed container pchecker_lxc
> Création d'une machine debian buster minimaliste.
> Autoriser l'ip forwarding, pour router vers la machine virtuelle.
> Ajoute un brige réseau pour la machine virtualisée
> Active le bridge réseau
> Configuration réseau du conteneur
> Configuration réseau de la machine virtualisée
> Configure le parefeu
> Vérification du contenu du resolv.conf
nameserver 192.168.6.1
> Démarrage de la machine
> Test la configuration dns
>>> The dns isn't working (Current dns = 192.168.6.1)
>>>Force to use the default dns
>>> Try to use the dns address 
>>> The dns isn't working (Current dns = )
>>>Force to use the dns from the config file
nameserver 192.168.6.1
>>> Try to use the dns address 192.168.6.1
>>> The dns isn't working (Current dns = 192.168.6.1)
>>>The dns is still broken, use FDN dns
nameserver 80.67.169.12
>>> Try to use the dns address 192.168.6.1
> Update et install aptitude sudo git
lxc-attach: pchecker_lxc: attach.c: lxc_attach: 1095 Failed to get init pid
lxc-attach: pchecker_lxc: attach.c: lxc_attach: 1095 Failed to get init pid
> Installation des paquets standard et ssh-server
lxc-attach: pchecker_lxc: attach.c: lxc_attach: 1095 Failed to get init pid
> Renseigne /etc/hosts sur l'invité
> Ajoute l'user pchecker
> Autorise pchecker à utiliser sudo sans mot de passe
> Mise en place de la connexion ssh vers l'invité.
Host 10.1.4.2 not found in /home/jens/.ssh/known_hosts
write (10.1.4.2): No route to host
write (10.1.4.2): No route to host
write (10.1.4.2): No route to host
ssh: connect to host 10.1.4.2 port 22: No route to host
ssh: connect to host 10.1.4.2 port 22: No route to host
> Installation de Yunohost...
ssh: connect to host 10.1.4.2 port 22: No route to host
> Disable apt-daily to prevent it from messing with apt/dpkg lock
lxc-attach: pchecker_lxc: attach.c: lxc_attach: 1095 Failed to get init pid
lxc-attach: pchecker_lxc: attach.c: lxc_attach: 1095 Failed to get init pid
lxc-attach: pchecker_lxc: attach.c: lxc_attach: 1095 Failed to get init pid
lxc-attach: pchecker_lxc: attach.c: lxc_attach: 1095 Failed to get init pid
lxc-attach: pchecker_lxc: attach.c: lxc_attach: 1095 Failed to get init pid
lxc-attach: pchecker_lxc: attach.c: lxc_attach: 1095 Failed to get init pid
lxc-attach: pchecker_lxc: attach.c: lxc_attach: 1095 Failed to get init pid
lxc-attach: pchecker_lxc: attach.c: lxc_attach: 1095 Failed to get init pid
lxc-attach: pchecker_lxc: attach.c: lxc_attach: 1095 Failed to get init pid
lxc-attach: pchecker_lxc: attach.c: lxc_attach: 1095 Failed to get init pid
> Post install Yunohost
ssh: connect to host 10.1.4.2 port 22: No route to host
ssh: connect to host 10.1.4.2 port 22: No route to host
ssh: connect to host 10.1.4.2 port 22: No route to host
> Ajout du sous domaine de test
ssh: connect to host 10.1.4.2 port 22: No route to host
> Ajout de l'utilisateur de test
ssh: connect to host 10.1.4.2 port 22: No route to host

> Vérification de l'état de Yunohost
ssh: connect to host 10.1.4.2 port 22: No route to host
> Arrêt de la machine virtualisée
> Suppression des règles de parefeu
> Création d'un snapshot

Any advice?

Merp …

lxc-attach: pchecker_lxc: attach.c: lxc_attach: 1095 Failed to get init pid

sounds like the container did not properly start … Would need to dig in to understand why …

Though I’m personally working since a few days on a big rework of the entire package_check scripts, and among other things will now be based on lxd instead of lxc, which imho is much less tedious to configure (c.f. the current scripts managing the lxc that need to handle the entire network configuration by hand and test if the DNS is working etc…)

Alternatively you could just come to the app packaging chat room and ask for an access to the dev CI where you’ll be able to submit jobs (you just need to provide us with an SSH key)

Though of course one should be able to selfhost package_check …

Think i will wait until the refactory will land…

In the end it would be great if everyone can easy setup this own CI instance, just by install package_check_ynh on a own Yunohost instance… As i written here: https://github.com/YunoHost/issues/issues/1694#issuecomment-747277930

Because of My "integration Level" falls from 7 to 0 ?!? - #10 by Limezy i will try it one more time with GitHub - YunoHost-Apps/yunorunner_ynh: YunoRunner package for YunoHost on proxmox in a new YunoHost instance…

Proxmox has two kind of virtualizations:

  • via KVM VM
  • as LXC container

Seems that a KVM instance is needed and a LXC container will not work, isn’t it?

Both should work (we do run some of our app CI inside a LXC - which then will do LXC-in-LXC). When running the CI in a LXC, you need to make sure that nesting is enabled on the LXC tho

1 Like

I now try to setup package check via vagrant in virtualbox…

I put some info together here: Setup YunoHost "package check" via Vagrant in a Virtual box · GitHub

Maybe it should be added to GitHub - YunoHost/package_check: Shell script which check package actions: install, remove, upgrade, backup, restore… ?

I puzzled everything together and create a PR, here: