Networking

Enabling Networking

Manually

It should be as simple as that: Log into ubuntu's chroot environment inside your phone (see "Shell" section below). Then issue the following command

nmcli -pretty dev wifi connect <network-name> password <password>

Alternative Setup 1

To do so requires several manual steps, as well as copying and editing a NetworkManager settings file from a 12.04 based device with a working Wi-Fi connection to the phone. This last step is due to the fact that the image contains no UI for system settings, nor any sort for network indicator.

Basically, on boot the following services are being manually started by our chroot start-up script:

  • dbus-daemon -- the system bus

  • wpa_supplicant -- the wireless daemon

  • NetworkManager

As mentioned above, in order to connect to a wireless network, we need to manually create a system connection file, and copy it to the following directory in the Ubuntu chroot:

/etc/NetworkManager/system-connections

The easiest way to do this, is to use an existing system connection file from a system already connected to the access point/network you want the phone to connect to ( i.e. your laptop ).

NetworkManager's system connection files can be found in the directory specified above. Note, as these files are protected system files, you'll need to run the cp as root, or use sudo. The connection files are usually named using network SSIDs, however some may have "Auto " pre-fixed to the SSID.

Make a copy of this file, and delete the "mac-address" line under [802-11-wireless].

Now copy the file to your phone, and copy it to the /etc/NetworkManager/system-connections in the Ubuntu chroot file-system. With adb and if <name-of-connection-file> is the file to copy, that would be

adb push <name-of-connection-file> /data/ubuntu/etc/NetworkManager/system-connections

This file needs to be read-able by root alone, so once you've copied it into place, make sure to set the permissions like this:

# chmod 600 <name-of-connection-file>

No need to re-start NetworkManager, it should just bring up this connection. You can check whether an IP address has been successfully assigned by running the following command:

# ip addr

ping also should be installed, allowing you to check that hostnames are properly resolved.

Alternative Setup 2

An alternative is create a connection file based on:

[connection]
id=ubuntu
uuid=8513de87-abe4-4aa0-b14c-d4637973e0c1
type=802-11-wireless

[802-11-wireless]
ssid=hyperion
mode=infrastructure
security=802-11-wireless-security

[802-11-wireless-security]
key-mgmt=wpa-psk
auth-alg=open
psk=This is a sample WPA PSK for an access point called ubuntu

[ipv4]
method=auto

[ipv6]
method=auto

Edit it the values under the [802-11-wireless] and [802-11-wireless-security] stanzas, and then copy the file to the /system-connections directory (using the full path above).

Under [802-11-wireless], you need to change the ssid to the name of your network.

Under [802-11-wireless-security], what you change depends on the type of security of your network. If you're network is WPA-Personal, then you can just change psk to your network's password/passphrase. If you network is WEP, the advice would be to instead use the copy method.

Touch/Networking (last edited 2013-03-21 16:03:13 by rsalveti)