"Invalid gzip magic" error

Nikolay Yevik Nikolay.Yevik at Halliburton.com
Wed Jun 6 22:55:21 UTC 2007


This problem has been resolved.

The problem stemmed from the version of "rpmbuild" utility I used on
Open SUSE using bzip2 to compress the files into the final binary .rpm.
BusyBox currently understands only gzip format.


 

-----Original Message-----
From: Nikolay Yevik 
Sent: Wednesday, June 06, 2007 2:32 PM
To: 'Denis Vlasenko'
Cc: busybox at busybox.net
Subject: RE: "Invalid gzip magic" error

Greetings,

You tried to install the .src rpm.
This explains the difference as far as error message is concerned.
Source rpms  are usually unpackaged into your %_topdir/SOURCES (for
source archive - tar.gz in this case) and %_topdir/SPECS (for .spec
file).
The tar.gz (or whatever the archive format) is not being unpacked.

In my case it was done on SUSE for 0x86 using standard for most Linux
distributions /usr/src/packages[RPM] top directory where RPM development
is usually done.

Hence the error - it tried to chdir to /usr/..., which is probably
mounted on RO FS (like cramfs for example).


Try to install the actual binary rpm and see if you can reproduce.

For the first two bytes I am getting 0x42 and 0x5A instead of 0x1F and
0x8B. The .tar.gz archive when extracted from .src rpm does have the
first two bytes as 0x1F8B.

	




-----Original Message-----
From: Denis Vlasenko [mailto:vda.linux at googlemail.com] 
Sent: Tuesday, June 05, 2007 7:04 PM
To: Nikolay Yevik
Cc: busybox at busybox.net
Subject: Re: "Invalid gzip magic" error

On Tuesday 05 June 2007 23:43, Nikolay Yevik wrote:
> --> No, this problem is not ARM9 specific. I am getting exactly the
same
> error with BusyBox on 0x86 with or without the same config, actually
any
> config (for example - make defconfig) with BusyBox 1.6.0 (also tried
> 1.0.0 rc 3 and 1.2.2.1). Moreover, standard (non-BusyBox) Linux RPM
> utility has no problems installing this .rpm when rpmbuild for 0x86
> (tried RPM 4.4.2 on OpenSUSE 10.2)
> 
> "Can you put the RPM you are trying to install somewhere on the net,
> and show *exact* command you use to install it and the resulting error
> message?"
> --> Correct me if I am wrong, but the only way you can install an rpm
> using BusyBox version is to issue:
> "rpm -i package.rpm".

Believe or not, but I never used rpm. Never ever.
That's why I was asking.

> I placed simplified source and binary .rpms illustrating the problem
at:
> http://www.4shared.com/dir/2891777/617a932/sharing.html
>  
> > I am getting "Invalid gzip magic" error from busybox rpm utility on
> ARM9.
> 
> "Don't describe errors, cut-n-paste from the screen instead. This way
> it's crearer what happens."
> 
> --> Thank you for your advice, but this is it. This is the error,-
> "rpm: invalid gzip magic" (or "rpm: Invalig gzip magic" depending on
the
> busybox version. There is nothing else.

This is what happens on my system:

# strace -o strace.log -f ./busybox rpm -i mil1553-0.0-1.src.rpm
rpm: can't open 'mil1553-0.0.spec': Read-only file system

Well, it obviously tries to create something in my root fs, which
is mounted RO specially for such cases. Is it supposed to do that?

In strace.log I see:

4526  execve("./busybox", ["./busybox", "rpm", "-i",
"mil1553-0.0-1.src.rpm"], [/* 32 vars */]) = 0
...
4526  chdir("/")                        = 0
...
4526  open("mil1553-0.0.spec", O_WRONLY|O_CREAT|O_EXCL|O_LARGEFILE,
0100644) = -1 EROFS (Read-only file system)
4526  write(2, "rpm: ", 5)              = 5
4526  write(2, "can\'t open \'mil1553-0.0.spec\'", 29) = 29
4526  write(2, ": Read-only file system\n", 24) = 24


Yes, it still doesn't work, but the point is, it does not report
"invalid gzip magic". Look here:


static void extract_cpio_gz(int fd)
{
        archive_handle_t *archive_handle;
        unsigned char magic[2];

        /* Initialise */
        archive_handle = init_handle();
        archive_handle->seek = seek_by_read;
        //archive_handle->action_header = header_list;
        archive_handle->action_data = data_extract_all;
        archive_handle->flags |= ARCHIVE_PRESERVE_DATE;
        archive_handle->flags |= ARCHIVE_CREATE_LEADING_DIRS;
        archive_handle->src_fd = fd;
        archive_handle->offset = 0;

        xread(archive_handle->src_fd, &magic, 2);
        if ((magic[0] != 0x1f) || (magic[1] != 0x8b)) {
                bb_error_msg_and_die("invalid gzip magic"); <========
you die here
        }
        check_header_gzip_or_die(archive_handle->src_fd);
        xchdir("/"); /* Install RPM's to root */        <======== on my
system I reach this chdir("/")

        archive_handle->src_fd =
open_transformer(archive_handle->src_fd, inflate_gunzip);
        archive_handle->offset = 0;
        while (get_header_cpio(archive_handle) == EXIT_SUCCESS)
                /* loop */;
}

Can you verify this by adding a debug message?

        if ((magic[0] != 0x1f) || (magic[1] != 0x8b)) {
                bb_error_msg_and_die("invalid gzip magic HERE: %x %x",
magic[0], magic[1]);
        }

If it does, you can capture strace too and compare with mine
(I am attaching strace.log) - "how the hell these two bytes ended up
different?"
--
vda



More information about the busybox mailing list