Auto startx with mksh

Everything about X, Gnome, KDE, ... and everything running on it

Auto startx with mksh

Postby bedtime » 2018-04-08 13:54

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?
OS: Debian GNU/Linux (Buster—testing); Kernel: 4.16.0-2-amd64; Shell: sh; WM: i3
Machine: HP ProDesk 600 G3—i7-7700, 8GB RAM, 256 SSD, Intel HD Graphics 630

bedtime
 
Posts: 93
Joined: 2012-12-16 19:34

Re: Auto startx with mksh

Postby Head_on_a_Stick » 2018-04-08 15:58

Code: Select all
mv ~/.bash_profile ~/.profile

Read the man pages d00d.
dbruce wrote:Ubuntu forums try to be like a coffee shop in Seattle. Debian forums strive for the charm and ambience of a skinhead bar in Bacau. We intend to keep it that way.
User avatar
Head_on_a_Stick
 
Posts: 8322
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Auto startx with mksh

Postby debiman » 2018-04-08 16:06

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
debiman
 
Posts: 3064
Joined: 2013-03-12 07:18

Re: Auto startx with mksh

Postby bw123 » 2018-04-08 16:10

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
User avatar
bw123
 
Posts: 3580
Joined: 2011-05-09 06:02
Location: TN_USA

Re: Auto startx with mksh

Postby Head_on_a_Stick » 2018-04-08 16:22

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:
dbruce wrote:Ubuntu forums try to be like a coffee shop in Seattle. Debian forums strive for the charm and ambience of a skinhead bar in Bacau. We intend to keep it that way.
User avatar
Head_on_a_Stick
 
Posts: 8322
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Auto startx with mksh

Postby bw123 » 2018-04-08 16:31

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.
User avatar
bw123
 
Posts: 3580
Joined: 2011-05-09 06:02
Location: TN_USA

Re: Auto startx with mksh

Postby bedtime » 2018-04-08 16:41

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.
OS: Debian GNU/Linux (Buster—testing); Kernel: 4.16.0-2-amd64; Shell: sh; WM: i3
Machine: HP ProDesk 600 G3—i7-7700, 8GB RAM, 256 SSD, Intel HD Graphics 630

bedtime
 
Posts: 93
Joined: 2012-12-16 19:34

Re: Auto startx with mksh

Postby Head_on_a_Stick » 2018-04-09 12:21

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
dbruce wrote:Ubuntu forums try to be like a coffee shop in Seattle. Debian forums strive for the charm and ambience of a skinhead bar in Bacau. We intend to keep it that way.
User avatar
Head_on_a_Stick
 
Posts: 8322
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Auto startx with mksh

Postby bedtime » 2018-04-09 18:15

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!
OS: Debian GNU/Linux (Buster—testing); Kernel: 4.16.0-2-amd64; Shell: sh; WM: i3
Machine: HP ProDesk 600 G3—i7-7700, 8GB RAM, 256 SSD, Intel HD Graphics 630

bedtime
 
Posts: 93
Joined: 2012-12-16 19:34


Return to Desktop & Multimedia

Who is online

Users browsing this forum: No registered users and 3 guests

fashionable