[Beta2][Pinephone] Mobile Data (sporadically) not working
Mobile Data is sporadically not working after (re)booting the phone. Calls are working.
This appears to be due to ofonod/ofonoctl not (properly) connecting to the modem and the wan connection not being properly established through ofono.
Additionally, there's a conflict between NetworkManager and ofono on `/etc/resolv.conf` (see below)
In my case, `ofonoctl` does not have any information on the modem, e.g.:
```
[root@pinephone ~]# ofonoctl
Modem Status SIM
------------ ------------ -------
quectelqmi_0 Unregistered Unknown
[root@pinephone ~]# ofonoctl wan
Could not fetch contexts on the modem
```
In this state, `ofonoctl wan` cannot be used to connect to the mobile network.
This does not always happen after (re)boots and might break spontaneously.
Most times, after unlocking the SIM, the mobile network is connected and `ofonoctl wan` shows the proper information (see below). However, DNS reoslution is broken (nameservers not in resolv.conf)
# steps to fix DNS
```
[root@pinephone ~]# ofonoctl wan
Interface Protocol APN Method Address Gateway DNS
----------- ---------- --------------- -------- ----------------- -------------- --------------------------
wwan0 ipv4 web.vodafone.de static 100.80.YYY.XXX/30 100.80.221.193 139.7.30.126, 139.7.30.125
```
for each DNS server, add a `nameserver` line to /etc/resolv.conf
# steps to fix modem + DNS
After `systemctl restart ofono` and going through the init sequence described e.g. [here](https://git.sr.ht/~martijnbraam/ofonoctl), modem info is back:
```
[root@pinephone ~]# ofonoctl
Modem Status SIM
------------ --------------------------- -------
quectelqmi_0 Registered to 26202 (80.0%) Unknown
```
Then, `ofonoctl` also shows wan information
```
[root@pinephone ~]# ofonoctl wan
Interface Protocol APN Method Address Gateway DNS
----------- ---------- --------------- -------- ----------------- -------------- --------------------------
wwan0 ipv4 web.vodafone.de static 100.80.YYY.XXX/30 100.80.221.193 139.7.30.126, 139.7.30.125
```
Despite this, connections via mobile data are not possible.
This can be solved through `ofonoctl wan --connect --append-dns`, which configures the interface and adds the DNS servers (shown above) to `/etc/resolv.conf`.
```
[root@pinephone ~]# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 10.0.1.1
nameserver 10.0.0.1
# DNS servers set by ofonoctl
nameserver 139.7.30.126
nameserver 139.7.30.125
# end
```
# DNS conflict with NetworkManager
:warning: Once Wifi is disabled (e.g. via the menu on the phone), `/etc/resolv.conf` is emptied fully, which obviously breaks DNS resolution.
The mobile data connection stays up according to `ip a`, however.
Here, apparently, NetworkManager is disregarding other applications' changes to the resolv.conf
issue