Adhoc network on Raspberry Pi 4

Hello,

I’m running the ubiquityrobotics raspberry pi 4 2019-06-19-ubiquity-xenial-lxde image on my UAV companion computer. ROS is working, including multimaster and connecting wired internet works well. I have 3 of these PIs set up on an ad-hoc networks with the following configuration in the /etc/network/interfaces file:

# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

# The loopback network interface
auto lo
iface lo inet loopback

#auto eth0
#iface eth0 inet dhcp

auto wlan0
iface wlan0 inet static
    address 10.42.0.3
    netmask 255.255.255.0
    gateway 10.42.0.1
    wireless-channel 1
    wireless-essid dragonflyadhoc
    wireless-mode ad-hoc
    wireless-key s:xxxx

This works from boot, but often the connection becomes unavailable after a couple minutes. Looking at the syslog, I can’t see any related issues that come up.

Is there a different or proper way to setup an ad-hoc network with this image?

Thanks.

I don’t know of anyone who has tried ad-hoc mode on our image, sorry. We generally use AP mode instead.

See if there is something in the dmesg log or maybe in journalctl -b.

Hmm, nothing notable in dmesg or journalctl -b either. What’s strange is the adhoc network behaves normally from boot for a time period (ping, ssh, etc works) then just shuts off silently.

I do see this error from pifi during boot, but during that time period the adhoc network is functional:

Mar  2 17:08:13 ubiquityrobot pifi_startup[650]: Initializing AP Mode
Mar  2 17:08:13 ubiquityrobot pifi_startup[650]: Traceback (most recent call last):
Mar  2 17:08:13 ubiquityrobot pifi_startup[650]:   File "/usr/bin/pifi_startup", line 9, in <module>
Mar  2 17:08:13 ubiquityrobot pifi_startup[650]:     load_entry_point('pifi==0.6.0', 'console_scripts', 'pifi_startup')()
Mar  2 17:08:13 ubiquityrobot pifi_startup[650]:   File "/usr/lib/python3/dist-packages/pifi/startup.py", line 123, in main
Mar  2 17:08:13 ubiquityrobot pifi_startup[650]:     start_ap_mode(pifi_conf_settings, ApModeDevice, ClientModeDevice)
Mar  2 17:08:13 ubiquityrobot pifi_startup[650]:   File "/usr/lib/python3/dist-packages/pifi/startup.py", line 70, in start_ap_mode
Mar  2 17:08:13 ubiquityrobot pifi_startup[650]:     NetworkManager.NetworkManager.AddAndActivateConnection(settings, ApModeDevice, "/")
Mar  2 17:08:13 ubiquityrobot pifi_startup[650]:   File "<string>", line 6, in AddAndActivateConnection
Mar  2 17:08:13 ubiquityrobot pifi_startup[650]:   File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 145, in __call__
Mar  2 17:08:13 ubiquityrobot pifi_startup[650]:     **keywords)
Mar  2 17:08:13 ubiquityrobot pifi_startup[650]:   File "/usr/lib/python3/dist-packages/dbus/connection.py", line 651, in call_blocking
Mar  2 17:08:13 ubiquityrobot pifi_startup[650]:     message, timeout)
Mar  2 17:08:13 ubiquityrobot pifi_startup[650]: dbus.exceptions.DBusException: org.freedesktop.NetworkManager.UnknownConnection: Connection 'Pifi AP Mode' is not available on the device wlan0 at this time.
Mar  2 17:08:13 ubiquityrobot systemd[1]: pifi.service: Main process exited, code=exited, status=1/FAILURE
Mar  2 17:08:13 ubiquityrobot systemd[1]: pifi.service: Unit entered failed state.
Mar  2 17:08:13 ubiquityrobot systemd[1]: pifi.service: Failed with result 'exit-code'.

Maybe pifi/NetworkManager is doing something screwy in the background that is causing your network to fail.

Try disabling pifi with sudo systemctl disable pifi

Rohan

Although it removes the error from the log, the problem with the adhoc connection is the same. I did notice that cycling a sudo ifdown wlan0 and sudo ifup wlan0 restores the network. Is there another log associated with the network of if* that may give some more clues?

You could try checking /var/log/syslog or dmesg, but after that I am unsure of anywhere else to check.

Rohan

Playing with some of the configurations, it seems I just needed to change the channel that I was running on. Thanks for your help @rohbotics

1 Like

Glad you got it working!
Good luck with your project.

Rohan