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

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
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
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews