I am not extensively familiar with how this file gets generated if ever. We definitely would love to make it compatible with Linux. As I understand most apps do not need it to make outgoing network calls but Golang in this case (as in many others) bypasses probably some abstractions in this context. Hopefully others in the group have better idea.
If we were to add the logic to generate this file it would probably be in dhcp.cc. For now you can simply add it as a static file same way as Erlang app does, no need to code anything. Unless in your case on EC2 you need to make sure it points to DNS server supplied by AWS. If you want feel free to send a patch if you know what exactly should happen. Lastly I will be sending some patches to the group to take care of some of the missing syscalls Golang runtime needs that we identified. I am very interested to make OSv better support Go. Let us know of any gaps. There may be more syscalls that are missing and hopefully they will be trivial to add. Waldek On Thursday, January 24, 2019 at 7:24:38 PM UTC-5, Brian Ledbetter wrote: > > Waldek -- > > You're a genius, adding the resolv.conf file fixes the User Data problem!! > (Now I have a crash somewhere else I need to figure out, hehe) > > If I were to put together a patch to automatically generate > /etc/resolv.conf on successful DHCP, would it be more appropriate to put > that in core/dhcp.cc? Or in libc/network/__dns.cc? And is that something > that the OSv team would even want? (If not, I'll have to keep it in my > personal patch collection :) ) > > Respectfully, > Brian > > > On Thursday, January 24, 2019 at 3:20:51 PM UTC-5, Waldek Kozaczuk wrote: >> >> Hi Brian, >> >> Sorry it took me longer than I thought. I have not forgotten about you >> and I have good news for you. >> >> It turns out that this issue can be easily replicated (I think it is the >> same issue) by having some Golang program to fetch arbitrary content using >> http.Get like so: >> http.Get(redirectURI) >> >> And it happens because Golang runtime appears to rely on presence of >> /etc/resolv.conf (http://man7.org/linux/man-pages/man5/resolv.conf.5.html) >> to resolve host names. I am not sure what exactly should go into it but >> using the same one as for Erlang - >> https://github.com/cloudius-systems/osv-apps/blob/master/erlang/default/resolv.conf >> >> - made this error go away. >> >> Also to make it also handle https://... request I had to ca-certificates >> module (bunch of static files that need to be added) like so: >> ./scripts/build image=golang-httpserver,ca-certificates >> >> Finally I am not sure if this is gonna help you with fetch cloud init >> data as requests like these (I am presuming this is what client uses to >> fetch cloud init from EC2 instance) >> >> *curl http://169.254.169.254/latest >> <http://169.254.169.254/latest>/meta-data/* >> >> should not involve DNS. But who knows. >> >> I also have easy patch for these errors you might be seeing in standard >> out: >> syscall(): unimplemented system call 262 >> >> It might be that this needs to be fixed as well to make. >> >> If so just apply this patch to linux.cc (I will be sending patch to the >> group soon): >> diff --git a/linux.cc b/linux.cc >> index d1cd61b7..d548db93 100644 >> --- a/linux.cc >> +++ b/linux.cc >> @@ -420,6 +420,7 @@ long syscall(long number, ...) >> SYSCALL5(epoll_pwait, int, struct epoll_event *, int, int, void*); >> SYSCALL3(getrandom, char *, size_t, unsigned int); >> SYSCALL2(nanosleep, const struct timespec*, struct timespec *); >> + SYSCALL4(fstatat, int, const char *, struct stat *, int); >> } >> >> debug_always("syscall(): unimplemented system call %d\n", number); >> >> Let me know if this helps, >> Waldek >> >> I hope adding resolv.conf will fix your problem >> On Thursday, January 17, 2019 at 12:03:33 PM UTC-5, Brian Ledbetter wrote: >>> >>> Thanks again for all of the help, Waldek! I've been sidetracked but am >>> finally getting back around to this. :) >>> >>> On Tuesday, January 8, 2019 at 7:47:42 AM UTC-5, Waldek Kozaczuk wrote: >>>> >>>> I think you should be using HVM-based instance types, so I think you >>>> are fine. I know there are certain new EC2 instance types announced in >>>> 2017 >>>> that are KVM based and use ENA and NVMe drivers which OSv does not >>>> support. >>>> Please see this - https://github.com/cloudius-systems/osv/issues/924. >>>> >>> >>> Yeah, it looks like networking is working. >>> >>> >>> >>>> I have a modern version of this script and others. So if you care I can >>>>> dig it up. >>>>> >>>> >>> I've managed to cobble something together with the AWS API directly, so >>> hopefully I'm good there :) >>> >>> >>> Additionally I am not sure you are familiar with capstan tool that can >>>> build OSv images Docker compose style - >>>> https://github.com/cloudius-systems/osv/wiki/Build-and-run-apps-on-OSv-using-Capstan. >>>> >>>> You need new mikelangelo capstan - >>>> https://github.com/mikelangelo-project/capstan >>>> >>> >>> I've seen it but haven't messed with it yet. Maybe that's the way I >>> need to go, I'll have to throw together a container and see how it works. >>> >>> >>> Is it OSv cloud-init module that fails to get metadata ( >>>> https://github.com/cloudius-systems/osv/blob/master/modules/cloud-init/data-source.cc) >>>> >>>> or your app? I wonder if your problems are Golang specific. >>>> >>> >>> Neither sees any init data, both elements report that the internal AWS >>> IP that contains host metadata is unreachable. >>> >>> >>> >>>> I might have some time this week to create an EC2 instance and try a >>>> Golang app myself. Which instance type are you using - >>>> https://aws.amazon.com/ec2/instance-types/? >>>> >>> >>> I was trying with t2.micro, which I thought was the most basic and >>> generic instance I could get. Is there a better option? >>> >>> Thanks again for all of your help! :) >>> >> -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
