runtime icon indicating copy to clipboard operation
runtime copied to clipboard

"Exec format error" on Linux ARM

Open vrooijen opened this issue 9 years ago • 20 comments

Steps to reproduce

Downloaded https://dotnetcli.blob.core.windows.net/dotnet/master/Binaries/Latest/dotnet-linux-arm.latest.tar.gz (currently version 2.0.0-preview2-25311-01) Running dotnet will give you "Exec format error" where as builds for preview1 did work perfectly

Actual behavior

image

Environment data

Ubuntu 16.04 ARM

vrooijen avatar May 11 '17 07:05 vrooijen

What does lscpu say? What does file /usr/bin/dotnet say?

omajid avatar May 11 '17 12:05 omajid

lscpu results in: image

/usr/bin/dotnet is a directory containing dotnet I extract it like this:

wget https://dotnetcli.blob.core.windows.net/dotnet/master/Binaries/Latest/dotnet-linux-arm.latest.tar.gz
sudo tar -xvf dotnet-linux-arm.latest.tar.gz -C /usr/bin/dotnet/

Today I upgraded from the latest (working) preview1 build to this one (preview2) after the builds were unavailable for a week or so because of changes in the build system see: https://github.com/dotnet/core-setup/commit/3bc2694a81d2ba931f473e84854c8ca216fac542#commitcomment-22043270

vrooijen avatar May 11 '17 12:05 vrooijen

Is there any more to the lscpu output? Can you also include the output of cat /proc/cpuinfo?

Can you run file /usr/bin/dotnet/dotnet ?

omajid avatar May 11 '17 12:05 omajid

I can confirm this problem.

According to readelf, the dotnet executable is for x64 machines:

capture

SilverCard avatar May 11 '17 12:05 SilverCard

Looks like a dupe of https://github.com/dotnet/core-setup/issues/2280.

omajid avatar May 11 '17 12:05 omajid

This issue was fixed in the latest build.

SilverCard avatar May 11 '17 22:05 SilverCard

I can confirm dotnet --info does work now, it seems to be compiled correctly, however I have another issue (I might need to open up another issue I presume?)

image

Build using CLI: 2.0.0-preview2-006062 Targetted runtime: 2.0.0-preview2-25311-10 ubuntu.16.04-arm

vrooijen avatar May 12 '17 06:05 vrooijen

@Venex; worked for me. Did you do "dotnet restore" + "dotnet publish" or "dotnet restore -r linux-arm" + "dotnet publish -r linux-arm". I got different results depending on this, as described in dotnet/runtime#2757, but maybe it is my csproj-authoring or erronoeous expectations.

JensNordenbro avatar May 12 '17 12:05 JensNordenbro

dotnet restore + dotnet publish as I always used to The file is compiled to 64 bit (ELFCLASS64) and should be 32 as discussed in dotnet/runtime#2757

vrooijen avatar May 12 '17 12:05 vrooijen

Try to force the project to use the latest "Microsoft.NETCore.DotNetHostPolicy" version, which is "2.0.0-preview2-25311-10", the previous versions have the format issue.

I added the following in the .csproj and it worked.

<PackageReference Include="Microsoft.NETCore.DotNetHostPolicy" Version="2.0.0-preview2-25311-10" />

SilverCard avatar May 12 '17 13:05 SilverCard

Restore did output both

  Installing Microsoft.NETCore.DotNetHostPolicy 2.0.0-preview2-25311-10.
  Installing runtime.linux-arm.Microsoft.NETCore.DotNetHostPolicy 2.0.0-preview2-25311-10.

I'll try with next build, maybe better luck

vrooijen avatar May 12 '17 13:05 vrooijen

@Venex; I am not sure if you use the -r flag on restore and publish, otherwise you might end upp as in dotnet/runtime#2757 unless dotnet/core-setup#2377 gets resolved, but maybe you have another issue.

JensNordenbro avatar May 14 '17 16:05 JensNordenbro

I only did the -r flag on publish, I applied it to restore too and can confirm this step works! With preview1 builds, the flag was not required

vrooijen avatar May 15 '17 05:05 vrooijen

@Venex , is this issue ready to be closed? Everything works again for me. Also dotnet/core-setup#2377.

JensNordenbro avatar Jun 01 '17 07:06 JensNordenbro

For me this is working

vrooijen avatar Jun 01 '17 08:06 vrooijen

i download dotnet-linux-arm.latest.tar.gz on 12/10 and im getting a robot@ev3dev:~/dotnetlinux$ ./dotnet -bash: ./dotnet: No such file or directory

i installed it in a local directory as well as robot@ev3dev:~$ /usr/bin/dotnet/dotnet -bash: /usr/bin/dotnet/dotnet: No such file or directory

is there some preinstallation i need to install? i did a sudo apt-get upgrade before trying.

here are some diagnostics from my linux system cat /etc/os-release PRETTY_NAME="Debian GNU/Linux 8 (jessie)" NAME="Debian GNU/Linux" VERSION_ID="8" VERSION="8 (jessie)" ID=ev3dev ID_LIKE=debian HOME_URL="http://www.ev3dev.org/" SUPPORT_URL="http://www.ev3dev.org/support" BUG_REPORT_URL="https://github.com/ev3dev/ev3dev/issues" robot@ev3dev:~$ cat /etc/debian_version 8.5 robot@ev3dev:~$

robot@ev3dev:~$ lscpu Architecture: armv5tejl Byte Order: Little Endian CPU(s): 1 On-line CPU(s) list: 0 Thread(s) per core: 1 Core(s) per socket: 1 Socket(s): 1 Model name: ARM926EJ-S rev 5 (v5l)

juansuerogit avatar Dec 10 '17 20:12 juansuerogit

i tried hacking around by opening the dotnet executable and saw a path in there. so i copied one of the sym links in the lib directory so it could match that path and something changed.

now i get a segmentation fault.

the path was in the first few lines of the dotnet exe its: /lib/ld-linux-armhf.so.3 when i put everything back the way it was i get the original

-bash: ./dotnet: No such file or directory silent crash.

any ideas?

juansuerogit avatar Dec 11 '17 00:12 juansuerogit

Just in case you hadn't seen it, there are RPi instructions that should work for most arm32 based distros. https://github.com/dotnet/core/blob/master/samples/RaspberryPiInstructions.md

Segfaults can often mean you dont have all the dependency packages installed.

Petermarcu avatar Dec 14 '17 05:12 Petermarcu

You can also try publishing for generic linux which is what is most tested. dotnet publish -r linux-arm rather than trying o specify Ubuntu.

Petermarcu avatar Dec 14 '17 05:12 Petermarcu

One thing to note is that .NET Core requires an ARM32 chip that supports ARMv7 instruction sets or higher. Many things like Raspberry Pi Zero and other devices don't have ARM chips with that level of instruction set support.

If you map the model name from sudo lscpu to this table: https://en.wikipedia.org/wiki/List_of_ARM_microarchitectures

You can see which "ARM Architecture" that chip has.

Petermarcu avatar Dec 14 '17 06:12 Petermarcu