MichaIng / DietPi

Lightweight justice for your single-board computer!
https://dietpi.com/
GNU General Public License v2.0
4.81k stars 494 forks source link

DietPi-Installer | Allow WiFi-only install, workaround NetMan uninstall #2054

Open mohitverma123 opened 6 years ago

mohitverma123 commented 6 years ago

Orange pi lite has only WIFI and not an ethernet port, hence wifi is only possible network access for it. The install script removes wifi (even after we select Yes, I need wifi modules)

MichaIng commented 6 years ago

@mohitverma123 Thanks for your report. We will investigate.

As an active eth0 connection is expected (https://github.com/Fourdee/DietPi/blob/master/PREP_SYSTEM_FOR_DIETPI.sh#L8), this might be a general issue on WiFi-only devices.

Maybe we find a way to preserve WiFi connection (and settings) when no eth device is available. I hope NetworkManager does not always drop connection on removal, as we do not want to keep it for the final image.

Fourdee commented 6 years ago

@MichaIng

this might be a general issue on WiFi-only devices.

Yep, correct 👍

Always been a problem with image creation on WiFi only devices with NetworkManager installed.

The only solution I found, was to run PREP, via serial connection and manually reconfigure WiFi if required.

We'll need to see if we can upgrade PREP script to:

Or, (hopeful):

MichaIng commented 5 years ago

Ref: https://wiki.debian.org/WiFi/HowToUse

MichaIng commented 5 years ago

I successfully installed DietPi via preparation script on a WiFi-only device with direct console access. netman however was not pre-installed on the fresh Debian image, installed via Debian netboot installer.

[ethernet] mac-address=XX:XX:XX:XX:XX:XX mac-address-blacklist=

[ipv4] address1=192.168.178.31/24,192.168.178.1 dns=192.168.178.1; dns-search= method=manual

[ipv6] addr-gen-mode=stable-privacy dns-search= method=auto



So generally we have two possibilities:
- Scrape interface information from `/etc/NetworkManager/system-connections/*`, if available, and store those to `/etc/network/interfaces`, if not yet the case. The interface name (eth0, wlan0, enp0s3. wlp0s3) can be retrieved by comparing MAC address with `ip l` output. The profile name can be freely chosen, so `eth0` above was entered by me, while the interface name is `enp0s3` (Stretch+ default naming scheme).
- Or we simply scrape `ip r` + `ip a` outputs, possibly required (possibly on old systems `route` + `ifconfig` needed?) and retrieve IP, netmask and standard gateway from there, then store those info to /etc/network/interfaces again.
- WiFi credentials stay stored within `wpa_supplicant` as said, so they survive as long as there is no alternative WPA handler?

Then testing is required, if connection can stay active, when installing DietPi default network packages first, configure them (/etc/network/interfaces), in case `systemctl restart networking; ifup $IFACE` and then purge `network-manager`.
MichaIng commented 5 years ago

Additionally: connman: https://github.com/MichaIng/DietPi/issues/1285#issuecomment-508415843

General issue, even when we manually pre-configure the network with ifupdown, if uninstalling netman or connman always drops the connection, the SSH connection breaks which again breaks the installer, so re-connecting is not done anymore. This only works from a screen session which goes on in the background and can be reattached to.

So currently indeed, if no local console (keyboard+monitor) is available, a serial console is required to reliably have the installer finish, at least when SSH is only possible via WiFi.

Not sure if Ethernet connections, controlled by netman or connman, can break as well? At least I never faced that.