Opened 11 months ago

Closed 11 months ago

Last modified 11 months ago

#23754 closed defect (duplicate)

rbm make failing do to golang error while unmarshalling json

Reported by: kkuehl@… Owned by: boklm
Priority: Medium Milestone:
Component: Applications/rbm Version:
Severity: Normal Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

The original error looked as follows:
git clone https://git.torproject.org/builders/tor-browser-build.git
sudo apt-get install -y libyaml-libyaml-perl libtemplate-perl \

libio-handle-util-perl libio-all-perl \
libio-captureoutput-perl libfile-slurp-perl \
libstring-shellquote-perl libsort-versions-perl \
libdigest-sha-perl libdata-uuid-perl libdata-dump-perl \
libfile-copy-recursive-perl git libgtk2.0-dev curl runc

cd tor-browser-build
make submodule-update
make testbuild-linux-x86_64
git submodule update --init
./rbm/rbm build release --target testbuild --target torbrowser-linux-x86_64
Building project tor-browser - tor-browser-7.5a5-linux-x86_64-a14a6a
Building project container-image - container-image_wheezy-amd64-df3a332e7b34.tar.gz
Building project debootstrap-image - container-image_wheezy-amd64.tar.gz
Using file /home/kkuehl/Downloads/tor-browser-build/out/debootstrap-image/container-image_ubuntu-base-17.04-base-amd64.tar.gz
Error: Error starting remote:

json: cannot unmarshal object into Go value of type []string

Makefile:69: recipe for target 'testbuild-linux-x86_64' failed
make: * [testbuild-linux-x86_64] Error 1

After determining that the error was being emitted from rbm/lib/RBB.pm
I added a print statement to producte the following more verbose output:

$ make testbuild-linux-x86_64
git submodule update --init
./rbm/rbm build release --target testbuild --target torbrowser-linux-x86_64
Building project tor-browser - tor-browser-7.5a5-linux-x86_64-a14a6a
Building project container-image - container-image_wheezy-amd64-df3a332e7b34.tar.gz
Building project debootstrap-image - container-image_wheezy-amd64.tar.gz
Using file /home/kkuehl/Downloads/tor-browser-build/out/debootstrap-image/container-image_ubuntu-base-17.04-base-amd64.tar.gz
project debootstrap-image command #!/bin/sh
set -e
if [ $(ls -1 '/home/kkuehl/Downloads/tor-browser-build/tmp/rbm-VfB1R/container-image_'* | wc -l) -ne 1 ]
then

echo "Can't find container image in input files" >&2
ls -l '/home/kkuehl/Downloads/tor-browser-build/tmp/rbm-VfB1R' >&2
exit 1

fi
mkdir -p '/home/kkuehl/Downloads/tor-browser-build/tmp/rbm-qUfJ9d/rbm-containers/342cf55668a5bfef12e5fa4af3b57de63b7534dcae071c61e816d79c9b5af2b7'/rootfs/rbm
sudo tar -C '/home/kkuehl/Downloads/tor-browser-build/tmp/rbm-qUfJ9d/rbm-containers/342cf55668a5bfef12e5fa4af3b57de63b7534dcae071c61e816d79c9b5af2b7'/rootfs -xf $(ls -1 '/home/kkuehl/Downloads/tor-browser-build/tmp/rbm-VfB1R/container-image_'*)
#!/bin/sh
set -e
mkdir -p '/home/kkuehl/Downloads/tor-browser-build/tmp/rbm-qUfJ9d/rbm-containers/342cf55668a5bfef12e5fa4af3b57de63b7534dcae071c61e816d79c9b5af2b7'/rootfs/rbm
echo '#!/bin/sh' > '/home/kkuehl/Downloads/tor-browser-build/tmp/rbm-qUfJ9d/rbm-containers/342cf55668a5bfef12e5fa4af3b57de63b7534dcae071c61e816d79c9b5af2b7'/rootfs/rbm/cmd

echo 'id rbm >/dev/null 2>&1
adduser -m rbm useradd -m rbm' >> '/home/kkuehl/Downloads/tor-browser-build/tmp/rbm-qUfJ9d/rbm-containers/342cf55668a5bfef12e5fa4af3b57de63b7534dcae071c61e816d79c9b5af2b7'/rootfs/rbm/cmd

echo '#!/bin/sh' > '/home/kkuehl/Downloads/tor-browser-build/tmp/rbm-qUfJ9d/rbm-containers/342cf55668a5bfef12e5fa4af3b57de63b7534dcae071c61e816d79c9b5af2b7'/rootfs/rbm/run

