cenk1cenk2 / docker-softether-vpnsrv

SoftEther VPN Server with DNSMASQ DHCP Server or bridge mode connection for VPN-to-site setup.
29 stars 15 forks source link

can`t build image #21

Closed dormancygrace closed 2 years ago

dormancygrace commented 2 years ago

Hi, Im trying to build own image but getting error:Step 7/10 : COPY ./dist/pipe /usr/bin/pipe COPY failed: file not found in build context or excluded by .dockerignore: stat dist/pipe: file does not exist `

cenk1cenk2 commented 2 years ago

Hey @dormancygrace

Please be sure to build the golang application through make build after installing the dependencies.

Dockerfile is not a multistage one and the application build is handled through CI step.

dormancygrace commented 2 years ago

Thanks. But now i have another problem [W] [postrouting] modprobe: can't change directory to '/lib/modules': No such file or directory

[W] [postrouting] modprobe: can't change directory to '/lib/modules': No such file or directory

[W] [postrouting] iptables v1.8.8 (legacy): can't initialize iptables table 'nat': Table does not exist (do you need to insmod?)

[W] [postrouting] Perhaps iptables or your kernel needs to be upgraded.

[E] [postrouting] [FAIL] $ iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -j MASQUERADE > exit status 3

[E] [postrouting] exit status 3

cenk1cenk2 commented 2 years ago

Np.

I do think this is the permission issue, you can add additional permissions as discussed here.

https://github.com/cenk1cenk2/docker-softether-vpnsrv#permissions

dormancygrace commented 2 years ago

No, I have all permissions set. I have one docker-compose file. On AMD64 with Oracle Linux 8 it works like a charm. On arm64 with same os I'm getting errors.

cenk1cenk2 commented 2 years ago

Oh it makes sense. I guess then you have to dive deeper to check if the kernel has the tun module loaded on the arm64 system or anything related to that is different.

Sincerly I did not know that softether can compile for arm64, I can also check that out and build a image with docker buildx.

cenk1cenk2 commented 2 years ago

Did you made any changes for compiling to arm64 on softethers part?

dormancygrace commented 2 years ago

https://hub.docker.com/r/siomiz/softethervpn/ I used this one, but your image waaay faster. Siomiz's image prints nearly same error (can't find 'filter'), but works well. I've managed to run your image built for arm64 using modprobe iptables. But I can't connect to server. Same with siomiz's image, modprobe ip_filter solves errors in logs, but server stops responding

dormancygrace commented 2 years ago

No, I changed only cross compile options in makefile

cenk1cenk2 commented 2 years ago

Yeah unfortunetly securenat on softether makes it really slow compared to having a dedicated dhcp server.

I guess it should be set on the os part then but unfortunetly can not help you since I do not have access to an arm64 server.

dormancygrace commented 2 years ago

I can give you access to arm64 vm in Oracle cloud, or, you can get one absolutely for free. 4 cores, 24 gb ram, up to 200gb storage

cenk1cenk2 commented 2 years ago

Hmm the build on emulator did not go very well, so it seems i can not publish a arm64 image. https://gitlab.kilic.dev/docker/softether-vpnsrv/-/jobs/13064

Thanks for the heads up I will check it out sometime.

dormancygrace commented 2 years ago

Trouble with blake2 (requiring sse2) yes?

cenk1cenk2 commented 2 years ago

Exactly, I guess it is not available on arm arch and it is abysmally slow as well due to the VM.

dormancygrace commented 2 years ago

Or you can change path for arm64 build from .../sse to /neon

dormancygrace commented 2 years ago

https://github.com/BLAKE2/BLAKE2/tree/master/neon Arm64 supported.

dormancygrace commented 2 years ago

Have you started docker run --privileged --rm tonistiigi/binfmt --install all As I remember, without this one my multiarch builds failed

cenk1cenk2 commented 2 years ago

Hey yes, I got a different image going for emulation "multiarch/qemu-user-static" but they should be doing the same thing.

I can not seem to get it work with the flags CMAKE_FLAGS="-DSKIP_CPU_FEATURES=ON" or CMAKE_FLAGS="${CMAKE_FLAGS} -msse -msse2".

