Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Connecting to PinePhone (Mobian) over USB
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
McLink
Apprentice
Apprentice


Joined: 02 Feb 2008
Posts: 181
Location: /dev/chair

PostPosted: Thu May 13, 2021 11:48 am    Post subject: Connecting to PinePhone (Mobian) over USB Reply with quote

I just got a PinePhone and installed Mobian on it. I now want to connect to sshd over USB, which the guide says should be easy... on Linux boxes that have NetworkManager, which my Gentoo box doesn't. I figured it shouldn't be too hard to set up manually, but I can't get it working.

On the PinePhone, after plugging in the USB while shhd is running:
Code:
# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: usb0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 1a:d0:70:1f:3a:cb brd ff:ff:ff:ff:ff:ff
    inet 10.66.0.1/8 brd 10.255.255.255 scope global noprefixroute usb0
       valid_lft forever preferred_lft forever
    inet6 fe80::1986:d40a:946c:2087/64 scope link noprefixroute
       valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 02:ba:34:3b:5f:6c brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.21/24 brd 192.168.1.255 scope global dynamic noprefixroute wlan0
       valid_lft 85993sec preferred_lft 85993sec
    inet6 fe80::3f47:1dd3:21fa:f67c/64 scope link noprefixroute
       valid_lft forever preferred_lft forever
4: wwan0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 1000
    link/none
    inet 10.178.88.161/30 brd 10.178.88.163 scope global noprefixroute wwan0
       valid_lft forever preferred_lft forever

# ip route
default via 192.168.1.1 dev wlan0 proto dhcp metric 600
default via 10.178.88.162 dev wwan0 proto static metric 1050
10.0.0.0/8 dev usb0 proto kernel scope link src 10.66.0.1 metric 1500
10.178.88.160/30 dev wwan0 proto kernel scope link src 10.178.88.161 metric 1050
192.168.1.0/24 dev wlan0 proto kernel scope link src 192.168.1.21 metric 600

# iptables-save
# Generated by iptables-save v1.8.7 on Thu May 13 12:41:01 2021
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [85:13160]
-A INPUT -i usb0 -j ACCEPT
-A INPUT -s 192.168.1.21/32 -i wlan0 -j ACCEPT
-A INPUT -i usb0 -p udp -m udp --dport 67 -j ACCEPT
-A INPUT -i usb0 -p tcp -m tcp --dport 67 -j ACCEPT
-A INPUT -i usb0 -p udp -m udp --dport 53 -j ACCEPT
-A INPUT -i usb0 -p tcp -m tcp --dport 53 -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -s 127.0.0.1/32 -j ACCEPT
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A INPUT -j DROP
-A FORWARD -d 10.0.0.0/8 -o usb0 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -s 10.0.0.0/8 -i usb0 -j ACCEPT
-A FORWARD -i usb0 -o usb0 -j ACCEPT
-A FORWARD -o usb0 -j REJECT --reject-with icmp-port-unreachable
-A FORWARD -i usb0 -j REJECT --reject-with icmp-port-unreachable
-A FORWARD -d 10.0.0.0/8 -o usb0 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -s 10.0.0.0/8 -i usb0 -j ACCEPT
-A FORWARD -i usb0 -o usb0 -j ACCEPT
-A FORWARD -o usb0 -j REJECT --reject-with icmp-port-unreachable
-A FORWARD -i usb0 -j REJECT --reject-with icmp-port-unreachable
COMMIT
# Completed on Thu May 13 12:41:01 2021
# Generated by iptables-save v1.8.7 on Thu May 13 12:41:01 2021
*nat
:PREROUTING ACCEPT [19:5309]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [5:356]
:POSTROUTING ACCEPT [4:304]
-A POSTROUTING -s 10.0.0.0/8 ! -d 10.0.0.0/8 -j MASQUERADE
COMMIT
# Completed on Thu May 13 12:41:01 2021
# Warning: iptables-legacy tables present, use iptables-legacy-save to see them