echo 'su - root -c /rbm/cmd' >> '/home/kkuehl/Downloads/tor-browser-build/tmp/rbm-qUfJ9d/rbm-containers/342cf55668a5bfef12e5fa4af3b57de63b7534dcae071c61e816d79c9b5af2b7'/rootfs/rbm/run
chmod +x '/home/kkuehl/Downloads/tor-browser-build/tmp/rbm-qUfJ9d/rbm-containers/342cf55668a5bfef12e5fa4af3b57de63b7534dcae071c61e816d79c9b5af2b7'/rootfs/rbm/cmd
chmod +x '/home/kkuehl/Downloads/tor-browser-build/tmp/rbm-qUfJ9d/rbm-containers/342cf55668a5bfef12e5fa4af3b57de63b7534dcae071c61e816d79c9b5af2b7'/rootfs/rbm/run
cat > '/home/kkuehl/Downloads/tor-browser-build/tmp/rbm-qUfJ9d/rbm-containers/342cf55668a5bfef12e5fa4af3b57de63b7534dcae071c61e816d79c9b5af2b7'/config.json << EOF
{

"ociVersion": "1.0.0",
"platform": {

"os": "linux",
"arch": "amd64"

},
"process": {

"terminal": false,
"user": {

"uid": 0,
"gid": 0

},
"args": [

"/rbm/run"

],
"env": [

"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"TERM=xterm"

],
"cwd": "/",
"capabilities": {

"bounding": [

"CAP_AUDIT_WRITE",
"CAP_KILL",
"CAP_NET_BIND_SERVICE",
"CAP_SETGID",
"CAP_SETUID",
"CAP_MKNOD",
"CAP_SYS_CHROOT",
"CAP_SYS_ADMIN",
"CAP_FSETID",
"CAP_FOWNER",
"CAP_DAC_OVERRIDE",
"CAP_CHOWN"

],
"effective": [

"CAP_AUDIT_WRITE",
"CAP_KILL",
"CAP_NET_BIND_SERVICE",
"CAP_SETGID",
"CAP_SETUID",
"CAP_MKNOD",
"CAP_SYS_CHROOT",
"CAP_SYS_ADMIN",
"CAP_FSETID",
"CAP_FOWNER",
"CAP_DAC_OVERRIDE",
"CAP_CHOWN"

],
"inheritable": [

"CAP_AUDIT_WRITE",
"CAP_KILL",
"CAP_NET_BIND_SERVICE",
"CAP_SETGID",
"CAP_SETUID",
"CAP_MKNOD",
"CAP_SYS_CHROOT",
"CAP_SYS_ADMIN",
"CAP_FSETID",
"CAP_FOWNER",
"CAP_DAC_OVERRIDE",
"CAP_CHOWN"

],
"permitted": [

"CAP_AUDIT_WRITE",
"CAP_KILL",
"CAP_NET_BIND_SERVICE",
"CAP_SETGID",
"CAP_SETUID",
"CAP_MKNOD",
"CAP_SYS_CHROOT",
"CAP_SYS_ADMIN",
"CAP_FSETID",
"CAP_FOWNER",
"CAP_DAC_OVERRIDE",
"CAP_CHOWN"

],
"ambient": [

"CAP_AUDIT_WRITE",
"CAP_KILL",
"CAP_NET_BIND_SERVICE",
"CAP_SETGID",
"CAP_SETUID",
"CAP_MKNOD",
"CAP_SYS_CHROOT",
"CAP_SYS_ADMIN",
"CAP_FSETID",
"CAP_FOWNER",
"CAP_DAC_OVERRIDE",
"CAP_CHOWN"

]

},
"rlimits": [

{

"type": "RLIMIT_NOFILE",
"hard": 1024,
"soft": 1024

}

],
"noNewPrivileges": true

},
"root": {

"path": "rootfs",
"readonly": false

},
"hostname": "runc",
"mounts": [

{

"destination": "/proc",
"type": "proc",
"source": "proc"

},
{

"type": "bind",
"source": "/etc/resolv.conf",
"destination": "/etc/resolv.conf",
"options": [

"rbind",
"ro"

]

},
{

"destination": "/dev",
"type": "tmpfs",
"source": "tmpfs",
"options": [

"nosuid",
"strictatime",
"mode=755",
"size=65536k"

]

},
{

"destination": "/dev/pts",
"type": "devpts",
"source": "devpts",
"options": [

"nosuid",
"noexec",
"newinstance",
"ptmxmode=0666",
"mode=0620",
"gid=5"

]

},
{

"destination": "/dev/shm",
"type": "tmpfs",
"source": "shm",
"options": [

"nosuid",
"noexec",
"nodev",
"mode=1777",
"size=65536k"

]

},
{

"destination": "/dev/mqueue",
"type": "mqueue",
"source": "mqueue",
"options": [

"nosuid",
"noexec",
"nodev"

]

},
{

"destination": "/sys",
"type": "sysfs",
"source": "sysfs",
"options": [

"nosuid",
"noexec",
"nodev",
"ro"

]

},
{

"destination": "/sys/fs/cgroup",
"type": "cgroup",
"source": "cgroup",
"options": [

"nosuid",
"noexec",
"nodev",
"relatime",
"ro"

]

}

],
"hooks": {},
"linux": {

"resources": {

"devices": [

{

"allow": false,
"access": "rwm"

}

]

},
"namespaces": [

{

"type": "pid"

},
{

"type": "ipc"

},
{

"type": "uts"

},
{

"type": "mount"

}

],
"maskedPaths": [

"/proc/kcore",
"/proc/latency_stats",
"/proc/timer_stats",
"/proc/timer_list",
"/sys/firmware",
"/proc/sched_debug"

],
"readonlyPaths": [

"/proc/asound",
"/proc/bus",
"/proc/fs",
"/proc/irq",
"/proc/sys",
"/proc/sysrq-trigger"

]

},
"solaris": {

"cappedCPU": {},
"cappedMemory": {}

}

}

