Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Network Settings not working with snap installed on Ubuntu Server 24.04 #3178

Open
benfrancis opened this issue Nov 22, 2024 · 8 comments
Open
Labels
bug snap Issues relating to the snap package
Milestone

Comments

@benfrancis
Copy link
Member

STR:

  • Install Ubuntu Server 24.04 and configure networking
  • $ sudo snap install --edge webthings-gateway
  • $ snap connect webthings-gateway:system-observe
  • $ sudo snap connect webthings-gateway:network-manager
  • $ sudo snap restart webthings-gateway
  • Load web interface, register subdomain, create user account
  • Navigate to Settings -> Network

Expected:

  • Shows current IP address(s)

Actual:

  • Displays no IP addresses

Errors in run-app.log:

2024-11-22 11:36:27.031 ERROR  : Error accessing the NetworkManager DBus interface: Error: No introspectable
2024-11-22 11:36:27.031 INFO   : Unable to detect an Ethernet IP address
2024-11-22 11:36:27.031 ERROR  : Error accessing the NetworkManager DBus interface: Error: No introspectable
2024-11-22 11:36:27.031 INFO   : Unable to detect a Wi-Fi IP address and active SSID
2024-11-22 11:36:31.150 ERROR  : Error accessing the NetworkManager DBus interface: Error: No introspectable
2024-11-22 11:36:31.150 INFO   : Unable to detect an Ethernet IP address
2024-11-22 11:36:31.151 ERROR  : Error accessing the NetworkManager DBus interface: Error: No introspectable
2024-11-22 11:36:31.152 INFO   : Unable to detect a Wi-Fi IP address and active SSID
@benfrancis benfrancis added bug snap Issues relating to the snap package labels Nov 22, 2024
@benfrancis
Copy link
Member Author

Usually the "No introspectable" error occurs if the application tries to open two connections to the DBus system bus at once, but that shouldn't be possible.

Could it be conflicting with another application on Ubuntu Server?

@benfrancis
Copy link
Member Author

Doesn't reproduce on Ubuntu Desktop 22.04 or Ubuntu Core 22 or Ubuntu Core 24.

@benfrancis benfrancis added this to the 2.0 milestone Nov 22, 2024
@GHoGit
Copy link

GHoGit commented Nov 24, 2024

I tried the install sequence above on RPI5+Core24, ref recent discussion on Matrix.

ubu-core-666@localhost:~$ sudo snap install --edge webthings-gateway

webthings-gateway (edge) 2.0.0 from WebThings (webthingsio✓) installed
ubu-core-666@localhost:~$ snap connect webthings-gateway:system-observe

ubu-core-666@localhost:~$ sudo snap connect webthings-gateway:network-manager
error: snap "snapd" has no "network-manager" interface slots

ubu-core-666@localhost:~$ sudo snap restart webthings-gateway

With proper syntax system-observe is connected, but the network-manager is not.

Still no mail after 'reclaim'. Hit 'Continue' for local access.

Log complains about system-observe, among other things:

2024-11-24 14:00:02.188 INFO : Error trying to read os-release file: Error: EACCES: permission denied, open '/var/lib/snapd/hostfs/etc/os-release'
2024-11-24 14:00:02.190 INFO : Check that the system-observe interface is connected
2024-11-24 14:00:02.696 INFO : Creating database: /root/snap/webthings-gateway/21/.webthings/log/logs.sqlite3
2024-11-24 14:00:02.709 INFO : Error trying to read os-release file: Error: EACCES: permission denied, open '/var/lib/snapd/hostfs/etc/os-release'
2024-11-24 14:00:02.709 INFO : Check that the system-observe interface is connected
2024-11-24 14:00:02.714 INFO : HTTP server listening on port 8080
..
..
2024-11-24 14:04:09.093 INFO : Checking for add-on updates...
2024-11-24 14:04:09.489 INFO : Finished updating add-ons
2024-11-24 14:07:27.813 INFO : Starting registration
2024-11-24 14:07:28.817 INFO : Sent subscription to registration server
2024-11-24 14:07:28.818 INFO : Error received from registration server: UnavailableNameReclamationPossible
..
2024-11-24 14:13:35.717 INFO : Tunnel domain not set.
2024-11-24 14:13:42.589 ERROR : Error accessing the NetworkManager DBus interface: Error: No introspectable
2024-11-24 14:13:42.589 INFO : Unable to detect an Ethernet IP address
2024-11-24 14:13:42.591 ERROR : Error accessing the NetworkManager DBus interface: Error: No introspectable
2024-11-24 14:13:42.591 INFO : Unable to detect a Wi-Fi IP address and active SSID
2024-11-24 14:13:45.441 ERROR : Error accessing the NetworkManager DBus interface: Error: No introspectable
2024-11-24 14:13:45.442 ERROR : Error getting LAN mode from Network Manager: undefined
2024-11-24 14:13:53.073 ERROR : Error accessing the NetworkManager DBus interface: Error: No introspectable
2024-11-24 14:13:53.074 INFO : Unable to detect an Ethernet IP address
2024-11-24 14:13:53.075 ERROR : Error accessing the NetworkManager DBus interface: Error: No introspectable
2024-11-24 14:13:53.075 INFO : Unable to detect a Wi-Fi IP address and active SSID
2024-11-24 14:13:54.431 ERROR : Error accessing the NetworkManager DBus interface: Error: No introspectable
2024-11-24 14:13:54.432 INFO : Unhandled Rejection
2024-11-24 14:13:54.432 ERROR : undefined
2024-11-24 14:13:59.214 ERROR : Error accessing the NetworkManager DBus interface: Error: No introspectable
2024-11-24 14:13:59.215 INFO : Unable to detect an Ethernet IP address
2024-11-24 14:13:59.215 ERROR : Error accessing the NetworkManager DBus interface: Error: No introspectable
2024-11-24 14:13:59.216 INFO : Unable to detect a Wi-Fi IP address and active SSID

