Building zynthian image now works with docker

Allright, so it failed for me in my windows box, so I started a fresh ubuntu 18 box and tried the magic commands, and it failed also, log file attached.build.log (17.0 KB)

Also one point to mention, is the step 4, we do a wget to get another docker-compose.yml, but this command as is will not overwrite the already checkouted docker-compose.yml file but will make a new file with number 1 suffix, so if one does not rename or replace the file then the compose up command will process the wrong one, so one should do this instead if one wants to replace the file:

wget -q https://raw.githubusercontent.com/guysoft/CustomPiOS/devel/src/docker/docker-compose.yml -O docker-compose.yml

Looks like you have issues with failed to setup loop device for device.

It is reporting a free loopback device at: /dev/loop8.

What is the output of:
sudo losetup?

We can try figure out what is going on, but also using vagrant build method is a workaround.

thanks for looking, so sudo losetup inside the container you mean, right ?

root@52388e741f5b:/# sudo losetup
NAME       SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE                                          DIO LOG-SEC
/dev/loop1         0      0         1  1 /var/lib/snapd/snaps/gnome-logs_61.snap              0     512
/dev/loop6         0      0         1  1 /var/lib/snapd/snaps/gnome-characters_296.snap       0     512
/dev/loop4         0      0         1  1 /var/lib/snapd/snaps/gnome-calculator_406.snap       0     512
/dev/loop2         0      0         1  1 /var/lib/snapd/snaps/core18_1066.snap                0     512
/dev/loop0         0      0         1  1 /var/lib/snapd/snaps/gnome-3-28-1804_67.snap         0     512
/dev/loop7         0      0         1  1 /var/lib/snapd/snaps/core_7270.snap                  0     512
/dev/loop5         0      0         1  1 /var/lib/snapd/snaps/gtk-common-themes_1313.snap     0     512
/dev/loop3         0      0         1  1 /var/lib/snapd/snaps/gnome-system-monitor_100.snap   0     512

Both would work. You can also try to stop-start docker.

restarted the box & docker, and still the same error:

++++ expr 276824064 - 4194304
+++ sudo mount -o loop,offset=4194304,sizelimit=272629760 2019-07-10-raspbian-buster-lite.img /distro/workspace/mount/boot
mount: /distro/workspace/mount/boot: failed to setup loop device for /distro/workspace/2019-07-10-raspbian-buster-lite.img.
+ exit 1

losetup output, this time loop8 has the file:

root@52388e741f5b:/# sudo losetup
NAME       SIZELIMIT    OFFSET AUTOCLEAR RO BACK-FILE                                             DIO LOG-SEC
/dev/loop1         0         0         1  1 /var/lib/snapd/snaps/gnome-characters_296.snap          0     512
/dev/loop8         0 276824064         1  0 /distro/workspace/2019-07-10-raspbian-buster-lite.img   0     512
/dev/loop6         0         0         1  1 /var/lib/snapd/snaps/gtk-common-themes_1313.snap        0     512
/dev/loop4         0         0         1  1 /var/lib/snapd/snaps/core_7270.snap                     0     512
/dev/loop2         0         0         1  1 /var/lib/snapd/snaps/gnome-system-monitor_100.snap      0     512
/dev/loop0         0         0         1  1 /var/lib/snapd/snaps/gnome-3-28-1804_67.snap            0     512
/dev/loop7         0         0         1  1 /var/lib/snapd/snaps/core18_1066.snap                   0     512
/dev/loop5         0         0         1  1 /var/lib/snapd/snaps/gnome-calculator_406.snap          0     512
/dev/loop3         0         0         1  1 /var/lib/snapd/snaps/gnome-logs_61.snap                 0     512

and the file is there:

root@52388e741f5b:/distro/workspace# ls -l
total 16482312
-rw-r--r--  1 root root 16877879296 Aug 26 13:26 2019-07-10-raspbian-buster-lite.img
drwxr-xr-x 21 root root        4096 Jul 10 00:06 mount

Also a point I should mention is that Iā€™m doing it in a virtual machine.

So after having stopped and removed the container, removed the image, removed mount and loop device by hand and restarted process from step 8 compose up, it passed the loop device issue.

Now I get a build failed because of ā€œUnable to fetch some archivesā€, Iā€™ll try again :wink:

build.log (30.7 KB)

Looks like you donā€™t have internet connection on the container/ virtual machine.
Check if your VM has internet connection. And if there is a container inside it, then check that too.

I have internet cnx inside and outside, I can issue apt instal htop for example.
No problem Iā€™ll try on another physical machine. Thanks for the advise. brgs Seb

ā€¦ (I reuse post because system tell me to as I write too much :wink: )

So on the physical dev machine, ubuntu 16 updated today, had to update yml file to docker compose 2.0 but that is ok I guess, the build fail at update-binfmts, see log attached.build.log (20.3 KB)

Might also be the image is using the wrong DNS server. Name resolution means it canā€™t find the DNS server.

Ok looks liek the error is now:

+ '[' -f /.dockerenv ']'
+ update-binfmts --enable qemu-arm
update-binfmts: warning: unable to close /proc/sys/fs/binfmt_misc/register: Invalid argument
update-binfmts: exiting due to previous errors

Thats a new one for me.
There is a bug about it here:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=843032

Found in version qemu/1:2.7+dfsg-3
Fixed in version qemu/1:2.8+dfsg-2

What version of qemu-arm-static do you have?

output of
qemu-arm-static --version

Mine is 3.1.0 for refrence

same here

root@1ce5a99d3df0:/# qemu-arm-static --version
qemu-arm version 3.1.0 (Debian 1:3.1+dfsg-8~deb10u1)
Copyright (c) 2003-2018 Fabrice Bellard and the QEMU Project developers

