1

I have a freshly installed Raspberry Pi 5, onto which I have put Ubuntu 24.04 server (aarch). The packages wpasupplicant, iw and wireless-tools are installed, but in the Raspberry Pi imager I have not entered any WiFi configuration data. I would like to set up the WLAN adapter to operate in ad-hoc mode, with a statically configured IP address.

I have put the following configuration into the file 60-setup-myadhocnetwork.yaml in the directory /etc/netplan/:

network:
  version: 2
  wifis:
    wlan0:
      addresses: [192.168.144.1/24]
      dhcp4: false
      dhcp6: false
      access-points:
        "MyAdHoc":
          mode: adhoc
          band: 2.4GHz
          channel: 1

I have double-checked that there are no tabs in this configuration. The output of sudo netplan --debug apply suggests that the wlan0 interface is in some way processed by netplan, that the configuration for wlan0 is valid, and none of the messages given there ring any alarm bells (I can supply the output if needed). The generated file /run/netplan/wpa-wlan0.conf looks as follows:

ctrl_interface=/run/wpa_supplicant

network={ ssid=P"MyAdHoc" frequency=2412 mode=1 key_mgmt=NONE }

The problem is, the wlan0 interface does not come up (as checked with ip link) and tshark also does not capture anything on that interface (it should though).

Question: Does anyone know of example netplan configurations which successfully set up an ad-hoc WLAN on a WiFi adapter on a Raspberry Pi 5, using Ubuntu 24.04 server?

I should add that I would like to avoid switching to Raspberry Pi OS (there I got the WLAN adapter running the way I wanted, after editing /etc/network/interfaces and rebooting). For certain things I need to do the underlying Debian Bookworm is just too old.

UPDATE Feb 7 Here is the output of sudo lshw -C network:

  *-network                 
       description: Ethernet controller
       product: RP1 PCIe 2.0 South Bridge
       vendor: Raspberry Pi Ltd
       physical id: 0
       bus info: pci@0000:01:00.0
       version: 00
       width: 32 bits
       clock: 33MHz
       capabilities: pm pciexpress msix bus_master cap_list
       configuration: driver=rp1 latency=0
       resources: irq:41 memory:1f00410000-1f00413fff memory:1f00000000-1f003fffff memory:1f00400000-1f0040ffff
  *-interface:0
       description: Wireless interface
       product: 4345
       vendor: Broadcom
       physical id: 1
       bus info: mmc@1:0001:1
       logical name: mmc1:0001:1
       logical name: wlan0
       serial: 2c:cf:67:71:23:8f
       capabilities: ethernet physical wireless
       configuration: broadcast=yes driver=brcmfmac driverversion=7.45.234 firmware=01-996384e2 multicast=yes wireless=IEEE 802.11
  *-network
       description: Ethernet interface
       physical id: f
       logical name: eth0
       serial: 2c:cf:67:71:23:8e
       size: 1Gbit/s
       capacity: 1Gbit/s
       capabilities: ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=macb driverversion=6.8.0-1018-raspi duplex=full ip=xx.yy.zz.ww link=yes multicast=yes port=twisted pair speed=1Gbit/s

And here is also the output of sudo netplan --debug apply:

