frigidcode

frigidcode

Looking for some help having my laptop reliably use mDNS to resolve local nerves projects connected over usb. For this example I am using a Raspberry Pi Zero W, System76 Galago Pro, Majaro Linux (consider this the same as Arch), and a new nerves project burned to the sd card.

Packages installed:

  • avahi
  • nss-mdns

Services disabled and stopped:

  • systemd-resolvd

Services enabled and started:

  • avahi-daemon

Relevant line in /etc/nsswitch.conf:

hosts: files mymachines mdns4_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] dns mdns4 myhostname

When I plug the usb cable in I manually edit the connection and switch it to Local-Link Only. The connection is established and the following lines are shown when viewing the status of the avahi-daemon.service:

Mar 08 08:13:26 schmerz avahi-daemon[558]: Withdrawing address record for fe80::1bd2:2363:f3f0:10fa on enp0s20f0u7.
Mar 08 08:13:26 schmerz avahi-daemon[558]: Leaving mDNS multicast group on interface enp0s20f0u7.IPv6 with address fe80::1bd2:2363:f3f0:10fa.
Mar 08 08:13:26 schmerz avahi-daemon[558]: Interface enp0s20f0u7.IPv6 no longer relevant for mDNS.
Mar 08 08:13:26 schmerz avahi-daemon[558]: Joining mDNS multicast group on interface enp0s20f0u7.IPv6 with address fe80::1bd2:2363:f3f0:10fa.
Mar 08 08:13:26 schmerz avahi-daemon[558]: New relevant interface enp0s20f0u7.IPv6 for mDNS.
Mar 08 08:13:26 schmerz avahi-daemon[558]: Registering new address record for fe80::1bd2:2363:f3f0:10fa on enp0s20f0u7.*.
Mar 08 08:13:32 schmerz avahi-daemon[558]: Joining mDNS multicast group on interface enp0s20f0u7.IPv4 with address 169.254.158.42.
Mar 08 08:13:32 schmerz avahi-daemon[558]: New relevant interface enp0s20f0u7.IPv4 for mDNS.

Sometimes I can ping nerves.local and have it resolve, ssh was tested to work as well :slight_smile: However this is not consistent, and I can’t tell why. Any help would be great, I spent an absurd amount of time dealing with this issue across multiple distros. Majaro is the first to actually work at all, so I am hopeful.

Nerves config, stock generated config:

config :nerves_init_gadget,
  ifname: "usb0",
  address_method: :dhcpd,
  mdns_domain: "nerves.local",
  node_name: node_name,
  node_host: :mdns_domain

Thanks!!

Most Liked

fhunleth

fhunleth

Co-author of Nerves

The IP address of the Nerves device will be the same even after reboots. It is computed off the serial number of the Raspberry Pi, so if you have multiple Pi’s connected to your computer, they’ll all have different addresses. Once you have the address, though, you could add it to the hosts file to avoid mDNS altogether.

There might be another problem. I’ve been noticing lately that Raspberry Pi Zeros don’t connect reliably to Linux computers and it’s everything USB. This seems to correlate with a Linux update from GitHub - raspberrypi/linux: Kernel source tree for Raspberry Pi-provided kernel builds. Issues unrelated to the linux kernel should be posted on the community forum at https://forums.raspberrypi.com/ · GitHub, but I don’t understand it. My MacBook Pro does not have this issue at all.

Frank

fhunleth

fhunleth

Co-author of Nerves

There is an issue with the Raspberry Pi Zero’s USB gadget mode being flaky. It’s really hard to determine what the issue is or even hints to provide upstream. I’ve seen some commits to the Raspberry Pi’s Linux github addressing the dwc2 driver (the gadget mode one), but none of them seem to work. I’m tracking their tip 4.19 revision now.

I have a PR that compiles the dwc2 driver as a module instead of building it into the kernel. At the moment, I’m enjoying a long streak of gadget mode working. The tradeoff is that the time for the USB gadget network and serial to come up is longer. I believe that this only changed the timing and things are “working”. Consistently booting is obviously better than booting slowly, so I’m leaning to merging this assuming it continues working.

As for the other issues, if the USB connection isn’t working, then nothing higher level will work. The ModemManager change will fix a bunch of junk characters being sent over the virtual serial port. I’m not sure why the IP address is changing unless you’re getting a link local one. At any rate, I’m hopeful that PR 100 will make things better and then we can get a new system out.

ConnorRigby

ConnorRigby

Nerves Core Team

@frigidcode I second the problem that Frank described. It effects my machine as well (i run Arch btw :stuck_out_tongue:)

A way to test is to do the following:

  1. run dmesg -w in one terminal tab
  2. plug rpi in
  3. observe for messages that look like ...failed to set dts...

If that isn’t the case your avahi daemon conf may be incorrect. I can’t remember where the config file is but i had to make some changes to it on Arch to get reliable mdns.

Where Next? Top

Trending in Questions Top

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
water
I’m aware of 2 such projects, are there others? git: GitHub - team-alembic/realworld: A fullstack Phoenix LiveView application with back...
New
itzmidinesh
Hi all, I’m working on a Phoenix project where I need to make external HTTP requests and I’m trying to choose between Req and HTTPoison....
New
peck
Hi everyone. My team and I have been working on a fairly modest app based around video streaming and chat, but we’ve landed a customer t...
New
leoschweizer
Hi, we run different LLM models across a cluster, with each node loading a configurable subset. Model-specific queues let nodes consume ...
New
csmr
Hi all, I’m new here and would like to hear peoples views on my Elixir/Phoenix based game-engine! :smiley: Mutonex gamedesign was finish...
New
perzanko
Do we have maintainer of absinthe-graphql/dataloader here? We have a PR that we’d like to merge to the library. Relatively small additive...
New

Other Trending Topics Top

dominicletz
Hey there, I haven’t seen a list of useful Elixir specific skills for the popular AI tools yet so I’m starting one here with my first. ...
New
mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
OndrejValenta
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly) AI dream has many faces, but general...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews