Change WiFi Credentials¶
Set up WiFi after your printer has moved or your WiFi credentials have changed.
Requirements¶
Make sure you have a proper text editor installed:
- Notepad++ (Windows)
- Visual Studio Code (Windows, macOS, Linux)
- SublimeText (Windows, macOS, Linux)
Incompatible Editors
Do not use Windows Notepad or WordPad! They can corrupt the file with incorrect line endings or encoding.
If you use TextEdit on macOS, make sure to enable plain text format and disable smart quotes in
TextEdit > Preferences, otherwise it will insert incompatible characters.
MainsailOS >= v2.0.0 (NetworkManager)¶
MainsailOS v2.0.0 and newer uses NetworkManager for network configuration. WiFi credentials are set via a simple configuration file on the boot partition of the SD card.
To change your WiFi credentials, follow these steps:
- Remove the SD card from your SBC and insert it into your computer's SD card reader.
- Open the boot partition. This is the partition readable on Windows and macOS, formatted as FAT32.
- Copy the file
headless_nm.txt.templateand rename the copy toheadless_nm.txt. -
Open
headless_nm.txtwith your text editor and fill in your WiFi credentials: -
Replace
<mySSID>with your WiFi network name and<mySecretPassword>with your WiFi password. - Set
REGDOMAINto your country code (e.g.,DEfor Germany,USfor United States,FRfor France). For a complete list, visit ISO 3166-1 alpha-2. - If your WiFi network is hidden, change
HIDDENto"true". - Save the file and safely eject the SD card.
- Insert the SD card back into your SBC and power it on.
Finding Your Device
After booting, you can find your device by navigating to http://mainsailos.local in your browser, or check your
router's admin page for the assigned IP address.
Note
The headless_nm.txt file is automatically deleted after the configuration has been applied.
MainsailOS < v2.0.0 (wpa_supplicant)¶
Older versions of MainsailOS use wpa_supplicant for WiFi configuration.
Note
This method only applies to MainsailOS versions before v2.0.0. If you are using v2.0.0 or newer, use the NetworkManager method above.
To change your WiFi credentials, follow these steps:
- Remove the SD card from your SBC and insert it into your computer's SD card reader.
- Open the boot partition — this is the partition readable on Windows and macOS, formatted as FAT32.
- Open your text editor and create a new file called
wpa_supplicant.conf. -
Copy the following content into the file:
-
Replace the placeholder values with your country code, WiFi SSID, and password.
- Save the file with LF line endings (not CRLF).
- Copy the
wpa_supplicant.conffile to the boot partition of the SD card. - Safely eject the SD card, insert it back into your SBC, and power it on.
Multiple Networks
To configure more than one network, add additional network={} blocks to the file. You may also want to add
ap_scan=1 before the first network block and scan_ssid=1 inside each block for hidden networks.
Country Codes
Common country codes: DE (Germany), US (United States), GB (United Kingdom), FR (France), SE (Sweden).
For a complete list, visit
ISO 3166-1 alpha-2.
MainsailOS Armbian-Based < v2.0.0¶
Armbian-based MainsailOS versions before v2.0.0 use a different configuration file (network_config.txt) to set up
WiFi. This method is based on the Armbian first-run configuration.
To change your WiFi credentials, follow these steps:
- Remove the SD card from your SBC and insert it into your computer's SD card reader.
- Open the boot partition. This is the partition readable on Windows and macOS, formatted as FAT32.
- Copy the file
network_config.txt.templateand rename the copy tonetwork_config.txt. -
Open
network_config.txtwith your text editor and adjust the following settings:# Set to 1 to apply any network related settings below NC_net_change_defaults=1 # Enable WiFi and disable Ethernet NC_net_ethernet_enabled=0 NC_net_wifi_enabled=1 # Enter your WiFi credentials NC_net_wifi_ssid='MySSID' NC_net_wifi_key='MyWiFiKEY' # Country code for WiFi regulatory domain NC_net_wifi_countrycode='GB' -
Set
NC_net_change_defaultsto1to enable network configuration. - Set
NC_net_wifi_enabledto1andNC_net_ethernet_enabledto0to use WiFi. - Replace
MySSIDwith your WiFi network name andMyWiFiKEYwith your WiFi password. - Set
NC_net_wifi_countrycodeto your country code (e.g.,DE,US,FR). For a complete list, visit ISO 3166-1 alpha-2. - Save the file, safely eject the SD card, insert it back into your SBC, and power it on.