LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Killing X Blindly (by Script)? (https://www.linuxquestions.org/questions/slackware-14/killing-x-blindly-by-script-234942/)

negface 09-24-2004 08:43 PM

Killing X Blindly (by Script)?
 
Hello,

I'm running Slax 4.1.4 and am having problems with X. I get a black screen, lose keyboard functionality, and must reboot. Ive tried a bunch of stuff with no luck, and now I have an idea thats beyond my know-how.

Id like to edit my xinitrc (or a more relevant script) to include something that will kill X after a given amount of time, like 1 minute, and drop me back to prompt. Since I lose my keyboard, scripting seemed like a natural choice.

I figure if I can get back to prompt and look at the /var/log/Xorg.0.log then I can see whats causing the problem/formulate solution. I cant look at it after reboot because everything is saved in RAM (LiveCD), and dont feel like setting up partitions/finding a floppy.

My assumption is that the script continues to run after I get the black screen and keyboard lockup (which may be false). It might be the case that the whole shebang hangs, which will render this idea pointless.

Here are some of the "bunches of stuff" Ive tried before this:
-Slax's guisafe and guifast scripts (these are just startx's with pre-loaded values. "gui" is the default w/kde and what I try unless otherwise stated)
-startx
-manually editing slax's gui.conf multiple times (including putting in obviously bad but safe values to try and get a different response)
-manually editing the actual gui* script (dont understand why it does xinitrc 2<dev/null <dev/null more than once...)
-running xorgconfig a few times, then doing startx
-creating another user, running x, then trying ctrl+alt+F1/BS and alt+f7 (this is how I found out my keyboard was locking up, cant toggle numlock/capslock either)
-doing the same without making a new user (another root tty)
-asking for help on the slax website
-asking for help on the linuxquestions.org newbie forum
-google searching for solution
-asking my box nicely in binary/japanese/pimp-speak

And some possibly relevant specs:
-nVidia GeForce 3 Ti500
-circa 1999 eMachines eView 17 monitor (supports resolutions up to -1280x1024 with refresh rates within slax's default values)
-360MB pc 133 sdram
-Generic 104 keyboard with windows button

Thanks, any input is appreciated ;)

shilo 09-24-2004 08:47 PM

How about using virtual terminals to check what is going on while you are having the probelm? just ctrl-alt-fx, where x is each of 1 through 12. One of them should give you a usable login prompt.

negface 09-24-2004 08:52 PM

Yeah, like I said, thats how I found out my keyboard was locking up. I cant toggle the leds by hitting numlock/capslock either. It seems no input is accepted at all, so I thought maybe a script could do what I couldnt.

gbonvehi 09-24-2004 09:00 PM

If you have a spare machine try connecting trough SSH to see if it's still alive (I got some lockups, no keyboard or graphic response while trying some stuff on X and could get it back trought ssh). If you do, you can kill X and startx from the ssh connection so the X messages will be dumped there, and of course you can see the X log :)

Btw, "I'm running Slax 4.1.4 and am having problems with X. I get a black screen, lose keyboard functionality, and must reboot. Ive tried a bunch of stuff with no luck, and now I have an idea thats beyond my know-how." When do you get the black screen? And does Slax uses framebuffer (the console with the Tux logo) and Xorg (which version) or Xfree86?

negface 09-24-2004 09:19 PM

gbonvehi-

