Network manager does not automatically detect phone

Some time ago, I would tether my phone to PC and the connection would happen automatically. After a few updates, I realised that after tethering I have to go to network manager, to the pertinent connection to select which USB device to use for the connection. How do I solve this?

So this connection used to be automatic, but now you need to activate the connection manually? Please share your connection profile located in the /etc/NetworkManager/system-connections/ directory. I’m wondering if it is configured to connect automatically?

With the phone attached and before activating the connection, what is shown by the following?

nmcli g
nmcli d

What I mean is that every time I tether I have to go to specified profile and select the device to restrict to. Initially, I did this only once and Network Manager would remember every other time afterwards.

The profile

[connection] 
id=SGP 
uuid=1033c3f5-0806-44b4-ac4f-d70dc32d047f 
type=ethernet 
permissions=user:Giantas:; 
secondaries= 

[ethernet] 
mac-address=0A:74:C8:30:76:FC 
mac-address-blacklist= 

[ipv4] 
dns-search= 
method=auto 

[ipv6] 
dns-search= 
method=auto

nmcli g returns

STATE         CONNECTIVITY  WIFI-HW  WIFI     WWAN-HW  WWAN     
disconnected  none          enabled  enabled  enabled  enabled 

nmcli d returns

usb0    ethernet  disconnected  --          
wlan0   wifi      disconnected  --          
eth0    ethernet  unavailable   --          
lo      loopback  unmanaged     -- 

Strange. I can see that the profile is already restricted to a particular mac-address, and without ‘autoconnect=false’ it should just connect when that device is present. I’m not sure why it doesn’t. I note that you have it configure as a user connection. I wonder if setting it up as a system-wide connection might change the behaviour. For KDE NM, this is done by selecting ‘All users may connect to his network’.

https://doc.opensuse.org/documentation/leap/reference/html/book.opensuse.reference/cha.nm.html#sec.nm.sec.types

You could try observing NM with

sudo journalctl -fu NetworkManager

then note what is reported when the phone is connected via USB.

Is it possible that the MAC Address of the device (phone) changes on every connection?

This is what I did:
I disconnected my phone completely from the PC. I opened a new terminal window and ran

sudo journalctl -fu NetworkManager

I then attached the phone via usb and tethered. Since the phone did not automatically detect the device to use for connection, I went into the SGP Network Manager profile and selected the correct choice for ‘Restrict to Device’. Then connected to the internet.
The log for the whole process is as follows:

-- Logs begin at Tue 2016-10-11 09:20:40 EAT. --
Apr 22 23:47:22 linux-ba38 NetworkManager[1092]: dns-resolver: You can find my version in 
/etc/resolv.conf.netconfig
Apr 22 23:47:22 linux-ba38 NetworkManager[1092]: ATTENTION: You have modified /etc/resolv.
conf.  Leaving it untouched...
Apr 22 23:47:22 linux-ba38 NetworkManager[1092]: You can find my version in /etc/resolv.co
nf.netconfig ...
Apr 22 23:47:22 linux-ba38 NetworkManager[1092]: <info>  NetworkManager state is now CONNE
CTED_LOCAL
Apr 22 23:47:22 linux-ba38 NetworkManager[1092]: <info>  NetworkManager state is now DISCO
NNECTED
Apr 22 23:47:22 linux-ba38 NetworkManager[1092]: <info>  (28:27:BF:3B:29:06): device state
 change: disconnected -> unmanaged (reason 'removed') [30 10 36]
Apr 22 23:47:22 linux-ba38 NetworkManager[1092]: <info>  (08:FD:0E:74:1E:67): device state
 change: disconnected -> unmanaged (reason 'removed') [30 10 36]
Apr 22 23:47:22 linux-ba38 NetworkManager[1092]: <info>  (B8:6C:E8:64:D3:1A): device state
 change: disconnected -> unmanaged (reason 'removed') [30 10 36]
Apr 22 23:47:22 linux-ba38 NetworkManager[1092]: <info>  (1C:CB:99:93:C1:83): device state
 change: disconnected -> unmanaged (reason 'removed') [30 10 36]
Apr 22 23:47:28 linux-ba38 NetworkManager[1092]: <info>  (usb0): device state change: disc
onnected -> unmanaged (reason 'removed') [30 10 36]
Apr 22 23:47:59 linux-ba38 NetworkManager[1092]: **<warn>  (usb0): failed to find device 6 '**
usb0' with udev
Apr 22 23:47:59 linux-ba38 NetworkManager[1092]: <info>  (usb0): new Ethernet device (carr
ier: OFF, driver: 'rndis_host', ifindex: 6)
Apr 22 23:47:59 linux-ba38 NetworkManager[1092]: <info>  (usb0): device state change: unma
naged -> unavailable (reason 'managed') [10 20 2]
Apr 22 23:47:59 linux-ba38 NetworkManager[1092]: <info>  (usb0): link connected
Apr 22 23:47:59 linux-ba38 NetworkManager[1092]: <info>  (usb0): device state change: unav
ailable -> disconnected (reason 'none') [20 30 0]
Apr 22 23:48:41 linux-ba38 NetworkManager[1092]: <info>  Auto-activating connection 'SGP'.
Apr 22 23:48:41 linux-ba38 NetworkManager[1092]: <info>  (usb0): Activation: starting conn
ection 'SGP' (1033c3f5-0806-44b4-ac4f-d70dc32d047f)
Apr 22 23:48:41 linux-ba38 NetworkManager[1092]: <info>  (usb0): device state change: disc
onnected -> prepare (reason 'none') [30 40 0]
Apr 22 23:48:41 linux-ba38 NetworkManager[1092]: <info>  NetworkManager state is now CONNE
CTING
Apr 22 23:48:41 linux-ba38 NetworkManager[1092]: <info>  (usb0): device state change: prep
are -> config (reason 'none') [40 50 0]
Apr 22 23:48:41 linux-ba38 NetworkManager[1092]: <info>  (usb0): device state change: conf
ig -> ip-config (reason 'none') [50 70 0]
Apr 22 23:48:41 linux-ba38 NetworkManager[1092]: <info>  Activation (usb0) Beginning DHCPv
4 transaction (timeout in 45 seconds)
Apr 22 23:48:41 linux-ba38 NetworkManager[1092]: <info>  dhclient started with pid 9712
Apr 22 23:48:41 linux-ba38 NetworkManager[1092]: <info>  (usb0): DHCPv4 state changed unkn
own -> expire
Apr 22 23:48:41 linux-ba38 NetworkManager[1092]: <info>  (usb0): DHCPv4 state changed expi
re -> unknown
Apr 22 23:48:46 linux-ba38 NetworkManager[1092]: <info>    address 192.168.42.124
Apr 22 23:48:46 linux-ba38 NetworkManager[1092]: <info>    plen 24 (255.255.255.0)
Apr 22 23:48:46 linux-ba38 NetworkManager[1092]: <info>    gateway 192.168.42.129
Apr 22 23:48:46 linux-ba38 NetworkManager[1092]: <info>    server identifier 192.168.42.12
9
Apr 22 23:48:46 linux-ba38 NetworkManager[1092]: <info>    lease time 3600
Apr 22 23:48:46 linux-ba38 NetworkManager[1092]: <info>    hostname 'linux-ba38'
Apr 22 23:48:46 linux-ba38 NetworkManager[1092]: <info>    nameserver '192.168.42.129'
Apr 22 23:48:46 linux-ba38 NetworkManager[1092]: <info>  (usb0): DHCPv4 state changed unkn
own -> bound
Apr 22 23:48:46 linux-ba38 NetworkManager[1092]: <info>  (usb0): device state change: ip-c
onfig -> ip-check (reason 'none') [70 80 0]
Apr 22 23:48:46 linux-ba38 NetworkManager[1092]: <info>  (usb0): device state change: ip-c
heck -> secondaries (reason 'none') [80 90 0]
Apr 22 23:48:46 linux-ba38 NetworkManager[1092]: <info>  (usb0): device state change: seco
ndaries -> activated (reason 'none') [90 100 0]
Apr 22 23:48:46 linux-ba38 NetworkManager[1092]: <info>  NetworkManager state is now CONNE
CTED_LOCAL
Apr 22 23:48:46 linux-ba38 NetworkManager[1092]: <info>  NetworkManager state is now CONNE
CTED_GLOBAL
Apr 22 23:48:46 linux-ba38 NetworkManager[1092]: <info>  Policy set 'SGP' (usb0) as defaul
t for IPv4 routing and DNS.
Apr 22 23:48:47 linux-ba38 dns-resolver[9776]: **You can find my version in /etc/resolv.conf**
.netconfig
Apr 22 23:48:47 linux-ba38 NetworkManager[1092]: dns-resolver: ATTENTION: You have modifie
d /etc/resolv.conf. Leaving it untouched...
Apr 22 23:48:47 linux-ba38 NetworkManager[1092]: dns-resolver: You can find my version in 
/etc/resolv.conf.netconfig
Apr 22 23:48:47 linux-ba38 NetworkManager[1092]: ATTENTION: You have modified /etc/resolv.
conf.  Leaving it untouched...
Apr 22 23:48:47 linux-ba38 NetworkManager[1092]: You can find my version in /etc/resolv.co
nf.netconfig ...
Apr 22 23:48:47 linux-ba38 NetworkManager[1092]: <info>  (usb0): Activation: successful, d
evice activated.

I wouldn’t have thought so. This does seem pertinent

Apr 22 23:47:59 linux-ba38 NetworkManager[1092]: <warn>  (usb0): failed to find device 6 '
usb0' with udev

I find it unusual that you need to ‘Restrict to device’ in order to get the connection working though. A bug report might be needed to help resolve this behaviour. I’m using openSUSE 42.2, but when I get a chance I’ll try testing USB tethering with my iPhone.