# ss -plunt
Netid               State                Recv-Q               Send-Q                               Local Address:Port                                Peer Address:Port               Process                                                 
udp                 UNCONN               0                    3072                                       0.0.0.0:5353                                     0.0.0.0:*                   users:(("avahi-daemon",pid=380,fd=12))                 
udp                 UNCONN               0                    2304                                       0.0.0.0:5355                                     0.0.0.0:*                   users:(("systemd-resolve",pid=464,fd=11))               
udp                 UNCONN               0                    0                                        10.66.0.1:53                                       0.0.0.0:*                   users:(("dnsmasq",pid=1378,fd=6))                       
udp                 UNCONN               0                    0                                       127.0.0.53:53                                       0.0.0.0:*                   users:(("systemd-resolve",pid=464,fd=16))               
udp                 UNCONN               0                    0                                          0.0.0.0:67                                       0.0.0.0:*                   users:(("dnsmasq",pid=1378,fd=4))                       
udp                 UNCONN               0                    0                                        127.0.0.1:323                                      0.0.0.0:*                   users:(("chronyd",pid=520,fd=5))                       
udp                 UNCONN               0                    0                                          0.0.0.0:41355                                    0.0.0.0:*                   users:(("avahi-daemon",pid=380,fd=14))                 
udp                 UNCONN               0                    3072                                             *:5353                                           *:*                   users:(("avahi-daemon",pid=380,fd=13))                 
udp                 UNCONN               0                    2304                                             *:5355                                           *:*                   users:(("systemd-resolve",pid=464,fd=13))               
udp                 UNCONN               0                    0                                                *:42539                                          *:*                   users:(("avahi-daemon",pid=380,fd=15))                 
udp                 UNCONN               0                    0                                            [::1]:323                                            *:*                   users:(("chronyd",pid=520,fd=6))                       
tcp                 LISTEN               0                    32                                       10.66.0.1:53                                       0.0.0.0:*                   users:(("dnsmasq",pid=1378,fd=7))                       
tcp                 LISTEN               0                    4096                                 127.0.0.53%lo:53                                       0.0.0.0:*                   users:(("systemd-resolve",pid=464,fd=17))               
tcp                 LISTEN               0                    128                                        0.0.0.0:22                                       0.0.0.0:*                   users:(("sshd",pid=528,fd=3))                           
tcp                 LISTEN               0                    4096                                       0.0.0.0:5355                                     0.0.0.0:*                   users:(("systemd-resolve",pid=464,fd=12))               
tcp                 LISTEN               0                    128                                           [::]:22                                          [::]:*                   users:(("sshd",pid=528,fd=4))                           
tcp                 LISTEN               0                    4096                                          [::]:5355                                        [::]:*                   users:(("systemd-resolve",pid=464,fd=14))


On the Gentoo box (some irrelevant parts removed):
Code:
# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 brd 127.255.255.255 scope host lo
       valid_lft forever preferred_lft forever
2: dummy0: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
    link/ether e2:2d:51:3a:57:e4 brd ff:ff:ff:ff:ff:ff
    inet 169.254.202.248/16 brd 169.254.255.255 scope global noprefixroute dummy0
       valid_lft forever preferred_lft forever
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 74:d4:35:0f:c7:c0 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.16/24 brd 192.168.1.255 scope global dynamic noprefixroute eth0
       valid_lft 49258sec preferred_lft 38458sec
[...]
9: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
    link/ether 02:42:c6:4e:78:07 brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever
30: usb0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000
    link/ether e6:3f:48:e8:c8:e5 brd ff:ff:ff:ff:ff:ff
    inet 169.254.213.51/16 brd 169.254.255.255 scope global noprefixroute usb0
       valid_lft forever preferred_lft forever

# ip route
default via 192.168.1.1 dev eth0 proto dhcp src 192.168.1.16 metric 203
169.254.0.0/16 dev dummy0 scope link src 169.254.202.248 metric 202
169.254.0.0/16 dev usb0 scope link src 169.254.213.51 metric 230
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown
192.168.1.0/24 dev eth0 proto dhcp scope link src 192.168.1.16 metric 203