Unfortunatly no spare machine :(

And yes, I suppose that first bit was a slight vague...

Slax 4.1.4 uses X.org 6.7.0 and KDE 3.3.0 (Final)

I get the black screen when I do anything with the intent of starting a gui environment. Slax has a few built in scripts (gui, guifast, guisafe, etc) that basically slap default values into the xorg.conf. The black screen happens after I enter one of those, and also if I enter 'startx'. I'm running from root with the exception of when I tried adding a new user as mentioned above (echo $PATH is correct...).

Dont know what framebuffer is; I'm working from a CLI. Only graphical effects are a 4 leafed clover (slax logo) at boot prompt, and colored text.

gbonvehi 09-24-2004 10:20 PM

Mmm I can't be of any help then, sorry, but I don't know Slax's scripts.
The only thing I can recommend you to try (If it works on Slax) is: X -configure
and run X with the configuration generated there (it says how to do it when the configuration finishes)

Nichole_knc 09-24-2004 10:42 PM

Well I have ran `hup startx &` to capture the output to hup.out. WORKED...
I was having problems close to what is listed above...
DO tell....
Seems xorg (as many other programs) that do not exit on a good note leaves a few lock files around...
As I 'experiment' with machines quite often I have this happen regularly.
Solultion??
As root goto /tmp and remove everything related to the user and xwindows/gnome/kde...
Usually fixes it right up...
This is of course that a bad exit started the whole lock up to begin with...

gbonvehi 09-24-2004 10:51 PM

"Well I have ran `hup startx &` to capture the output to hup.out. WORKED..."
Nice command :)

Regarding the tmp files, Slax is a LiveCD Slackware based distribution, so every gets "reseted" on each reboot because it's mantained on ram during uptime so I guess deleting /tmp folder won't do it here :/ .

negface 09-25-2004 12:33 AM

'hup startx &'

Not sure what 'hup' is. I get the 'startx &' part... Tried it and it just gave a "bash-invalid command" or some such. Is it some script you made? Or just some random name you made up? Or a command omitted from the Slax cd?

Anyways, 'Xorg -configure' gives me the same black screen of oddness; I assume because it probes compatibility by cycling through different things. The difference is I get some error text before the black screen, but it goes by too fast for me to ctrl+c, alt+sysrq+k, etc. I did manage to get a ctrl+alt+F2 off during the error text though; it went to the black screen at the new tty's login prompt. XD

Ive been playing around with the watch command. The intent is to set it to where I run something like "watch -n 60 kill startxPID#" (the commandname exception doesnt seem to be set up in slax). Then running startx and waiting for watch to kill it, thus dumping me back to prompt. Trouble is, Im not sure what part of Xorg to kill, theres xinit, xinitrc, xserverrc... Is there a way to just kill everything except the shell from the CLI?

Like say I knew startx ran xinit, then xinitrc, then xserverrc. I could do a 'ps' to get the current PID, say 1500. My watch command could then be set up like 'watch -n 60 kill 1504; watch -n 60 kill 1505; watch -n 60 kill 1506' since the watches themselves would be 1501,2 and 3. Or can you even kill rc's? It would not be fun to set it up to kill every process within those files... :(

One other idea: Is there a way to startx in another tty while staying within the original tty? I thought this was what 'startx &' would do, but apparantly that just gives you a continuous xterm upon getting into X. Also tried 'startx -- :1 &' but the black screen returned, I guess thats more for multiple monitor systems or something?

Anyways thanks again for replying :)

gbonvehi 09-25-2004 12:38 AM

startx -- :1 will open another X server on :1 instead of :0 the default. (So you can have two X servers running)
try: watch -n 60 killall X
or watch -n 60 kill <PID of X in ps>

negface 09-25-2004 01:10 AM

Well, I tried "watch -n 60 killall X &" and "watch -n 60 killall Xorg &" before startx with no luck. :( Might just be the case that my entire system halts...

Nichole_knc 09-25-2004 06:33 AM

My Bad... late night and tired...

The command is `nohup startx &`
this will send the output of startx (stdout) to the file pwd/nohup.out.

negface 09-25-2004 01:27 PM

Tried nohup, still tried to run x...still black screen. But trying to send output somewhere is a good idea. Ill need to send it to floppy... Maybe I can get something like 'startx 2>/mnt/floppy/logfile.txt >/mnt/floppy/logfile.txt' to work.

Cedrik 09-25-2004 02:18 PM

startx > /mnt/floppy/logfile.txt 2>&1

would be more appropriate, but I think X logs error already in /var/log

gbonvehi 09-25-2004 03:53 PM

Try:

Code:

startx -- -logfile /mnt/floppy/logfile.txt
and

Code:

startx -- -logfile /mnt/floppy/logfile2.txt -logverbose 5
Good luck! I hope you can get trough this.


All times are GMT -5. The time now is 09:27 PM.