Skip to content

[NetworkManager] Add wifi with only files

Hi,

I have successfully installed ArchLinux arm on a Pinephone, but obviously now I need to interact with it, and would like to know if I can add a wifi connection on NetworkManager (if I cant, I am open to suggestions for other network stacks). I need it to be a file-only setup since I can only chroot into the rootfs, I cannot start any service, so nmcli is not available.

​

Now you may ask why I am not using a usb-c keyboard or the serial console Pinephone have for debugging. I do not own a usb-c keyboard (nor would it work since ive heard the phone delivers no power through its usb port), and I dont have a UART cable yet.

I tried copying my laptop's /etc/NetworkManager/system-connection/{my SSID} file, to no avail

Any help would be really appreciated!

7 points3 comments
Open on Reddit
About this post
Posted
Archived
Score
7 · 100% up
Kind
Text
ID
ff91hz

Author

59
posts
308
comments
8
media
View profile

3 comments

that should work...

NetworkManager explicitly supports that you just configure connection profiles on disk (in /{lib,etc,run}/NetworkManager/system-connection). So, that should be fine.

While the file format is documented (somewhat, in man nm-settings and man nm-settings-keyfile), I think it would be easiest to create a profile on another machine and copy it over. As you tried to do. Take care that the file is owned by root and has permissions only readable to root (chmod 600).

You also should make sure that the passwords are in the file itself. E.g. wifi-security.psk should be set, and wifi-security.psk-flags should be absent or 0 (meaning, that the profile is present, see "Secret flag types" in man nm-settings).

One problem is that for Wi-Fi profiles, currently NetworkManager won't autoconnect them, unless they were connected before. When NetworkManager activates a profile, it stores the timestamp in /var/lib/NetworkManager/timestamps. I guess, you would need to hack the timestamps file before starting the daemon. That is ugly because the "timestamps" files is internal API. This problem should be fixed. Other connection types don't behave like this.

I guess, you can pre-deploy the file and boot the machine to see whether it's working. And if it works, you may access the machine via the network. Otherwise, you'd have to debug it. Hence, before doing that, I'd enable level=TRACE logging in NetworkManager.conf, so you can check debug it afterwards, if it didn't work. See https://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/contrib/fedora/rpm/NetworkManager.conf#n28

2 points

If you don't find a way to do this by just manipulating the files yourself, maybe you could try to boot into it using QEMU so you could start services and configure it using nmcli?

Should be similar to how you can also boot Raspberry Pi images using QEMU I guess...

1 points

Create the connection on another device and copy the .nmconnection file over.

Just make sure you remove any MAC addresses.

1 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.