# iptables-save
# Generated by iptables-save v1.8.7 on Thu May 13 13:17:12 2021
*security
:INPUT ACCEPT [7097722995:5696167566361]
:FORWARD ACCEPT [721450:725587894]
:OUTPUT ACCEPT [6559926118:7904690270338]
COMMIT
# Completed on Thu May 13 13:17:12 2021
# Generated by iptables-save v1.8.7 on Thu May 13 13:17:12 2021
*raw
:PREROUTING ACCEPT [7102672051:5697510320193]
:OUTPUT ACCEPT [6559937981:7904691158193]
COMMIT
# Completed on Thu May 13 13:17:12 2021
# Generated by iptables-save v1.8.7 on Thu May 13 13:17:12 2021
*nat
:PREROUTING ACCEPT [3456:114854]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [65408:3794643]
:POSTROUTING ACCEPT [65395:3793863]
:DOCKER - [0:0]
-A PREROUTING -m addrtype --dst-type LOCAL -j DOCKER
-A OUTPUT ! -d 127.0.0.0/8 -m addrtype --dst-type LOCAL -j DOCKER
-A POSTROUTING -s 172.17.0.0/16 ! -o docker0 -j MASQUERADE
-A DOCKER -i docker0 -j RETURN
COMMIT
# Completed on Thu May 13 13:17:12 2021
# Generated by iptables-save v1.8.7 on Thu May 13 13:17:12 2021
*mangle
:PREROUTING ACCEPT [7102672051:5697510320193]
:INPUT ACCEPT [7100985017:5696595423886]
:FORWARD ACCEPT [721450:725587894]
:OUTPUT ACCEPT [6559937981:7904691158193]
:POSTROUTING ACCEPT [6567683442:7906485850421]
COMMIT
# Completed on Thu May 13 13:17:12 2021
# Generated by iptables-save v1.8.7 on Thu May 13 13:17:12 2021
*filter
:INPUT ACCEPT [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [18:1375]
:BLOCK - [0:0]
:DOCKER - [0:0]
:DOCKER-ISOLATION-STAGE-1 - [0:0]
:DOCKER-ISOLATION-STAGE-2 - [0:0]
:DOCKER-USER - [0:0]
-A INPUT -j BLOCK
-A INPUT -i usb0 -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -s 62.238.161.58/32 -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -s 192.168.3.0/24 -j ACCEPT
-A INPUT -s 192.168.42.0/24 -j ACCEPT
-A INPUT -s 127.0.0.1/32 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 51413 -j ACCEPT
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A INPUT -j DROP
-A FORWARD -j DOCKER-USER
-A FORWARD -j DOCKER-ISOLATION-STAGE-1
-A FORWARD -o docker0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -o docker0 -j DOCKER
-A FORWARD -i docker0 ! -o docker0 -j ACCEPT
-A FORWARD -i docker0 -o docker0 -j ACCEPT
-A OUTPUT -j BLOCK
-A BLOCK -j RETURN
-A DOCKER-ISOLATION-STAGE-1 -i docker0 ! -o docker0 -j DOCKER-ISOLATION-STAGE-2
-A DOCKER-ISOLATION-STAGE-1 -j RETURN
-A DOCKER-ISOLATION-STAGE-2 -o docker0 -j DROP
-A DOCKER-ISOLATION-STAGE-2 -j RETURN
-A DOCKER-USER -j RETURN
COMMIT
# Completed on Thu May 13 13:17:12 2021


I then assign the address 10.66.0.2 to the USB device:
Code:
# ip addr add 10.66.0.2/24 dev usb0
# ip addr
[...]
30: usb0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000
    link/ether e6:3f:48:e8:c8:e5 brd ff:ff:ff:ff:ff:ff
    inet 10.66.0.2/24 scope global usb0
       valid_lft forever preferred_lft forever
    inet 169.254.144.161/16 brd 169.254.255.255 scope global noprefixroute usb0
       valid_lft forever preferred_lft forever

# ip route
default via 192.168.1.1 dev eth0 proto dhcp src 192.168.1.16 metric 203
10.66.0.0/24 dev usb0 proto kernel scope link src 10.66.0.2
169.254.0.0/16 dev dummy0 scope link src 169.254.202.248 metric 202
169.254.0.0/16 dev usb0 scope link src 169.254.144.161 metric 230
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown
192.168.1.0/24 dev eth0 proto dhcp scope link src 192.168.1.16 metric 203


So 10.66.0.0/24 gets routed through usb0 as it should, and I would now expect my PinePhone to be visible at 10.66.0.1, but I only see the local machine (10.66.0.2):
Code:
# nmap 10.66.0.0/24
Starting Nmap 7.91 ( https://nmap.org ) at 2021-05-13 13:34 CEST
Nmap scan report for 10.66.0.2 (10.66.0.2)
Host is up (0.000022s latency).
Not shown: 995 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
111/tcp  open  rpcbind
631/tcp  open  ipp
2049/tcp open  nfs
5500/tcp open  hotline

Nmap done: 256 IP addresses (1 host up) scanned in 40.97 seconds


I've also tried removing the FORWARD and POSTROUTING lines on the PinePhone, but to no avail. What am I missing here?
Back to top
View user's profile Send private message
Ralphred
Guru
Guru


Joined: 31 Dec 2013
Posts: 501

PostPosted: Thu May 13, 2021 4:53 pm    Post subject: Reply with quote

From the phone >> inet 10.66.0.1/8
Also from the phone >> inet 10.178.88.161/30

Your /8 is stomping all over your /30, unpredictable results will ensue...
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54236
Location: 56N 3W

PostPosted: Thu May 13, 2021 5:07 pm    Post subject: Reply with quote

McLink,

PinePhone:
# ip route
default via 192.168.1.1 dev wlan0 proto dhcp metric 600
default via 10.178.88.162 dev wwan0 proto static metric 1050
10.0.0.0/8 dev usb0 proto kernel scope link src 10.66.0.1 metric 1500
10.178.88.160/30 dev wwan0 proto kernel scope link src 10.178.88.161 metric 1050
192.168.1.0/24 dev wlan0 proto kernel scope link src 192.168.1.21 metric 600


Two default routes is usually a problem. The one with the lowest metric (wlan0) will always be used. Is that what you expect?

Code:
10.0.0.0/8 dev usb0 proto kernel scope link src 10.66.0.1 metric 1500
10.178.88.160/30 dev wwan0 proto kernel scope link src 10.178.88.161 metric 1050


10.178.88.160/30 is contained wholly inside 10.0.0.0/8. Again the route with the lowest metric should be preferred, so it might work.
Can you fix that so you don not have overlapping ranges?


gentoo:
# ip route
default via 192.168.1.1 dev eth0 proto dhcp src 192.168.1.16 metric 203
169.254.0.0/16 dev dummy0 scope link src 169.254.202.248 metric 202
169.254.0.0/16 dev usb0 scope link src 169.254.213.51 metric 230
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown
192.168.1.0/24 dev eth0 proto dhcp scope link src 192.168.1.16 metric 203


169.254.0.0/16 is the self assigned link local IP range. That normally indicates that dncpcd failed to find a dhcp server.
For things to 'just work', I would expect the phone to run such a server.
It either isn't or the network link was never established, or both.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
McLink
Apprentice
Apprentice


Joined: 02 Feb 2008
Posts: 181
Location: /dev/chair

PostPosted: Thu May 13, 2021 5:52 pm    Post subject: Reply with quote

Thanks for your replies! I guess the default configuration in Mobian isn't quite sensible. The two default routes are Wi-Fi (wlan0) and 4G (wwan0). I can kill 4G to stop stuff from overlapping, but it doesn't fix the problem yet.

The phone has dnsmasq running:
Code:
# ps aux | grep dnsmasq
nobody      2161  0.0  0.1  12552  3904 ?        S    16:51   0:00 /usr/sbin/dnsmasq --conf-file=/dev/null --no-hosts --keep-in-foreground --bind-interfaces --except-interface=lo --clear-on-reload --strict-order --listen-address=10.66.0.1 --dhcp-range=10.66.0.10,10.66.0.254,60m --dhcp-lease-max=50 --dhcp-leasefile=/var/lib/NetworkManager/dnsmasq-usb0.leases --pid-file=/run/nm-dnsmasq-usb0.pid --conf-dir=/etc/NetworkManager/dnsmasq-shared.d
FWIW, the configuration directory is empty, but it looks like the command-line arguments themselves should do the trick. My Gentoo box doesn't seem to care, though: on plugging in, I get this in /var/log/everything/current:
Code:
May 13 19:44:37 [kernel] [449899.813181] usb 10-1: new high-speed USB device number 33 using xhci_hcd
May 13 19:44:37 [kernel] [449899.943111] usb 10-1: New USB device found, idVendor=1d6b, idProduct=0104, bcdDevice= 5.10
May 13 19:44:37 [kernel] [449899.943117] usb 10-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
May 13 19:44:37 [kernel] [449899.943120] usb 10-1: Product: Mobian
May 13 19:44:37 [kernel] [449899.943121] usb 10-1: Manufacturer: Mobian Project
May 13 19:44:37 [kernel] [449899.943123] usb 10-1: SerialNumber: ea887bd9131af61659d8a02021e68be8308cbf18ed5b9cb14691fb5d6dbfd88e
May 13 19:44:37 [kernel] [449899.946294] cdc_ether 10-1:1.0 usb0: register 'cdc_ether' at usb-0000:04:00.0-1, CDC Ethernet Device, e6:3f:48:e8:c8:e5
May 13 19:44:37 [dhcpcd] usb0: waiting for carrier
May 13 19:44:37 [dhcpcd] usb0: carrier acquired
May 13 19:44:38 [dhcpcd] usb0: IAID 48:e8:c8:e5
May 13 19:44:38 [dhcpcd] usb0: adding address fe80::2b96:6322:286d:ce86
May 13 19:44:38 [dhcpcd] ipv6_addaddr1: Permission denied
May 13 19:44:38 [dhcpcd] usb0: soliciting an IPv6 router
May 13 19:44:39 [dhcpcd] usb0: soliciting a DHCP lease
May 13 19:44:44 [dhcpcd] usb0: probing for an IPv4LL address
May 13 19:44:50 [dhcpcd] usb0: using IPv4LL address 169.254.213.51
May 13 19:44:50 [dhcpcd] usb0: adding route to 169.254.0.0/16

_________________
Mc'abit wrote:
Islam isn't the problem, religion is.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54236
Location: 56N 3W

PostPosted: Thu May 13, 2021 6:07 pm    Post subject: Reply with quote

McLink,

The IPv6 things don't matter.
Code:
May 13 19:44:39 [dhcpcd] usb0: soliciting a DHCP lease
May 13 19:44:44 [dhcpcd] usb0: probing for an IPv4LL address


Only 5 sec for dhcpcd to do its thing - that's a bit fast.

What happens if you run
Code:
dhcpcd usb0
yourself?

Or even
Code:
dhcpcd -t 60 usb0
That's a 60 second timeout.

The pinephone end has
Code:
 inet 10.66.0.1/8

Staying out of the
Code:
10.0.0.0/8 dev usb0 proto kernel scope link src 10.66.0.1 metric 1500
10.178.88.160/30 dev wwan0 proto kernel scope link src 10.178.88.161 metric 1050
overlap.

Code:
ifconfig usb0 10.66.0.2/8
on your Gentoo should let
Code:
ping 10.66.0.1
work.
That's if both ends are using the same protocol on the USB bus. There are several to choose from.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
McLink
Apprentice
Apprentice


Joined: 02 Feb 2008
Posts: 181
Location: /dev/chair

PostPosted: Thu May 13, 2021 6:30 pm    Post subject: Reply with quote

Code:
# dhcpcd -t 60 usb0
sending commands to dhcpcd process

And in /var/log/everything/current, I get
Code:
May 13 20:16:58 [dhcpcd] sending commands to dhcpcd process
May 13 20:16:58 [dhcpcd] control command: dhcpcd -t 60 usb0
May 13 20:17:09 [dhcpcd] dhcp_openbpf: firewire0: Invalid argument
and nothing else.

NeddySeagoon wrote:
McLink,
Code:
ifconfig usb0 10.66.0.2/8
on your Gentoo should let
Code:
ping 10.66.0.1
work.
That's if both ends are using the same protocol on the USB bus. There are several to choose from.
Nope:
Code:
# ping 10.66.0.1
PING 10.66.0.1 (10.66.0.1) 56(84) bytes of data.
^C
--- 10.66.0.1 ping statistics ---
50 packets transmitted, 0 received, 100% packet loss, time 50139ms


Could it be that I'm missing some kernel option? I really have no idea which options are required to get this to work (and that information isn't easy to find either, since practically everyone uses generic kernel), and I kind of figured if usb0 got created in the first place, that would be enough.
_________________
Mc'abit wrote:
Islam isn't the problem, religion is.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54236
Location: 56N 3W

PostPosted: Thu May 13, 2021 7:05 pm    Post subject: Reply with quote

McLink,

Code:
May 13 20:17:09 [dhcpcd] dhcp_openbpf: firewire0: Invalid argument


firewire0 ?
You don't have one of those.

Put your kernel .config onto a pastebin site.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
McLink
Apprentice
Apprentice


Joined: 02 Feb 2008
Posts: 181
Location: /dev/chair

PostPosted: Thu May 13, 2021 7:29 pm    Post subject: Reply with quote

Yeah, that's what I was thinking. AFAIK there's no FireWire on a PinePhone, and I'm not even sure my motherboard has FireWire.

Current .config here. (Uploaded to my own site cause I CBA making a pastebin account.)
_________________
Mc'abit wrote:
Islam isn't the problem, religion is.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54236
Location: 56N 3W

PostPosted: Thu May 13, 2021 8:06 pm    Post subject: Reply with quote

McLink,

wgetpaste is your friend for files or command output.

Code:
CONFIG_FIREWIRE_NET=y
yets you network over firewire but I don't know why dhcpcd is trying to set that up instead of usb0.

For tethering an Android phone, you need
Code:
Module                  Size  Used by
rndis_host             16384  0
cdc_ether              16384  1 rndis_host
usbnet                 28672  2 rndis_host,cdc_ether

and all those and more are built into your kernel.

When Android is connected with a USB data cable to a PC, tethering needs to be selected from the list of USB options.
Does the PinePhone need that too?

Not all USB cables are created equal. Some have the data wires missing to make space for more copper in the charging wires. Are you sure you have a USB data cable?

I'm not sure if you need
Code:
  │ │      <M>   USB Gadget functions configurable through configfs                    │ │ 
  │ │      [ ]     Generic serial bulk in/out                                          │ │ 
  │ │      [ ]     Abstract Control Model (CDC ACM)                                    │ │ 
  │ │      [ ]     Object Exchange Model (CDC OBEX)                                    │ │ 
  │ │      [*]     Network Control Model (CDC NCM)                                     │ │ 
  │ │      [*]     Ethernet Control Model (CDC ECM)                                    │ │ 
  │ │      [*]     Ethernet Control Model (CDC ECM) subset                             │ │ 
  │ │      [*]     RNDIS                                                               │ │ 
  │ │      [*]     Ethernet Emulation Model (EEM)

You have
Code:
# CONFIG_USB_CONFIGFS
is not set so they are all off in your kernel.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
McLink
Apprentice
Apprentice


Joined: 02 Feb 2008
Posts: 181
Location: /dev/chair

PostPosted: Thu May 13, 2021 9:00 pm    Post subject: Reply with quote

The USB cable I'm using is the USB-C cable that came with the phone. Unless this edition ships with inferior cable compared to the previous ones, it should work, since other users have had success with that before. IIRC Android usually offers tethering, MTP and plain charging by default, but those phones also charge in tethering and MTP modes. Since the PinePhone (or Mobian, rather) doesn't have an MTP mode AFAIK, nothing needs to be selected (although enabling tethering by default sounds like a big security hole, but that's another topic).

I'll have a look at those kernel options tomorrow (I don't feel like rebooting at this moment).
_________________
Mc'abit wrote:
Islam isn't the problem, religion is.
Back to top
View user's profile Send private message
McLink
Apprentice
Apprentice


Joined: 02 Feb 2008
Posts: 181
Location: /dev/chair

PostPosted: Fri May 14, 2021 9:07 am    Post subject: Reply with quote

I disabled FireWire in the kernel config (since, in my entire life, I've owned a grand total of zero devices that need it) and set those gadget options. No change; I still get a 169.254.*.* address from DHCP. Also, removing the DHCP-assigned address and calling dhcpcd manually causes it to *instantly* assign a similar address. Also, while I can remove the DHCP-assigned address, I can't remove the corresponding route: while the ip route del command exits normally with status 0, the route is still there if I call ip route immediately afterwards.

Assigning an address via ifconfig leads to no route to 10.66.0.0/16 being created, unlike assigning the address via ip addr add. SSH correspondingly just waits forever. Manually adding the route with one of these
Code:
ip route add 10.66.0.0/16 dev usb0
ip route add 10.66.0.0/16 dev usb0 src 10.66.0.2 metric 201
just causes a "no route to host" error from SSH.
_________________
Mc'abit wrote:
Islam isn't the problem, religion is.
Back to top
View user's profile Send private message
Ralphred
Guru
Guru


Joined: 31 Dec 2013
Posts: 501

PostPosted: Fri May 14, 2021 2:55 pm    Post subject: Reply with quote

Can you not just disable dhcp on the gentoo machine completely, knowing what the network you are going to attach to is going to be and configure it statically?
That way you can assign a /8 or at least put yourself as 10.255.255.x/24 so the phone and PC are using the same broadcast address
Unless there is some mechanism in dnsmasq that prevents a network connection to unleased IP's




Mildly offtopic: I recently got bitten in the ass by assuming the knowledge of the person I was helping, so feel free to ignore this if you already know.
When we use 192.168.12.34/24 as an IP address this tells us 4 things
The IP address of the local machine is 192.168.12.34
The subnet mask is 255.255.255.0 (from the 24, 24 bits, add the last 8 bits as 0's (all IPV4 addresses are 32bit) and split into blocks of 8 "11111111.11111111.11111111.00000000" <== that's a binary representation of our subnet mask
From the IP and subnet mask we know the network address (lowest in the subnet) 192.168.12.0 <== we'll see this in the routing table telling the kernel how to reach other addresses in this subnet or "network"
From the IP and subnet mask we know the broadcast address (highest in the subnet) 192.168.12.255 <== sometimes used to ask questions of "strangers" or "everyone" in the network.

I'm going to quickly break down your wwan0 address to give real world context: 10.178.88.161/30
IP Address: 10.178.88.161
Subnet mask: 255.255.255.252
Network address: 10.178.88.160
Broadcast address: 10.178.88.163
Address of device it talks to at your mobile provider: 10.178.88.162 <== we know this because there are only 4 addresses in the subnet, and 3 are already in use, 1 each by "network" "broadcast" and "your phone".
Back to top
View user's profile Send private message
McLink
Apprentice
Apprentice


Joined: 02 Feb 2008
Posts: 181
Location: /dev/chair

PostPosted: Fri May 14, 2021 4:09 pm    Post subject: Reply with quote

Ralphred wrote:
Can you not just disable dhcp on the gentoo machine completely, knowing what the network you are going to attach to is going to be and configure it statically?
Yeah that seems to be more sensible. I've also disabled the usb0 autoconfig on Mobian's side, because it's just all manner of broken. Since I have unlimited data and the Wi-Fi signal from my sub-€20 router is terrible, I prefer using data, but plugging in the USB instantly kills the connection due to the overlapping addresses in 10.0.0.0/8. It also insists on adding a slew of iptables rules that don't get deleted and lead to steadily accumulating cruft.

I'm now trying to manually set up the phone at 192.168.27.1 and the Gentoo box at 192.168.27.2, with no autoconfig on either side. If I'm not mistaken, something as simple as this should work:
Code:
# on the Pinephone:
ifconfig usb0 192.168.27.1
# on the Gentoo box:
ifconfig usb0 192.168.27.2
...Except it doesn't. The routes show up correctly on both ends, the addresses show up correctly on both end, and both ends have all input on usb0 allowed. But ssh still reports "no route to host", and nmap on either side does not show the other side as being up.

...But as I'm typing this post and breaking my brain over how it's possible that the Gentoo box is able to see the PinePhone but not make a connection, I tried something really stupid: plugging it in to a different USB port. Namely, a USB2 port instead of USB3. And guess what. It WORKS. This motherboard (a real piece of garbage) has given me problems with USB3 before, but it's been so long that I sort of forgot about that. Makes me really want to defenestrate this damned thing.
_________________
Mc'abit wrote:
Islam isn't the problem, religion is.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54236
Location: 56N 3W

PostPosted: Fri May 14, 2021 10:47 pm    Post subject: Reply with quote

McLink,

That's a fun fact to file away for the future.
Thank you for sharing.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum