Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Auto startx with mksh

Graphical Environments, Managers, Multimedia & Desktop questions.
Post Reply
Message
Author
bedtime
Posts: 146
Joined: 2012-12-16 19:34
Has thanked: 1 time
Been thanked: 6 times

Auto startx with mksh

#1 Post by bedtime »

I would like the computer to automatically startx upon login. This worked well with the default bash shell, but now with the mksh shell, it just brings me to the tty, and I have to manually issue a 'startx' command myself to start it.

Here is my .xsession:

Code: Select all

(sleep .5; xterm)&
exec windowlab
My .mkshrc file is empty.

.mksh_profile

Code: Select all

if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then exec startx; fi
It logs in fine, but I'll add this config anyways, just incase it could be a factor.

/etc/systemd/system/getty@tty1.service.d/override.conf <

Code: Select all

[Service]
Type=simple
ExecStart=
ExecStart=-/sbin/mingetty --autologin user %I
Restart=no
Any ideas?

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Auto startx with mksh

#2 Post by Head_on_a_Stick »

Code: Select all

mv ~/.bash_profile ~/.profile
Read the man pages d00d.
deadbang

User avatar
debiman
Posts: 3063
Joined: 2013-03-12 07:18

Re: Auto startx with mksh

#3 Post by debiman »

Head_on_a_Stick wrote:

Code: Select all

mv ~/.bash_profile ~/.profile
Read the man pages d00d.
did op edit their post after you answered?
afaics no bash is involved.

User avatar
bw123
Posts: 4015
Joined: 2011-05-09 06:02
Has thanked: 1 time
Been thanked: 28 times

Re: Auto startx with mksh

#4 Post by bw123 »

https://duckduckgo.com/html/?q=bash+double+bracket

I've been using [ and quoting, you may need to do some research on the differences between different shells. http://mywiki.wooledge.org/BashFAQ/031

Code: Select all

if [ $(tty) = "/dev/tty1" ]; then
        startx &> /dev/null
### without exec stay logged in after X
fi
resigned by AI ChatGPT

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Auto startx with mksh

#5 Post by Head_on_a_Stick »

debiman wrote:did op edit their post after you answered?
No.
afaics no bash is involved.
If the OP has configured bash to work as described but the configuration does not work for mksh then they must have used ~/.bash_profile — ~/.profile is read by all shells (including bash, as long as ~/.bash_profile does not exist) but ~/.mksh_profile is a figment of the OP's imagination, AFAICT.
bw123 wrote:differences between different shells
The MirBSD Korn Shell accepts [[ as a test :wink:
deadbang

User avatar
bw123
Posts: 4015
Joined: 2011-05-09 06:02
Has thanked: 1 time
Been thanked: 28 times

Re: Auto startx with mksh

#6 Post by bw123 »

Head_on_a_Stick wrote:...but ~/.mksh_profile is a figment of the OP's imagination, AFAICT.
bw123 wrote:differences between different shells
The MirBSD Korn Shell accepts [[ as a test :wink:
lmao, I knew I should not have replied to this op...

I still think [ is better habit to get into. I like bash so I'd never replace it, but it does have some quirks.
resigned by AI ChatGPT

bedtime
Posts: 146
Joined: 2012-12-16 19:34
Has thanked: 1 time
Been thanked: 6 times

Re: Auto startx with mksh

#7 Post by bedtime »

Head_on_a_Stick wrote:

Code: Select all

mv ~/.bash_profile ~/.profile
Read the man pages d00d.
Just did this.
bw123 wrote:https://duckduckgo.com/html/?q=bash+double+bracket

I've been using [ and quoting, you may need to do some research on the differences between different shells. http://mywiki.wooledge.org/BashFAQ/031

Code: Select all

if [ $(tty) = "/dev/tty1" ]; then
        startx &> /dev/null
### without exec stay logged in after X
fi
And this...

And it works now. Thanks guys! :D

I did look around the web. It seems that there is not nearly as much info on mksh as for zsh and bash; I didn't find much. I guess I just had to dig into the man pages. :roll:

Yes, the .mksh_profile was made up.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Auto startx with mksh

#8 Post by Head_on_a_Stick »

Head_on_a_Stick wrote:

Code: Select all

mv ~/.bash_profile ~/.profile
^ On reflection this may not be the best advice because Debian's stock ~/.profile contains some settings that will be overwritten.

Check the stock file at /etc/skel/.profile and replace any missing lines.

It's also worth copying the supplied mkshrc over to $HOME as well:

Code: Select all

cp /etc/skel/.mkshrc ~
The maintainer of the Debian package happens to be the upstream developer in this case so the mksh package is especially excellent — it even supplies a statically-linked version which is built against klibc (*much* lighter than bloated old glibc) but I prefer to re-link it to the musl version:

Code: Select all

# ln -sf /usr/lib/x86_64-linux-musl/bin/mksh /bin/mksh-static
chsh -s /bin/mksh-static
There's also a dietlibc binary :)

The backported version may be preferred because upstream is very active with new fixes being pushed constantly:

https://packages.debian.org/stretch-backports/mksh
deadbang

bedtime
Posts: 146
Joined: 2012-12-16 19:34
Has thanked: 1 time
Been thanked: 6 times

Re: Auto startx with mksh

#9 Post by bedtime »

Head_on_a_Stick wrote:
Head_on_a_Stick wrote:

Code: Select all

mv ~/.bash_profile ~/.profile
^ On reflection this may not be the best advice because Debian's stock ~/.profile contains some settings that will be overwritten.

Check the stock file at /etc/skel/.profile and replace any missing lines.

It's also worth copying the supplied mkshrc over to $HOME as well:

Code: Select all

cp /etc/skel/.mkshrc ~
I'll do that. It's good to see an example file around. :)
The maintainer of the Debian package happens to be the upstream developer in this case so the mksh package is especially excellent — it even supplies a statically-linked version which is built against klibc (*much* lighter than bloated old glibc) but I prefer to re-link it to the musl version:

Code: Select all

# ln -sf /usr/lib/x86_64-linux-musl/bin/mksh /bin/mksh-static
chsh -s /bin/mksh-static
Nice, I was wondering what the 'static' extension on the end of mksh and other programs meant when I was doing a update-alternatives... Now I know! :)
There's also a dietlibc binary :)

The backported version may be preferred because upstream is very active with new fixes being pushed constantly:

https://packages.debian.org/stretch-backports/mksh
I'll definately check this out once I get things a little more sorted.

Thank you for all this info!

Post Reply