readelf fails in qemu chroot when using absolute path

0

I'm trying to install java 8 SDK in a qemu emulated chrooted environment and I'm running up against the following error

readelf: Error: /proc/self/exe: Failed to read file's magic number

Readelf works when the path is not absolute. The following outputs the correct header.

cd / && readelf -h proc/self/exe

But the following does not

readelf -h /proc/self/exe

Any suggestions or continuing debugging tips? Thanks in advance!

Fish11

Posted 2018-09-06T18:20:44.953

Reputation: 113

Answers

0

Try

ls -l proc/self/exe /proc/self/exe

and see if there is a difference.

Why would you even want to show the header of readelf inside the chroot?

RalfFriedl

Posted 2018-09-06T18:20:44.953

Reputation: 1 370

The /proc/self/exe is linked to /bin/ls, why does readelf not follow this symlink, why does using the absolute path matter? As to that second question, it's called in the pre-configuring packages process when installing oracle-java8-installer. I'm guessing it's for getting system information? – Fish11 – 2018-09-06T18:38:29.317

It must be an issue with qemu emulated chrooted environment, in a normal chroot both work. Also the message doesn't say No such file. It seems open is successful, but read isn't. Try strace readelf -h /proc/self/exe – RalfFriedl – 2018-09-06T18:56:39.020

The output of strace says it all! qemu: Unsupported syscall: 26. Thank-you so much for your help! – Fish11 – 2018-09-06T19:08:04.630