VintageNet issue when running on host: (File.Error) could not write to file “/etc/resolv.conf”: permission denied

Hello, my Nerves app is using VintageNet and VintageNetWizard to establish a network connection when on target. My app also has a phoenix app and I want to run/develop the web app on my host. I’ve created a fake for VintageNet and VintageNetWizard when running on host. When I start the application on host I get the following error:

** (Mix) Could not start application vintage_net: VintageNet.Application.start(:normal, ) returned an error: shutdown: failed to start child: VintageNet.NameResolver
** (EXIT) an exception was raised:
** (File.Error) could not write to file “/etc/resolv.conf”: permission denied
(elixir 1.17.2) lib/file.ex:1144: File.write!/3
(vintage_net 0.13.5) lib/vintage_net/name_resolver.ex:129: VintageNet.NameResolver.refresh/1
(vintage_net 0.13.5) lib/vintage_net/name_resolver.ex:96: VintageNet.NameResolver.init/1
(stdlib 6.0) gen_server.erl:2057: :gen_server.init_it/2
(stdlib 6.0) gen_server.erl:2012: :gen_server.init_it/6
(stdlib 6.0) proc_lib.erl:329: :proc_lib.init_p_do_apply/3

Even though I am using a fake the application is trying to start the NameResolver. Any ideas how I can get around this?

What do you mean about having created a fake?
I think normally if you run on host VintageNet will just not do very much? I don’t recall having had problems with it. Probably just leaving it unconfigured that makes it not do anything but I haven’t checked why. Was just never a problem.

Do you have the following in your host.exs configuration?

config :vintage_net,
  resolvconf: "/dev/null",
  persistence: VintageNet.Persistence.Null,
  bin_ip: "false"

Which avoids attempting to write to resolve.conf.

However, if you really want to have a resolv.conf, you would want to give a path that is writable on the host to override the default /etc/resolv.conf

1 Like

This solved the issue for me. Thanks. I’ll post something here later about the Fakes I’m using.