DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 16th March 2011
kpedersen kpedersen is offline
Port Guard
 
Join Date: Nov 2009
Posts: 25
Default Xorg run from rc.local no keyboard response

Hello,

Currently for one of my machines, I have it automatically starting X using rc.local. E.g by putting in the following line.

Code:
su -l myusername -c "xinit twm &"
Whilst this works pretty well, I seem to not be able to type anything on the keyboard (keypresses go to the ttyC0 console underneath instead). To hack around this I have to write a script that waits 10 seconds and then runs 'xinit twm'. With this then it seems to have expected behavior.

Can anyone suggest a reason for this?

Best Regards,
Reply With Quote
  #2   (View Single Post)  
Old 16th March 2011
BSDfan666 BSDfan666 is offline
Real Name: N/A, this is the interweb.
Banned
 
Join Date: Apr 2008
Location: Ontario, Canada
Posts: 2,223
Default

If you want X to start during boot, it makes more sense to use a display manager.. xdm(1) is in base and can be started by adding a single line to /etc/rc.conf.local.

You could also start it by adding something to your shell initialization script, see your home directory.
Reply With Quote
  #3   (View Single Post)  
Old 16th March 2011
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

Quote:
Originally Posted by kpedersen View Post
Can anyone suggest a reason for this?
Yep, but it only a suggestion. The xinit application was designed to be run by a logged in end user, with both an attached tty/pty and a $HOME environment variable. It was not intented to be run by an rc(8) script at initialization time.

Like BSDfan666, I would recommend xdm. It is highly configurable, and designed for this purpose.
Reply With Quote
  #4   (View Single Post)  
Old 16th March 2011
kpedersen kpedersen is offline
Port Guard
 
Join Date: Nov 2009
Posts: 25
Default

The issue with XDM is that the user would need to log in.
Ideally this machine is to be used as a permanently logged in terminal with a GUI and interactive application running. (twm was just a simple example)

I used to use FreeBSD for this (put a similar script in '/etc/rc.d' and it worked well), unfortunately OpenBSD better supports the hardware than FreeBSD, thus the change.

Is there a way to forcefully attach a tty/pty before I call xinit (or startx)?

On another note I am also concerned that my clone of CDE's dtlogin is going to have problems with OpenBSD because it uses a similar method of starting up.
Reply With Quote
  #5   (View Single Post)  
Old 17th March 2011
BSDfan666 BSDfan666 is offline
Real Name: N/A, this is the interweb.
Banned
 
Join Date: Apr 2008
Location: Ontario, Canada
Posts: 2,223
Default

There are other display managers in the ports tree, gdm/kdm/slim, the idea of logging in automatically seems very inadvisable though.. but probably supported by one of them.

http://en.wikipedia.org/wiki/X_displ...mplementations

You may be able to workaround your problem and start X in the way you wish, but isn't a traditional way of doing things.

Note that using your method X will not recover if it crashes or is terminated by the user.. so you may wish to make your rc.local a bit more intelligent.

Indeed the keyboard input will probably be intercepted by the other wscons terminal, the following before or after executing xinit might help.. or even better try turning off ttyC0 in /etc/ttys.

wsconsctl display.focus=4

Good luck.
Reply With Quote
  #6   (View Single Post)  
Old 18th March 2011
kpedersen kpedersen is offline
Port Guard
 
Join Date: Nov 2009
Posts: 25
Default

Hello,

I tried the wsconsctl trick you suggested but unfortunately it seems to just flick back to ttyC0 and when I try to go to x11 (ctrl-alt-F5) it doesn't seem to exist.

Oh well, I will probably just make do with my 10 seconds wait since I don't really want to disable ttyC0 in /etc/ttys.

Thanks for the suggestion and If I come up with a great workaround, I will update this post.
Reply With Quote
  #7   (View Single Post)  
Old 19th April 2017
kpedersen kpedersen is offline
Port Guard
 
Join Date: Nov 2009
Posts: 25
Default

Hello again everyone. I hope all is well since the last post around 6 years ago

I finally found a solution to this that I thought I might share:

The trick is to keep checking until getty is running. This is because if getty starts after X11, it seems to grab the input devices leaving the machine locked.

A script like this called from rc.local should be enough to automatically startx from a user.

Code:
while true; do

  pkill -0 getty
  RESULT=$?

  if [ $RESULT = 0 ]; then
    break
  fi

  sleep 1

done

su -l kpedersen -c startx
Hope this helps.
Reply With Quote
  #8   (View Single Post)  
Old 20th April 2017
backrow backrow is offline
Real Name: Anthony J. Bentley
Shell Scout
 
Join Date: Jul 2009
Location: Albuquerque, NM
Posts: 136
Default

Quote:
Originally Posted by kpedersen View Post
Hello again everyone. I hope all is well since the last post around 6 years ago
Well, since then OpenBSD’s xdm(1) — now xenodm(1) — has acquired an “autoLogin” option, which logs into X as the specified user with no user interaction whatsoever. Might want to switch!
__________________
Many thanks to the forum regulars who put time and effort into helping others solve their problems.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
AMD Fusion APU benchmarks, the AMD's 'Response to Atom CPU' vermaden News 1 6th January 2011 12:56 AM
Can't Response Ping Request widhi OpenBSD General 5 24th March 2010 10:40 PM
Tor Project infrastructure updates in response to security breach J65nko News 1 22nd January 2010 06:57 PM
log from rc.conf.local and rc.local sdesilet OpenBSD General 1 21st January 2010 02:37 AM


All times are GMT. The time now is 12:23 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick