03-10-2023, 11:21 AM
(This post was last modified: 03-10-2023, 11:45 AM by Tim Curtis.
Edit Reason: ETA
)
(03-10-2023, 07:41 AM)the_bertrum Wrote: Thanks for the explanation Tim, all very clear now.
Out of interest how is this fact:
(03-09-2023, 11:52 AM)Tim Curtis Wrote: Note that the userid pi should not be renamed because there are still a few hard coded "/home/pi" paths left in the code. A future release will address this :-)dealt with on new systems where the default user is specified? Is there still a /home/pi created even without a pi user?
Yes the directory /home/pi is present on the ISO image.
Code:
pi@sig:~ $ ls -l /media/rootfs/home/pi
total 4
-rwxr-xr-x 1 root root 1389 Mar 5 10:01 piano.sh
pi@sig:~ $
In the Pi Imager if SSH is not selected a userid and password are not required. This is not a recommended configuration because SSH is almost always needed for troubleshooting issues but moOde should still work without the userid pi being present.
ETA (Edit To Add)
I suppose that my statement below is not really correct because IIRC if something other than "pi" is chosen as the userid the Imager will alias the new id to the pi id (I think).
Code:
[b]Note[/b] that the userid pi should not be renamed because there are still a few hard coded "/home/pi" paths left in the code. A future release will address this :-)
The Imager creates this file /boot/firstrun.sh
Code:
#!/bin/bash
set +e
FIRSTUSER=`getent passwd 1000 | cut -d: -f1`
FIRSTUSERHOME=`getent passwd 1000 | cut -d: -f6`
if [ -f /usr/lib/raspberrypi-sys-mods/imager_custom ]; then
/usr/lib/raspberrypi-sys-mods/imager_custom enable_ssh
else
systemctl enable ssh
fi
if [ -f /usr/lib/userconf-pi/userconf ]; then
/usr/lib/userconf-pi/userconf 'pi' '$5$L9QXMdEni1$rrm8vu353U0MGXtv7bfIcYsBYaEKnDGTPuK5i8u8N94'
else
echo "$FIRSTUSER:"'$5$L9QXMdEni1$rrm8vu353U0MGXtv7bfIcYsBYaEKnDGTPuK5i8u8N94' | chpasswd -e
if [ "$FIRSTUSER" != "pi" ]; then
usermod -l "pi" "$FIRSTUSER"
usermod -m -d "/home/pi" "pi"
groupmod -n "pi" "$FIRSTUSER"
if grep -q "^autologin-user=" /etc/lightdm/lightdm.conf ; then
sed /etc/lightdm/lightdm.conf -i -e "s/^autologin-user=.*/autologin-user=pi/"
fi
if [ -f /etc/systemd/system/getty@tty1.service.d/autologin.conf ]; then
sed /etc/systemd/system/getty@tty1.service.d/autologin.conf -i -e "s/$FIRSTUSER/pi/"
fi
if [ -f /etc/sudoers.d/010_pi-nopasswd ]; then
sed -i "s/^$FIRSTUSER /pi /" /etc/sudoers.d/010_pi-nopasswd
fi
fi
fi
if [ -f /usr/lib/raspberrypi-sys-mods/imager_custom ]; then
/usr/lib/raspberrypi-sys-mods/imager_custom set_wlan 'AirnetN5' '4c5d8834c963a31e5c3e7412de1481378ba3fcaf5a00c1b7cbae334269d75d73' 'GB'
else
cat >/etc/wpa_supplicant/wpa_supplicant.conf <<'WPAEOF'
country=GB
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
ap_scan=1
update_config=1
network={
ssid="AirnetN5"
psk=4c5d8834c963a31e5c3e7412de1481378ba3fcaf5a00c1b7cbae334269d75d73
}
WPAEOF
chmod 600 /etc/wpa_supplicant/wpa_supplicant.conf
rfkill unblock wifi
for filename in /var/lib/systemd/rfkill/*:wlan ; do
echo 0 > $filename
done
fi
rm -f /boot/firstrun.sh
sed -i 's| systemd.run.*||g' /boot/cmdline.txt
exit 0