0

I've got a Raspberry PI 3B+ configured to diskless boot with the PIServer PXE system. I have created a user 'map7' and would like it to autologin my thin clients into the GUI as that user.

I've edited /etc/lightdm/lightdm.conf in the chroot section and also tried the server section and both attempts don't autologin at all. I've tried raspi-config -> boot options -> desktop autologin which sets it up for the 'pi' user then I changed it to 'map7' and still no joy.

The chroot section is the image on the server in which the thin clients mount and use as their root file system. This is in /var/lib/piserver/os/<image name>. The image name maybe Raspbian-2018-11-13 in my example. I use the chroot command to enter into this directory and add my changes for the thin clients. I can add packages etc. The server section is the Raspbian Desktop (which includes scripts for setting up a PIServer and I run in a VM) in which I'm booted into.

I do have the thin clients booting with different users, but I want one of those users to be automatically logged in. I'm using the thin clients as media centers with remotes so they won't have a keyboard to login with.

How do I get 'thin clients' which are linked to PIServer using the Raspbian Normal image to autologin?

Update

I've found that if I try and login really quick at the login screen on the thin client it rejects my username and password. I've tried many times so I know it's not me typing the password incorrect.

I started timing as soon as the dialog box appears, then I type my username and password and hit enter.

5 seconds after the login box appears fails. 10 seconds it accepts the password and continues on.

So there seems to be a timing issue here with thin clients and maybe setting up mount points before it can authorise itself.

UPDATE

Found that it isn't possible with write access to setup autologin for a PIServer thin client. It is however possible if you make it read only.

https://github.com/raspberrypi/piserver/issues/11

  • 1
    Don't the instructions at raspberrypi.org/magpi/set-up-piserver give you enough detail? – Dougie Mar 22 at 5:47
  • What is the chroot section? What is th server section? – Ingo Mar 22 at 18:53
  • Ingo: The chroot section is the image on the server in which the thin clients mount and use as their root file system. This is in /var/lib/piserver/os/<image name>. The image name maybe Raspbian-2018-11-13 in my example. I use the 'chroot' command to enter into this directory and add my changes for the thin clients. I can add packages etc. The server section is the Raspbian x86 PIServer VM in which I'm booted into. – map7 Mar 24 at 23:59
  • Dougie: No those instructions don't include any detail about autologin. I've followed those instructions and I do have the thin clients booting with different users, but I want one of those users to be automatically logged in. I'm using the thin clients as media centers with remotes so they won't have a keyboard to login with. – map7 Mar 25 at 0:02
  • 1
    Offering a bounty won't help if the question is unclear. "Raspbian x86 PIServer VM" - what is this supposed to mean - Raspbian only runs on an ARM SOC? – Milliways Mar 27 at 5:21
0

I haven't looked at PiServer in detail, so don't know if this is possible, but have you tried the following changes (modified as needed for your chroot'ed config)? This is what raspi-config does, and looks like it should be capable of being performed in your environment.

SUDO_USER="autologin-username" # map7 in your case?
#(systemctl set-default graphical.target) The next line "simulates" this
ln -fs /lib/systemd/system/graphical.target /lib/systemd/system/default.target
ln -fs /lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@tty1.service
cat > /etc/systemd/system/getty@tty1.service.d/autologin.conf << EOF                                                                  
[Service]                                                                                                                             
ExecStart=                                                                                                                            
ExecStart=-/sbin/agetty --autologin $SUDO_USER --noclear %I $TERM                                                                     
EOF                                                                                                                                   
sed /etc/lightdm/lightdm.conf -i -e "s/^\(#\|\)autologin-user=.*/autologin-user=$SUDO_USER/"
if [ -e /etc/profile.d/raspi-config.sh ]; then
    rm -f /etc/profile.d/raspi-config.sh
    if [ -e /etc/systemd/system/getty@tty1.service.d/raspi-config-override.conf ]; then
      rm /etc/systemd/system/getty@tty1.service.d/raspi-config-override.conf
    fi
  • I just tried this and the thin client doesn't autologin to the GUI, it's still left at the login screen. – map7 Mar 28 at 22:55
  • I get the error 'systemd[1]: [/etc/systemd/system/getty@tty1.server.d/autologin.conf:1] Invalid section header '[Service] art=/sbin/agetty --autologin map7 --noclear %I xterm' – map7 Mar 28 at 23:56
  • I'm guessing you did, but can you confirm that you modified the commands to operate on your chrooted environment? Also, the lines [Service] and each line following it need to be on separate lines in the autologin.conf file. From the error, it looks as if they're all on one line? – bls Mar 29 at 0:00
  • Yes it was in the chroot area. I did notice that it was on one line and fixed that. The error went away but still doesn't auto login. I'm now thinking it's a timing issue. Please look at my update at the top. – map7 Mar 29 at 0:02
  • Planning to set up my own test...stay tuned. – bls Mar 29 at 18:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.