containers / build

another build tool for container images (archived, see https://github.com/rkt/rkt/issues/4024)
Apache License 2.0
342 stars 80 forks source link

"begin: extracttar error: exit status 1, output: error extracting tar". Unable to create image from tarball rootfs, GNU sparse unsupported #263

Open pmariani opened 8 years ago

pmariani commented 8 years ago

Hi,

I am trying to create a complete Ubuntu image, starting from an Ubuntu-provided tarball.

I am using the current master of acbuild (4c0e077), built locally with ./build.

My script is the following:

#!/bin/bash

set -o nounset
set -o errexit
set -o xtrace
set -o pipefail

rootfs_img=$1

workpath='/home/vagrant'
acbuild="sudo /vagrant/acbuild/bin/acbuild --debug --work-path ${workpath}"

acbuildend () {
    export EXIT=$?
    echo "trapped error"
    $acbuild end
    exit $EXIT
}

$acbuild begin $rootfs_img
trap acbuildend EXIT

$acbuild set-name localhost/testbox
$acbuild write testbox.aci
$acbuild end

It is running on a Trusty vagrant guest:

vagrant@dev:/vagrant/acbuild$ uname -a
Linux dev 3.16.0-30-generic #40~14.04.1-Ubuntu SMP Thu Jan 15 17:43:14 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
vagrant@dev:/vagrant/acbuild$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.5 LTS"
vagrant@dev:/vagrant/acbuild$

The script invocation fails with the following output:

vagrant@dev:/vagrant$ ./buildscript.sh /home/vagrant/ubuntu-14.04-server-cloudimg-amd64-root.tar.gz
+ set -o pipefail
+ rootfs_img=/home/vagrant/ubuntu-14.04-server-cloudimg-amd64-root.tar.gz
+ workpath=/home/vagrant
+ acbuild='sudo /vagrant/acbuild/bin/acbuild --debug --work-path /home/vagrant'
+ sudo /vagrant/acbuild/bin/acbuild --debug --work-path /home/vagrant begin /home/vagrant/ubuntu-14.04-server-cloudimg-amd64-root.tar.gz
Beginning build with /home/vagrant/ubuntu-14.04-server-cloudimg-amd64-root.tar.gz
begin: extracttar error: exit status 1, output: error extracting tar
vagrant@dev:/vagrant$

Local acbuild edits and print-based debugging showed that the issue was with attempting to untar /usr/lib/locale/locale-archive which is compressed with GNUSparse. The error comes from this line and the corresponding header type flag is 83.

Manually untarring the image and pointing acbuild at the resulting directory produces a working image.

J-Swift commented 7 years ago

This is also the case when using acbuild begin docker://debian:jessie-slim

cgonyeo commented 7 years ago

Sorry about taking forever to get around to this.

I can't seem to reproduce the error in acbuild currently when I try to begin from jessie-slim:

derek@proton ~> acbuild begin docker://debian:jessie-slim
Downloading sha256:a3ed95caeb0 [=============================]       32 B / 32 B
Downloading sha256:b5161f7f177 [=============================] 29.5 MB / 29.5 MB
acbuild begin docker://debian:jessie-slim  8.13s user 0.54s system 48% cpu 17.867 total
derek@proton ~>

Maybe the image has changed on the docker hub since then? I'll see if I can create an image that reproduces this and find a fix.

sharedprophet commented 7 years ago

This seems like another issue with VM shared file systems...