EOF
sudo runc run -b '/home/kkuehl/Downloads/tor-browser-build/tmp/rbm-qUfJ9d/rbm-containers/342cf55668a5bfef12e5fa4af3b57de63b7534dcae071c61e816d79c9b5af2b7' rbm-342cf55668a5bfef12e5fa4af3b57de63b7534dcae071c61e816d79c9b5af2b7

Error: Error starting remote:

json: cannot unmarshal object into Go value of type []string

Makefile:69: recipe for target 'testbuild-linux-x86_64' failed
make: * [testbuild-linux-x86_64] Error 1

Child Tickets

Attachments (1)

23585.diff (1.3 KB) - added by kkuehl@… 11 months ago.
patch from ticket 23585

Download all attachments as: .zip

Change History (14)

comment:1 Changed 11 months ago by kkuehl@…

Host OS:
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 17.04
Release: 17.04
Codename: zesty

comment:2 Changed 11 months ago by kkuehl@…

Component: - Select a componentApplications/Tor Browser
Owner: set to tbb-team

comment:3 Changed 11 months ago by isis

Component: Applications/Tor BrowserApplications/rbm
Owner: changed from tbb-team to boklm
Summary: make failingrbm make failing do to golang error while unmarshalling json

comment:4 Changed 11 months ago by sysrqb

kkuehl, what version of runc is installed? sudo runc --version

We started working on this [0], but then I became busy and didn't have time to respond to boklm.

I recently tried again, and it building is successful with runc-1.0.0-rc2 when the config.json for runc-0.1.1 is used. So I believe the json config file should only use the new object format when runc is v1.1 or newer.

[0] https://lists.torproject.org/pipermail/tbb-dev/2017-September/000616.html

comment:5 Changed 11 months ago by boklm

In ticket #23585 I posted a patch that might fix the issue.

https://gitweb.torproject.org/user/boklm/tor-browser-build.git/commit/?h=bug_23585&id=a48690ea2873d699351929b25c9fd667f31e0890

Could you try it to see if that fix the issue for you?

comment:6 Changed 11 months ago by kkuehl@…

runc version spec: 1.0.0-rc2-dev

Changed 11 months ago by kkuehl@…

Attachment: 23585.diff added

patch from ticket 23585

comment:7 Changed 11 months ago by kkuehl@…

git apply 23585.diff
git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:

(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)

modified: projects/common/runc-config.json
modified: rbm.conf

make testbuild-linux-x86_64
git submodule update --init
./rbm/rbm build release --target testbuild --target torbrowser-linux-x86_64
Building project tor-browser - tor-browser-7.5a5-linux-x86_64-a14a6a
Building project container-image - container-image_wheezy-amd64-df3a332e7b34.tar.gz
Building project debootstrap-image - container-image_wheezy-amd64.tar.gz
Using file /home/kkuehl/Downloads/tor-browser-build/out/debootstrap-image/container-image_ubuntu-base-17.04-base-amd64.tar.gz
Build log: /home/kkuehl/Downloads/tor-browser-build/logs/debootstrap-image-.log
Error running build
Opening debug shell
Warning: build files will be removed when you exit this shell.
Container directory: /home/kkuehl/Downloads/tor-browser-build/tmp/rbm-nPJpET/rbm-containers/ba6fbe182fa7d3ed641c266de19acb5a779debdf260293a68080248c25106ff9
mesg: ttyname failed: No such device
bash: cannot set terminal process group (7): Inappropriate ioctl for device
bash: no job control in this shell
root@runc:/var/tmp/tmp.RzjlEWVmNu# exit

comment:8 Changed 11 months ago by kkuehl@…

From the referenced log:
Starting build: Wed Oct 4 15:32:44 2017
mesg: ttyname failed: Inappropriate ioctl for device
Err:1 http://archive.ubuntu.com/ubuntu zesty InRelease

Temporary failure resolving 'archive.ubuntu.com'

Err:2 http://security.ubuntu.com/ubuntu zesty-security InRelease

Temporary failure resolving 'security.ubuntu.com'

Err:3 http://archive.ubuntu.com/ubuntu zesty-updates InRelease

Temporary failure resolving 'archive.ubuntu.com'

Err:4 http://archive.ubuntu.com/ubuntu zesty-backports InRelease

Temporary failure resolving 'archive.ubuntu.com'

Reading package lists...
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/zesty/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/zesty-updates/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/zesty-backports/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/zesty-security/InRelease Temporary failure resolving 'security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists...
Building dependency tree...
E: Unable to locate package debian-archive-keyring

$ ping archive.ubuntu.com
PING archive.ubuntu.com(danava.canonical.com (2001:67c:1360:8001::17)) 56 data bytes
64 bytes from danava.canonical.com (2001:67c:1360:8001::17): icmp_seq=1 ttl=57 time=155 ms
64 bytes from danava.canonical.com (2001:67c:1360:8001::17): icmp_seq=2 ttl=57 time=152 ms

comment:9 Changed 11 months ago by kkuehl@…

Here I stash away the changes from the patch, and install the latest runc.

$ git stash
Saved working directory and index state WIP on master: 3660028 Fold in 7.0.6 changelog and update release date
HEAD is now at 3660028 Fold in 7.0.6 changelog and update release date
sudo apt-get remove runc
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:

runc

0 upgraded, 0 newly installed, 1 to remove and 2 not upgraded.
After this operation, 6,357 kB disk space will be freed.
Do you want to continue? [Y/n] y

$ sudo runc --version
runc version 1.0.0-rc4
spec: 1.0.0
$ make testbuild-linux-x86_64
git submodule update --init
./rbm/rbm build release --target testbuild --target torbrowser-linux-x86_64
Building project tor-browser - tor-browser-7.5a5-linux-x86_64-a14a6a
Building project container-image - container-image_wheezy-amd64-df3a332e7b34.tar.gz
Building project debootstrap-image - container-image_wheezy-amd64.tar.gz
Using file /home/kkuehl/Downloads/tor-browser-build/out/debootstrap-image/container-image_ubuntu-base-17.04-base-amd64.tar.gz
Build log: /home/kkuehl/Downloads/tor-browser-build/logs/debootstrap-image-.log
Error running build
Opening debug shell
Warning: build files will be removed when you exit this shell.
Container directory: /home/kkuehl/Downloads/tor-browser-build/tmp/rbm-VVRGNR/rbm-containers/57870e7709fe3f3d4e0c557d05b94261d803b70d43e8298f6e2efebcf9477ac0
bash: cannot set terminal process group (8): Inappropriate ioctl for device
bash: no job control in this shell
root@runc:/var/tmp/tmp.ILRlYNjrAb#

Last edited 11 months ago by kkuehl@… (previous) (diff)

comment:10 Changed 11 months ago by kkuehl@…

After looking at the contents of the pre shell script inside the container.
cat pre
#!/bin/sh
set -e
apt-get update -y
apt-get install -y debian-archive-keyring ubuntu-keyring debootstrap
debootstrap --arch=amd64 wheezy base-image
tar -C ./base-image -czf /var/tmp/tmp.spYLcjXI7k/container-image_wheezy-amd64.tar.gz .

I tried running pre and received errors like the following:

Failed to fetch http://archive.ubuntu.com/ubuntu/dists/zesty/InRelease Temporary failure resolving 'archive.ubuntu.com'

root@runc:/var/tmp/tmp.o9sbbmB4dP# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 127.0.1.1

comment:11 Changed 11 months ago by kkuehl@…

The resolv.conf contents were the clue.
After seeing:
{
"type": "bind",
"source": "/etc/resolv.conf",
"destination": "/etc/resolv.conf",
"options": [
"rbind",
"ro"
]
},

I looked at resolv.conf on my main system and it was of course set to 127.0.0.1.
NOTE: This is common if your system is running dnsmasq

Once I set this to 8.8.8.8 so the container would have something useful, things worked :)

comment:12 Changed 11 months ago by boklm

Resolution: duplicate
Status: newclosed

Thanks. So the patch from branch bug_23585 is fixing the issue, and the next error was caused by having 127.0.0.1 in the resolv.conf file?

So I think we can close this ticket as a duplicate of #23585.

comment:13 Changed 11 months ago by kkuehl@…

That is correct. Also upgrading runc is another solution.

Note: See TracTickets for help on using tickets.