2

nmcli output (among other items):

p2p-dev-wlp1s0: disconnected "p2p-dev-wlp1s0" wifi-p2p, hw 

How can I remove this p2p-dev-wlp1s0 device? It's used for wireless peer-to-peer connections but I don't need it. I tried through wpa_supplicant.conf but no difference. I think it's created by network-manager.


The system runs on Debian 12 bookworm. Perhaps on other distros with different options on the compilation of Network Manager, there may be other behaviours.

3 Answers 3

1

I might have missed something in the NetworkManager code base, but I don't think there's a way do delete it without changing and recompiling NetworkManager (I'm on Debian bookworm). The device seems to be created unconditionally

I've opted to add this to my NetworkManager.conf:

[keyfile] unmanaged-devices=<name of p2p-dev device> 

It doesn't answer the question as it doesn't delete the device, but at least it marks it as unmanaged instead of disconnected.

5
  • Interesting, didn't think about looking the code. I'll have a look whenever I have time. Commented Mar 24 at 13:03
  • 1
    FWIW this is the most interesting place I think: github.com/NetworkManager/NetworkManager/blob/… -- for some reason, p2p_available is true. Since the info seems to come from wpa_supplicant this is a bit weird. If you run wpa_supplicant with extra logging ('-dd') you'll see a bunch of P2P stuff even if you set p2p_disabled=1. You can force-disable with wpa_cli -i WIFI_IFACE_NAME p2p_set disabled 1, but it doesn't change anything when you restart NetworkManager. Not sure where the culprit is. Commented Mar 25 at 22:33
  • Ok, so I made this my little lunch break project. It turns out that 1) the p2p_disabled config in wpa_supplicant is per-interface, it never applies to newly-created interfaces and 2) NetworkManager deletes and recreates the wlan interface through wpa_supplicant, so whatever per-config was there prior to NetworkManager start is forgotten. I experimented a bit, and wpa_supplicant would needs 2 changes - one to allow setting a global flag (which already exists!) and another one to check it in the dbus interface (or to inherit the config from the global flag) Commented Mar 28 at 3:30
  • 1
    The interesting bit in wpa_supplicant is this: w1.fi/cgit/hostap/tree/wpa_supplicant/dbus/… It checks wpa_s->conf->p2p_disabled which is the per-interface config. When NetworkManager recreates the interface, this is always false (because it's a new interface added programmatically), so wpa_supplicant always add the "p2p" flag to the capabilities advertised through dbus, which in turns causes NetworkManager to always create the p2p device. Maybe the right thing to do would be to change NetworkManager to have its own P2P setting. Commented Mar 28 at 3:34
  • I'm marking your response as giving the answer, since it's the most definitive on the question (a proven negative is still an answer!). Commented Mar 28 at 8:21
0

To delete a network interface, use:

nmcli device delete p2p-dev-wlp1s0 nmcli con reload 

Add p2p_disabled=1 to your wpa_supplicant.conf file as documented here.

# Disable P2P functionality # p2p_disabled=1 
5
  • 1
    No, this doesn't work: Error: Device 'p2p-dev-wlp1s0' (/org/freedesktop/NetworkManager/Devices/6) deletion failed: This device is not a software device or is not realized. I tried using sudo also. Commented Dec 19, 2023 at 8:25
  • @Krackout See my edit. Please. Commented Dec 19, 2023 at 12:06
  • p2p_disabled=1 in wpa_supplicant.conf doesn't remove the device either. I had already tried this, quote from my question, "I tried through wpa_supplicant.conf but no difference"; sorry for not mentioning the specifics. I tried making /etc/wpa_supplicant.conf (non-existent in my system) and /etc/wpa_supplicant/wpa_supplicant.conf. /etc/wpa_supplicant directory was present before I take any action, some scripts are there. Commented Dec 21, 2023 at 6:19
  • @Krackout What is your wpasupplicant version? Commented Dec 21, 2023 at 7:03
  • 1
    wpa_supplicant v2.10, the standard package supplied by Debian 12.4 bookworm. Commented Dec 21, 2023 at 7:11
0

Id like to add some more details to the above answer.

this does not work

nmcli device delete p2p-dev-wlp1s0 nmcli con reload 

the solution:

create the file

 # cat /etc/wpa_supplicant/wpa_supplicant.conf p2p_disabled=1 

find

/usr/lib/systemd/system/wpa_supplicant.service 

and replace

ExecStart=/usr/bin/wpa_supplicant -u -s -O /run/wpa_supplicant -Dnl80211 -iwlp2s0 -c/etc/wpa_supplicant/wpa_supplicant.conf

# systemctl restart wpa_supplicant # systemctl restart NetworkManager 

check

$ nmcli device stat 

and p2p-dev-wlp1s0 must disappear

The key point - you must insist wpa_supplicant to use config file.

1
  • 1
    Still, no result; I also tried running wpa_supplicant manually. I think Network Manager is involved. Commented Feb 8 at 15:04

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.