No Internet connection when using cell phone as source (mobile hotspot)

If no normal wireless connection is available, I might want to use the ‘mobile hotspot’ function of my cell phone — that function enables one to use the data plan from the cell phone’s carrier.

I cannot however connect in snap applications: Firefox, Chromium, Matterhorn all fail to connect, whereas Links, Dillo or a normal Curl work just fine. If I evade the snap sandbox by directly launching the snapped application, e.g. with /snap/firefox/current/usr/lib/firefox/firefox, then I can browse the WWW normally. So this seems pretty clearly to be on snap.

The weird thing is, I’m connecting through the same interface, wlp2s0, either to my cell phone or to a normal router, so how can it be that only in the former case I get no connection in snapped applications?

Is this a known issue, is there any work-around?

Here is for instance the Firefox connections. Connecting network-observe did not help.

% snap connections firefox
Interface               Plug                            Slot                            Notes
alsa                    firefox:alsa                    -                               -
audio-playback          firefox:audio-playback          :audio-playback                 -
audio-record            firefox:audio-record            :audio-record                   -
avahi-observe           firefox:avahi-observe           :avahi-observe                  -
browser-support         firefox:browser-sandbox         :browser-support                -
camera                  firefox:camera                  :camera                         -
content[gnome-42-2204]  firefox:gnome-42-2204           gnome-42-2204:gnome-42-2204     -
content[gtk-3-themes]   firefox:gtk-3-themes            gtk-common-themes:gtk-3-themes  -
content[icon-themes]    firefox:icon-themes             gtk-common-themes:icon-themes   -
content[sound-themes]   firefox:sound-themes            gtk-common-themes:sound-themes  -
cups-control            firefox:cups-control            :cups-control                   -
dbus                    -                               firefox:dbus-daemon             -
desktop                 firefox:desktop                 :desktop                        -
desktop-legacy          firefox:desktop-legacy          :desktop-legacy                 -
gsettings               firefox:gsettings               :gsettings                      -
hardware-observe        firefox:hardware-observe        :hardware-observe               -
home                    firefox:home                    :home                           manual
joystick                firefox:joystick                :joystick                       -
mount-control           firefox:host-hunspell           :mount-control                  -
mpris                   -                               firefox:mpris                   -
network                 firefox:network                 :network                        -
network-bind            firefox:network-bind            :network-bind                   -
network-observe         firefox:network-observe         -                               -
opengl                  firefox:opengl                  :opengl                         -
personal-files          firefox:dot-mozilla-firefox     :personal-files                 -
removable-media         firefox:removable-media         :removable-media                -
screen-inhibit-control  firefox:screen-inhibit-control  :screen-inhibit-control         -
system-files            firefox:etc-firefox             :system-files                   -
system-packages-doc     firefox:system-packages-doc     :system-packages-doc            -
u2f-devices             firefox:u2f-devices             :u2f-devices                    -
unity7                  firefox:unity7                  :unity7                         -
upower-observe          firefox:upower-observe          :upower-observe                 -
wayland                 firefox:wayland                 :wayland                        -
x11                     firefox:x11                     :x11

What’s shown when you run Firefox snap through snappy-debug command? You can install it using this document: https://snapcraft.io/docs/debug-snaps

% snappy-debug
INFO: Following '/var/log/syslog'. If have dropped messages, use:
INFO: $ sudo journalctl --output=short --follow --all | sudo snappy-debug
= AppArmor =
Time: 2024-06-19T14:2
Log: apparmor="DENIED" operation="open" class="file" profile="snap-update-ns.firefox" name="/proc/63470/maps" pid=63470 comm="5" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
File: /proc/63470/maps (read)
Suggestion:
* adjust program to not access '@{PROC}/@{pid}/maps'

= AppArmor =
Time: 2024-06-19T14:2
Log: apparmor="DENIED" operation="dbus_method_call"  bus="system" path="/org/freedesktop/login1" interface="org.freedesktop.DBus.Properties" member="GetAll" mask="send" name=":1.3" pid=63455 label="snap.firefox.firefox" peer_pid=1291 peer_label="unconfined"
DBus access

= AppArmor =
Time: 2024-06-19T14:2
Log: apparmor="DENIED" operation="dbus_method_call"  bus="system" path="/org/freedesktop/timedate1" interface="org.freedesktop.DBus.Properties" member="GetAll" mask="send" name=":1.283" pid=63455 label="snap.firefox.firefox" peer_pid=63593 peer_label="unconfined"
DBus access
Suggestion:
* try adding one of 'time-control, timeserver-control, timezone-control' to 'plugs'

Only thing that I can think of - do you have different setting on your PC between your home wifi and mobile hotspot? In particular this kind of setting: image

Eventually you can try snap connect firefox:network-observe but I don’t know if that will help at all. For me it is working fine with firefox snap on my Ubuntu Unity 24.04 laptop.

Snapd does not set up a network namespace for snaps so I would expect things to continue working as they were.

One area worth checking though, is whether you can access any site by using the IP address directly rather than a domain name. eg. run nslookup google.com and then use that IP address directly in Firefox.

I don’t know whence you got that window, but if I compare nmcli c s mobile and nmcli c s normal-connection, the only differences I get are on the expected:

connection.id
connection.uuid
connection.timestamp
802-11-wireless.ssid
802-11-wireless.seen-bssids

That’s curious, nslookup fails:

% nslookup launchpad.net
;; communications error to 172.19.4.1#53: timed out
;; communications error to 172.19.4.1#53: timed out
;; communications error to 172.19.4.1#53: timed out
;; no servers could be reached

~% nslookup wikipedia.com
;; communications error to 172.19.4.1#53: timed out
;; communications error to 172.19.4.1#53: timed out
;; communications error to 172.19.4.1#53: timed out
;; no servers could be reached

Although, again, I can access any web site in unsnapped applications in that connection.

Does restarting eg. Firefox help? I wonder if there may be some problem with the DNS getting changed and the application inside a snap is unable to use it or unable to used access some cached names.

Have you tried to use an IP address instead of a domain name in Firefox?

I did resolvectl and that showed me that the “Global” and “Link 3 (wlp2s0)” DNS servers were different when I was connected to the cell phone:

Global:
Current DNS Server: 172.19.4.1
       DNS Servers: 172.19.4.1

Link 3 (wlp2s0)
       DNS Servers: 192.168.43.1 2a01:599:b42:6f41::f0

So I did nslookup launchpad.net 192.168.43.1 and that worked. So I changed

# Generated by resolvconf
search speedport.ip
nameserver 172.19.4.1

To

nameserver 192.168.43.1

and restarted systemd-resolved.service and that worked.

I don’t know how the DNS server is supposed to be updated, but certainly not this way manually. Any idea what could have been the source of the problem here and how do I fix this case of a outdated name server from sticking? And as a bonus, why only snapped browsers had an issue?

As always, it’s DNS issue

DNS not updating is very strange. Do you have dnsmasq running on your PC or just systemd-resolved?

In any case, you didn’t even needed to manually update file, restarting systemd-resolved service should suffice.

You don’t happen to have resolvconf installed, do you ?

Do you have dnsmasq running on your PC or just systemd-resolved?

ps aux|grep [d]nsmasq is empty.

You don’t happen to have resolvconf installed, do you ?

Nope, I’m on 24.10 and the package is not even available there. All I have is systemd-resolved.