[IDEA] Use Raspberry Pi Imager to configure WLAN country, time zone & keyboard layout - Printable Version +- Moode Forum (https://moodeaudio.org/forum) +-- Forum: moOde audio player (https://moodeaudio.org/forum/forumdisplay.php?fid=3) +--- Forum: Feature requests (https://moodeaudio.org/forum/forumdisplay.php?fid=8) +--- Thread: [IDEA] Use Raspberry Pi Imager to configure WLAN country, time zone & keyboard layout (/showthread.php?tid=6092) Pages:
1
2
|
Use Raspberry Pi Imager to configure WLAN country, time zone & keyboard layout - jenzd - 01-02-2024 Hi, When you install Moode following the official Setup Guide, Raspberry Pi Imager settings are used to activate SSH and provide a user id, password and (optionally) host name. The Raspberry Pi Imager additionally knows settings to configure the WLAN country, time zone and keyboard layout. These settings are, however, currently ignored by Moode (version 8.3.7). Of course you can provide the respective information later when Moode is running via Configure -> Network (WLAN country) and Configure -> System (time zone & keyboard layout). Idea: Would it be possible (i.e. without too much effort) to enhance the installation process so that it (optionally) uses the Rapberry Pi Imager settings to configure WLAN country, time zone and keyboard layout? Thanks & best regards Jens RE: Use Raspberry Pi Imager to configure WLAN country, time zone & keyboard layout - Tim Curtis - 01-02-2024 I'll add to the TODO list for upcoming 8.3.8 RE: Use Raspberry Pi Imager to configure WLAN country, time zone & keyboard layout - Tim Curtis - 01-02-2024 There is already some code in worker.php for timezone and kbd layout but perhaps it's not working correctly. // Pi Imager: Import time zone and keyboard layout RE: Use Raspberry Pi Imager to configure WLAN country, time zone & keyboard layout - jenzd - 01-03-2024 Hmm, you are right. The code was introduced in May 2023 and actually works correctly for time zone and keyboard layout (just retested in version 8.3.7). I must have picked an older image version in my previous test or maybe forgot to set the right check mark in the Imager. Sorry for posting wrong information and asking for something which was already implemented ... The same commit also added code to set the WLAN country (some lines later). That part, however, is indeed not working for me. When I set the WLAN country to "DE" in the Pi Imager, I still get "US" in Moode. Code: pi@moode:~ $ moodeutl -q "select wlan_country from cfg_network" whereas the file firstrun.sh which the Pi Imager created correctly contains "DE" as the WLAN country: Code: if [ -f /usr/lib/raspberrypi-sys-mods/imager_custom ]; then Regards Jens RE: Use Raspberry Pi Imager to configure WLAN country, time zone & keyboard layout - TheOldPresbyope - 01-03-2024 I can repro @jenzd's result. I told the Pi Imager I wanted WiFi country "DE" and locale settings "Europe/Berlin" and "de". Burnt the uSD card and booted. In addition to the WiFi country still being set to "US" in wpa_supplicant.conf I notice the locale variables all still have US-based values. I don't know if this matter if the install is used strictly as a moOde player. Code: pi@moode837:~ $ timedatectl show Regards, Kent RE: Use Raspberry Pi Imager to configure WLAN country, time zone & keyboard layout - Tim Curtis - 01-03-2024 What happens if u make same Imager settings and just burn a Bookworm image? I'll investigate the wifi country code bug. RE: Use Raspberry Pi Imager to configure WLAN country, time zone & keyboard layout - Tim Curtis - 01-03-2024 I verified the code in worker.php that extracts the country code from pi-imager generated wpa_supplicant.conf file and then updates cfg_network table works correctly. What doesn't seem right is the wpa_supplicant.conf file generated by the Pi Imager. It has country = US even though /boot/firstrun.sh shows country = GB which I specified in the imager. Here's my test 1. Prep image using Pi-Imager 1.8.4 2. Set WiFi country to something other than US 3. Write the image 4. Insert USB-uSD dongle into a moOde Pi # Save firstrun.sh file and examine it, verify country code 5. sudo cp /media/boot/firstrun.sh ./ # Add debug line to worker.php 6. sudo nano /media/rootfs/var/www/daemon/worker.php and add the bolded line // Pi Imager: Import SSID/PSK/Country if (file_exists('/etc/wpa_supplicant/wpa_supplicant.conf')) { $moodeHeader = sysCmd('cat /etc/wpa_supplicant/wpa_supplicant.conf 2>&1 | grep "This file is automatically generated"'); sysCmd('cp /etc/wpa_supplicant/wpa_supplicant.conf /home/pi/'); 7. Boot a Pi with the modified uSD card 8. SSH # Examine country code 9. sudo cat ./wpa_supplicant.conf RE: Use Raspberry Pi Imager to configure WLAN country, time zone & keyboard layout - TheOldPresbyope - 01-03-2024 (01-03-2024, 04:03 PM)Tim Curtis Wrote: I verified the code in worker.php that extracts the country code from pi-imager generated wpa_supplicant and then updates cfg_network table works correctly. It gets weirder---at least to me. With vanilla (e.g., no moOde) Bullseye 64-bit Lite flashed with Imager options set for Germany, wpa_supplicant.conf ends up with no country code line at all. Similarly with vanilla Bookworm 64-bit Lite, where the connection info is stored in /etc/NetworkManager/system-connections, I find no country code associated with the WiFi subsystem. I suppose in managed (aka infrastructure) mode this perhaps doesn't matter because it's the detectable APs which dictate which frequencies are acceptable for connection. Still, I don't understand the inner workings well enough to make any definitive statement. And in neither case is the locale properly set. In the bookworm test I'm running ATM I get (because RaspiOS comes configured for the UK) Code: pi@bookworm-test:~ $ locale yet the time zone is Europe/Berlin and the default keyboard settings include XKBLAYOUT="de" due to firstrun.sh. Regards, Kent PS - For what it's worth, I'm running Imager v1.8.4 on a Linux laptop. RE: Use Raspberry Pi Imager to configure WLAN country, time zone & keyboard layout - Tim Curtis - 01-03-2024 Scary :-0 When I walked the code in firstrun.sh to see what was happening I looked at this path firstrun.sh /usr/lib/raspberrypi-sys-mods/imager_custom set_wlan <ssid> <psk> <country> set_wlan() set_wlan_country () raspi-config nonint do_wifi_country "$COUNTRY" Maybe the desired wifi country code in firstrun.sh is getting overridden with "US" which is what is set when the moOde image is built. Prolly in the raspi-config part... RE: Use Raspberry Pi Imager to configure WLAN country, time zone & keyboard layout - jenzd - 01-03-2024 Also played around with a vanilla bullseye 64-bit lite image. I get the same result as @TheOldPresbyope, no country code in /etc/wpa_supplicant/wpa_supplicant.conf. Yet the country code is set correctly in /etc/default/crda Code: # Set REGDOMAIN to a ISO/IEC 3166-1 alpha2 country code so that iw(8) may set It also shows up correctly when running the command iw reg get Code: global So maybe /etc/default/crda is the correct location to look up the country? The locale settings are not so important from my point of view. It's probably even best to stick to en_US.UTF-8 here to have consistent formats ... Regards Jens |