AdGuardian-Term icon indicating copy to clipboard operation
AdGuardian-Term copied to clipboard

[arm64] exec format error

Open kzshantonu opened this issue 2 years ago • 10 comments

amd64 works fine

kzshantonu avatar May 29 '23 21:05 kzshantonu

Let me look into that... what method were you using to run?

In the meantime,the Cargo crate should work fine on Arm-based systems.

# Get latest version of rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Install AdGuardian
cargo install adguardian

# Start the app
adguardian

Lissy93 avatar May 29 '23 22:05 Lissy93

what method were you using to run?

docker container

kzshantonu avatar May 30 '23 00:05 kzshantonu

Maybe an issue with the libc, i tried the binary on an OpenWRT running adguardhome, but as adguardian is linked to the libc linker, it won't start on openwrt ( which uses musl libc). I'll see if i can build a musl version of Adguardian ( or maybe if you have time ?)

See:

root@HomeLan:~# /usr/bin/adguardian 
-ash: /usr/bin/adguardian: not found
root@HomeLan:~# cd /lib
root@HomeLan:/lib# ln -s ld-musl-aarch64.so.1 ld-linux-aarch64.so.1
root@HomeLan:/lib# /usr/bin/adguardian 
Error relocating /usr/bin/adguardian: __res_init: symbol not found
Error relocating /usr/bin/adguardian: gnu_get_libc_version: symbol not found
 

Pix13 avatar May 30 '23 07:05 Pix13

I've made you ARMv7 and ARM64 binaries, will be in the latest release: https://github.com/Lissy93/AdGuardian-Term/releases/tag/1.2.0

And I'll look into the Docker image this evening....

Lissy93 avatar May 30 '23 10:05 Lissy93

The Dockerfile is pretty minimal, it's more likely an issue with the way the container is built and tagged on the registry, which is done with this workflow.

https://github.com/Lissy93/AdGuardian-Term/blob/52a4cbf7832adebb0ad7a0ed1b6e2282523bce67/Dockerfile#L3-L13

Lissy93 avatar May 30 '23 10:05 Lissy93

If helpful, here is more info from trying to run via Docker on a Raspberry Pi:

[mrg@freya 07:33:49] ~ > docker run -it lissy93/adguardian
Unable to find image 'lissy93/adguardian:latest' locally
latest: Pulling from lissy93/adguardian
b4f5261e49b9: Pull complete 
Digest: sha256:5ca0c82e0d46010579343efe7c115780ede8821a9a81e61cbb565322805171bc
Status: Downloaded newer image for lissy93/adguardian:latest
standard_init_linux.go:219: exec user process caused: exec format error

Hardware/Software: Screenshot 2023-05-30 at 7 42 08 AM

[mrg@freya 07:41:41] ~ > docker -v
Docker version 20.10.5+dfsg1, build 55c4c88

PS. Neat looking project!

mrg avatar May 30 '23 11:05 mrg

I could be wrong here, but I do not see QEMU in build-docker.yml. IIRC, that's necessary to get multiarch working.

agneevX avatar Jun 01 '23 10:06 agneevX

If anyone's more experienced with Docker and GH actions than me, I could do with some help with this one. I've played around with a few things, but haven't had much luck so far.

  • Have enabled QEMU and Buildx, no issues with the workflow, but doesn't produce expected output
  • Running locally on an ARMv7 device seems to throw an error from the 1.69.0-alpine base image used for the build stage, although as far as I can see, that should be a multi-arch image
  • Tried enabling all the experimental modes, using buildx and specifying the --platform flag
  • The binary compiles just fine on alternative architectures, so I doubt it's an issue with any of the application code

Using the following Dockerfile on a Raspberry Pi

# Build application - Copy assets, install deps and compile binary
FROM rust:1.69.0-alpine AS builder
RUN apk add --no-cache pkgconfig openssl openssl-dev musl-dev
WORKDIR /usr/src/adguardian
COPY . .
RUN cargo build --release

# Run application - Using lightweight base, execute the binary
FROM scratch
COPY --from=builder /usr/src/adguardian/target/release/adguardian /
ENTRYPOINT ["/adguardian"]

Gives me this output:

Sending build context to Docker daemon    108kB
Step 1/8 : FROM rust:1.69.0-alpine AS builder
1.69.0-alpine: Pulling from library/rust
no matching manifest for linux/arm/v7 in the manifest list entries

Lissy93 avatar Jun 03 '23 21:06 Lissy93

That's because the arch does not exist. I think you're better off pulling latest in the builder stage.

Screenshot 2023-06-04 at 11 21 42 AM

agneevX avatar Jun 04 '23 05:06 agneevX

i have the same issue when trying to install with cargo, and when i tried to used git clone:

git clone [email protected]:Lissy93/AdGuardian-Term.git
Cloning into 'AdGuardian-Term'...
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists..

but git clone https://github.com/Lissy93/AdGuardian-Term worked.

Also, not to be that kind of person but to use CTRL+C or q to quit faster would be nice as in https://github.com/Lissy93/AdGuardian-Term/issues/6

I did also noticed that Adguardian is taking alot of resources, processor at 20% compared to 3% when not using adguardian, and heat gone up a few Celsius when running adguardian.

Love the idea, just hope this will be improved in the future :)

Dan1jel avatar Apr 09 '24 07:04 Dan1jel