** (generate:30441): DEBUG: 13:10:13.644: starting new processing pass
** (generate:30441): DEBUG: 13:10:13.644: starting new processing pass
** (generate:30441): DEBUG: 13:10:13.644: wlan0: adding wifi AP 'MyAdHoc'
** (generate:30441): DEBUG: 13:10:13.644: We have some netdefs, pass them through a final round of validation
** (generate:30441): DEBUG: 13:10:13.644: wlan0: setting default backend to 1
** (generate:30441): DEBUG: 13:10:13.644: Configuration is valid
** (generate:30441): DEBUG: 13:10:13.644: eth0: setting default backend to 1
** (generate:30441): DEBUG: 13:10:13.644: Configuration is valid
** (generate:30441): DEBUG: 13:10:13.645: Generating output files..
** (generate:30441): DEBUG: 13:10:13.645: Open vSwitch: definition eth0 is not for us (backend 1)
** (generate:30441): DEBUG: 13:10:13.645: NetworkManager: definition eth0 is not for us (backend 1)
** (generate:30441): DEBUG: 13:10:13.645: Creating wpa_supplicant config
** (generate:30441): DEBUG: 13:10:13.645: wlan0: Creating wpa_supplicant configuration file run/netplan/wpa-wlan0.conf
** (generate:30441): DEBUG: 13:10:13.645: Creating wpa_supplicant unit /run/systemd/system/netplan-wpa-wlan0.service
** (generate:30441): DEBUG: 13:10:13.650: Creating wpa_supplicant service enablement link /run/systemd/system/systemd-networkd.service.wants/netplan-wpa-wlan0.service
** (generate:30441): DEBUG: 13:10:13.651: Open vSwitch: definition wlan0 is not for us (backend 1)
** (generate:30441): DEBUG: 13:10:13.651: NetworkManager: definition wlan0 is not for us (backend 1)
DEBUG:netplan generated networkd configuration changed, reloading networkd
DEBUG:Cannot call Open vSwitch: Cannot apply OVS cleanup: ovsdb-server.service is 'not-found'.
DEBUG:no netplan generated NM configuration exists
** (process:30440): DEBUG: 13:10:15.168: starting new processing pass
** (process:30440): DEBUG: 13:10:15.170: starting new processing pass
** (process:30440): DEBUG: 13:10:15.170: wlan0: adding wifi AP 'MyAdHoc'
** (process:30440): DEBUG: 13:10:15.170: We have some netdefs, pass them through a final round of validation
** (process:30440): DEBUG: 13:10:15.170: wlan0: setting default backend to 1
** (process:30440): DEBUG: 13:10:15.170: Configuration is valid
** (process:30440): DEBUG: 13:10:15.170: eth0: setting default backend to 1
** (process:30440): DEBUG: 13:10:15.170: Configuration is valid
DEBUG:Merged config:
b''
DEBUG:Link changes: {}
DEBUG:netplan triggering .link rules for lo
DEBUG:netplan triggering .link rules for eth0
DEBUG:netplan triggering .link rules for wlan0
** (process:30440): DEBUG: 13:10:15.307: starting new processing pass
** (process:30440): DEBUG: 13:10:15.307: starting new processing pass
** (process:30440): DEBUG: 13:10:15.307: wlan0: adding wifi AP 'MyAdHoc'
** (process:30440): DEBUG: 13:10:15.307: We have some netdefs, pass them through a final round of validation
** (process:30440): DEBUG: 13:10:15.307: wlan0: setting default backend to 1
** (process:30440): DEBUG: 13:10:15.307: Configuration is valid
** (process:30440): DEBUG: 13:10:15.307: eth0: setting default backend to 1
** (process:30440): DEBUG: 13:10:15.307: Configuration is valid
DEBUG:Merged config:
b''

The output of ip link is:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
    link/ether 2c:cf:67:71:23:8e brd ff:ff:ff:ff:ff:ff
3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DORMANT group default qlen 1000
    link/ether 2c:cf:67:71:23:8f brd ff:ff:ff:ff:ff:ff
mpboden
  • 3,046

1 Answers1

1

I was now able to get around the problem. When trying to use the command sudo iwconfig wlan0 mode ad-hoc channel 1 essid "MyAdHoc" to put the WLAN adapter into ad-hoc mode manually, I got back a 'Device or resource busy' error. It turned out that wpa_applicant for some reason already created a (spurious-looking, to me) peer-to-peer IBSS network. For my particular case the crude-but-working solution was to simply kill all instances of wpa_applicant and then I could run all the iwconfig and other commands that I needed. Not robust and not a long-term solution, but for my purposes it will do.

mpboden
  • 3,046