liuyq / linaro-android-docker

0 stars 0 forks source link

Failed to run docker-compose build for linaro-android-docker to set up lava instance on Raspberry Pi 4 #1

Open liuyq opened 2 years ago

liuyq commented 2 years ago

instructions from: https://git.lavasoftware.org/lava/pkg/docker-compose Ubuntu 21.10 Desktop

  1. install docker and docker run hello-world works
  2. sudo apt install docker-compose
  3. docker-compose pull
  4. docker-compose build
  5. docker-compose up

22:23:40 liuyq:lava-docker-compose$ docker-compose build db uses an image, skipping lava-scheduler uses an image, skipping lava-publisher uses an image, skipping lava-coordinator uses an image, skipping apache2 uses an image, skipping lava-server uses an image, skipping lava-dispatcher-webserver uses an image, skipping Building lava-dispatcher-tftpd Step 1/4 : FROM debian:stable ---> 8ab73bae4114 Step 2/4 : RUN apt-get update ---> Using cache ---> bcda6e2dee9b Step 3/4 : RUN apt-get install -y tftpd-hpa ---> Using cache ---> d65e4f59d65b Step 4/4 : CMD in.tftpd -L --user tftp -a 0.0.0.0:69 -s -B1468 -v /srv/tftp ---> Using cache ---> c9b28c4f4cb6

Successfully built c9b28c4f4cb6 Successfully tagged lava-docker-compose_lava-dispatcher-tftpd:latest Building lava-dispatcher-ser2net Step 1/5 : FROM debian:stable ---> 8ab73bae4114 Step 2/5 : RUN apt-get update ---> Using cache ---> bcda6e2dee9b Step 3/5 : RUN apt-get install -y --no-install-recommends ser2net ---> Using cache ---> 9a347fd8cb7a Step 4/5 : ADD ser2net.conf /etc/ ---> Using cache ---> 8f93108d2414 Step 5/5 : CMD echo -n "Starting " && ser2net -v && ser2net -d -c /etc/ser2net.conf ---> Using cache ---> ed89fcb9be34

Successfully built ed89fcb9be34 Successfully tagged lava-docker-compose_lava-dispatcher-ser2net:latest Building lava-dispatcher-nfs Step 1/7 : FROM debian:stable ---> 8ab73bae4114 Step 2/7 : RUN apt-get update ---> Using cache ---> bcda6e2dee9b Step 3/7 : RUN apt-get install -y nfs-common nfs-ganesha nfs-ganesha-vfs ---> Using cache ---> eca1445b63d7 Step 4/7 : ADD start-nfs-ganesha.sh / ---> Using cache ---> fe423c4552c5 Step 5/7 : ADD ganesha.conf /etc/ganesha/ ---> Using cache ---> f796473b999b Step 6/7 : ADD services /etc/ ---> Using cache ---> c32498eb39a7 Step 7/7 : CMD ["/start-nfs-ganesha.sh"] ---> Using cache ---> ff5a35e9d998

Successfully built ff5a35e9d998 Successfully tagged lava-docker-compose_lava-dispatcher-nfs:latest Building lava-dispatcher Step 1/22 : ARG image=lavasoftware/lava-dispatcher:latest Step 2/22 : FROM ${image} ---> 6c02eb46e99f Step 3/22 : ARG extra_packages="" ---> Using cache ---> 5a0c89f5a86f Step 4/22 : RUN apt -q update ---> Using cache ---> 4ec95f5863e8 Step 5/22 : RUN DEBIAN_FRONTEND=noninteractive apt-get -q -y install software-properties-common nfs-common ---> Using cache ---> 9cb57eeaa901 Step 6/22 : RUN apt-add-repository non-free ---> Using cache ---> 5ba56c74a470 Step 7/22 : RUN apt -q update ---> Using cache ---> 76cd2a3e1492 Step 8/22 : RUN DEBIAN_FRONTEND=noninteractive apt-get -q -y install ${extra_packages} net-tools snmp snmp-mibs-downloader ---> Running in 25d48aed9774 Reading package lists... Building dependency tree... Reading state information... E: Unable to locate package linux-image-amd64 ERROR: Service 'lava-dispatcher' failed to build : The command '/bin/sh -c DEBIAN_FRONTEND=noninteractive apt-get -q -y install ${extra_packages} net-tools snmp snmp-mibs-downloader' returned a non-zero code: 100 22:23:49 liuyq:lava-docker-compose$

