Skip to content

tar command uses an option not available in BusyBox #352

Closed

Description

@miquecg

Output of a recent build using Alpine 1.31.1:

/bin/tar: unrecognized option: P
BusyBox v1.31.1 () multi-call binary.

Usage: tar c|x|t [-ZzJjahmvokO] [-f TARFILE] [-C DIR] [-T FILE] [-X FILE] [--exclude PATTERN]... [FILE]...

Create, extract, or list files from a tar file

	c	Create
	x	Extract
	t	List
	-f FILE	Name of TARFILE ('-' for stdin/out)
	-C DIR	Change to DIR before operation
	-v	Verbose
	-O	Extract to stdout
	-m	Don't restore mtime
	-o	Don't restore user:group
	-k	Don't replace existing files
	-Z	(De)compress using compress
	-z	(De)compress using gzip
	-J	(De)compress using xz
	-j	(De)compress using bzip2
	-a	(De)compress using lzma
	-h	Follow symlinks
	-T FILE	File with names to include
	-X FILE	File with glob patterns to exclude
	--exclude PATTERN	Glob pattern to exclude
[warning]Tar failed with error: The process '/bin/tar' failed with exit code 1

Would it be possible to solve this problem so anyone could use lighter images for building?

Activity

  1. miguelaferreira commented on Jul 10, 2020

    @miguelaferreira
  2. achton commented on Sep 23, 2021

    @achton

    As a workaround you can add tar to your Alpine container in a step prior to running actions/cache. Some Alpine-based images come with Busybox-version of tar, but adding the from the Alpine repository installes a POSIX-compliant version. Proof:

    $ docker run -ti --rm --entrypoint sh node:12-alpine
    / # tar --version
    tar (busybox) 1.31.1
    / # apk add --no-cache tar
    fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
    fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
    (1/2) Installing libacl (2.2.53-r0)
    (2/2) Installing tar (1.32-r2)
    Executing busybox-1.31.1-r10.trigger
    OK: 8 MiB in 18 packages
    / # tar --version
    tar (GNU tar) 1.32
    Copyright (C) 2019 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    
    Written by John Gilmore and Jay Fenlason.
    / # 
    

    So adding a step like this works:

          - name: Add build dependencies to container
            run: |
              apk add --update --no-progress \
              tar
    
  3. github-actions commented on May 7, 2022

    @github-actions

    This issue is stale because it has been open for 200 days with no activity. Leave a comment to avoid closing this issue in 5 days.

  4. self-assigned this
    on May 11, 2022
  5. github-actions commented on May 18, 2022

    @github-actions

    This issue was closed because it has been inactive for 5 days since being marked as stale.

  6. yeldiRium commented on Dec 23, 2025

    @yeldiRium

    Problem still persists, not stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions