LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Having trouble configuring to autostart app in xserver with no display manager (https://www.linuxquestions.org/questions/linux-software-2/having-trouble-configuring-to-autostart-app-in-xserver-with-no-display-manager-4175486067/)

rtmistler 11-27-2013 01:07 PM

Having trouble configuring to autostart app in xserver with no display manager
 
Running on a BeagleBone Black, using their provided distribution, 3.8.13. Using the CircuitCo 3.5" TFT LCD display. My intentions were to autostart a GUI application at power on, not presently caring whether or not it's under the root user.

I've managed to get the X server running with no display manager. Have a UI based application which runs fine, full screen and all. The X server also will start automatically at boot.

What I'm having difficulty doing is getting the app to be automatically run just after the X server is running.

Here's what I have that accomplishes this.

- Had to install xf86-video-fbdev to get the X server so that it would allow me to rotate the screen.
- Went into /etc/rc#.d and removed the gdm scripts to stop gnome
- xorg.conf looks like this:
Code:

Section "Device"                                 
        Identifier      "Frame Buffer"
        Driver  "fbdev"
        Option        "Rotate"        "CCW"
EndSection

That's the whole file, no additional stuff.
- In order to run the X server after boot, I added this script to /etc/init.d:
Code:

#!/bin/sh

/usr/bin/setterm -blank 0
/usr/bin/setterm -powersave off
/usr/bin/startx -- -nocursor

And run that from levels 2345, after any other scripts were run.

Thus far this gets my display manager run and gets me to a prompt.

Interestingly, if I don't auto-run the x server, and run the startx command from the command prompt; the path available at the prompt once in the server matches root's home directory, and all of root's environment are there.

Auto-running the x server, the directory is "/", and root's environment information is not there, however the user is root.

Therefore trying to create a .xinitrc in root's home does not appear to work. I've placed an echo line to place info into a file to see if the script gets run and the UI happened to fail for some reason. It seems pretty clear that the .xinitrc script is not being run. So I looked into playing with the default xinitrc, no dice there; it ran the script but did not load the server. I'm not sure if that's all backwards either, for instance if the xinitrc runs before the server or any window manager runs. But I'm not running any window manager, just the server.

The reason I need the server is that Qt was near impossible to build for this, and FLTK worked extremely well. However FLTK does not yet work directly out of the frame buffer, hence it requires the X server.

Any suggestions on this? Should I try to figure a way to auto-login as root and from within there have a script which runs startx and then next get my UI running?

My Solution
In the end I had to edit the /usb/lib/X11/xinit/xinitrc file to place the starting of my application at the end of that file. I knew of that file, however this particular copy had xterms as well as xclock being run out of it and also knew that no xterms were running on my screen. In looking at the total processes running I did see that the xterm sessions were running; therefore this xinitrc was being used. So I removed all of the file and now it loads automatically to my custom GUI.

Here's the xinitrc:
Code:

#!/bin/sh
exec /home/root/myui


elucches 12-03-2013 08:06 AM

Hello, I just want to say this blog post -which I didn't try and uses blackbox- might give you some hint. Some time ago I intended to do somethig similar to what you're trying to achieve and saved that link (for now I can use Qt embedded server without X).
Good luck,
Esteban

rtmistler 12-03-2013 08:16 AM

Quote:

Originally Posted by elucches (Post 5074594)
Hello, I just want to say this blog post -which I didn't try and uses blackbox- might give you some hint. Some time ago I intended to do somethig similar to what you're trying to achieve and saved that link (for now I can use Qt embedded server without X).
Good luck,
Esteban

Thanks. You caught me just updating the thread and marking it as solved because I self-resolved it. Yes, I've seen a few blogs like that one which refer to the /etc/inittab. Beagleboard's Angstrom doesn't have any inittab, but I gave that a try and tried to just use only the getty line in an inittab or grabbed an inittab from another distribution, but neither seemed to get me there. In parallel I was able to modify the xinitrc in the default location.

I have to say that I've not always been a real good X server person. It took me quite a bit to get the screen to rotate, and then to do this part. There are several ways to skin the cat here. If nothing, I'd be happier if it was possible to explain better to everyone, how the Xserver loads, exactly where it looks, what key words it accepts. But I do realize that it's a complex topic. And further, truthfully I had tried that xinitrc long ago, but instead of putting in exec I had put in ./home/root/mygui. The problem was, in having made that change, the whole Xserver then did not load and I went "whoa-oh!" and gave that effort up quickly. Not understanding any of all the environmental stuff in there. In the end, I checked it section by section and found that a 2-line xinitrc works perfectly fine; I just had to hit the exactly precise variations. I shouldn't complain, this is just my frustration with the mysteries of Xserver showing.

elucches 12-04-2013 02:17 PM

Yes, X is too complex. Good to hear you've solved it.


All times are GMT -5. The time now is 06:55 AM.