@benfrancis
Copy link
Member Author

@GHoGit On Ubuntu Core you need to install the network-manager snap before connecting the network-manager interface, because it doesn't come pre-installed on Ubuntu Core.

Try installing the network-manager snap, connecting the interface and then restarting the gateway daemon:

$ snap install network-manager
$ snap connect webthings-gateway:network-manager network-manager:service
$ snap restart webthings-gateway

I've added installation instructions for both Ubuntu and Ubuntu Core to the snap listing https://snapcraft.io/webthings-gateway

@GHoGit
Copy link

GHoGit commented Nov 25, 2024

Swapped flash and tried again with Ubuntu desktop on RPI5.
Back to CoreXX later.

Attempt to install 24.10 twice without success.
Booting with tons of errors.
SD card corrupted ? 64GB Sandisk, normally well behaved.
Full reformat with SD-Formatter and repeat image write.
Same result. Something is broken with this image when applied to RPI5.

Apply quick format and install 24.04 -> boot and initial install OK.
Apply relevant snap commands according to instructions.

This time DO_NOT reclaim domain (tried reclaim again this morning, and again no mail received), but rather create new domain name for test.
Success.

Observations (some of these are known):
Domain tab -> No local access. 'Update host name' greyed.
Network tab -> Filled in and active. Local wifi 2.4 & 5 GHz access points listed.
Users tab -> Ok
Localization tab -> Country & TZ not filled in.
Updates tab -> Current version: 2.0.0-alpha.1. Automatic updates not tickable.
Authorizations & Experiments tab -> None
Developer tab -> SSH not tickable. View log OK. Auth token stuff appears OK.

