[Nottingham] Log in to X11 at boot

Mike Cardwell nlug at lists.grepular.com
Mon May 26 15:37:44 UTC 2014


In /etc/inittab I changed:

# The default runlevel.
id:2:initdefault:

To:

# The default runlevel.
id:5:initdefault:

I then rebooted. I can see that during boot up it enters run level 5. I
ssh in and run "runlevel" and it tells me it is running at run level 5.
All I see is a blank screen though after X apparently starts.

Now, if I ssh in and run "startx" as the pi user, it all works fine and
I can see the app running on the screen. But this is no different to the
way it was before when it was running at run level 2, and yet worked
fine after I ssh'd in and ran startx.

Before, when I was running at run level 2, the X11 app did work. I just
don't know how to start it automatically.

pi at blackpi ~ $ cat ~/.xinitrc 
/home/pi/x11.pl
pi at blackpi ~ $ 

How do I make "x11.pl" run as the "pi" user, without having to ssh in
first. I'm not convinced this has anything to do with run levels as it
works fine at run level 2.

I think you might be confusing my setup with a more standard one where
things like window managers which are loaded from startup scripts are
involved. x11.pl is just a simple script which draws some stuff on to
an x11 display.

Regards,

Mike

* on the Mon, May 26, 2014 at 12:59:10PM +0100, Paul wrote:
> Mike 
> 
> Absolutely. You can put what ever you like in rc.local or crontab an it
> wont get executed unless the kernal has started the run level required
> for the script to execute.
> 
> Its actually much easier to see and understand on a 2.6 kernel than the
> the later 3 kernels. If you have access to a 2.x kernel you can see what
> happens by adding a switch to the grub boot line. If you add 1 to the
> end of the line it will just start and log you is as root with no
> networking. If you add a 5 it will start xwindows. Have a play and see
> and you will also get to see the importance of rc.1 ... rc.x
> directories.
> 
> Paul
>  
> 
> On Mon, 2014-05-26 at 12:31 +0100, Mike Cardwell wrote:
> > Hmm. Are you sure this has something to do with run levels? Just to be
> > clear, if I ssh in and run "startx" it all works fine. I just want this
> > to happen automatically at boot... Normally when I want things to happen
> > automatically at boot, I run them from /etc/rc.local or cron, but this
> > doesn't work for startx. I don't want to start up gnome or kde or get a
> > graphical login prompt or anything like that, I just want this simple
> > single x11 app to run as a particular user, automatically at boot.
> > 
> > Mike
> > 
> > * on the Mon, May 26, 2014 at 10:44:31AM +0100, Paul wrote:
> > > Hi 
> > > 
> > > Sorry a bit late in replying but the problem is to do with Kernel run
> > > levels. To start X windows you need runlevel 5 where for text login with
> > > network you only need runlevel 4. This might help you and explains
> > > kernel run levels.
> > > 
> > > http://www.debian-administration.org/articles/212
> > > 
> > > Paul 
> > > 
> > > On Sat, 2014-05-24 at 16:50 +0100, Martin wrote:
> > > > On 24/05/14 09:02, Mike Cardwell wrote:
> > > > > I purchased a small 2.8" touchscreen for one of my Raspberry Pi's. I
> > > > > wrote a small X11 app and then added the path to it to my "pi" users
> > > > > ~/.xinitrc. If I ssh in and run startx, the app begins and displays
> > > > > on screen. I can't figure out how to get this to happen automatically
> > > > > at boot though. I've tried adding it to /etc/rc.local, and as a
> > > > > "@reboot" cron job. I even replicated the act of ssh'ing and and
> > > > > running "startx" by setting up ssh keys and running "ssh localhost
> > > > > startx" to cron, to no avail.
> > > > > 
> > > > > I'm sure I'm missing something fundemental about how this is
> > > > > supposed to work. Any ideas?
> > > > 
> > > > Mmmm... Never needed to do that!
> > > > 
> > > > You'll need to have some non-root user with the appropriate groups set
> > > > (video?) to run the startx... su "non-root" needed?
> > > > 
> > > > 
> > > > Or might you just need the access to the X11 display screen enabling to
> > > > allow other processes?
> > > > 
> > > > For whichever shell has run the startx, issue the command:
> > > > 
> > > > xhost +si:localuser:other_user_for_access
> > > > 
> > > > to allow "other_user_for_access" to do things to the display screen.
> > > > 
> > > > 
> > > > Take a look at what the various login display managers do?
> > > > 
> > > > And trying to use ssh is going to be awfully confusing for whether
> > > > things are getting X-forwarded back over ssh!...
> > > > 
> > > > 
> > > > Good luck?!
> > > > Others??
> > > > 
> > > > 
> > > > > Here's the touchscreen in case you're interested:
> > > > > 
> > > > > https://www.adafruit.com/products/1601
> > > > 
> > > > Great fun but also...
> > > > 
> > > > Is that better than rooting a cheapie graphics pad for similarly swish
> > > > fun for similar price and effort?
> > > > 
> > > > :-)
> > > > 
> > > > 
> > > > Cheers,
> > > > Martin
> > > > 
> > > > 
> > > > 
> > > 
> > > 
> > > 
> > > _______________________________________________
> > > Nottingham mailing list
> > > Nottingham at mailman.lug.org.uk
> > > https://mailman.lug.org.uk/mailman/listinfo/nottingham
> > _______________________________________________
> > Nottingham mailing list
> > Nottingham at mailman.lug.org.uk
> > https://mailman.lug.org.uk/mailman/listinfo/nottingham
> 
> 
> 
> _______________________________________________
> Nottingham mailing list
> Nottingham at mailman.lug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/nottingham
-- 
Mike Cardwell  https://grepular.com https://emailprivacytester.com
OpenPGP Key    35BC AF1D 3AA2 1F84 3DC3   B0CF 70A5 F512 0018 461F
XMPP OTR Key   8924 B06A 7917 AAF3 DBB1   BF1B 295C 3C78 3EF1 46B4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 598 bytes
Desc: Digital signature
URL: <http://mailman.lug.org.uk/pipermail/nottingham/attachments/20140526/82f16c88/attachment.pgp>


More information about the Nottingham mailing list