NetworkManager will not autoconnect to wireless if it is unavailable at creation timeConstant interrutions in very slow Wifi brcmfmac43241b4-sdio in VAIO pro 13I have a Sony Vaio SVT131Aiil. The wireless does not show up as an option in network managerWhat's wrong with my isc-dhcp-server configuration?Internet connection drops out after 1-2 hours (RTL8821AE wifi drivers)Not able to connect to school wifi network in Ubuntu 16.04 - need to edit ca-certificateWifi connectivity issue in Ubuntu 16.04Wireless problems Lenovo Thinkpad E580Wifi breaks all the time - Ubuntu 18.04 - [14e4:4331]

Can a microwave oven cook chicken?

How do impulse response guitar amp simulators work?

How to deal with third parties in physical pentests?

Continuous functions taking uncountably many values countably often

Format a swedish phone number

Conflict between a religious belief that accounts for the existence of transgender people vs. one that doesn't

In an interview, is it self-defeating to say you use StackOverflow to find errors in code?

Is there a text editor that can run shell scripts?

Who was the first human to sleep on the Moon?

What does buying a wish in Sega's Aladdin do?

Can I land my aircraft on the grass next to the runway at a public airport?

Is there a mechanic for a PC to learn the relative strength of an opponent, stat-wise?

SQL Server - Snapshot is useful in production environments?

Is there any math conjecture that would cause a lot of damage if disproven?

Crack hashed passwords using a known password

What is an example of a sequence which "thins out" and is finite?

How to react to unfair reviewer comments?

Does a small cup of coffee result in a 45% reduced blood flow to the brain?

Is 忍者/忍び also used for women?

What are the benefits of the classic f-number scheme?

Why is the Australian ETA application fee cheaper on a 3rd party website?

Is there a bulletproof way to know a file has been successfully decrypted?

"packing with a hard knot in the pit of his stomach" meaning

Does the German President's apology for WWII reflect the prevailing views of the people of Germany?



NetworkManager will not autoconnect to wireless if it is unavailable at creation time


Constant interrutions in very slow Wifi brcmfmac43241b4-sdio in VAIO pro 13I have a Sony Vaio SVT131Aiil. The wireless does not show up as an option in network managerWhat's wrong with my isc-dhcp-server configuration?Internet connection drops out after 1-2 hours (RTL8821AE wifi drivers)Not able to connect to school wifi network in Ubuntu 16.04 - need to edit ca-certificateWifi connectivity issue in Ubuntu 16.04Wireless problems Lenovo Thinkpad E580Wifi breaks all the time - Ubuntu 18.04 - [14e4:4331]






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;









3

















As part of an automated build process for Ubuntu 16.04 servers, I use nmcli to create network profiles, including wireless. This is on headless systems without window manager FWIW.



I have noticed that when I create a profile and activate it, if the access point (AP) is not there at activation it will never auto-connect, regardless if it is available subsequently.



I've tried to narrow down the cause of the problem and believe it might be something to do with dbus registration.



Profile creation:



sudo nmcli con add con-name "aNetwork" ifname wlp2s0 type wifi ssid "aNetwork"
sudo nmcli con modify "aNetwork" wifi-sec.key-mgmt wpa-psk
sudo nmcli con modify "aNetwork" wifi-sec.psk aPassword
sudo nmcli con up id "aNetwork"


From syslog, it seems it adds it correctly and sets it to scanning:



ug 12 08:55:06 bacer-104 NetworkManager[585]: <info> [1565600106.4111] Config: added 'ssid' value 'aNetwork'
Aug 12 08:55:06 bacer-104 NetworkManager[585]: <info> [1565600106.4111] Config: added 'scan_ssid' value '1'
Aug 12 08:55:06 bacer-104 NetworkManager[585]: <info> [1565600106.4112] Config: added 'key_mgmt' value 'WPA-PSK'
Aug 12 08:55:06 bacer-104 NetworkManager[585]: <info> [1565600106.4112] Config: added 'psk' value '<omitted>'
Aug 12 08:55:06 bacer-104 NetworkManager[585]: <info> [1565600106.4128] sup-iface[0x1b0ff90,wlp2s0]: config: set interface ap_scan to 1


However after I make the AP visible, it never scans/connects, but when the connection is activated when the ESSID was present at creation, I get the following entry:



NetworkManager[489]: <debug> [1565287017.8330] device[0x1fb95f0] (wlp2s0): add_pending_action (3): 'scan'


But when the connection is activated *and the ESSID was not present at creation I get this:



NetworkManager[489]: <debug> [1565287064.3891] device[0x1fb95f0] (wlp2s0): add_pending_action (1): 'scan'
NetworkManager[489]: <debug> [1565287065.4580] device[0x1fb95f0] (wlp2s0): remove_pending_action (0): 'scan'


The contents of /etc/NetworkManager/system-connection/aNetwork are:



[connection]
id=aNetwork
uuid=6f24046b-b265-46d5-b89f-59ec802ce0af
type=wifi
interface-name=wlp2s0
permissions=
secondaries=

[wifi]
mac-address-blacklist=
mac-address-randomization=0
seen-bssids=
ssid=aNetwork

[wifi-security]
group=
key-mgmt=wpa-psk
pairwise=
proto=
psk=aPassword

[ipv4]
dns-search=
method=auto

[ipv6]
addr-gen-mode=stable-privacy
dns-search=
method=auto


I have diffed the contents between profiles created where theESSID are both present and absent and there is no difference.



Looking at the output of nmcli con show aNetwork between the two shows a big difference:




  1. The output when disconnected, no ESSID at creation/activation is:



    connection.id: aNetwork
    connection.uuid: 9dfacadb-f52a-453b-b6f1-2fbae6426d79
    connection.interface-name: wlp2s0
    connection.type: 802-11-wireless
    connection.autoconnect: yes
    connection.autoconnect-priority: 0
    connection.timestamp: 0
    connection.read-only: no
    connection.permissions:
    connection.zone: --
    connection.master: --
    connection.slave-type: --
    connection.autoconnect-slaves: -1 (default)
    connection.secondaries:
    connection.gateway-ping-timeout: 0
    connection.metered: unknown
    connection.lldp: -1 (default)
    802-11-wireless.ssid: aNetwork
    802-11-wireless.mode: --
    802-11-wireless.band: --
    802-11-wireless.channel: 0
    802-11-wireless.bssid: --
    802-11-wireless.rate: 0
    802-11-wireless.tx-power: 0
    802-11-wireless.mac-address: --
    802-11-wireless.cloned-mac-address: --
    802-11-wireless.mac-address-blacklist:
    802-11-wireless.mac-address-randomization:default
    802-11-wireless.mtu: auto
    802-11-wireless.seen-bssids:
    802-11-wireless.hidden: no
    802-11-wireless.powersave: default (0)
    802-11-wireless-security.key-mgmt: wpa-psk
    802-11-wireless-security.wep-tx-keyidx: 0
    802-11-wireless-security.auth-alg: --
    802-11-wireless-security.proto:
    802-11-wireless-security.pairwise:
    802-11-wireless-security.group:
    802-11-wireless-security.leap-username: --
    802-11-wireless-security.wep-key0: <hidden>
    802-11-wireless-security.wep-key1: <hidden>
    802-11-wireless-security.wep-key2: <hidden>
    802-11-wireless-security.wep-key3: <hidden>
    802-11-wireless-security.wep-key-flags: 0 (none)
    802-11-wireless-security.wep-key-type: 0 (unknown)
    802-11-wireless-security.psk: <hidden>
    802-11-wireless-security.psk-flags: 0 (none)
    802-11-wireless-security.leap-password: <hidden>
    802-11-wireless-security.leap-password-flags:0 (none)
    ipv4.method: auto
    ipv4.dns:
    ipv4.dns-search:
    ipv4.dns-options: (default)
    ipv4.dns-priority: 0
    ipv4.addresses:
    ipv4.gateway: --
    ipv4.routes:
    ipv4.route-metric: -1
    ipv4.ignore-auto-routes: no
    ipv4.ignore-auto-dns: no
    ipv4.dhcp-client-id: --
    ipv4.dhcp-timeout: 0
    ipv4.dhcp-send-hostname: yes
    ipv4.dhcp-hostname: --
    ipv4.dhcp-fqdn: --
    ipv4.never-default: no
    ipv4.may-fail: yes
    ipv4.dad-timeout: -1 (default)
    ipv6.method: auto
    ipv6.dns:
    ipv6.dns-search:
    ipv6.dns-options: (default)
    ipv6.dns-priority: 0
    ipv6.addresses:
    ipv6.gateway: --
    ipv6.routes:
    ipv6.route-metric: -1
    ipv6.ignore-auto-routes: no
    ipv6.ignore-auto-dns: no
    ipv6.never-default: no
    ipv6.may-fail: yes
    ipv6.ip6-privacy: -1 (unknown)
    ipv6.addr-gen-mode: stable-privacy
    ipv6.dhcp-send-hostname: yes
    ipv6.dhcp-hostname: --



  2. The output when disconnected, and the ESSID is present at creation/activation is:



    connection.id: aNetwork
    connection.uuid: 10d2d80a-4f64-4466-9e4e-6190e4628d45
    connection.interface-name: wlp2s0
    connection.type: 802-11-wireless
    connection.autoconnect: yes
    connection.autoconnect-priority: 0
    connection.timestamp: 1565600053
    connection.read-only: no
    connection.permissions:
    connection.zone: --
    connection.master: --
    connection.slave-type: --
    connection.autoconnect-slaves: -1 (default)
    connection.secondaries:
    connection.gateway-ping-timeout: 0
    connection.metered: unknown
    connection.lldp: -1 (default)
    802-11-wireless.ssid: aNetwork
    802-11-wireless.mode: --
    802-11-wireless.band: --
    802-11-wireless.channel: 0
    802-11-wireless.bssid: --
    802-11-wireless.rate: 0
    802-11-wireless.tx-power: 0
    802-11-wireless.mac-address: --
    802-11-wireless.cloned-mac-address: --
    802-11-wireless.mac-address-blacklist:
    802-11-wireless.mac-address-randomization:default
    802-11-wireless.mtu: auto
    802-11-wireless.seen-bssids: 9A:9B:CB:54:C4:5A
    802-11-wireless.hidden: no
    802-11-wireless.powersave: default (0)
    802-11-wireless-security.key-mgmt: wpa-psk
    802-11-wireless-security.wep-tx-keyidx: 0
    802-11-wireless-security.auth-alg: --
    802-11-wireless-security.proto:
    802-11-wireless-security.pairwise:
    802-11-wireless-security.group:
    802-11-wireless-security.leap-username: --
    802-11-wireless-security.wep-key0: <hidden>
    802-11-wireless-security.wep-key1: <hidden>
    802-11-wireless-security.wep-key2: <hidden>
    802-11-wireless-security.wep-key3: <hidden>
    802-11-wireless-security.wep-key-flags: 0 (none)
    802-11-wireless-security.wep-key-type: 0 (unknown)
    802-11-wireless-security.psk: <hidden>
    802-11-wireless-security.psk-flags: 0 (none)
    802-11-wireless-security.leap-password: <hidden>
    802-11-wireless-security.leap-password-flags:0 (none)
    ipv4.method: auto
    ipv4.dns:
    ipv4.dns-search:
    ipv4.dns-options: (default)
    ipv4.dns-priority: 0
    ipv4.addresses:
    ipv4.gateway: --
    ipv4.routes:
    ipv4.route-metric: -1
    ipv4.ignore-auto-routes: no
    ipv4.ignore-auto-dns: no
    ipv4.dhcp-client-id: --
    ipv4.dhcp-timeout: 0
    ipv4.dhcp-send-hostname: yes
    ipv4.dhcp-hostname: --
    ipv4.dhcp-fqdn: --
    ipv4.never-default: no
    ipv4.may-fail: yes
    ipv4.dad-timeout: -1 (default)
    ipv6.method: auto
    ipv6.dns:
    ipv6.dns-search:
    ipv6.dns-options: (default)
    ipv6.dns-priority: 0
    ipv6.addresses:
    ipv6.gateway: --
    ipv6.routes:
    ipv6.route-metric: -1
    ipv6.ignore-auto-routes: no
    ipv6.ignore-auto-dns: no
    ipv6.never-default: no
    ipv6.may-fail: yes
    ipv6.ip6-privacy: -1 (unknown)
    ipv6.addr-gen-mode: stable-privacy
    ipv6.dhcp-send-hostname: yes
    ipv6.dhcp-hostname: --
    GENERAL.NAME: aNetwork
    GENERAL.UUID: 10d2d80a-4f64-4466-9e4e-6190e4628d45
    GENERAL.DEVICES: wlp2s0
    GENERAL.STATE: activated
    GENERAL.DEFAULT: no
    GENERAL.DEFAULT6: no
    GENERAL.VPN: no
    GENERAL.ZONE: --
    GENERAL.DBUS-PATH: /org/freedesktop/NetworkManager/ActiveConnection/15
    GENERAL.CON-PATH: /org/freedesktop/NetworkManager/Settings/11
    GENERAL.SPEC-OBJECT: /org/freedesktop/NetworkManager/AccessPoint/12
    GENERAL.MASTER-PATH: --
    IP4.ADDRESS[1]: 192.168.179.29/24
    IP4.GATEWAY: 192.168.179.1
    IP4.DNS[1]: 192.168.179.1
    DHCP4.OPTION[1]: dhcp_rebinding_time = 18900
    DHCP4.OPTION[2]: requested_domain_search = 1
    DHCP4.OPTION[3]: requested_host_name = 1
    DHCP4.OPTION[4]: requested_time_offset = 1
    DHCP4.OPTION[5]: requested_domain_name = 1
    DHCP4.OPTION[6]: requested_rfc3442_classless_static_routes = 1
    DHCP4.OPTION[7]: requested_broadcast_address = 1
    DHCP4.OPTION[8]: requested_wpad = 1
    DHCP4.OPTION[9]: requested_netbios_scope = 1
    DHCP4.OPTION[10]: next_server = 192.168.179.1
    DHCP4.OPTION[11]: expiry = 1565621653
    DHCP4.OPTION[12]: requested_interface_mtu = 1
    DHCP4.OPTION[13]: requested_subnet_mask = 1
    DHCP4.OPTION[14]: routers = 192.168.179.1
    DHCP4.OPTION[15]: dhcp_message_type = 5
    DHCP4.OPTION[16]: ip_address = 192.168.179.29
    DHCP4.OPTION[17]: broadcast_address = 192.168.179.255
    DHCP4.OPTION[18]: requested_static_routes = 1
    DHCP4.OPTION[19]: dhcp_renewal_time = 10800
    DHCP4.OPTION[20]: requested_domain_name_servers = 1
    DHCP4.OPTION[21]: requested_ms_classless_static_routes = 1
    DHCP4.OPTION[22]: domain_name_servers = 192.168.179.1
    DHCP4.OPTION[23]: subnet_mask = 255.255.255.0
    DHCP4.OPTION[24]: dhcp_lease_time = 21600
    DHCP4.OPTION[25]: requested_ntp_servers = 1
    DHCP4.OPTION[26]: requested_netbios_name_servers = 1
    DHCP4.OPTION[27]: ntp_servers = 192.168.179.1
    DHCP4.OPTION[28]: network_number = 192.168.179.0
    DHCP4.OPTION[29]: requested_routers = 1
    DHCP4.OPTION[30]: dhcp_server_identifier = 192.168.179.1
    IP6.ADDRESS[1]: fd00::1:79ff:2a88:6b89:f5a3/64
    IP6.ADDRESS[2]: fd00::1:53f4:ea8b:a2c6:88bc/64
    IP6.ADDRESS[3]: fe80::42af:506a:16:1256/64
    IP6.GATEWAY:
    IP6.ROUTE[1]: dst = fd00:0:0:1::/64, nh = fe80::9a9b:cbff:fe54:c457, mt = 600
    IP6.DNS[1]: fd00::1:9a9b:cbff:fe54:c457
    DHCP6.OPTION[1]: requested_dhcp6_domain_search = 1
    DHCP6.OPTION[2]: dhcp6_name_servers = fd00::1:9a9b:cbff:fe54:c457
    DHCP6.OPTION[3]: dhcp6_server_id = 0:3:0:1:98:9b:cb:54:c4:57
    DHCP6.OPTION[4]: requested_dhcp6_client_id = 1
    DHCP6.OPTION[5]: requested_dhcp6_name_servers = 1
    DHCP6.OPTION[6]: dhcp6_client_id = 0:4:cd:4c:df:d9:4d:62:c6:97:e1:a2:ed:b7:68:6a:be:9c


Notice all the GENERAL. entries, including GENERAL.STATE Activated and entries for DBUS-PATH and CON-PATH so I'm lead to believe this is what is causing the connection to not auto-connect, but I don't really know where to go from here.



I need to:



  • be able to create the profile out of range of the network

  • have it auto-connect when it's in range.

  • use NetworkManager

How do i proceed from here?










share|improve this question




























  • thanks for the tidyup @Fabby In theory I could set a cron job to constantly try and bring the connection up using nmcli but in reality not practical. These are boxes with no active user login where the wifi(as a hotspot) comes to them with a support engineer. Another workaround of course is to make sure the ESSID is there at build time, again there are reasons of practicality why this cannot be ensured. Ideally I'd like to identify the root cause though, but failing that I will look at any and all workarounds

    – cim
    Aug 13 at 6:22











  • @Fabby Ah right. That is exactly what I do. The nmcli commands from the profile creation above are taken from an ansible playbook that is used to build. The problem is the same, if the ESSID is not present at build (which it is not) then they will not connect when it is available.

    – cim
    Aug 13 at 12:53











  • Answer and comments deleted. No further ideas, sorry.

    – Fabby
    Aug 19 at 17:49

















3

















As part of an automated build process for Ubuntu 16.04 servers, I use nmcli to create network profiles, including wireless. This is on headless systems without window manager FWIW.



I have noticed that when I create a profile and activate it, if the access point (AP) is not there at activation it will never auto-connect, regardless if it is available subsequently.



I've tried to narrow down the cause of the problem and believe it might be something to do with dbus registration.



Profile creation:



sudo nmcli con add con-name "aNetwork" ifname wlp2s0 type wifi ssid "aNetwork"
sudo nmcli con modify "aNetwork" wifi-sec.key-mgmt wpa-psk
sudo nmcli con modify "aNetwork" wifi-sec.psk aPassword
sudo nmcli con up id "aNetwork"


From syslog, it seems it adds it correctly and sets it to scanning:



ug 12 08:55:06 bacer-104 NetworkManager[585]: <info> [1565600106.4111] Config: added 'ssid' value 'aNetwork'
Aug 12 08:55:06 bacer-104 NetworkManager[585]: <info> [1565600106.4111] Config: added 'scan_ssid' value '1'
Aug 12 08:55:06 bacer-104 NetworkManager[585]: <info> [1565600106.4112] Config: added 'key_mgmt' value 'WPA-PSK'
Aug 12 08:55:06 bacer-104 NetworkManager[585]: <info> [1565600106.4112] Config: added 'psk' value '<omitted>'
Aug 12 08:55:06 bacer-104 NetworkManager[585]: <info> [1565600106.4128] sup-iface[0x1b0ff90,wlp2s0]: config: set interface ap_scan to 1


However after I make the AP visible, it never scans/connects, but when the connection is activated when the ESSID was present at creation, I get the following entry:



NetworkManager[489]: <debug> [1565287017.8330] device[0x1fb95f0] (wlp2s0): add_pending_action (3): 'scan'


But when the connection is activated *and the ESSID was not present at creation I get this:



NetworkManager[489]: <debug> [1565287064.3891] device[0x1fb95f0] (wlp2s0): add_pending_action (1): 'scan'
NetworkManager[489]: <debug> [1565287065.4580] device[0x1fb95f0] (wlp2s0): remove_pending_action (0): 'scan'


The contents of /etc/NetworkManager/system-connection/aNetwork are:



[connection]
id=aNetwork
uuid=6f24046b-b265-46d5-b89f-59ec802ce0af
type=wifi
interface-name=wlp2s0
permissions=
secondaries=

[wifi]
mac-address-blacklist=
mac-address-randomization=0
seen-bssids=
ssid=aNetwork

[wifi-security]
group=
key-mgmt=wpa-psk
pairwise=
proto=
psk=aPassword

[ipv4]
dns-search=
method=auto

[ipv6]
addr-gen-mode=stable-privacy
dns-search=
method=auto


I have diffed the contents between profiles created where theESSID are both present and absent and there is no difference.



Looking at the output of nmcli con show aNetwork between the two shows a big difference:




  1. The output when disconnected, no ESSID at creation/activation is:



    connection.id: aNetwork
    connection.uuid: 9dfacadb-f52a-453b-b6f1-2fbae6426d79
    connection.interface-name: wlp2s0
    connection.type: 802-11-wireless
    connection.autoconnect: yes
    connection.autoconnect-priority: 0
    connection.timestamp: 0
    connection.read-only: no
    connection.permissions:
    connection.zone: --
    connection.master: --
    connection.slave-type: --
    connection.autoconnect-slaves: -1 (default)
    connection.secondaries:
    connection.gateway-ping-timeout: 0
    connection.metered: unknown
    connection.lldp: -1 (default)
    802-11-wireless.ssid: aNetwork
    802-11-wireless.mode: --
    802-11-wireless.band: --
    802-11-wireless.channel: 0
    802-11-wireless.bssid: --
    802-11-wireless.rate: 0
    802-11-wireless.tx-power: 0
    802-11-wireless.mac-address: --
    802-11-wireless.cloned-mac-address: --
    802-11-wireless.mac-address-blacklist:
    802-11-wireless.mac-address-randomization:default
    802-11-wireless.mtu: auto
    802-11-wireless.seen-bssids:
    802-11-wireless.hidden: no
    802-11-wireless.powersave: default (0)
    802-11-wireless-security.key-mgmt: wpa-psk
    802-11-wireless-security.wep-tx-keyidx: 0
    802-11-wireless-security.auth-alg: --
    802-11-wireless-security.proto:
    802-11-wireless-security.pairwise:
    802-11-wireless-security.group:
    802-11-wireless-security.leap-username: --
    802-11-wireless-security.wep-key0: <hidden>
    802-11-wireless-security.wep-key1: <hidden>
    802-11-wireless-security.wep-key2: <hidden>
    802-11-wireless-security.wep-key3: <hidden>
    802-11-wireless-security.wep-key-flags: 0 (none)
    802-11-wireless-security.wep-key-type: 0 (unknown)
    802-11-wireless-security.psk: <hidden>
    802-11-wireless-security.psk-flags: 0 (none)
    802-11-wireless-security.leap-password: <hidden>
    802-11-wireless-security.leap-password-flags:0 (none)
    ipv4.method: auto
    ipv4.dns:
    ipv4.dns-search:
    ipv4.dns-options: (default)
    ipv4.dns-priority: 0
    ipv4.addresses:
    ipv4.gateway: --
    ipv4.routes:
    ipv4.route-metric: -1
    ipv4.ignore-auto-routes: no
    ipv4.ignore-auto-dns: no
    ipv4.dhcp-client-id: --
    ipv4.dhcp-timeout: 0
    ipv4.dhcp-send-hostname: yes
    ipv4.dhcp-hostname: --
    ipv4.dhcp-fqdn: --
    ipv4.never-default: no
    ipv4.may-fail: yes
    ipv4.dad-timeout: -1 (default)
    ipv6.method: auto
    ipv6.dns:
    ipv6.dns-search:
    ipv6.dns-options: (default)
    ipv6.dns-priority: 0
    ipv6.addresses:
    ipv6.gateway: --
    ipv6.routes:
    ipv6.route-metric: -1
    ipv6.ignore-auto-routes: no
    ipv6.ignore-auto-dns: no
    ipv6.never-default: no
    ipv6.may-fail: yes
    ipv6.ip6-privacy: -1 (unknown)
    ipv6.addr-gen-mode: stable-privacy
    ipv6.dhcp-send-hostname: yes
    ipv6.dhcp-hostname: --



  2. The output when disconnected, and the ESSID is present at creation/activation is:



    connection.id: aNetwork
    connection.uuid: 10d2d80a-4f64-4466-9e4e-6190e4628d45
    connection.interface-name: wlp2s0
    connection.type: 802-11-wireless
    connection.autoconnect: yes
    connection.autoconnect-priority: 0
    connection.timestamp: 1565600053
    connection.read-only: no
    connection.permissions:
    connection.zone: --
    connection.master: --
    connection.slave-type: --
    connection.autoconnect-slaves: -1 (default)
    connection.secondaries:
    connection.gateway-ping-timeout: 0
    connection.metered: unknown
    connection.lldp: -1 (default)
    802-11-wireless.ssid: aNetwork
    802-11-wireless.mode: --
    802-11-wireless.band: --
    802-11-wireless.channel: 0
    802-11-wireless.bssid: --
    802-11-wireless.rate: 0
    802-11-wireless.tx-power: 0
    802-11-wireless.mac-address: --
    802-11-wireless.cloned-mac-address: --
    802-11-wireless.mac-address-blacklist:
    802-11-wireless.mac-address-randomization:default
    802-11-wireless.mtu: auto
    802-11-wireless.seen-bssids: 9A:9B:CB:54:C4:5A
    802-11-wireless.hidden: no
    802-11-wireless.powersave: default (0)
    802-11-wireless-security.key-mgmt: wpa-psk
    802-11-wireless-security.wep-tx-keyidx: 0
    802-11-wireless-security.auth-alg: --
    802-11-wireless-security.proto:
    802-11-wireless-security.pairwise:
    802-11-wireless-security.group:
    802-11-wireless-security.leap-username: --
    802-11-wireless-security.wep-key0: <hidden>
    802-11-wireless-security.wep-key1: <hidden>
    802-11-wireless-security.wep-key2: <hidden>
    802-11-wireless-security.wep-key3: <hidden>
    802-11-wireless-security.wep-key-flags: 0 (none)
    802-11-wireless-security.wep-key-type: 0 (unknown)
    802-11-wireless-security.psk: <hidden>
    802-11-wireless-security.psk-flags: 0 (none)
    802-11-wireless-security.leap-password: <hidden>
    802-11-wireless-security.leap-password-flags:0 (none)
    ipv4.method: auto
    ipv4.dns:
    ipv4.dns-search:
    ipv4.dns-options: (default)
    ipv4.dns-priority: 0
    ipv4.addresses:
    ipv4.gateway: --
    ipv4.routes:
    ipv4.route-metric: -1
    ipv4.ignore-auto-routes: no
    ipv4.ignore-auto-dns: no
    ipv4.dhcp-client-id: --
    ipv4.dhcp-timeout: 0
    ipv4.dhcp-send-hostname: yes
    ipv4.dhcp-hostname: --
    ipv4.dhcp-fqdn: --
    ipv4.never-default: no
    ipv4.may-fail: yes
    ipv4.dad-timeout: -1 (default)
    ipv6.method: auto
    ipv6.dns:
    ipv6.dns-search:
    ipv6.dns-options: (default)
    ipv6.dns-priority: 0
    ipv6.addresses:
    ipv6.gateway: --
    ipv6.routes:
    ipv6.route-metric: -1
    ipv6.ignore-auto-routes: no
    ipv6.ignore-auto-dns: no
    ipv6.never-default: no
    ipv6.may-fail: yes
    ipv6.ip6-privacy: -1 (unknown)
    ipv6.addr-gen-mode: stable-privacy
    ipv6.dhcp-send-hostname: yes
    ipv6.dhcp-hostname: --
    GENERAL.NAME: aNetwork
    GENERAL.UUID: 10d2d80a-4f64-4466-9e4e-6190e4628d45
    GENERAL.DEVICES: wlp2s0
    GENERAL.STATE: activated
    GENERAL.DEFAULT: no
    GENERAL.DEFAULT6: no
    GENERAL.VPN: no
    GENERAL.ZONE: --
    GENERAL.DBUS-PATH: /org/freedesktop/NetworkManager/ActiveConnection/15
    GENERAL.CON-PATH: /org/freedesktop/NetworkManager/Settings/11
    GENERAL.SPEC-OBJECT: /org/freedesktop/NetworkManager/AccessPoint/12
    GENERAL.MASTER-PATH: --
    IP4.ADDRESS[1]: 192.168.179.29/24
    IP4.GATEWAY: 192.168.179.1
    IP4.DNS[1]: 192.168.179.1
    DHCP4.OPTION[1]: dhcp_rebinding_time = 18900
    DHCP4.OPTION[2]: requested_domain_search = 1
    DHCP4.OPTION[3]: requested_host_name = 1
    DHCP4.OPTION[4]: requested_time_offset = 1
    DHCP4.OPTION[5]: requested_domain_name = 1
    DHCP4.OPTION[6]: requested_rfc3442_classless_static_routes = 1
    DHCP4.OPTION[7]: requested_broadcast_address = 1
    DHCP4.OPTION[8]: requested_wpad = 1
    DHCP4.OPTION[9]: requested_netbios_scope = 1
    DHCP4.OPTION[10]: next_server = 192.168.179.1
    DHCP4.OPTION[11]: expiry = 1565621653
    DHCP4.OPTION[12]: requested_interface_mtu = 1
    DHCP4.OPTION[13]: requested_subnet_mask = 1
    DHCP4.OPTION[14]: routers = 192.168.179.1
    DHCP4.OPTION[15]: dhcp_message_type = 5
    DHCP4.OPTION[16]: ip_address = 192.168.179.29
    DHCP4.OPTION[17]: broadcast_address = 192.168.179.255
    DHCP4.OPTION[18]: requested_static_routes = 1
    DHCP4.OPTION[19]: dhcp_renewal_time = 10800
    DHCP4.OPTION[20]: requested_domain_name_servers = 1
    DHCP4.OPTION[21]: requested_ms_classless_static_routes = 1
    DHCP4.OPTION[22]: domain_name_servers = 192.168.179.1
    DHCP4.OPTION[23]: subnet_mask = 255.255.255.0
    DHCP4.OPTION[24]: dhcp_lease_time = 21600
    DHCP4.OPTION[25]: requested_ntp_servers = 1
    DHCP4.OPTION[26]: requested_netbios_name_servers = 1
    DHCP4.OPTION[27]: ntp_servers = 192.168.179.1
    DHCP4.OPTION[28]: network_number = 192.168.179.0
    DHCP4.OPTION[29]: requested_routers = 1
    DHCP4.OPTION[30]: dhcp_server_identifier = 192.168.179.1
    IP6.ADDRESS[1]: fd00::1:79ff:2a88:6b89:f5a3/64
    IP6.ADDRESS[2]: fd00::1:53f4:ea8b:a2c6:88bc/64
    IP6.ADDRESS[3]: fe80::42af:506a:16:1256/64
    IP6.GATEWAY:
    IP6.ROUTE[1]: dst = fd00:0:0:1::/64, nh = fe80::9a9b:cbff:fe54:c457, mt = 600
    IP6.DNS[1]: fd00::1:9a9b:cbff:fe54:c457
    DHCP6.OPTION[1]: requested_dhcp6_domain_search = 1
    DHCP6.OPTION[2]: dhcp6_name_servers = fd00::1:9a9b:cbff:fe54:c457
    DHCP6.OPTION[3]: dhcp6_server_id = 0:3:0:1:98:9b:cb:54:c4:57
    DHCP6.OPTION[4]: requested_dhcp6_client_id = 1
    DHCP6.OPTION[5]: requested_dhcp6_name_servers = 1
    DHCP6.OPTION[6]: dhcp6_client_id = 0:4:cd:4c:df:d9:4d:62:c6:97:e1:a2:ed:b7:68:6a:be:9c