AddOns tab ->
ZigBee adapter not available (I know this has been troublesome, but I'm quite certain it was present just recently...) - missed.
Install 'Counter'. Appears to work, despite quite a few error msgs in log.
Install 'Cron'.
Install 'Philips HUE'.  + add things.
Install 'Pulse'.
Install 'Run Program'.
Install 'Timer'. For the above: Log warnings much as for Counter.

Bulk or msgs are of this kind, ~13 lines per addon:
2024-11-25 21:50:04.379 ERROR  : philips-hue-adapter: strict mode: missing type "object" for keyword "properties" at "https://raw.githubusercontent.com/WebThingsIO/gateway-addon-ipc-schema/master/messages/definitions.json#/allOf/1" (strictTypes)

Install 'System Info'. Works partially. 
RAM and Uptime look plausible. CPU speed, load and usage probably OK, Temp and Battery zero. 
No data in network info. 
Log is filled with json data.

2024-11-25 22:01:58.783 ERROR  : systeminfo-adapter: /bin/sh: 1: iw: not found
2024-11-25 22:01:58.788 INFO   : systeminfo-adapter: {}
2024-11-25 22:01:58.873 ERROR  : Invalid message received: {
"messageType": 8199,

"data": {
"adapterId": "SysteminfoAdapter",
"deviceId": "cpu",
"property": {
"name": "currentSpeed",
"value": 2.4,
"title": "Current speed",
"type": "number",
"unit": "GHz",
"description": "The current clock speed",
"minimum": null,
"maximum": null,
"readOnly": true,
"multipleOf": 0.01,
"forms": []
},
"pluginId": "systeminfo-adapter"
}
}
.. and so on ...

I'll redo my 'Rules' test tomorrow to check if the indexing issue is again apparent.

@benfrancis
Copy link
Member Author

@GHoGit Thank you very much for doing this testing and reporting back your findings.

Most of the below is unrelated to this issue so I've linked to other issues where appropriate.

Swapped flash and tried again with Ubuntu desktop on RPI5. Back to CoreXX later.

Attempt to install 24.10 twice without success. Booting with tons of errors. SD card corrupted ? 64GB Sandisk, normally well behaved. Full reformat with SD-Formatter and repeat image write. Same result. Something is broken with this image when applied to RPI5.

Hmm, I haven't tried Ubuntu Desktop 24.x, only 22.x so it's possible the issue is with Ubuntu Desktop 24.x? Could be the same issue I'm seeing on Ubuntu Server 24.04.

Apply quick format and install 24.04 -> boot and initial install OK. Apply relevant snap commands according to instructions.

This time DO_NOT reclaim domain (tried reclaim again this morning, and again no mail received), but rather create new domain name for test. Success.

I still haven't been able to reproduce a bug with either reclaiming or registering a domain, but glad to hear that a new registration worked.

Observations (some of these are known):
Domain tab -> No local access. 'Update host name' greyed.

#3157

Network tab -> Filled in and active. Local wifi 2.4 & 5 GHz access points listed.

Oh, so is this working on Ubuntu (Desktop?) 24.04 but not 24.10?

Localization tab -> Country & TZ not filled in.

#3153

Updates tab -> Current version: 2.0.0-alpha.1. Automatic updates not tickable.

#3158

Developer tab -> SSH not tickable.

#3159

AddOns tab ->
ZigBee adapter not available (I know this has been troublesome, but I'm quite certain it was present just recently...) - missed.

Oh, interesting. It appears this is because it gets filtered out of the add-ons list in the gateway UI due to the required Node.js version. I have filed WebThingsIO/zigbee-adapter#346

Bulk or msgs are of this kind, ~13 lines per addon:
2024-11-25 21:50:04.379 ERROR : philips-hue-adapter: strict mode: missing type "object" for keyword "properties" at "https://raw.githubusercontent.com/WebThingsIO/gateway-addon-ipc-schema/master/messages/definitions.json#/allOf/1" (strictTypes)

#2887

Install 'System Info'. Works partially.
RAM and Uptime look plausible. CPU speed, load and usage probably OK, Temp and Battery zero.
No data in network info.
Log is filled with json data.

2024-11-25 22:01:58.783 ERROR : systeminfo-adapter: /bin/sh: 1: iw: not found
2024-11-25 22:01:58.788 INFO : systeminfo-adapter: {}
2024-11-25 22:01:58.873 ERROR : Invalid message received: {
"messageType": 8199,


"data": { "adapterId": "SysteminfoAdapter", "deviceId": "cpu", "property": { "name": "currentSpeed", "value": 2.4, "title": "Current speed", "type": "number", "unit": "GHz", "description": "The current clock speed", "minimum": null, "maximum": null, "readOnly": true, "multipleOf": 0.01, "forms": [] }, "pluginId": "systeminfo-adapter" } } .. and so on ...

I have filed tim-hellhake/systeminfo-adapter#36 for this.

I'll redo my 'Rules' test tomorrow to check if the indexing issue is again apparent.

Thanks.

@GHoGit
Copy link

GHoGit commented Dec 18, 2024

As a follow up on this testing done last month:
Gave up on Ubuntu Core. Reflashed and booted. Never was able to set a working key. RPI each time asking for password, which I have no idea what would be.

So, instead i loaded Raspberry Pi OS 64bit and installed the snap and made a quick run-through.
Superficially much like RPI5 + Ubuntu 24.04 + snap, but some differences.

Add Cron, HUE, Pulse, Run Program, SystemInfo, Timer.
Network tab -> Network settings are not supported for this platform.
SystemInfo -> Slightly different contents from Ubuntu 24.04 test.

Extract from log:
..
2024-11-26 16:54:03.372 INFO : Unknown host Linux distribution
..
024-11-26 17:05:02.171 ERROR : systeminfo-adapter: /bin/sh: 1: iw: not found
2024-11-26 17:05:02.174 INFO : systeminfo-adapter: {}
2024-11-26 17:05:03.172 ERROR : systeminfo-adapter: /bin/sh: 1: iw: not found
..
..
024-11-26 18:28:24.407 ERROR : Error getting thing description for thing with id /var/lib/snapd/hostfs/boot/firmware: Error: Unable to find thing with id = /var/lib/snapd/hostfs/boot/firmware
at /snap/webthings-gateway/21/lib/node_modules/webthings-gateway/build/models/things.js:259:23
..

// GHo

@benfrancis
Copy link
Member Author

benfrancis commented Dec 18, 2024

@GHoGit wrote:

Network tab -> Network settings are not supported for this platform.

This is expected. The platform detection from inside a snap currently only recognises Ubuntu or Ubuntu Core https://github.com/WebThingsIO/gateway/blob/master/src/platform.ts#L89 If it doesn't detect one of those operating systems then it won't try to use the NetworkManager back end for Network Settings.

It's possible that other Linux distributions which ship with NetworkManager (which I think Raspberry Pi OS Bookworm does) might work with the NetworkManager back end, but we'd need to test that and add support to the corresponding platform instance.

To be honest if you're installing the snap on an existing installation of Raspberry Pi OS it's probably not as important to be able to configure the network settings from the WebThings Gateway web interface because you've probably already configured network settings during first time setup or the built-in UI.

It would be nice for the snap to be able to modify hardware settings on other headless Linux distributions though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug snap Issues relating to the snap package
Projects
Status: Sprint Backlog
Development

No branches or pull requests

2 participants