There are some upstream issues about this in the SoftEtherVPN repository which seem to be fixed? https://github.com/SoftEtherVPN/SoftEtherVPN/issues/1546 https://github.com/SoftEtherVPN/SoftEtherVPN/issues/1288

I guess I will roll these changes back if I can not succeed since you already built your own image I assume.

You can see the pipelines here: https://gitlab.kilic.dev/docker/softether-vpnsrv/-/pipelines

cenk1cenk2 commented 2 years ago

Sorry for the spam.

I have added this dirty hack as advised since this error comes from the upstream. https://github.com/cenk1cenk2/docker-softether-vpnsrv/blob/2e6dee0e0d8a60fb1be0672f72f50afd6e7e92f3/Dockerfile#L24

Even though the build is painfully slow because of the emulation, the image is on Dockerhub now. If you can make this work on your arm64 machine and have some tips we can add that to the readme.

dormancygrace commented 2 years ago

Thanks, I'll check this later today

dormancygrace commented 2 years ago

Still errors:

[W] [postrouting] modprobe: can't change directory to '/lib/modules': No such file or directory

[W] [postrouting] modprobe: can't change directory to '/lib/modules': No such file or directory

[W] [postrouting] iptables v1.8.8 (legacy): can't initialize iptables table 'nat': Table does not exist (do you need to insmod?)

[W] [postrouting] Perhaps iptables or your kernel needs to be upgraded.

[E] [postrouting] [FAIL] $ iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -j MASQUERADE > exit status 3

[E] [postrouting] exit status 3

after modprobe ip_tables on host machine I can connect with management tools, api works well, but can`t connect.

cenk1cenk2 commented 2 years ago

I see. That is a shame. But I do not know how to help further other than something like here https://superuser.com/questions/497245/how-to-load-tun-module-in-linux . If you have no chance please do inform me so I would drop the arm64 image.

dormancygrace commented 2 years ago

On Ubuntu 22.04 (arm64) work like a charm!

cenk1cenk2 commented 2 years ago

Yey all cool then. Thanks for heads up on Oracle Cloud. Have fun and glad this is resolved.

dormancygrace commented 2 years ago

Thanks for amazing work!

dormancygrace commented 2 years ago

Why you drop arm64 image? =(

cenk1cenk2 commented 2 years ago

I did not. Maybe something wrong on pipeline side will check.

cenk1cenk2 commented 2 years ago

It should still be there something was wrong with manifest.

dormancygrace commented 2 years ago

I'm very sorry, but just now I tried to setup vpn, and found that it have no ip =( Strange thing - i can connect with management tools, but that`s all. image

dormancygrace commented 2 years ago

Can you try prebuilt arm64 binaries?

https://github.com/SoftEtherVPN/SoftEtherVPN_Stable/releases/download/v4.39-9772-beta/softether-vpnserver-v4.39-9772-beta-2022.04.26-linux-arm64-64bit.tar.gz

Or it's not an option for you?

cenk1cenk2 commented 2 years ago

Na sorry can not do that since prebuild ones are too much out of date, thats why i have created this container anyway.

dormancygrace commented 2 years ago

I see you`ve fixed something, but again, no arm64 builds. If you can, build it one more time, i want to try CentOS 7

cenk1cenk2 commented 2 years ago

Yeah sorry, there is a rouge branch I have that triggers the CI because of renovate, I disabled it completely hopefully.

It should be there after this build finishes: https://gitlab.kilic.dev/docker/softether-vpnsrv/-/jobs/13503 and hopefully would not break anymore.

dormancygrace commented 2 years ago

New errors =) image

log.txt

dormancygrace commented 2 years ago

It`s from Oracle Linux 7.

On Ubuntu I've successfully connected!

cenk1cenk2 commented 2 years ago

Glad to hear so everything is working for you now right? I will check the errors.

dormancygrace commented 2 years ago

Yep, sir! On Ubuntu all is working, on Oracle Linux 7 I got errors, but container starts. I have no vm with Oracle Linux 8, but can make it, if you want me to check