Part 4 of the series How I use Linux desktop at work where I describe how I’m building a new Vagrant configuration to use for coding on Windows Host systems.
This post describes the learning process to setup LightDM with autologin.
As with previous posts, I will go over the research and manual implementation first, then go over how to automate it.
In part 3, I described how I automated the build of the VirtualBox guest additions using vagrant. Part 4 will improve our current box by swapping the display manager to LightDM and setup autologin.
In the post, I’ll cover:
Steps 1-4 are describing the manual process while step 5 describe how I automated this in the Vagrantfile.
Note: You can find the sources created during this post in my github devbox-arch repository.
I want to setup autologin since I want to get in the guest linux box ASAP without unecessary login.
I only want to do this on a vagrant box under certain conditions:
I really like the quality, somewhat simplicity and features that lightDM gives.
The setup I usually put in place with lightDM:
In arch, this means installing lightdm, lightdm-gtk-greeter, and xinit-xsession (AUR)
For the first two, its simple:
xinit-xsession is part of AUR, so it’s a bit more involved as you have to build it from source.
Now time to enable lightdm:
You’ll now see the lightdm greeter with the vagrant user pre-selected.
If you want to login, the password is vagrant.
Note that you can select xinitrc as a session in the session selection at the top right of the screen.
Autoconfig is configured in lightDM main configuration /etc/lightdm/lightdm.conf.
You must set the following two properties to get autologin with xinit session enabled:
[seat:*] autologin-user=vagrant autologin-session=xinitrc
Note: you have to uncomment the two properties under the existing seat configuration.
You can restart lightdm to see it in action:
You also need to add the autologin group and add user vagrant to this group:
All changes were made to the 2-core.sh script.
The interesting part is how to install xinit-xsession and then setup lightdm for autologin.
Installing xinit-xsession using AUR comes to one command:
Note: makepkg needs to run as a regular user, so you need to clone, and call makepkg using vagrant.
Enabling autologin can be done using sed:
The sed’s -i option enables in-place editing which change the file specified.
The last part, creating a .xinitrc that calls openbox:
Here, the file is created as root, and then ownership is transferred to the vagrant user.
I hope I am able to demonstrate how easy it is to provision a Linux development VM using vagrant and some unix scripts.
The hardest part is done, getting a foundation to install development tools and configuration.
In next post, I’ll configure this VM using chezmoi. This will allow me to bring my dotfiles and installation scripts.
When I started this blog, I was hoping it would be useful to others. Now I see that it may be as useful to me. It makes me thinks of my goals, think about improving, it makes me learn.
I hope this series inspires people to shape tools to meet their needs.
This is day 6 of my #100DaysToOffload. You can read more about the challenge here: https://100daystooffload.com.