Skip to main content
Topic: How to autostart X at login without SDDM (boot to your DE/WM without login) (Read 643 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

How to autostart X at login without SDDM (boot to your DE/WM without login)

I stuck this in the thread that is asking for suggestions for the FAQ. On second thoughts it is likely better off out here with its own title as it will make it easier for someone to find if they are looking for a how-to on this topic (autologin without a display manager - some of us operate our systems in "secure" environments, & also don't like to use DM's for whatever reason ;) ).

I'm sure that someone can come up with alternative ways, perhaps there is a more correct way? I don't know?

I didn't create the following, I searched it out on the web, & it works perfectly for me (I'm using Openbox), & it was really quite quick & easy to do.

So here you go:

To start X automatically:

Make your /etc/conf.d/agetty.tty1 the same as the following:

# Set the baud rate of the terminal line
baud="38400"

# set the terminal type
term_type="linux"

# extra options to pass to agetty for this port
agetty_options="--autologin guest"

# make agetty quiet
#quiet="no"

Be sure replace guest in the above code, to the user name that you desire to autologin.


Put the following into the user's  ~/.bash_profile :

# Start x on login
if [[ -z $DISPLAY && ! -e /tmp/.X11-unix/X0 ]]; then
   exec startx
fi

Apart from the above, you will just need to use pacman to delete sddm, lightdm or whichever other DM you have installed. After you have done that, the above changes should allow you to boot straight into your WM or DE without any user input (no logging in with user names & passwords).

Note: the above code & information came from the Porteus forum: http://forum.porteus.org/viewtopic.php?p=58946&sid=7e00b1918e3bc2d578709e57979e0bd1

[edit:] If a system update makes you have to startx manually

Thus far, once, I've had an update that overwrote the /etc/conf.d/agetty.tty1 which of course meant that I had to login manually again.

All that was required (in my case) was changing the following line:

agetty_options=""

Back to:

agetty_options="--autologin handy"

So you just have to add --autologin <your.user.name> between the double quotes & your good to go.

You could stop this from happening in future by using one of the two following methods. I used this first one today, but after @thefallenrat posted a link below, I am now using the 2nd method shown here, as it is more elegant:

Method 1. Making the agetty.tty1 file immutable like so:

$ sudo chattr +i /etc/conf.d/agetty.tty1

If you need to make the file changeable again then do this:

$ sudo chattr -i /etc/conf.d/agetty.tty1

If you want to list the file attributes of a file that is using the second extended file system (which is what the chattr command is using), you use the following command like so:

$ lsattr /etc/conf.d/agetty.tty1

Which will give a result like so:

----i---------e---- /etc/conf.d/agetty.tty1

Method 2. (quoted from the Arch Wiki)
Quote
To prevent any package from overwriting a certain file, add the following line to /etc/pacman.conf:

NoUpgrade = absolute/path/to/file

Note that the path must not start with a slash.

Which means that I've uncommented the # NoUpgrade   = line in my /etc/pacman.conf & it now looks like this:

NoUpgrade   = etc/conf.d/agetty.tty1

So that is a much more Arch way of doing things. ;)


Re: How to autostart X at login without SDDM (boot to your DE/WM without login)

Reply #1
Today's update overwrote the /etc/conf.d/agetty.tty1 which of course meant that I had to login manually again.

I've edited to the OP above. ;)

Re: How to autostart X at login without SDDM (boot to your DE/WM without login)

Reply #2
Today's update overwrote the /etc/conf.d/agetty.tty1

https://wiki.archlinux.org/index.php/Pacman/Pacnew_and_Pacsave#Systemwide_backup_files
If I can hit that bullseye, the rest of the dominoes will fall like a house of cards. Checkmate!

Re: How to autostart X at login without SDDM (boot to your DE/WM without login)

Reply #3
@thefallenrat Thanks, that is a much nicer way to stop a file from being overwritten. :)

I'll edit the OP to reflect this new (to me) info'.

 

Re: How to autostart X at login without SDDM (boot to your DE/WM without login)

Reply #4
Thanks for this, really nice.

I also run openbox wm and tried this out, works beautifully.

This automatically logs me into the desktop so as an added security measure i have added xtrlock & at the end of my ~/.config/openbox/autostart

This locks the desktop using xtrlock - https://www.archlinux.org/packages/community/x86_64/xtrlock/

You could use any screen locker that works but i like xtrlock.