Are the instructions at the top of the thread still valid? I would guess so since this thread is linked from the wiki. However, I tried building (Debian Buster), and all commands went well except the last one terminates with:

+++ source /distro/config
/CustomPiOS/config: line 24: /distro/config: No such file or directory
+ exit 1

Should work. can you please provide the full log and also if possible the commands you are running?
Thanks.

That config file exists here:

Hi all,
Iā€™m not sure @jofemodo use this to build the latest stable ZynthianOs. On @guysoft repo, last commit is 6 month old and there is a :

ZYNTHIANOS_SYS_REPO_BRANCH=master

in some config file, but as far as I know, weā€™re now on a ā€œstableā€ or on a ā€œtestingā€ branch.

1 Like

Sorry, I goofed up. I realized when I was putting together a log of what Iā€™d done that Iā€™d done cd ZynthianOS rather than cd ZynthianOS/src.

Havenā€™t completed the build yet, but itā€™s well underway at least. Thanks for confirming that the instructions are still valid!

Damn. Went well initially, but after a 9 hour build (did this on an old 2nd generation i3 which was available), terminated with:

+ unpack /filesystem/soundfonts /zynthian/zynthian-data/soundfonts
+ from=/filesystem/soundfonts
+ to=/zynthian/zynthian-data/soundfonts
+ owner=
+ '[' 2 -gt 2 ']'
+ mkdir -p /tmp/unpack/
+ cp -v -r --preserve=mode,timestamps /filesystem/soundfonts/. /tmp/unpack/
/bin/cp: cannot stat '/filesystem/soundfonts/.': No such file or directory
++++ echo_red 'build failed, unmounting image...'
++++ echo -e -n '\e[91m'
++++ echo build failed, unmounting image...
build failed, unmounting image...
++++ echo -e -n '\e[0m'
++++ cd /distro
++++ unmount_image /distro/workspace/mount force
++++ mount_path=/distro/workspace/mount
++++ force=
++++ '[' 2 -gt 1 ']'
++++ force=force
++++ sync
++++ '[' -n force ']'
+++++ sudo lsof -t /distro/workspace/mount
+++++ sudo mount
+++++ grep /distro/workspace/mount
+++++ awk -F ' on ' '{print $2}'
+++++ sort -r
+++++ awk '{print $1}'
++++ for m in $(sudo mount | grep $mount_path | awk -F " on " '{print $2}' | awk '{print $1}' | sort -r)
++++ echo 'Unmounting /distro/workspace/mount/var/cache/apt...'
Unmounting /distro/workspace/mount/var/cache/apt...
++++ sudo umount /distro/workspace/mount/var/cache/apt
++++ for m in $(sudo mount | grep $mount_path | awk -F " on " '{print $2}' | awk '{print $1}' | sort -r)
++++ echo 'Unmounting /distro/workspace/mount/proc...'
Unmounting /distro/workspace/mount/proc...
++++ sudo umount /distro/workspace/mount/proc
++++ for m in $(sudo mount | grep $mount_path | awk -F " on " '{print $2}' | awk '{print $1}' | sort -r)
++++ echo 'Unmounting /distro/workspace/mount/dev/pts...'
Unmounting /distro/workspace/mount/dev/pts...
++++ sudo umount /distro/workspace/mount/dev/pts
++++ for m in $(sudo mount | grep $mount_path | awk -F " on " '{print $2}' | awk '{print $1}' | sort -r)
++++ echo 'Unmounting /distro/workspace/mount/dev...'
Unmounting /distro/workspace/mount/dev...
++++ sudo umount /distro/workspace/mount/dev
++++ for m in $(sudo mount | grep $mount_path | awk -F " on " '{print $2}' | awk '{print $1}' | sort -r)
++++ echo 'Unmounting /distro/workspace/mount/boot...'
Unmounting /distro/workspace/mount/boot...
++++ sudo umount /distro/workspace/mount/boot
++++ for m in $(sudo mount | grep $mount_path | awk -F " on " '{print $2}' | awk '{print $1}' | sort -r)
++++ echo 'Unmounting /distro/workspace/mount...'
Unmounting /distro/workspace/mount...
++++ sudo umount /distro/workspace/mount
++++ echo_red -e '\nBUILD FAILED!\n'
++++ echo -e -n '\e[91m'
++++ echo -e '\nBUILD' 'FAILED!\n'

BUILD FAILED!

++++ echo -e -n '\e[0m'
+ exit 1

The commands run are identical to what was posted at the top of this thread:

git clone https://github.com/guysoft/ZynthianOS.git
cd ZynthianOS/src
wget https://raw.githubusercontent.com/guysoft/CustomPiOS/devel/src/docker/docker-compose.yml
wget --directory-prefix=./image -c --trust-server-names 'https://downloads.raspberrypi.org/raspbian_lite_latest'
echo "DISTRO_NAME=zynthianos" > .env
sudo docker-compose up -d
sudo docker exec -it zynthianos-build /CustomPiOS/nightly_build_scripts/custompios_nightly_build

build.log (2.9 MB)

This seems to be building a bit out of date, the Raspberry Pi lite image is from 2020. I also hit the ā€œsoundfontā€ issue, so one fix at a timeā€¦
Hereā€™s how to get a working build:
Starting with Step 7.

echo "DISTRO_NAME=zynthianos" > .env
mkdir modules/zynthianos/filesystem/soundfonts
sudo docker-compose up -d
sudo docker exec -it zynthianos-build CustomPiOS/nightly_build_scripts/custompios_nightly_build