Notice all the GENERAL. entries, including GENERAL.STATE Activated and entries for DBUS-PATH and CON-PATH so I'm lead to believe this is what is causing the connection to not auto-connect, but I don't really know where to go from here.



I need to:



  • be able to create the profile out of range of the network

  • have it auto-connect when it's in range.

  • use NetworkManager

How do i proceed from here?










share|improve this question




























  • thanks for the tidyup @Fabby In theory I could set a cron job to constantly try and bring the connection up using nmcli but in reality not practical. These are boxes with no active user login where the wifi(as a hotspot) comes to them with a support engineer. Another workaround of course is to make sure the ESSID is there at build time, again there are reasons of practicality why this cannot be ensured. Ideally I'd like to identify the root cause though, but failing that I will look at any and all workarounds

    – cim
    Aug 13 at 6:22











  • @Fabby Ah right. That is exactly what I do. The nmcli commands from the profile creation above are taken from an ansible playbook that is used to build. The problem is the same, if the ESSID is not present at build (which it is not) then they will not connect when it is available.

    – cim
    Aug 13 at 12:53











  • Answer and comments deleted. No further ideas, sorry.

    – Fabby
    Aug 19 at 17:49













3












3








3








As part of an automated build process for Ubuntu 16.04 servers, I use nmcli to create network profiles, including wireless. This is on headless systems without window manager FWIW.



I have noticed that when I create a profile and activate it, if the access point (AP) is not there at activation it will never auto-connect, regardless if it is available subsequently.



I've tried to narrow down the cause of the problem and believe it might be something to do with dbus registration.



Profile creation:



sudo nmcli con add con-name "aNetwork" ifname wlp2s0 type wifi ssid "aNetwork"
sudo nmcli con modify "aNetwork" wifi-sec.key-mgmt wpa-psk
sudo nmcli con modify "aNetwork" wifi-sec.psk aPassword
sudo nmcli con up id "aNetwork"


From syslog, it seems it adds it correctly and sets it to scanning:



ug 12 08:55:06 bacer-104 NetworkManager[585]: <info> [1565600106.4111] Config: added 'ssid' value 'aNetwork'
Aug 12 08:55:06 bacer-104 NetworkManager[585]: <info> [1565600106.4111] Config: added 'scan_ssid' value '1'
Aug 12 08:55:06 bacer-104 NetworkManager[585]: <info> [1565600106.4112] Config: added 'key_mgmt' value 'WPA-PSK'
Aug 12 08:55:06 bacer-104 NetworkManager[585]: <info> [1565600106.4112] Config: added 'psk' value '<omitted>'
Aug 12 08:55:06 bacer-104 NetworkManager[585]: <info> [1565600106.4128] sup-iface[0x1b0ff90,wlp2s0]: config: set interface ap_scan to 1


However after I make the AP visible, it never scans/connects, but when the connection is activated when the ESSID was present at creation, I get the following entry:



NetworkManager[489]: <debug> [1565287017.8330] device[0x1fb95f0] (wlp2s0): add_pending_action (3): 'scan'


But when the connection is activated *and the ESSID was not present at creation I get this:



NetworkManager[489]: <debug> [1565287064.3891] device[0x1fb95f0] (wlp2s0): add_pending_action (1): 'scan'
NetworkManager[489]: <debug> [1565287065.4580] device[0x1fb95f0] (wlp2s0): remove_pending_action (0): 'scan'


The contents of /etc/NetworkManager/system-connection/aNetwork are:



[connection]
id=aNetwork
uuid=6f24046b-b265-46d5-b89f-59ec802ce0af
type=wifi
interface-name=wlp2s0
permissions=
secondaries=

[wifi]
mac-address-blacklist=
mac-address-randomization=0
seen-bssids=
ssid=aNetwork

[wifi-security]
group=
key-mgmt=wpa-psk
pairwise=
proto=
psk=aPassword

[ipv4]
dns-search=
method=auto

[ipv6]
addr-gen-mode=stable-privacy
dns-search=
method=auto


I have diffed the contents between profiles created where theESSID are both present and absent and there is no difference.



