[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!
About this post
- Posted
- Archived
- Score
- 7 · 100% up
- Kind
- Text
- ID
- ff91hz
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-settingsandman 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.pskshould be set, andwifi-security.psk-flagsshould be absent or0(meaning, that the profile is present, see "Secret flag types" inman 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=TRACElogging 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#n28If 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...
Create the connection on another device and copy the .nmconnection file over.
Just make sure you remove any MAC addresses.