Failing to add bundles with swupd bundle-add <bundle> on docker container

Trying to create a portable terminal environment with docker+clear linux. I have the following docker file.

FROM clearlinux:latest

RUN swupd update

RUN swupd bundle-add tmux
RUN swupd bundle-add git
RUN swupd bundle-add zsh
RUN swupd bundle-add sysadmin-basic
RUN swupd bundle-add sudo

I get this error on the second swupd call.

The command '/bin/sh -c swupd bundle-add git' returned a non-zero code: 6

It doesn’t matter what order i run the commands it seems to always be the second command. What am I doing wrong here?

Hm, that Dockerfile worked for me. Try adding --debug to the end of the swupd lines to see if there is any more information about the error.

A couple tips:

  • You can put all the swupd bundle-adds on one line to reduce the size of the image like swupd bundle-add tmux git zsh sysadmin-basic sudo

  • Add the -b flag to the swupd update command to avoid boot manager errors, due to it being run in a container with no boot partition to update.

I actually want to put them on separate lines so I can take advantage of caching when adding packages in the future. otherwise I have to rebuild the whole thing every time I add a package. Although I guess I could just collapse them every once in a while.

This is the output I got after adding --debug

2019-06-11 21:21:07 (src/curl.c:399)              Debug: Curl - process_curl_error_codes: curl_ret = 0, response = 200
2019-06-11 21:21:07 (src/curl_async.c:277)        Debug: Curl - Complete ASYNC download: https://cdn.download.clearlinux.org/update/29850/pack-git-from-0.tar -> /var/lib/swupd/pack-git-from-0-to-29850.tar, status=0
2019-06-11 21:21:07 (src/packs.c:60)              Debug:
Extracting git pack for version 29850
2019-06-11 21:21:07 (src/curl_async.c:486)        Debug: Curl - Start ASYNC download: https://cdn.download.clearlinux.org/update/29800/pack-curl-from-0.tar -> /var/lib/swupd/pack-curl-from-0-to-29800.tar
2019-06-...98%2019-06-11 21:21:07 (src/lib/progress.c:108)
2019-06-...99%2019-06-11 21:21:07 (src/lib/progress.c:108)
2019-06-11 21:21:07 (src/curl.c:399)              Debug: Curl - process_curl_error_codes: curl_ret = 0, response = 200
2019-06-11 21:21:07 (src/curl_async.c:277)        Debug: Curl - Complete ASYNC download: https://cdn.download.clearlinux.org/update/29800/pack-curl-from-0.tar -> /var/lib/swupd/pack-curl-from-0-to-29800.tar, status=0
2019-06-11 21:21:07 (src/curl_async.c:486)        Debug: Curl - Start ASYNC download: https://cdn.download.clearlinux.org/update/29750/pack-less-from-0.tar -> /var/lib/swupd/pack-less-from-0-to-29750.tar
2019-06-...100%2019-06-11 21:21:07 (src/lib/progress.c:108)
2019-06-11 21:21:07 (src/curl.c:399)              Debug: Curl - process_curl_error_codes: curl_ret = 0, response = 200
2019-06-11 21:21:07 (src/curl_async.c:277)        Debug: Curl - Complete ASYNC download: https://cdn.download.clearlinux.org/update/29750/pack-less-from-0.tar -> /var/lib/swupd/pack-less-from-0-to-29750.tar, status=0
2019-06-11 21:21:07 (src/packs.c:302)
2019-06-11 21:21:07 (src/packs.c:304)             Finishing packs extraction...
2019-06-11 21:21:09 (src/packs.c:60)              Debug:
Extracting curl pack for version 29800
2019-06-11 21:21:09 (src/packs.c:60)              Debug:
Extracting less pack for version 29750
2019-06-11 21:21:11 (src/fullfile.c:158)          No extra files need to be downloaded
2019-06-11 21:21:11 (src/bundle.c:924)            Installing bundle(s) files...
2019-06-...0%2019-06-11 21:21:12 (src/lib/progress.c:108)
2019-06-11 21:21:12 (src/bundle.c:1065)           Failed to install 1 of 1 bundles
The command '/bin/sh -c swupd bundle-add git --debug' returned a non-zero code: 6

I thought this might be something wrong with my setup but I tried a similar setup with ubuntu and it didn’t have any issues, I also tried just running docker run -ti clearlinux:latest bash and running these commands manually and everything worked fine. It’s only when I run it in a Dockerfile

Is this maybe a kernel compatibility issue? I’m running on ubuntu 18.04 right now.

uname -a

Linux jordan-ThinkPad-P51s-18 4.15.0-51-generic #55-Ubuntu SMP Wed May 15 14:27:21 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

I wouldn’t think so but I don’t have an Ubuntu box handy to test.

Are you running the build with --no-cache or deleting the previously build docker images? Sometimes those previous builds can cause weird issues for me.

1 Like

I get the same error if I set --no-cache

Clearing out my image cache did not help either.

This looks like a bug that we are still investigating that are affecting some specific versions of docker on Ubuntu. I couldn’t reproduce that on Clear systems yet.
A work around for the problem is to clean swupd cache before running a bundle-add. Can you try to add this line before the first bundle-add command for a while:

RUN swupd clean

Looks like that didn’t help either :frowning:

Here is my docker info output if that helps

Containers: 1
 Running: 0
 Paused: 0
 Stopped: 1
Images: 8
Server Version: 18.09.5
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 
runc version: N/A
init version: v0.18.0 (expected: fec3683b971d9c3ef73f284f176672c44b448662)
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.15.0-51-generic
Operating System: Ubuntu 18.04.2 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 31.14GiB
Name: jordan-ThinkPad-P51s-18
ID: MVHN:HLD5:ZJMP:GA3Q:OETW:VI4Q:7SQW:NBMS:XOC6:4H7A:XTPK:4NDP
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

Looks like adding RUN swupd clean before every bundle-add command works though.

1 Like