USB Network: Difference between revisions
m Adding windows RNDIS configuration in case it's not working out of the box |
Connecting - networks from other computers |
||
(39 intermediate revisions by 17 users not shown) | |||
Line 1: | Line 1: | ||
Out of the box, a postmarketOS device uses a static address of ''172.16.42.1''<code>/24</code> on any USB network interface and runs the [https://gitlab.postmarketos.org/postmarketOS/unudhcpd unudhcpd] DHCP server, offering one address, 172.16.42.2/24, to the USB network. After plugging a cable between your device and a PC, from the PC you might be able to SSH to the phone with: | |||
postmarketOS | |||
= | <syntaxhighlight lang="shell-session"> | ||
$ ssh 172.16.42.1 | |||
</syntaxhighlight> | |||
This article provides details in case this does not work out of the box (no IP assigned, doing a new port, etc.). | |||
= Connecting = | = Connecting = | ||
Power on your device and connect it to your USB port. | {{note|'''Note:''' If you have multiple postmarketOS devices connected, you may want to manually set IP via setup-interfaces both on host and on second phone to 173.16.42.x (or any other) to have internet access on all devices.}} | ||
Power on your device and connect it to your USB port. A new network interface should appear, run <code>ip a</code> to list all of them. The new entry should look something like: | |||
< | <syntaxhighlight lang="shell-session"> | ||
$ ip a | $ ip a | ||
1: enp0s19f2u1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 1000 | 1: enp0s19f2u1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 1000 | ||
Line 25: | Line 19: | ||
inet6 fe80::aabb:ccdd:eeff:00aa/64 scope link noprefixroute | inet6 fe80::aabb:ccdd:eeff:00aa/64 scope link noprefixroute | ||
valid_lft forever preferred_lft forever | valid_lft forever preferred_lft forever | ||
</ | </syntaxhighlight> | ||
If you instead get something like - | |||
<syntaxhighlight lang="shell-session"> | |||
$ ip a | |||
5: enp4s0u1u1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000 | |||
link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff | |||
</syntaxhighlight> | |||
then you need to give the interface a proper MAC address to be able to get an IP address, run <code>sudo ip link set dev enp4s0u1u1 address 12:12:12:12:12:12</code>. Make sure you specify the right interface name. | |||
You should now have been assigned the IP address <code>172.16.42.2</code> (verify with <code>ip a</code> or <code>ifconfig</code>). If it still does not work automatically, you might need to run a DHCP client on your PC (<code>dhclient</code> or <code>dhcpcd</code>). | |||
== SSH == | == SSH == | ||
Line 32: | Line 38: | ||
When you are past the initramfs, you should be able to connect via <code>ssh</code> and the username and password you set during the install phase: | When you are past the initramfs, you should be able to connect via <code>ssh</code> and the username and password you set during the install phase: | ||
< | <syntaxhighlight lang="shell-session"> | ||
$ ssh user@172.16.42.1 | $ ssh user@172.16.42.1 | ||
user@172.16.42.1's password: | user@172.16.42.1's password: | ||
Line 45: | Line 51: | ||
localhost:~$ | localhost:~$ | ||
</ | </syntaxhighlight> | ||
Use <code>sudo</code> to run commands as <code>root</code>, it is configured. | Use <code>sudo</code> to run commands as <code>root</code>, it is configured. | ||
Line 54: | Line 60: | ||
Add the following to <code>~/.ssh/config</code>: | Add the following to <code>~/.ssh/config</code>: | ||
< | <syntaxhighlight lang="text"> | ||
Host pmos | Host pmos | ||
HostName 172.16.42.1 | HostName 172.16.42.1 | ||
UserKnownHostsFile /dev/null | UserKnownHostsFile /dev/null | ||
StrictHostKeyChecking | StrictHostKeyChecking no | ||
</ | </syntaxhighlight> | ||
Afterwards you can connect to your device by running <code>ssh <username>@pmos</code>. Replace <code><username></code> with the proper username on your device. | Afterwards you can connect to your device by running <code>ssh <username>@pmos</code>. Replace <code><username></code> with the proper username on your device. | ||
{{note|You can also add <code>User <username></code> to <code>~/.ssh/config</code> in order to not have to enter your username everytime!}} | |||
== Share device TCP/IP ports through the PC == | |||
To share ports from the ''postmarketOS'' device through a computer, do this: | |||
<syntaxhighlight lang="shell-session"> | |||
$ socat tcp-listen:[OUTWARD PORT],reuseaddr,fork tcp:[DEVICE IP ADDRESS]:[INWARD DEVICE PORT] | |||
</syntaxhighlight> | |||
For SSH, ''[INWARD DEVICE PORT]'' is ''22''. | |||
''[OUTWARD PORT]'' can be ''90''XX when connected to ''adb'' (Android Debug Bridge tool) to open the socket port using Android with connection forwarding - <code>adb reverse </code> (or) <code>adb forward </code> - with <code>tcp:[PORT] tcp:[PORT]</code>. | |||
== Add IP addresses to the Alpine Linux device's network interfaces == | |||
To use networks from other computers, editing ''/etc/network/interfaces'' can be needed. | |||
To put IP information into that, you can do: | |||
<syntaxhighlight lang="shell-session"> | |||
$ echo $'echo -e \'[line of file]\' >> /etc/network/interfaces' | sudo "$SHELL" -s | |||
</syntaxhighlight> | |||
and use the page [https://wiki.alpinelinux.org/wiki/Configure_Networking#IPv4_DHCP_Configuration Configure Networking - Alpine Linux (IPv4 DHCP Configuration)]. | |||
= Troubleshooting = | = Troubleshooting = | ||
== Try IPv4 only == | == Try IPv4 only == | ||
Especially while mainlining, getting an IP | Especially while mainlining, getting an IP often only works with the following command: | ||
< | <syntaxhighlight lang="shell-session"> | ||
$ dhcpcd interface --nohook ipv6 | $ dhcpcd interface --nohook ipv6 | ||
</ | </syntaxhighlight> | ||
== Making sure the USB is detected == | == Making sure the USB is detected == | ||
In case you don't get an IP address directly, make sure that your PC recognizes the phone after it booted into postmarketOS at all. It should show the following in <code>dmesg</code>. | In case you don't get an IP address directly, make sure that your PC recognizes the phone after it booted into postmarketOS at all. It should show the following in <code>dmesg</code>. | ||
< | <syntaxhighlight lang="dmesg"> | ||
[ 6284.442088] usb 1-1: new high-speed USB device number 36 using xhci_hcd | [ 6284.442088] usb 1-1: new high-speed USB device number 36 using xhci_hcd | ||
[ 6284.627106] usb 1-1: New USB device found, idVendor=18d1, idProduct=d001 | [ 6284.627106] usb 1-1: New USB device found, idVendor=18d1, idProduct=d001 | ||
Line 84: | Line 113: | ||
[ 6285.239048] rndis_host 1-1:1.0 enp0s20f0u1: renamed from usb0 | [ 6285.239048] rndis_host 1-1:1.0 enp0s20f0u1: renamed from usb0 | ||
[ 6285.287058] IPv6: ADDRCONF(NETDEV_UP): enp0s20f0u1: link is not ready | [ 6285.287058] IPv6: ADDRCONF(NETDEV_UP): enp0s20f0u1: link is not ready | ||
</ | </syntaxhighlight> | ||
It should also show up on <code>lsusb</code> (the name doesn't necessarily match the model): | It should also show up on <code>lsusb</code> (the name doesn't necessarily match the model): | ||
< | <syntaxhighlight lang="text"> | ||
Bus 001 Device 023: ID 18d1:d001 Google Inc. Nexus 4 (fastboot) | Bus 001 Device 023: ID 18d1:d001 Google Inc. Nexus 4 (fastboot) | ||
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub | Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub | ||
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub | Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub | ||
</ | </syntaxhighlight> | ||
And <code>ip link</code> should show an additional entry as well (the last one, in the following list): | And <code>ip link</code> should show an additional entry as well (the last one, in the following list): | ||
< | <syntaxhighlight lang="text"> | ||
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1 | 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1 | ||
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 | link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 | ||
Line 103: | Line 132: | ||
14: enp0s29f7u3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN mode DEFAULT group default qlen 1000 | 14: enp0s29f7u3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN mode DEFAULT group default qlen 1000 | ||
link/ether 86:11:85:5e:df:fa brd ff:ff:ff:ff:ff:ff | link/ether 86:11:85:5e:df:fa brd ff:ff:ff:ff:ff:ff | ||
</ | </syntaxhighlight> | ||
If that's the case and you can't connect, your computer probably just doesn't have an IP address on its side of the link. | If that's the case and you can't connect, your computer probably just doesn't have an IP address on its side of the link. | ||
Line 113: | Line 142: | ||
If there's no MAC address assigned(00:00:00:00:00:00), you need to assign one. | If there's no MAC address assigned(00:00:00:00:00:00), you need to assign one. | ||
< | <syntaxhighlight lang="shell-session"> | ||
# ip link set dev enp0s20f0u1 address 12:12:12:12:12:12 | # ip link set dev enp0s20f0u1 address 12:12:12:12:12:12 | ||
</ | </syntaxhighlight> | ||
Use the following command to start a DHCP client. Replace the interface name with the one on your machine (see <code>ip a</code> before and after connecting the device via USB). Some Linux distributions have <code>dhcpcd</code> installed instead of <code>dhclient</code>. | Use the following command to start a DHCP client. Replace the interface name with the one on your machine (see <code>ip a</code> before and after connecting the device via USB). Some Linux distributions have <code>dhcpcd</code> installed instead of <code>dhclient</code>. | ||
< | <syntaxhighlight lang="shell-session"> | ||
$ dhclient -v enp0s20f0u1 | $ dhclient -v enp0s20f0u1 | ||
</ | </syntaxhighlight> | ||
Some distribution use other tools that might interfere with <code>dhclient</code> and <code>dhcpcd</code>. In most cases, you should be able to set an IP address with | Some distribution use other tools that might interfere with <code>dhclient</code> and <code>dhcpcd</code>. In most cases, you should be able to set an IP address with | ||
< | <syntaxhighlight lang="shell-session"> | ||
# ip address add dev enp0s20f0u1 172.16.42.2/24 | # ip address add dev enp0s20f0u1 172.16.42.2/24 | ||
</ | </syntaxhighlight> | ||
If after assigning an IP address and <code>ip a</code> shows your device status as "DOWN" instead of "UNKNOWN", bring it up with | If after assigning an IP address and <code>ip a</code> shows your device status as "DOWN" instead of "UNKNOWN", bring it up with | ||
< | <syntaxhighlight lang="shell-session"> | ||
# ip link set enp0s20f0u1 up | # ip link set enp0s20f0u1 up | ||
</ | </syntaxhighlight> | ||
P.S. If your device is Samsung with old kernel and <code>CONFIG_USB_ANDROID_SAMSUNG_COMPOSITE</code>, something like [https://gitlab.postmarketos.org/postmarketOS/pmaports/-/blob/master/device/unmaintained/linux-samsung-klte-downstream/0007-usb_gadget-set-random-rndis-host-MAC-address-to-prev.patch usb_gadget-set-random-rndis-host-MAC-address.patch] can help with preventing zero MAC. | |||
After the interface is brought up you can SSH to the phone at the phone's ip address: | |||
<syntaxhighlight lang="shell-session"> | |||
# ssh user@172.16.42.1 | |||
username here is dependent on what you chose in the pmbootstrap init step | |||
</syntaxhighlight> | |||
== Kernel configuration parameters == | == Kernel configuration parameters == | ||
Line 146: | Line 182: | ||
You can use <code>grep</code> on your kernel config to check which of these options are enabled or not (<code>option=y</code> means it is enabled). If you want to change the options, don't modify the file directly, but use <code>pmbootstrap kconfig edit</code> ([[Kernel_configuration|usage instructions]]). Otherwise the dependencies in that configuration file will not get resolved properly and cause other issues. | You can use <code>grep</code> on your kernel config to check which of these options are enabled or not (<code>option=y</code> means it is enabled). If you want to change the options, don't modify the file directly, but use <code>pmbootstrap kconfig edit</code> ([[Kernel_configuration|usage instructions]]). Otherwise the dependencies in that configuration file will not get resolved properly and cause other issues. | ||
Related: {{ | Related: {{MR|1462}} linux-postmarketos-qcom: Remove composite usb gadget for networking | ||
== SSH issues == | == SSH issues == | ||
Line 158: | Line 194: | ||
</pre> | </pre> | ||
Put the following content into <code>/sysroot/etc/init.d/telnetd</code> | Put the following content into <code>/sysroot/etc/init.d/telnetd</code>: | ||
< | <syntaxhighlight lang="bash"> | ||
#!/sbin/openrc-run | #!/sbin/openrc-run | ||
Line 171: | Line 207: | ||
after firewall | after firewall | ||
} | } | ||
</ | </syntaxhighlight> | ||
Then make the file executable and enable the service so telnet gets launched by openrc: | |||
<pre> | <pre> | ||
chroot /sysroot rc-update add telnetd default | chmod +x /sysroot/etc/init.d/telnetd && chroot /sysroot rc-update add telnetd default | ||
</pre> | </pre> | ||
Then | Then resume boot by typing <code>pmos_continue_boot</code>. Telnetd should be started once the device boots and you should be able to connect to it. | ||
=== Using Dropbear === | === Using Dropbear === | ||
Line 199: | Line 235: | ||
== Note about HTC devices == | == Note about HTC devices == | ||
* HTC devices seem to be tricky in general, we have a [[Troubleshooting:boot#See_also|few open issues]] with HTC devices that seem to be not booting | * HTC devices seem to be tricky in general, we have a [[Troubleshooting:boot#See_also|few open issues]] with HTC devices that seem to be not booting | ||
* The [[HTC_Desire_(htc-bravo)|HTC desire]] does work, and it required [https:// | * The [[HTC_Desire_(htc-bravo)|HTC desire]] does work, and it required [https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/blob/bd4ebb3473764108daa92b308511be7e0a1b6948/aports/device/device-htc-bravo/initfs-hook.sh#L8 this line in the initfs-hook] to get USB network | ||
* It was hard to discover: drebrez used the [[tuning sysfs]] instructions, but he had to write it as a initfs hook and save it in the <code>cache</code> partition of the device, then reboot in TWRP to get that file. | * It was hard to discover: drebrez used the [[tuning sysfs]] instructions, but he had to write it as a initfs hook and save it in the <code>cache</code> partition of the device, then reboot in TWRP to get that file. | ||
* Without a working display, no USB network and no serial output, you can use the LEDs for debugging and the other partitions to store files. | * Without a working display, no USB network and no serial output, you can use the LEDs for debugging and the other partitions to store files. | ||
== Windows driver == | |||
See [[Windows_FAQ#USB_networking]]. | |||
= See also = | = See also = |
Latest revision as of 23:14, 23 November 2024
Out of the box, a postmarketOS device uses a static address of 172.16.42.1/24
on any USB network interface and runs the unudhcpd DHCP server, offering one address, 172.16.42.2/24, to the USB network. After plugging a cable between your device and a PC, from the PC you might be able to SSH to the phone with:
$ ssh 172.16.42.1
This article provides details in case this does not work out of the box (no IP assigned, doing a new port, etc.).
Connecting
Note: If you have multiple postmarketOS devices connected, you may want to manually set IP via setup-interfaces both on host and on second phone to 173.16.42.x (or any other) to have internet access on all devices. |
Power on your device and connect it to your USB port. A new network interface should appear, run ip a
to list all of them. The new entry should look something like:
$ ip a
1: enp0s19f2u1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 1000
link/ether aa:bb:cc:dd:ee:ff brd ff:ff:ff:ff:ff:ff
inet 172.16.42.2/24 brd 172.16.42.255 scope global dynamic noprefixroute enp0s19f2u1
valid_lft 861920sec preferred_lft 861920sec
inet6 fe80::aabb:ccdd:eeff:00aa/64 scope link noprefixroute
valid_lft forever preferred_lft forever
If you instead get something like -
$ ip a
5: enp4s0u1u1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
then you need to give the interface a proper MAC address to be able to get an IP address, run sudo ip link set dev enp4s0u1u1 address 12:12:12:12:12:12
. Make sure you specify the right interface name.
You should now have been assigned the IP address 172.16.42.2
(verify with ip a
or ifconfig
). If it still does not work automatically, you might need to run a DHCP client on your PC (dhclient
or dhcpcd
).
SSH
There is a dedicated article for inspecting the initramfs via telnet. |
When you are past the initramfs, you should be able to connect via ssh
and the username and password you set during the install phase:
$ ssh user@172.16.42.1
user@172.16.42.1's password:
Welcome to postmarketOS!
This distribution is based on Alpine Linux.
Read both our wikis to find a large amount of how-to guides and
general information about administrating and development.
See <https://wiki.postmarketos.org> and <https://wiki.alpinelinux.org>.
You may change this message by editing /etc/motd.
localhost:~$
Use sudo
to run commands as root
, it is configured.
Prevent host key verification clashes when connecting to different devices
If you have multiple devices you want to SSH into, you will get issues with host key verification as your system will realize it's talking to different devices on the same IP address. To prevent this, disable host key verification entirely for the IP address used by postmarketOS devices when connected by USB.
Add the following to ~/.ssh/config
:
Host pmos
HostName 172.16.42.1
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
Afterwards you can connect to your device by running ssh <username>@pmos
. Replace <username>
with the proper username on your device.
You can also add User <username> to ~/.ssh/config in order to not have to enter your username everytime! |
To share ports from the postmarketOS device through a computer, do this:
$ socat tcp-listen:[OUTWARD PORT],reuseaddr,fork tcp:[DEVICE IP ADDRESS]:[INWARD DEVICE PORT]
For SSH, [INWARD DEVICE PORT] is 22.
[OUTWARD PORT] can be 90XX when connected to adb (Android Debug Bridge tool) to open the socket port using Android with connection forwarding - adb reverse
(or) adb forward
- with tcp:[PORT] tcp:[PORT]
.
Add IP addresses to the Alpine Linux device's network interfaces
To use networks from other computers, editing /etc/network/interfaces can be needed.
To put IP information into that, you can do:
$ echo $'echo -e \'[line of file]\' >> /etc/network/interfaces' | sudo "$SHELL" -s
and use the page Configure Networking - Alpine Linux (IPv4 DHCP Configuration).
Troubleshooting
Try IPv4 only
Especially while mainlining, getting an IP often only works with the following command:
$ dhcpcd interface --nohook ipv6
Making sure the USB is detected
In case you don't get an IP address directly, make sure that your PC recognizes the phone after it booted into postmarketOS at all. It should show the following in dmesg
.
[ 6284.442088] usb 1-1: new high-speed USB device number 36 using xhci_hcd
[ 6284.627106] usb 1-1: New USB device found, idVendor=18d1, idProduct=d001
[ 6284.627123] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 6284.627134] usb 1-1: Product: Android
[ 6284.627143] usb 1-1: Manufacturer: Android
[ 6284.627151] usb 1-1: SerialNumber: 0123456789ABCDEF
[ 6284.632322] rndis_host 1-1:1.0 usb0: register 'rndis_host' at usb-0000:00:14.0-1, RNDIS device, b2:c4:1e:03:64:b9
[ 6285.239048] rndis_host 1-1:1.0 enp0s20f0u1: renamed from usb0
[ 6285.287058] IPv6: ADDRCONF(NETDEV_UP): enp0s20f0u1: link is not ready
It should also show up on lsusb
(the name doesn't necessarily match the model):
Bus 001 Device 023: ID 18d1:d001 Google Inc. Nexus 4 (fastboot)
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
And ip link
should show an additional entry as well (the last one, in the following list):
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
link/ether e2:88:85:58:0f:99 brd ff:ff:ff:ff:ff:ff
3: wlp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
link/ether e2:08:85:58:0f:99 brd ff:ff:ff:ff:ff:ff
14: enp0s29f7u3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN mode DEFAULT group default qlen 1000
link/ether 86:11:85:5e:df:fa brd ff:ff:ff:ff:ff:ff
If that's the case and you can't connect, your computer probably just doesn't have an IP address on its side of the link.
If however, nothing shows up (even when Inspecting the initramfs), the most likely reason is a wrong Kernel_configuration. This is highly device-specific, but some hints can be found in #Kernel configuration parameters
No IP assigned or MAC address is 00:00:00:00:00:00
If USB gets detected, then you probably don't have a network manager that automatically requests IP addresses from new ethernet interfaces, so you'll have to set the interface up manually.
If there's no MAC address assigned(00:00:00:00:00:00), you need to assign one.
# ip link set dev enp0s20f0u1 address 12:12:12:12:12:12
Use the following command to start a DHCP client. Replace the interface name with the one on your machine (see ip a
before and after connecting the device via USB). Some Linux distributions have dhcpcd
installed instead of dhclient
.
$ dhclient -v enp0s20f0u1
Some distribution use other tools that might interfere with dhclient
and dhcpcd
. In most cases, you should be able to set an IP address with
# ip address add dev enp0s20f0u1 172.16.42.2/24
If after assigning an IP address and ip a
shows your device status as "DOWN" instead of "UNKNOWN", bring it up with
# ip link set enp0s20f0u1 up
P.S. If your device is Samsung with old kernel and CONFIG_USB_ANDROID_SAMSUNG_COMPOSITE
, something like usb_gadget-set-random-rndis-host-MAC-address.patch can help with preventing zero MAC.
After the interface is brought up you can SSH to the phone at the phone's ip address:
# ssh user@172.16.42.1
username here is dependent on what you chose in the pmbootstrap init step
Kernel configuration parameters
If you think that the kernel configuration may be at fault, first double check with pmbootstrap kconfig check
that the required parameters are all set.
The postmarketOS initramfs is able to configure two different USB systems in the kernel in order to let your PC talk to your phone via networking. One of them has to be enabled (exclusively?):
- CONFIG_USB_ETH
- CONFIG_USB_ETH_RNDIS is usually needed as well, it enables a compatibility interface for microsoft hosts.
- Usually used in mainline kernels (see also: Mainlining FAQ)
- CONFIG_USB_G_ANDROID
- This option is usually enabled in Android kernel forks
You can use grep
on your kernel config to check which of these options are enabled or not (option=y
means it is enabled). If you want to change the options, don't modify the file directly, but use pmbootstrap kconfig edit
(usage instructions). Otherwise the dependencies in that configuration file will not get resolved properly and cause other issues.
Related: !1462 linux-postmarketos-qcom: Remove composite usb gadget for networking
SSH issues
If SSH doesn't work for one reason or another, you can try enabling telnetd on your installation. For that, add the debug-shell initfs hook and connect to it. Then run the following commands to mount your root partition (writable):
source /etc/deviceinfo source init_functions.sh mount_root_partition mount -o rw,remount /sysroot
Put the following content into /sysroot/etc/init.d/telnetd
:
#!/sbin/openrc-run
command="/usr/sbin/telnetd"
command_args="-F"
pidfile="/run/${RC_SVCNAME}.pid"
command_background="yes"
depend() {
need net localmount
after firewall
}
Then make the file executable and enable the service so telnet gets launched by openrc:
chmod +x /sysroot/etc/init.d/telnetd && chroot /sysroot rc-update add telnetd default
Then resume boot by typing pmos_continue_boot
. Telnetd should be started once the device boots and you should be able to connect to it.
Using Dropbear
Alternatively you can try to use dropbear
SSH server instead of default openssh
. For this you can avoid messing with debug-shell hook and modifying system on running phone, you can tweak rootfs before flashing it in this sequence:
1. pmbootstrap init 2. pmbootstrap install 3. pmbootstrap chroot -r # go inside you phone's future rootfs 4. # make modifications to rootfs # in this case, to workaround an SSH issue: apk add dropbear rc-update del sshd default rc-update add dropbear default 5. exit 6. pmbootstrap install # again, to recreate image # flash images as usual 7. pmbootstrap flasher flash_kernel 8. pmbootstrap flasher flash_rootfs
Note about HTC devices
- HTC devices seem to be tricky in general, we have a few open issues with HTC devices that seem to be not booting
- The HTC desire does work, and it required this line in the initfs-hook to get USB network
- It was hard to discover: drebrez used the tuning sysfs instructions, but he had to write it as a initfs hook and save it in the
cache
partition of the device, then reboot in TWRP to get that file. - Without a working display, no USB network and no serial output, you can use the LEDs for debugging and the other partitions to store files.
Windows driver
See Windows_FAQ#USB_networking.
See also
- USB Internet: Let your phone access the Internet by sharing your PC's Internet connection via USB.
- Osk-sdl#Troubleshooting
- Troubleshooting:boot