Looking at the output of nmcli con show aNetwork between the two shows a big difference:




  1. The output when disconnected, no ESSID at creation/activation is:



    connection.id: aNetwork
    connection.uuid: 9dfacadb-f52a-453b-b6f1-2fbae6426d79
    connection.interface-name: wlp2s0
    connection.type: 802-11-wireless
    connection.autoconnect: yes
    connection.autoconnect-priority: 0
    connection.timestamp: 0
    connection.read-only: no
    connection.permissions:
    connection.zone: --
    connection.master: --
    connection.slave-type: --
    connection.autoconnect-slaves: -1 (default)
    connection.secondaries:
    connection.gateway-ping-timeout: 0
    connection.metered: unknown
    connection.lldp: -1 (default)
    802-11-wireless.ssid: aNetwork
    802-11-wireless.mode: --
    802-11-wireless.band: --
    802-11-wireless.channel: 0
    802-11-wireless.bssid: --
    802-11-wireless.rate: 0
    802-11-wireless.tx-power: 0
    802-11-wireless.mac-address: --
    802-11-wireless.cloned-mac-address: --
    802-11-wireless.mac-address-blacklist:
    802-11-wireless.mac-address-randomization:default
    802-11-wireless.mtu: auto
    802-11-wireless.seen-bssids:
    802-11-wireless.hidden: no
    802-11-wireless.powersave: default (0)
    802-11-wireless-security.key-mgmt: wpa-psk
    802-11-wireless-security.wep-tx-keyidx: 0
    802-11-wireless-security.auth-alg: --
    802-11-wireless-security.proto:
    802-11-wireless-security.pairwise:
    802-11-wireless-security.group:
    802-11-wireless-security.leap-username: --
    802-11-wireless-security.wep-key0: <hidden>
    802-11-wireless-security.wep-key1: <hidden>
    802-11-wireless-security.wep-key2: <hidden>
    802-11-wireless-security.wep-key3: <hidden>
    802-11-wireless-security.wep-key-flags: 0 (none)
    802-11-wireless-security.wep-key-type: 0 (unknown)
    802-11-wireless-security.psk: <hidden>
    802-11-wireless-security.psk-flags: 0 (none)
    802-11-wireless-security.leap-password: <hidden>
    802-11-wireless-security.leap-password-flags:0 (none)
    ipv4.method: auto
    ipv4.dns:
    ipv4.dns-search:
    ipv4.dns-options: (default)
    ipv4.dns-priority: 0
    ipv4.addresses:
    ipv4.gateway: --
    ipv4.routes:
    ipv4.route-metric: -1
    ipv4.ignore-auto-routes: no
    ipv4.ignore-auto-dns: no
    ipv4.dhcp-client-id: --
    ipv4.dhcp-timeout: 0
    ipv4.dhcp-send-hostname: yes
    ipv4.dhcp-hostname: --
    ipv4.dhcp-fqdn: --
    ipv4.never-default: no
    ipv4.may-fail: yes
    ipv4.dad-timeout: -1 (default)
    ipv6.method: auto
    ipv6.dns:
    ipv6.dns-search:
    ipv6.dns-options: (default)
    ipv6.dns-priority: 0
    ipv6.addresses:
    ipv6.gateway: --
    ipv6.routes:
    ipv6.route-metric: -1
    ipv6.ignore-auto-routes: no
    ipv6.ignore-auto-dns: no
    ipv6.never-default: no
    ipv6.may-fail: yes
    ipv6.ip6-privacy: -1 (unknown)
    ipv6.addr-gen-mode: stable-privacy
    ipv6.dhcp-send-hostname: yes
    ipv6.dhcp-hostname: --



  2. The output when disconnected, and the ESSID is present at creation/activation is:



    connection.id: aNetwork
    connection.uuid: 10d2d80a-4f64-4466-9e4e-6190e4628d45
    connection.interface-name: wlp2s0
    connection.type: 802-11-wireless
    connection.autoconnect: yes
    connection.autoconnect-priority: 0
    connection.timestamp: 1565600053
    connection.read-only: no
    connection.permissions:
    connection.zone: --
    connection.master: --
    connection.slave-type: --
    connection.autoconnect-slaves: -1 (default)
    connection.secondaries:
    connection.gateway-ping-timeout: 0
    connection.metered: unknown
    connection.lldp: -1 (default)
    802-11-wireless.ssid: aNetwork
    802-11-wireless.mode: --
    802-11-wireless.band: --
    802-11-wireless.channel: 0
    802-11-wireless.bssid: --
    802-11-wireless.rate: 0
    802-11-wireless.tx-power: 0
    802-11-wireless.mac-address: --
    802-11-wireless.cloned-mac-address: --
    802-11-wireless.mac-address-blacklist:
    802-11-wireless.mac-address-randomization:default
    802-11-wireless.mtu: auto
    802-11-wireless.seen-bssids: 9A:9B:CB:54:C4:5A
    802-11-wireless.hidden: no
    802-11-wireless.powersave: default (0)
    802-11-wireless-security.key-mgmt: wpa-psk
    802-11-wireless-security.wep-tx-keyidx: 0
    802-11-wireless-security.auth-alg: --
    802-11-wireless-security.proto:
    802-11-wireless-security.pairwise:
    802-11-wireless-security.group:
    802-11-wireless-security.leap-username: --
    802-11-wireless-security.wep-key0: <hidden>
    802-11-wireless-security.wep-key1: <hidden>
    802-11-wireless-security.wep-key2: <hidden>
    802-11-wireless-security.wep-key3: <hidden>
    802-11-wireless-security.wep-key-flags: 0 (none)
    802-11-wireless-security.wep-key-type: 0 (unknown)
    802-11-wireless-security.psk: <hidden>
    802-11-wireless-security.psk-flags: 0 (none)
    802-11-wireless-security.leap-password: <hidden>
    802-11-wireless-security.leap-password-flags:0 (none)
    ipv4.method: auto
    ipv4.dns:
    ipv4.dns-search:
    ipv4.dns-options: (default)
    ipv4.dns-priority: 0
    ipv4.addresses:
    ipv4.gateway: --
    ipv4.routes:
    ipv4.route-metric: -1
    ipv4.ignore-auto-routes: no
    ipv4.ignore-auto-dns: no
    ipv4.dhcp-client-id: --
    ipv4.dhcp-timeout: 0
    ipv4.dhcp-send-hostname: yes
    ipv4.dhcp-hostname: --
    ipv4.dhcp-fqdn: --
    ipv4.never-default: no
    ipv4.may-fail: yes
    ipv4.dad-timeout: -1 (default)
    ipv6.method: auto
    ipv6.dns:
    ipv6.dns-search:
    ipv6.dns-options: (default)
    ipv6.dns-priority: 0
    ipv6.addresses:
    ipv6.gateway: --
    ipv6.routes:
    ipv6.route-metric: -1
    ipv6.ignore-auto-routes: no
    ipv6.ignore-auto-dns: no
    ipv6.never-default: no
    ipv6.may-fail: yes
    ipv6.ip6-privacy: -1 (unknown)
    ipv6.addr-gen-mode: stable-privacy
    ipv6.dhcp-send-hostname: yes
    ipv6.dhcp-hostname: --
    GENERAL.NAME: aNetwork
    GENERAL.UUID: 10d2d80a-4f64-4466-9e4e-6190e4628d45
    GENERAL.DEVICES: wlp2s0
    GENERAL.STATE: activated
    GENERAL.DEFAULT: no
    GENERAL.DEFAULT6: no
    GENERAL.VPN: no
    GENERAL.ZONE: --
    GENERAL.DBUS-PATH: /org/freedesktop/NetworkManager/ActiveConnection/15
    GENERAL.CON-PATH: /org/freedesktop/NetworkManager/Settings/11
    GENERAL.SPEC-OBJECT: /org/freedesktop/NetworkManager/AccessPoint/12
    GENERAL.MASTER-PATH: --
    IP4.ADDRESS[1]: 192.168.179.29/24
    IP4.GATEWAY: 192.168.179.1
    IP4.DNS[1]: 192.168.179.1
    DHCP4.OPTION[1]: dhcp_rebinding_time = 18900
    DHCP4.OPTION[2]: requested_domain_search = 1
    DHCP4.OPTION[3]: requested_host_name = 1
    DHCP4.OPTION[4]: requested_time_offset = 1
    DHCP4.OPTION[5]: requested_domain_name = 1
    DHCP4.OPTION[6]: requested_rfc3442_classless_static_routes = 1
    DHCP4.OPTION[7]: requested_broadcast_address = 1
    DHCP4.OPTION[8]: requested_wpad = 1
    DHCP4.OPTION[9]: requested_netbios_scope = 1
    DHCP4.OPTION[10]: next_server = 192.168.179.1
    DHCP4.OPTION[11]: expiry = 1565621653
    DHCP4.OPTION[12]: requested_interface_mtu = 1
    DHCP4.OPTION[13]: requested_subnet_mask = 1
    DHCP4.OPTION[14]: routers = 192.168.179.1
    DHCP4.OPTION[15]: dhcp_message_type = 5
    DHCP4.OPTION[16]: ip_address = 192.168.179.29
    DHCP4.OPTION[17]: broadcast_address = 192.168.179.255
    DHCP4.OPTION[18]: requested_static_routes = 1
    DHCP4.OPTION[19]: dhcp_renewal_time = 10800
    DHCP4.OPTION[20]: requested_domain_name_servers = 1
    DHCP4.OPTION[21]: requested_ms_classless_static_routes = 1
    DHCP4.OPTION[22]: domain_name_servers = 192.168.179.1
    DHCP4.OPTION[23]: subnet_mask = 255.255.255.0
    DHCP4.OPTION[24]: dhcp_lease_time = 21600
    DHCP4.OPTION[25]: requested_ntp_servers = 1
    DHCP4.OPTION[26]: requested_netbios_name_servers = 1
    DHCP4.OPTION[27]: ntp_servers = 192.168.179.1
    DHCP4.OPTION[28]: network_number = 192.168.179.0
    DHCP4.OPTION[29]: requested_routers = 1
    DHCP4.OPTION[30]: dhcp_server_identifier = 192.168.179.1
    IP6.ADDRESS[1]: fd00::1:79ff:2a88:6b89:f5a3/64
    IP6.ADDRESS[2]: fd00::1:53f4:ea8b:a2c6:88bc/64
    IP6.ADDRESS[3]: fe80::42af:506a:16:1256/64
    IP6.GATEWAY:
    IP6.ROUTE[1]: dst = fd00:0:0:1::/64, nh = fe80::9a9b:cbff:fe54:c457, mt = 600
    IP6.DNS[1]: fd00::1:9a9b:cbff:fe54:c457
    DHCP6.OPTION[1]: requested_dhcp6_domain_search = 1
    DHCP6.OPTION[2]: dhcp6_name_servers = fd00::1:9a9b:cbff:fe54:c457
    DHCP6.OPTION[3]: dhcp6_server_id = 0:3:0:1:98:9b:cb:54:c4:57
    DHCP6.OPTION[4]: requested_dhcp6_client_id = 1
    DHCP6.OPTION[5]: requested_dhcp6_name_servers = 1
    DHCP6.OPTION[6]: dhcp6_client_id = 0:4:cd:4c:df:d9:4d:62:c6:97:e1:a2:ed:b7:68:6a:be:9c


Notice all the GENERAL. entries, including GENERAL.STATE Activated and entries for DBUS-PATH and CON-PATH so I'm lead to believe this is what is causing the connection to not auto-connect, but I don't really know where to go from here.



I need to:



  • be able to create the profile out of range of the network

  • have it auto-connect when it's in range.

  • use NetworkManager

How do i proceed from here?










share|improve this question

















As part of an automated build process for Ubuntu 16.04 servers, I use nmcli to create network profiles, including wireless. This is on headless systems without window manager FWIW.



I have noticed that when I create a profile and activate it, if the access point (AP) is not there at activation it will never auto-connect, regardless if it is available subsequently.



I've tried to narrow down the cause of the problem and believe it might be something to do with dbus registration.



Profile creation:



sudo nmcli con add con-name "aNetwork" ifname wlp2s0 type wifi ssid "aNetwork"
sudo nmcli con modify "aNetwork" wifi-sec.key-mgmt wpa-psk
sudo nmcli con modify "aNetwork" wifi-sec.psk aPassword
sudo nmcli con up id "aNetwork"


From syslog, it seems it adds it correctly and sets it to scanning:



ug 12 08:55:06 bacer-104 NetworkManager[585]: <info> [1565600106.4111] Config: added 'ssid' value 'aNetwork'
Aug 12 08:55:06 bacer-104 NetworkManager[585]: <info> [1565600106.4111] Config: added 'scan_ssid' value '1'
Aug 12 08:55:06 bacer-104 NetworkManager[585]: <info> [1565600106.4112] Config: added 'key_mgmt' value 'WPA-PSK'
Aug 12 08:55:06 bacer-104 NetworkManager[585]: <info> [1565600106.4112] Config: added 'psk' value '<omitted>'
Aug 12 08:55:06 bacer-104 NetworkManager[585]: <info> [1565600106.4128] sup-iface[0x1b0ff90,wlp2s0]: config: set interface ap_scan to 1


However after I make the AP visible, it never scans/connects, but when the connection is activated when the ESSID was present at creation, I get the following entry:



NetworkManager[489]: <debug> [1565287017.8330] device[0x1fb95f0] (wlp2s0): add_pending_action (3): 'scan'


But when the connection is activated *and the ESSID was not present at creation I get this:



NetworkManager[489]: <debug> [1565287064.3891] device[0x1fb95f0] (wlp2s0): add_pending_action (1): 'scan'
NetworkManager[489]: <debug> [1565287065.4580] device[0x1fb95f0] (wlp2s0): remove_pending_action (0): 'scan'


The contents of /etc/NetworkManager/system-connection/aNetwork are:



[connection]
id=aNetwork
uuid=6f24046b-b265-46d5-b89f-59ec802ce0af
type=wifi
interface-name=wlp2s0
permissions=
secondaries=

[wifi]
mac-address-blacklist=
mac-address-randomization=0
seen-bssids=
ssid=aNetwork

[wifi-security]
group=
key-mgmt=wpa-psk
pairwise=
proto=
psk=aPassword

[ipv4]
dns-search=
method=auto

[ipv6]
addr-gen-mode=stable-privacy
dns-search=
method=auto


I have diffed the contents between profiles created where theESSID are both present and absent and there is no difference.



Looking at the output of nmcli con show aNetwork between the two shows a big difference:




  1. The output when disconnected, no ESSID at creation/activation is:



    connection.id: aNetwork
    connection.uuid: 9dfacadb-f52a-453b-b6f1-2fbae6426d79
    connection.interface-name: wlp2s0
    connection.type: 802-11-wireless
    connection.autoconnect: yes
    connection.autoconnect-priority: 0
    connection.timestamp: 0
    connection.read-only: no
    connection.permissions:
    connection.zone: --
    connection.master: --
    connection.slave-type: --
    connection.autoconnect-slaves: -1 (default)
    connection.secondaries:
    connection.gateway-ping-timeout: 0
    connection.metered: unknown
    connection.lldp: -1 (default)
    802-11-wireless.ssid: aNetwork
    802-11-wireless.mode: --
    802-11-wireless.band: --
    802-11-wireless.channel: 0
    802-11-wireless.bssid: --
    802-11-wireless.rate: 0
    802-11-wireless.tx-power: 0
    802-11-wireless.mac-address: --
    802-11-wireless.cloned-mac-address: --
    802-11-wireless.mac-address-blacklist:
    802-11-wireless.mac-address-randomization:default
    802-11-wireless.mtu: auto
    802-11-wireless.seen-bssids:
    802-11-wireless.hidden: no
    802-11-wireless.powersave: default (0)
    802-11-wireless-security.key-mgmt: wpa-psk
    802-11-wireless-security.wep-tx-keyidx: 0
    802-11-wireless-security.auth-alg: --
    802-11-wireless-security.proto:
    802-11-wireless-security.pairwise:
    802-11-wireless-security.group:
    802-11-wireless-security.leap-username: --
    802-11-wireless-security.wep-key0: <hidden>
    802-11-wireless-security.wep-key1: <hidden>
    802-11-wireless-security.wep-key2: <hidden>
    802-11-wireless-security.wep-key3: <hidden>
    802-11-wireless-security.wep-key-flags: 0 (none)
    802-11-wireless-security.wep-key-type: 0 (unknown)
    802-11-wireless-security.psk: <hidden>
    802-11-wireless-security.psk-flags: 0 (none)
    802-11-wireless-security.leap-password: <hidden>
    802-11-wireless-security.leap-password-flags:0 (none)
    ipv4.method: auto
    ipv4.dns:
    ipv4.dns-search:
    ipv4.dns-options: (default)
    ipv4.dns-priority: 0
    ipv4.addresses:
    ipv4.gateway: --
    ipv4.routes:
    ipv4.route-metric: -1
    ipv4.ignore-auto-routes: no
    ipv4.ignore-auto-dns: no
    ipv4.dhcp-client-id: --
    ipv4.dhcp-timeout: 0
    ipv4.dhcp-send-hostname: yes
    ipv4.dhcp-hostname: --
    ipv4.dhcp-fqdn: --
    ipv4.never-default: no
    ipv4.may-fail: yes
    ipv4.dad-timeout: -1 (default)
    ipv6.method: auto
    ipv6.dns:
    ipv6.dns-search:
    ipv6.dns-options: (default)
    ipv6.dns-priority: 0
    ipv6.addresses:
    ipv6.gateway: --
    ipv6.routes:
    ipv6.route-metric: -1
    ipv6.ignore-auto-routes: no
    ipv6.ignore-auto-dns: no
    ipv6.never-default: no
    ipv6.may-fail: yes
    ipv6.ip6-privacy: -1 (unknown)
    ipv6.addr-gen-mode: stable-privacy
    ipv6.dhcp-send-hostname: yes
    ipv6.dhcp-hostname: --



  2. The output when disconnected, and the ESSID is present at creation/activation is:



    connection.id: aNetwork
    connection.uuid: 10d2d80a-4f64-4466-9e4e-6190e4628d45
    connection.interface-name: wlp2s0
    connection.type: 802-11-wireless
    connection.autoconnect: yes
    connection.autoconnect-priority: 0
    connection.timestamp: 1565600053
    connection.read-only: no
    connection.permissions:
    connection.zone: --
    connection.master: --
    connection.slave-type: --
    connection.autoconnect-slaves: -1 (default)
    connection.secondaries:
    connection.gateway-ping-timeout: 0
    connection.metered: unknown
    connection.lldp: -1 (default)
    802-11-wireless.ssid: aNetwork
    802-11-wireless.mode: --
    802-11-wireless.band: --
    802-11-wireless.channel: 0
    802-11-wireless.bssid: --
    802-11-wireless.rate: 0
    802-11-wireless.tx-power: 0
    802-11-wireless.mac-address: --
    802-11-wireless.cloned-mac-address: --
    802-11-wireless.mac-address-blacklist:
    802-11-wireless.mac-address-randomization:default
    802-11-wireless.mtu: auto
    802-11-wireless.seen-bssids: 9A:9B:CB:54:C4:5A
    802-11-wireless.hidden: no
    802-11-wireless.powersave: default (0)
    802-11-wireless-security.key-mgmt: wpa-psk
    802-11-wireless-security.wep-tx-keyidx: 0
    802-11-wireless-security.auth-alg: --
    802-11-wireless-security.proto:
    802-11-wireless-security.pairwise:
    802-11-wireless-security.group:
    802-11-wireless-security.leap-username: --
    802-11-wireless-security.wep-key0: <hidden>
    802-11-wireless-security.wep-key1: <hidden>
    802-11-wireless-security.wep-key2: <hidden>
    802-11-wireless-security.wep-key3: <hidden>
    802-11-wireless-security.wep-key-flags: 0 (none)
    802-11-wireless-security.wep-key-type: 0 (unknown)
    802-11-wireless-security.psk: <hidden>
    802-11-wireless-security.psk-flags: 0 (none)
    802-11-wireless-security.leap-password: <hidden>
    802-11-wireless-security.leap-password-flags:0 (none)
    ipv4.method: auto
    ipv4.dns:
    ipv4.dns-search:
    ipv4.dns-options: (default)
    ipv4.dns-priority: 0
    ipv4.addresses:
    ipv4.gateway: --
    ipv4.routes:
    ipv4.route-metric: -1
    ipv4.ignore-auto-routes: no
    ipv4.ignore-auto-dns: no
    ipv4.dhcp-client-id: --
    ipv4.dhcp-timeout: 0
    ipv4.dhcp-send-hostname: yes
    ipv4.dhcp-hostname: --
    ipv4.dhcp-fqdn: --
    ipv4.never-default: no
    ipv4.may-fail: yes
    ipv4.dad-timeout: -1 (default)
    ipv6.method: auto
    ipv6.dns:
    ipv6.dns-search:
    ipv6.dns-options: (default)
    ipv6.dns-priority: 0
    ipv6.addresses:
    ipv6.gateway: --
    ipv6.routes:
    ipv6.route-metric: -1
    ipv6.ignore-auto-routes: no
    ipv6.ignore-auto-dns: no
    ipv6.never-default: no
    ipv6.may-fail: yes
    ipv6.ip6-privacy: -1 (unknown)
    ipv6.addr-gen-mode: stable-privacy
    ipv6.dhcp-send-hostname: yes
    ipv6.dhcp-hostname: --
    GENERAL.NAME: aNetwork
    GENERAL.UUID: 10d2d80a-4f64-4466-9e4e-6190e4628d45
    GENERAL.DEVICES: wlp2s0
    GENERAL.STATE: activated
    GENERAL.DEFAULT: no
    GENERAL.DEFAULT6: no
    GENERAL.VPN: no
    GENERAL.ZONE: --
    GENERAL.DBUS-PATH: /org/freedesktop/NetworkManager/ActiveConnection/15
    GENERAL.CON-PATH: /org/freedesktop/NetworkManager/Settings/11
    GENERAL.SPEC-OBJECT: /org/freedesktop/NetworkManager/AccessPoint/12
    GENERAL.MASTER-PATH: --
    IP4.ADDRESS[1]: 192.168.179.29/24
    IP4.GATEWAY: 192.168.179.1
    IP4.DNS[1]: 192.168.179.1
    DHCP4.OPTION[1]: dhcp_rebinding_time = 18900
    DHCP4.OPTION[2]: requested_domain_search = 1
    DHCP4.OPTION[3]: requested_host_name = 1
    DHCP4.OPTION[4]: requested_time_offset = 1
    DHCP4.OPTION[5]: requested_domain_name = 1
    DHCP4.OPTION[6]: requested_rfc3442_classless_static_routes = 1
    DHCP4.OPTION[7]: requested_broadcast_address = 1
    DHCP4.OPTION[8]: requested_wpad = 1
    DHCP4.OPTION[9]: requested_netbios_scope = 1
    DHCP4.OPTION[10]: next_server = 192.168.179.1
    DHCP4.OPTION[11]: expiry = 1565621653
    DHCP4.OPTION[12]: requested_interface_mtu = 1
    DHCP4.OPTION[13]: requested_subnet_mask = 1
    DHCP4.OPTION[14]: routers = 192.168.179.1
    DHCP4.OPTION[15]: dhcp_message_type = 5
    DHCP4.OPTION[16]: ip_address = 192.168.179.29
    DHCP4.OPTION[17]: broadcast_address = 192.168.179.255
    DHCP4.OPTION[18]: requested_static_routes = 1
    DHCP4.OPTION[19]: dhcp_renewal_time = 10800
    DHCP4.OPTION[20]: requested_domain_name_servers = 1
    DHCP4.OPTION[21]: requested_ms_classless_static_routes = 1
    DHCP4.OPTION[22]: domain_name_servers = 192.168.179.1
    DHCP4.OPTION[23]: subnet_mask = 255.255.255.0
    DHCP4.OPTION[24]: dhcp_lease_time = 21600
    DHCP4.OPTION[25]: requested_ntp_servers = 1
    DHCP4.OPTION[26]: requested_netbios_name_servers = 1
    DHCP4.OPTION[27]: ntp_servers = 192.168.179.1
    DHCP4.OPTION[28]: network_number = 192.168.179.0
    DHCP4.OPTION[29]: requested_routers = 1
    DHCP4.OPTION[30]: dhcp_server_identifier = 192.168.179.1
    IP6.ADDRESS[1]: fd00::1:79ff:2a88:6b89:f5a3/64
    IP6.ADDRESS[2]: fd00::1:53f4:ea8b:a2c6:88bc/64
    IP6.ADDRESS[3]: fe80::42af:506a:16:1256/64
    IP6.GATEWAY:
    IP6.ROUTE[1]: dst = fd00:0:0:1::/64, nh = fe80::9a9b:cbff:fe54:c457, mt = 600
    IP6.DNS[1]: fd00::1:9a9b:cbff:fe54:c457
    DHCP6.OPTION[1]: requested_dhcp6_domain_search = 1
    DHCP6.OPTION[2]: dhcp6_name_servers = fd00::1:9a9b:cbff:fe54:c457
    DHCP6.OPTION[3]: dhcp6_server_id = 0:3:0:1:98:9b:cb:54:c4:57
    DHCP6.OPTION[4]: requested_dhcp6_client_id = 1
    DHCP6.OPTION[5]: requested_dhcp6_name_servers = 1
    DHCP6.OPTION[6]: dhcp6_client_id = 0:4:cd:4c:df:d9:4d:62:c6:97:e1:a2:ed:b7:68:6a:be:9c


Notice all the GENERAL. entries, including GENERAL.STATE Activated and entries for DBUS-PATH and CON-PATH so I'm lead to believe this is what is causing the connection to not auto-connect, but I don't really know where to go from here.



I need to:



  • be able to create the profile out of range of the network

  • have it auto-connect when it's in range.

  • use NetworkManager

How do i proceed from here?







16.04 networking network-manager






share|improve this question
















share|improve this question













share|improve this question




share|improve this question








edited Aug 12 at 20:37









Fabby

30.6k19 gold badges73 silver badges175 bronze badges




30.6k19 gold badges73 silver badges175 bronze badges










asked Aug 12 at 9:23









cimcim

333 bronze badges




333 bronze badges















  • thanks for the tidyup @Fabby In theory I could set a cron job to constantly try and bring the connection up using nmcli but in reality not practical. These are boxes with no active user login where the wifi(as a hotspot) comes to them with a support engineer. Another workaround of course is to make sure the ESSID is there at build time, again there are reasons of practicality why this cannot be ensured. Ideally I'd like to identify the root cause though, but failing that I will look at any and all workarounds

    – cim
    Aug 13 at 6:22











  • @Fabby Ah right. That is exactly what I do. The nmcli commands from the profile creation above are taken from an ansible playbook that is used to build. The problem is the same, if the ESSID is not present at build (which it is not) then they will not connect when it is available.

    – cim
    Aug 13 at 12:53











  • Answer and comments deleted. No further ideas, sorry.

    – Fabby
    Aug 19 at 17:49

















  • thanks for the tidyup @Fabby In theory I could set a cron job to constantly try and bring the connection up using nmcli but in reality not practical. These are boxes with no active user login where the wifi(as a hotspot) comes to them with a support engineer. Another workaround of course is to make sure the ESSID is there at build time, again there are reasons of practicality why this cannot be ensured. Ideally I'd like to identify the root cause though, but failing that I will look at any and all workarounds

    – cim
    Aug 13 at 6:22











  • @Fabby Ah right. That is exactly what I do. The nmcli commands from the profile creation above are taken from an ansible playbook that is used to build. The problem is the same, if the ESSID is not present at build (which it is not) then they will not connect when it is available.

    – cim
    Aug 13 at 12:53











  • Answer and comments deleted. No further ideas, sorry.

    – Fabby
    Aug 19 at 17:49
















thanks for the tidyup @Fabby In theory I could set a cron job to constantly try and bring the connection up using nmcli but in reality not practical. These are boxes with no active user login where the wifi(as a hotspot) comes to them with a support engineer. Another workaround of course is to make sure the ESSID is there at build time, again there are reasons of practicality why this cannot be ensured. Ideally I'd like to identify the root cause though, but failing that I will look at any and all workarounds

– cim
Aug 13 at 6:22





thanks for the tidyup @Fabby In theory I could set a cron job to constantly try and bring the connection up using nmcli but in reality not practical. These are boxes with no active user login where the wifi(as a hotspot) comes to them with a support engineer. Another workaround of course is to make sure the ESSID is there at build time, again there are reasons of practicality why this cannot be ensured. Ideally I'd like to identify the root cause though, but failing that I will look at any and all workarounds

– cim
Aug 13 at 6:22













@Fabby Ah right. That is exactly what I do. The nmcli commands from the profile creation above are taken from an ansible playbook that is used to build. The problem is the same, if the ESSID is not present at build (which it is not) then they will not connect when it is available.

– cim
Aug 13 at 12:53





@Fabby Ah right. That is exactly what I do. The nmcli commands from the profile creation above are taken from an ansible playbook that is used to build. The problem is the same, if the ESSID is not present at build (which it is not) then they will not connect when it is available.

– cim
Aug 13 at 12:53













Answer and comments deleted. No further ideas, sorry.

– Fabby
Aug 19 at 17:49





Answer and comments deleted. No further ideas, sorry.

– Fabby
Aug 19 at 17:49










1 Answer
1






active

oldest

votes


















2


















I ran into the same issue and after trying to debug it for a while, I went on Network Manager IRC channel and asked them directly. For Wi-Fi networks, this is intentional, the restriction comes from this check:



https://github.com/NetworkManager/NetworkManager/blob/master/src/devices/wifi/nm-device-wifi.c#L999



Quoting the comments just above the check:



 /* Don't autoconnect to networks that have been tried at least once
* but haven't been successful, since these are often accidental choices
* from the menu and the user may not know the password.
*/


The reasoning is questionable but that's what it is. If you look at /var/lib/NetworkManager/timestamps, you'll see that for the network it never connected to the timestamp value is 0. As far as I know, there is no way to change this value from D-Bus/nmcli, so you'll have to edit the file and eventually restart NetworkManager (no idea if the file is run when changed or on a periodic basis).



In my case, we're building Network Manager for an embedded distribution and have a chance to patch it in the process, so I commented out the check and it auto-connects to networks it never connected to before.






share|improve this answer


























  • Great info, thanks

    – cim
    Oct 9 at 9:25











  • Just wanted to add...finally got around to testing this and it works like a charm, thanks again

    – cim
    2 days ago












Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);














draft saved

draft discarded
















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1165133%2fnetworkmanager-will-not-autoconnect-to-wireless-if-it-is-unavailable-at-creation%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown


























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2


















I ran into the same issue and after trying to debug it for a while, I went on Network Manager IRC channel and asked them directly. For Wi-Fi networks, this is intentional, the restriction comes from this check:



https://github.com/NetworkManager/NetworkManager/blob/master/src/devices/wifi/nm-device-wifi.c#L999



Quoting the comments just above the check:



 /* Don't autoconnect to networks that have been tried at least once
* but haven't been successful, since these are often accidental choices
* from the menu and the user may not know the password.
*/


The reasoning is questionable but that's what it is. If you look at /var/lib/NetworkManager/timestamps, you'll see that for the network it never connected to the timestamp value is 0. As far as I know, there is no way to change this value from D-Bus/nmcli, so you'll have to edit the file and eventually restart NetworkManager (no idea if the file is run when changed or on a periodic basis).



In my case, we're building Network Manager for an embedded distribution and have a chance to patch it in the process, so I commented out the check and it auto-connects to networks it never connected to before.






share|improve this answer


























  • Great info, thanks

    – cim
    Oct 9 at 9:25











  • Just wanted to add...finally got around to testing this and it works like a charm, thanks again

    – cim
    2 days ago















2


















I ran into the same issue and after trying to debug it for a while, I went on Network Manager IRC channel and asked them directly. For Wi-Fi networks, this is intentional, the restriction comes from this check:



https://github.com/NetworkManager/NetworkManager/blob/master/src/devices/wifi/nm-device-wifi.c#L999



Quoting the comments just above the check:



 /* Don't autoconnect to networks that have been tried at least once
* but haven't been successful, since these are often accidental choices
* from the menu and the user may not know the password.
*/


The reasoning is questionable but that's what it is. If you look at /var/lib/NetworkManager/timestamps, you'll see that for the network it never connected to the timestamp value is 0. As far as I know, there is no way to change this value from D-Bus/nmcli, so you'll have to edit the file and eventually restart NetworkManager (no idea if the file is run when changed or on a periodic basis).



In my case, we're building Network Manager for an embedded distribution and have a chance to patch it in the process, so I commented out the check and it auto-connects to networks it never connected to before.






share|improve this answer


























  • Great info, thanks

    – cim
    Oct 9 at 9:25











  • Just wanted to add...finally got around to testing this and it works like a charm, thanks again

    – cim
    2 days ago













2














2










2









I ran into the same issue and after trying to debug it for a while, I went on Network Manager IRC channel and asked them directly. For Wi-Fi networks, this is intentional, the restriction comes from this check:



https://github.com/NetworkManager/NetworkManager/blob/master/src/devices/wifi/nm-device-wifi.c#L999



Quoting the comments just above the check:



 /* Don't autoconnect to networks that have been tried at least once
* but haven't been successful, since these are often accidental choices
* from the menu and the user may not know the password.
*/


The reasoning is questionable but that's what it is. If you look at /var/lib/NetworkManager/timestamps, you'll see that for the network it never connected to the timestamp value is 0. As far as I know, there is no way to change this value from D-Bus/nmcli, so you'll have to edit the file and eventually restart NetworkManager (no idea if the file is run when changed or on a periodic basis).



In my case, we're building Network Manager for an embedded distribution and have a chance to patch it in the process, so I commented out the check and it auto-connects to networks it never connected to before.






share|improve this answer














I ran into the same issue and after trying to debug it for a while, I went on Network Manager IRC channel and asked them directly. For Wi-Fi networks, this is intentional, the restriction comes from this check:



https://github.com/NetworkManager/NetworkManager/blob/master/src/devices/wifi/nm-device-wifi.c#L999



Quoting the comments just above the check:



 /* Don't autoconnect to networks that have been tried at least once
* but haven't been successful, since these are often accidental choices
* from the menu and the user may not know the password.
*/


The reasoning is questionable but that's what it is. If you look at /var/lib/NetworkManager/timestamps, you'll see that for the network it never connected to the timestamp value is 0. As far as I know, there is no way to change this value from D-Bus/nmcli, so you'll have to edit the file and eventually restart NetworkManager (no idea if the file is run when changed or on a periodic basis).



In my case, we're building Network Manager for an embedded distribution and have a chance to patch it in the process, so I commented out the check and it auto-connects to networks it never connected to before.







share|improve this answer













share|improve this answer




share|improve this answer










answered Oct 3 at 19:34









dkcdkc

363 bronze badges




363 bronze badges















  • Great info, thanks

    – cim
    Oct 9 at 9:25











  • Just wanted to add...finally got around to testing this and it works like a charm, thanks again

    – cim
    2 days ago

















  • Great info, thanks

    – cim
    Oct 9 at 9:25











  • Just wanted to add...finally got around to testing this and it works like a charm, thanks again

    – cim
    2 days ago
















Great info, thanks

– cim
Oct 9 at 9:25





Great info, thanks

– cim
Oct 9 at 9:25













Just wanted to add...finally got around to testing this and it works like a charm, thanks again

– cim
2 days ago





Just wanted to add...finally got around to testing this and it works like a charm, thanks again

– cim
2 days ago


















draft saved

draft discarded















































Thanks for contributing an answer to Ask Ubuntu!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1165133%2fnetworkmanager-will-not-autoconnect-to-wireless-if-it-is-unavailable-at-creation%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown









Popular posts from this blog

Tamil (spriik) Luke uk diar | Nawigatjuun

Align equal signs while including text over equalitiesAMS align: left aligned text/math plus multicolumn alignmentMultiple alignmentsAligning equations in multiple placesNumbering and aligning an equation with multiple columnsHow to align one equation with another multline equationUsing \ in environments inside the begintabularxNumber equations and preserving alignment of equal signsHow can I align equations to the left and to the right?Double equation alignment problem within align enviromentAligned within align: Why are they right-aligned?

Where does the image of a data connector as a sharp metal spike originate from?Where does the concept of infected people turning into zombies only after death originate from?Where does the motif of a reanimated human head originate?Where did the notion that Dragons could speak originate?Where does the archetypal image of the 'Grey' alien come from?Where did the suffix '-Man' originate?Where does the notion of being injured or killed by an illusion originate?Where did the term “sophont” originate?Where does the trope of magic spells being driven by advanced technology originate from?Where did the term “the living impaired” originate?