according to the instructions from here: https://git.lavasoftware.org/lava/pkg/docker-compose https://linaro.atlassian.net/wiki/spaces/LIPUB/pages/18852151302/Getting+Started+with+LAVA+Docker+and+a+FRDM-K64F https://github.com/danrue/lava.therub.org https://therub.org/2019/03/05/setting-up-a-board-farm-with-lava-and-docker/ https://github.com/mwasilew/lava-docker-compose https://therub.org/2019/03/01/lava-docker-compose/

liuyq commented 2 years ago

seems fixed with the following change:

17:40:46 rpi4:lava-docker-compose$ git diff --staged 
diff --git a/dispatcher/Dockerfile b/dispatcher/Dockerfile
index da796b0..623e595 100644
--- a/dispatcher/Dockerfile
+++ b/dispatcher/Dockerfile
@@ -11,7 +11,7 @@ RUN download-mibs

 # Add MIBs
 RUN mkdir -p /usr/share/snmp/mibs/
-ADD https://download.schneider-electric.com/files?p_enDocType=Firmware+-+Released&p_File_Name=powernet428.mib&p_Doc_Ref=APC_PowerNetMIB428 /usr/share/snmp/mibs/powernet428.mib
+ADD https://raw.githubusercontent.com/ci-box/ci-box-lava-worker/master/powernet428.mib /usr/share/snmp/mibs/powernet428.mib

 # Add certificates.
 COPY certs/* /etc/lava-dispatcher/certificates.d/
diff --git a/docker-compose.yaml b/docker-compose.yaml
index ef4ba59..15c926e 100644
--- a/docker-compose.yaml
+++ b/docker-compose.yaml
@@ -90,7 +90,7 @@ services:
       context: ./dispatcher
       args:
         image: ${DC_DISPATCHER_IMAGE}
-        extra_packages: "linux-image-amd64 curl"
+        extra_packages: "linux-image-arm64 curl"
     depends_on:
     - lava-dispatcher-webserver
     - lava-dispatcher-tftpd
@@ -171,10 +171,10 @@ services:
     volumes:
       - worker-http:/var/lib/lava/dispatcher/tmp
     ports:
-      - 111:111
-      - 111:111/udp
-      - 2049:2049
-      - 2049:2049/udp
+      - 3111:3111
+      - 3111:3111/udp
+      - 3049:3049
+      - 3049:3049/udp
       - 35543:35543

 volumes:
17:40:48 rpi4:lava-docker-compose$                       
liuyq commented 2 years ago

The following message does not mean error, please wait for a while, and the installation will be finished.

lava-dispatcher_1            | 2022-02-07 01:48:53,502   DEBUG [INIT] Auto register as 'worker0'     
lava-dispatcher_1            | 2022-02-07 01:48:53,511   ERROR [INIT] -> server error: code 503
lava-dispatcher_1            | 2022-02-07 01:48:53,511   DEBUG [INIT] --> HTTPConnectionPool(host='lava-server', port=8000): Max retries exceeded with url: /scheduler/internal/v1/workers/ (Caused by NewC
onnectionError('<urllib3.connection.HTTPConnection object at 0xffffb5888940>: Failed to establish a new connection: [Errno 111] Connection refused'))                                           
lava-scheduler_1             | Waiting for the database:                                                                                                                                                   
lava-scheduler_1             | [done]                                                                                                                                                                      
lava-scheduler_1             | Applying migrations                                                                                                                                                         
lava-dispatcher_1            | 2022-02-07 01:48:58,514   DEBUG [INIT] Auto register as 'worker0'                                                                                                           
lava-dispatcher_1            | 2022-02-07 01:48:58,530   ERROR [INIT] -> server error: code 503                                                                                                            
lava-dispatcher_1            | 2022-02-07 01:48:58,535   DEBUG [INIT] --> HTTPConnectionPool(host='lava-server', port=8000): Max retries exceeded with url: /scheduler/internal/v1/workers/ (Caused by NewC
onnectionError('<urllib3.connection.HTTPConnection object at 0xffffb5ab9b50>: Failed to establish a new connection: [Errno 111] Connection refused'))
lava-publisher_1             | 2022-02-07 01:48:58,650    INFO [INIT] Starting lava-publisher                                                                                                              
lava-publisher_1             | 2022-02-07 01:48:58,650    INFO [INIT] Version 2022.01.3                                                                                                                    
lava-publisher_1             | 2022-02-07 01:48:58,651    INFO [INIT] Dropping privileges       
lava-publisher_1             | 2022-02-07 01:48:58,653   DEBUG [INIT] Switching to (lavaserver(200), lavaserver(200))
lava-publisher_1             | 2022-02-07 01:48:58,654    INFO [INIT] Listening on http://*:8001     
lava-publisher_1             | 2022-02-07 01:48:58,669    INFO [INIT] Create input socket at 'tcp://*:5557'                                                                                                
lava-publisher_1             | 2022-02-07 01:48:58,675    INFO [INIT] Create the pub socket at 'tcp://*:5500'                                                                                              
lava-publisher_1             | 2022-02-07 01:48:58,677    INFO [PROXY] waiting for events                                                                                                                  
lava-server_1                | Waiting for the database:                                                                                                                                                   
lava-server_1                | [done]                                                                
lava-server_1                | Waiting for migrations                                  
lava-dispatcher_1            | 2022-02-07 01:49:03,543   DEBUG [INIT] Auto register as 'worker0'                                                                                                           
lava-dispatcher_1            | 2022-02-07 01:49:03,551   ERROR [INIT] -> server error: code 503                                                                                                            
lava-dispatcher_1            | 2022-02-07 01:49:03,552   DEBUG [INIT] --> HTTPConnectionPool(host='lava-server', port=8000): Max retries exceeded with url: /scheduler/internal/v1/workers/ (Caused by NewC
onnectionError('<urllib3.connection.HTTPConnection object at 0xffffb59e0220>: Failed to establish a new connection: [Errno 111] Connection refused'))                                                      
lava-dispatcher_1            | 2022-02-07 01:49:08,556   DEBUG [INIT] Auto register as 'worker0'                                                                                                           
lava-dispatcher_1            | 2022-02-07 01:49:08,563   ERROR [INIT] -> server error: code 503                                                                                                            
lava-dispatcher_1            | 2022-02-07 01:49:08,563   DEBUG [INIT] --> HTTPConnectionPool(host='lava-server', port=8000): Max retries exceeded with url: /scheduler/internal/v1/workers/ (Caused by NewC
onnectionError('<urllib3.connection.HTTPConnection object at 0xffffb59e0c70>: Failed to establish a new connection: [Errno 111] Connection refused'))                                                      
lava-dispatcher_1            | 2022-02-07 01:49:13,567   DEBUG [INIT] Auto register as 'worker0'                                                                                                           
lava-dispatcher_1            | 2022-02-07 01:49:13,577   ERROR [INIT] -> server error: code 503                                                                                                            
lava-dispatcher_1            | 2022-02-07 01:49:13,578   DEBUG [INIT] --> HTTPConnectionPool(host='lava-server', port=8000): Max retries exceeded with url: /scheduler/internal/v1/workers/ (Caused by NewC
onnectionError('<urllib3.connection.HTTPConnection object at 0xffffb5888d00>: Failed to establish a new connection: [Errno 111] Connection refused'))                                                      
^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[Alava-dispatcher_1            | 2022-02-07 01:49:18,583   DEBUG [INIT] Auto register as 'worker0'
lava-dispatcher_1            | 2022-02-07 01:49:18,589   ERROR [INIT] -> server error: code 503                                                                                                            
lava-dispatcher_1            | 2022-02-07 01:49:18,590   DEBUG [INIT] --> HTTPConnectionPool(host='lava-server', port=8000): Max retries exceeded with url: /scheduler/internal/v1/workers/ (Caused by NewC
onnectionError('<urllib3.connection.HTTPConnection object at 0xffffb58885b0>: Failed to establish a new connection: [Errno 111] Connection refused'))                                                      
lava-dispatcher_1            | 2022-02-07 01:49:23,595   DEBUG [INIT] Auto register as 'worker0'                                                                                                           
lava-dispatcher_1            | 2022-02-07 01:49:23,601   ERROR [INIT] -> server error: code 503                                                                                                            
lava-dispatcher_1            | 2022-02-07 01:49:23,601   DEBUG [INIT] --> HTTPConnectionPool(host='lava-server', port=8000): Max retries exceeded with url: /scheduler/internal/v1/workers/ (Caused by NewC
onnectionError('<urllib3.connection.HTTPConnection object at 0xffffb59f5340>: Failed to establish a new connection: [Errno 111] Connection refused')) 
liuyq commented 2 years ago

please access http://127.0.0.1 or http://ip_raspberry/ to access the service, and use the following command to create the superuser:

$ docker-compose exec lava-server lava-server manage users add "admin" --superuser --staff 
$ docker-compose exec lava-server lava-server manage users add "admin" --superuser --staff  --passwd $passwd

with the following commands to add the device type and device:

docker-compose exec lava-server lava-server manage device-types list -a
docker-compose exec lava-server lava-server manage device-types add hi6220-hikey-r2
docker-compose exec lava-server lava-server manage workers list
docker-compose exec lava-server lava-server manage devices add --offline --device-type hi6220-hikey-r2 --worker worker0 hikey-6220-r2-01

For the following error reported on the ui page like http://192.168.1.60/scheduler/device/hikey-6220-r2-01

Configuration Error: missing or invalid template.

Jobs requesting this device type (hi6220-hikey-r2) will not be able to start until a template is available on the master.

The device has no [health check job](http://192.168.1.60/static/docs/v2/glossary.html#term-health-check) Consider adding a [health check definition](http://192.168.1.60/static/docs/v2/healthchecks.html#health-checks).

need to add the health check jobs and the device files like this

$ docker cp lava-server-health-checks/hi6220-hikey-r2.yaml lava-docker-compose_lava-server_1://etc/lava-server/dispatcher-config/health-checks/hi6220-hikey-r2.yaml
$ docker cp lava-server-devices/hikey-6220-r2-01.jinja2 lava-docker-compose_lava-server_1://etc/lava-server/dispatcher-config/devices/hikey-6220-r2-01.jinja2
$ docker exec lava-docker-compose_lava-server_1 chown lavaserver:lavaserver /etc/lava-server/dispatcher-config/health-checks/hi6220-hikey-r2.yaml
$ docker exec lava-docker-compose_lava-server_1 chown lavaserver:lavaserver /etc/lava-server/dispatcher-config/devices/hikey-6220-r2-01.jinja2

need to run docker pull lavalabteam/adb-fastboot for the health jobs.

The following problem could be worked around with the commit here which is reported on lava repository here too: https://git.lavasoftware.org/lava/lava/-/issues/420

start: 1.9.3 fastboot-flash-action (timeout 00:12:26) [aosp]
17408 bytes
cmd: ['docker', 'run', '--detach', '--rm', '--init', '--name=lava-14-1.9.3', '--mount=type=bind,source=/var/lib/lava/dispatcher/tmp/14/fastboot-deploy-buls9fmw/ptable/ptable-aosp-8g.img,destination=/var/lib/lava/dispatcher/tmp/14/fastboot-deploy-buls9fmw/ptable/ptable-aosp-8g.img', 'lavalabteam/adb-fastboot', 'sleep', 'infinity']
Calling: 'nice' 'docker' 'run' '--detach' '--rm' '--init' '--name=lava-14-1.9.3' '--mount=type=bind,source=/var/lib/lava/dispatcher/tmp/14/fastboot-deploy-buls9fmw/ptable/ptable-aosp-8g.img,destination=/var/lib/lava/dispatcher/tmp/14/fastboot-deploy-buls9fmw/ptable/ptable-aosp-8g.img' 'lavalabteam/adb-fastboot' 'sleep' 'infinity'
>> docker: Error response from daemon: invalid mount config for type "bind": bind source path does not exist: /var/lib/lava/dispatcher/tmp/14/fastboot-deploy-buls9fmw/ptable/ptable-aosp-8g.img.
>> See 'docker run --help'.
Returned 125 in 2 seconds
Unable to run 'nice' '['docker', 'run', '--detach', '--rm', '--init', '--name=lava-14-1.9.3', '--mount=type=bind,source=/var/lib/lava/dispatcher/tmp/14/fastboot-deploy-buls9fmw/ptable/ptable-aosp-8g.img,destination=/var/lib/lava/dispatcher/tmp/14/fastboot-deploy-buls9fmw/ptable/ptable-aosp-8g.img', 'lavalabteam/adb-fastboot', 'sleep', 'infinity']'
Unable to run 'nice' 'docker' 'run' '--detach' '--rm' '--init' '--name=lava-14-1.9.3' '--mount=type=bind,source=/var/lib/lava/dispatcher/tmp/14/fastboot-deploy-buls9fmw/ptable/ptable-aosp-8g.img,destination=/var/lib/lava/dispatcher/tmp/14/fastboot-deploy-buls9fmw/ptable/ptable-aosp-8g.img' 'lavalabteam/adb-fastboot' 'sleep' 'infinity'

to enable health job to run, from here after you logged in as admin: http://192.168.1.60/scheduler/device/hikey-6220-r2-01 edit the Health item to set it to Good from the default Maintenance then one health job will be scheduled

liuyq commented 2 years ago

need to check how to add one qemu instance for test, or how to add one hikey device for test, and how to run adb/fastboot commands with docker for adding devices to lava: https://validation.linaro.org/static/docs/v2/first-devices.html#first-devices

liuyq commented 2 years ago

Some notes on the debug commands: docker run --detach --rm --init --name=lava-12-2.8.3-02be696d-533e-4613-bcbb-c240d78e6530 --device /dev/bus/usb/001/009 lavalabteam/adb-fastboot sleep infinity

Added mapping for {'serial_number': '6FFB682C0034659E'} to docker container lava-12-2.8.3-02be696d-533e-4613-bcbb-c240d78e6530 Calling: 'nice' 'udevadm' 'trigger' '--action=add' '/dev/bus/usb/001/009'

Returned 0 in 1 seconds docker exec lava-12-2.8.3-02be696d-533e-4613-bcbb-c240d78e6530 fastboot devices

< waiting for 6FFB682C0034659E >

docker container stop lava-12-2.8.3-02be696d-533e-4613-bcbb-c240d78e6530

    # it's ok to fail; container might have already exited at this point.
    nodedir = os.path.dirname(node)
    uid = nodeinfo.st_uid
    gid = nodeinfo.st_gid
    mode = "%o" % (0o777 & nodeinfo.st_mode)
    subprocess.call(
        [
            "docker",
            "exec",
            container,
            "sh",
            "-c",
            f"mkdir -p {nodedir} && mknod {node} {nodetype} {major} {minor} && chown {uid}:{gid} {node} && chmod {mode} {node}",
        ]
    )   

    for link in links:
        subprocess.call(
            [
                "docker",
                "exec",
                container,
                "sh",
                "-c",
                f"mkdir -p {os.path.dirname(link)} && ln -f -s {node} {link}",
            ]
        )

docker exec lava-docker-compose_lava-dispatcher_1 cp /usr/lib/python3/dist-packages/lava_dispatcher/utils/docker.py /usr/lib/python3/dist-packages/lava_dispatcher/utils/docker.py-orig docker exec lava-docker-compose_lava-dispatcher_1 sed -i '/for dev in self.devices:/i \ \ \ \ \ \ \ \ self.add_device("/dev/bus/usb/")' /usr/lib/python3/dist-packages/lava_dispatcher/utils/docker.py docker exec lava-docker-compose_lava-dispatcher_1 diff /usr/lib/python3/dist-packages/lava_dispatcher/utils/docker.py /usr/lib/python3/dist-packages/lava_dispatcher/utils/docker.py-orig

liuyq commented 2 years ago

https://lava.readthedocs.io/en/latest/admin/basic-tutorials/instance/install/ wget https://apt.lavasoftware.org/lavasoftware.key.asc apt-key add lavasoftware.key.asc echo "deb https://apt.lavasoftware.org/release buster main" > /etc/apt/sources.list.d/lava.list

apt-get update apt-get install python3-pip git curl -fsSL https://get.docker.com -o get-docker.sh sh get-docker.sh python3 -m pip install docker-compose

https://lava.readthedocs.io/en/latest/admin/advanced-tutorials/docker-worker/

lava-dispatcher-host

liuyq commented 1 year ago
liuyq@rpi4:~/lava/lava-docker-compose$ docker-compose up
lava-ser2net is up-to-date
lava-docker-compose_lava-coordinator_1 is up-to-date
lava-docker-compose_db_1 is up-to-date
Starting lava-docker-compose_lava-dispatcher-nfs_1 ... 
Starting lava-docker-compose_lava-dispatcher-webserver_1 ... 
lava-docker-compose_lava-publisher_1 is up-to-date
lava-docker-compose_lava-dispatcher-tftpd_1 is up-to-date
lava-docker-compose_apache2_1 is up-to-date
lava-docker-compose_lava-scheduler_1 is up-to-date
Starting lava-docker-compose_lava-dispatcher-webserver_1 ... error

Starting lava-docker-compose_lava-dispatcher-nfs_1       ... error
a': failed to mount local volume: mount /var/lib/lava/dispatcher/tmp:/var/lib/docker/volumes/lava-docker-compose_worker-http-local/_data, flags: 0x1000: no such file or directory

ERROR: for lava-docker-compose_lava-dispatcher-nfs_1  Cannot start service lava-dispatcher-nfs: error while mounting volume '/var/lib/docker/volumes/lava-docker-compose_worker-http-local/_data': failed to mount local volume: mount /var/lib/lava/dispatcher/tmp:/var/lib/docker/volumes/lava-docker-compose_worker-http-local/_data, flags: 0x1000: no such file or directory

ERROR: for lava-dispatcher-webserver  Cannot start service lava-dispatcher-webserver: error while mounting volume '/var/lib/docker/volumes/lava-docker-compose_worker-http-local/_data': failed to mount local volume: mount /var/lib/lava/dispatcher/tmp:/var/lib/docker/volumes/lava-docker-compose_worker-http-local/_data, flags: 0x1000: no such file or directory

ERROR: for lava-dispatcher-nfs  Cannot start service lava-dispatcher-nfs: error while mounting volume '/var/lib/docker/volumes/lava-docker-compose_worker-http-local/_data': failed to mount local volume: mount /var/lib/lava/dispatcher/tmp:/var/lib/docker/volumes/lava-docker-compose_worker-http-local/_data, flags: 0x1000: no such file or directory
ERROR: Encountered errors while bringing up the project.
liuyq@rpi4:~/lava/lava-docker-compose$ sudo mkdir /var/lib/lava/dispatcher/tmp -p
liuyq commented 1 year ago
$ tail -n1 /etc/apt/sources.list
deb https://apt.lavasoftware.org/release bullseye main
$ wget https://apt.lavasoftware.org/lavasoftware.key.asc
$ sudo apt-key add lavasoftware.key.asc
$ sudo apt-get update
$ sudo apt-get install lava-dispatcher-host
liuyq commented 1 year ago

/usr/lib/python3/dist-packages/lava_dispatcher_host/docker_worker.py

docker run \
    --rm \
    --init \
    --privileged \
    --net=host \
    --name lava-worker-2022.08-54c6A \
    --mount=type=bind,source=/var/lib/lava/dispatcher/tmp,destination=/var/lib/lava/dispatcher/tmp \
    --mount=type=bind,source=/var/lib/lava/dispatcher/worker,destination=/var/lib/lava/dispatcher/worker \
    --mount=type=bind,source=/run/udev,destination=/run/udev \
    --mount=type=bind,source=/dev,destination=/dev \
    --mount=type=bind,source=/var/run/docker.sock,destination=/var/run/docker.sock \
    --mount=type=bind,source=/boot,destination=/boot,readonly=true \
    --mount=type=bind,source=/lib/modules,destination=/lib/modules,readonly=true \
    --hostname=docker-rpi4 lavasoftware/lava-dispatcher:2022.08 \
    lava-worker \
    --exit-on-version-mismatch \
    --wait-jobs \
    --log-file - \
    --name worker0 \
    --worker-dir /var/lib/lava/dispatcher/worker \
    --url http://192.168.1.60/ \
    --http-timeout 600 \
    --ping-interval 20 \
    --job-log-interval 5 \
    --token 2fs65y0q7btmhxgysz1wil54e2u8bdc2cz9ah2zmk5xug9a08a31ishdljsy46p4fo918hxqy1n059eiq9up3dauc50l4tapcpmfd038lh7dl6o2cxky2ab500xw00nz   ----> here should be the worker token,
liuyq commented 1 year ago

lava-docker-worker.service -> log /var/log/lava-dispatcher-host/lava-docker-worker.log -> source lava_dispatcher_host/docker_worker.py -> container command lava-worker lava_dispatcher/worker.py -> start one lava-dispatcher container to check the version

lava-dispatcher-host.service -> /usr/bin/lava-dispatcher-host-server -> lava-dispatcher-host -> for share device with container -> etc/udev rules: lava_dispatcher_host/udev.py -> source file: lava_dispatcher_host/cmdline.py and lava_dispatcher_host/server.py

liuyq commented 1 year ago

add_device_container_mapping <- handle_devices_map

/var/lib/lava/dispatcher/tmp

sudo apt-get install linux-tools-raspi linux-cloud-tools-raspi sudo systemctl status lava-dispatcher-host.service sudo systemctl status lava-docker-worker.service

sudo journalctl -f -u lava-dispatcher-host.service

10月 03 15:39:25 rpi4 lava-dispatcher[13775]: Sharing /dev/bus/usb/001/014 with docker container lava-26-2.2-5dcc5453-9822-4611-a6b3-a6d859ca9660 10月 03 15:39:30 rpi4 lava-dispatcher-host-server[13775]: Task exception was never retrieved 10月 03 15:39:30 rpi4 lava-dispatcher-host-server[13775]: future: <Task finished name='Task-339' coro=<ServerWrapper.handle_request() done, defined at /usr/lib/python3/dist-packages/lava_dispatcher_host> 10月 03 15:39:30 rpi4 lava-dispatcher-host-server[13775]: Traceback (most recent call last): 10月 03 15:39:30 rpi4 lava-dispatcher-host-server[13775]: File "/usr/lib/python3/dist-packages/lava_dispatcher_host/server.py", line 87, in handle_request 10月 03 15:39:30 rpi4 lava-dispatcher-host-server[13775]: handler.handle(command) 10月 03 15:39:30 rpi4 lava-dispatcher-host-server[13775]: File "/usr/lib/python3/dist-packages/lava_dispatcher_host/server.py", line 44, in handle 10月 03 15:39:30 rpi4 lava-dispatcher-host-server[13775]: share_device_with_container(command.options) 10月 03 15:39:30 rpi4 lava-dispatcher-host-server[13775]: File "/usr/lib/python3/dist-packages/lava_dispatcher_host/init.py", line 92, in share_device_with_container 10月 03 15:39:30 rpi4 lava-dispatcher-host-server[13775]: elif container_type == "docker": 10月 03 15:39:30 rpi4 lava-dispatcher-host-server[13775]: File "/usr/lib/python3/dist-packages/lava_dispatcher_host/init.py", line 233, in share_device_with_container_docker 10月 03 15:39:30 rpi4 lava-dispatcher-host-server[13775]: device = pyudev.Devices.from_device_file(context, node) 10月 03 15:39:30 rpi4 lava-dispatcher-host-server[13775]: File "/usr/lib/python3/dist-packages/lava_dispatcher_host/init.py", line 181, in pass_device_into_container_docker 10月 03 15:39:30 rpi4 lava-dispatcher-host-server[13775]: device_filter.add(Device(major, minor)) 10月 03 15:39:30 rpi4 lava-dispatcher-host-server[13775]: File "/usr/lib/python3/dist-packages/lava_dispatcher_host/docker_devices/init.py", line 178, in apply 10月 03 15:39:30 rpi4 lava-dispatcher-host-server[13775]: bpf.attach_func(func, fd, BPFAttachType.CGROUP_DEVICE, BPF_F_ALLOW_MULTI) 10月 03 15:39:30 rpi4 lava-dispatcher-host-server[13775]: File "/usr/lib/python3/dist-packages/bcc/init.py", line 634, in attach_func 10月 03 15:39:30 rpi4 lava-dispatcher-host-server[13775]: raise Exception("Failed to attach BPF function with attach_type "\ 10月 03 15:39:30 rpi4 lava-dispatcher-host-server[13775]: Exception: Failed to attach BPF function with attach_type 6: Operation not permitted

10月 03 15:46:33 rpi4 lava-dispatcher[13775]: Sharing /dev/bus/usb/001/015 with docker container lava-29-2.2-ab4577b3-0fe4-4fbc-9dae-e517847d51a1 10月 03 15:46:35 rpi4 lava-dispatcher-host-server[122107]: Error: No such object: 6f240ac9125502d3666954bc8b66c617952fcf2e2e0dbfff05f0974109e28925 10月 03 15:46:35 rpi4 lava-dispatcher-host-server[13775]: Task exception was never retrieved 10月 03 15:46:35 rpi4 lava-dispatcher-host-server[13775]: future: <Task finished name='Task-407' coro=<ServerWrapper.handle_request() done, defined at /usr/lib/python3/dist-packages/lava_dispatcher_host/server.py:74> exception=CalledProcessError(1, ['docker', 'inspect', '--format={{.Id}}', '6f240ac9125502d3666954bc8b66c617952fcf2e2e0dbfff05f0974109e28925'])> 10月 03 15:46:35 rpi4 lava-dispatcher-host-server[13775]: Traceback (most recent call last): 10月 03 15:46:35 rpi4 lava-dispatcher-host-server[13775]: File "/usr/lib/python3/dist-packages/lava_dispatcher_host/server.py", line 87, in handle_request 10月 03 15:46:35 rpi4 lava-dispatcher-host-server[13775]: handler.handle(command) 10月 03 15:46:35 rpi4 lava-dispatcher-host-server[13775]: File "/usr/lib/python3/dist-packages/lava_dispatcher_host/server.py", line 44, in handle 10月 03 15:46:35 rpi4 lava-dispatcher-host-server[13775]: share_device_with_container(command.options) 10月 03 15:46:35 rpi4 lava-dispatcher-host-server[13775]: File "/usr/lib/python3/dist-packages/lava_dispatcher_host/init.py", line 92, in share_device_with_container 10月 03 15:46:35 rpi4 lava-dispatcher-host-server[13775]: elif container_type == "docker": 10月 03 15:46:35 rpi4 lava-dispatcher-host-server[13775]: File "/usr/lib/python3/dist-packages/lava_dispatcher_host/init.py", line 233, in share_device_with_container_docker 10月 03 15:46:35 rpi4 lava-dispatcher-host-server[13775]: device = pyudev.Devices.from_device_file(context, node) 10月 03 15:46:35 rpi4 lava-dispatcher-host-server[13775]: File "/usr/lib/python3/dist-packages/lava_dispatcher_host/init.py", line 179, in pass_device_into_container_docker 10月 03 15:46:35 rpi4 lava-dispatcher-host-server[13775]: state = Path(JOBS_DIR) / job_id / (container_id + ".devices") 10月 03 15:46:35 rpi4 lava-dispatcher-host-server[13775]: File "/usr/lib/python3/dist-packages/lava_dispatcher_host/docker_devices/init.py", line 68, in DeviceFilter 10月 03 15:46:35 rpi4 lava-dispatcher-host-server[13775]: return klass(*args, *kwargs) 10月 03 15:46:35 rpi4 lava-dispatcher-host-server[13775]: File "/usr/lib/python3/dist-packages/lava_dispatcher_host/docker_devices/init.py", line 149, in init 10月 03 15:46:35 rpi4 lava-dispatcher-host-server[13775]: super().init(container, state_file) 10月 03 15:46:35 rpi4 lava-dispatcher-host-server[13775]: File "/usr/lib/python3/dist-packages/lava_dispatcher_host/docker_devices/init.py", line 79, in init 10月 03 15:46:35 rpi4 lava-dispatcher-host-server[13775]: self.container_id = subprocess.check_output( 10月 03 15:46:35 rpi4 lava-dispatcher-host-server[13775]: File "/usr/lib/python3.10/subprocess.py", line 420, in check_output 10月 03 15:46:35 rpi4 lava-dispatcher-host-server[13775]: return run(popenargs, stdout=PIPE, timeout=timeout, check=True, 10月 03 15:46:35 rpi4 lava-dispatcher-host-server[13775]: File "/usr/lib/python3.10/subprocess.py", line 524, in run 10月 03 15:46:35 rpi4 lava-dispatcher-host-server[13775]: raise CalledProcessError(retcode, process.args, 10月 03 15:46:35 rpi4 lava-dispatcher-host-server[13775]: subprocess.CalledProcessError: Command '['docker', 'inspect', '--format={{.Id}}', '6f240ac9125502d3666954bc8b66c617952fcf2e2e0dbfff05f0974109e28925']' returned non-zero exit status 1.