How to restart xwin automatically after hard reset?

Using applications, configuring, problems
Message
Author
User avatar
ecomoney
Posts: 2178
Joined: Fri 25 Nov 2005, 07:00
Location: Lincolnshire, England
Contact:

How to restart xwin automatically after hard reset?

#1 Post by ecomoney »

We help manage a local community cybercafe with puppy installed on 4 pc's. The staff there a far from computer literate and what happen a lot is that the people using them or the staff just swith them off at the mains when they are done. The next morning they all boot up to the prompt and I get an early morning wakeup call saying "The computers are broken, the screen is all black with funny writing on it" ;-)

Would someone let me know what I could add to the startup file to make them automattically boot back into xwindows and assist my Monday morning Lie-ins?

Very much appreciated

Rob
Last edited by ecomoney on Wed 13 Dec 2006, 01:53, edited 1 time in total.
Puppy Linux's [url=http://www.murga-linux.com/puppy/viewtopic.php?p=296352#296352]Mission[/url]

Sorry, my server is down atm!

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#2 Post by MU »

edit /usr/X11R6/bin/xwin

comment the "exit" in this part, which is around line 210 in Puppy 2.10:

from

Code: Select all

  echo '
It seems that last time X ran, the computer hung and you had to reboot.
Have now dropped down to the commandline. If you want to run the Xorg
Video Wizrd, type "xorgwizard", and after configuring /etc/X11/xorg.conf
(hopefully correctly this time!) type "xwin" to start X.'
  echo -e "\\033[0;39m"
  rm -f /etc/.XLOADED #otherwise cannot start X.
  exit
 fi
fi
to

Code: Select all

  echo '
It seems that last time X ran, the computer hung and you had to reboot.
Have now dropped down to the commandline. If you want to run the Xorg
Video Wizrd, type "xorgwizard", and after configuring /etc/X11/xorg.conf
(hopefully correctly this time!) type "xwin" to start X.'
  echo -e "\\033[0;39m"
  rm -f /etc/.XLOADED #otherwise cannot start X.
#  exit
 fi
fi
Mark

User avatar
ecomoney
Posts: 2178
Joined: Fri 25 Nov 2005, 07:00
Location: Lincolnshire, England
Contact:

Thanks

#3 Post by ecomoney »

I should have put theyre still using puppy 1.09ce, However it seems to be the same. I edited the file and did a search for "It seems" and the same text came up, so I commented out the "exit" command, saved, and hit reset a (a "Crash Test" :roll: ) After checking the filesystem puppy booted back into X fine.

Thanks again for your help MU 8)
Puppy Linux's [url=http://www.murga-linux.com/puppy/viewtopic.php?p=296352#296352]Mission[/url]

Sorry, my server is down atm!

gabev
Posts: 38
Joined: Wed 15 Nov 2006, 18:15
Location: New York, NY

#4 Post by gabev »

I've tried the same code and after the second hard crash test , i was again welcomed by the prompt.Seems that the .xinitrc has more than one place where it should be alter such that always after a hard crash it will boot in x.How did you fixed that?

User avatar
ecomoney
Posts: 2178
Joined: Fri 25 Nov 2005, 07:00
Location: Lincolnshire, England
Contact:

Hi

#5 Post by ecomoney »

Bit late replying to this post :oops:

This didnt work either for us, but in the drop in centre where we have a cybercafe set up, the staff have learnt to type 'xwin' :P

Would like to know the answer tho, because this issue still probably causes us more "support calls" then any other..... :wink: :lol:

Would be great I think if this was the default behavior in puppy (it tries to start xwin every time). The worst that would happen in our experience (and I dont know all of the technical issues) would be that x fails and it drops back to the prompt anyway. (or perhaps a setup menu with the prompt and xorgwizard as options?). This would fit into puppys mission statement better.
Puppy Linux's [url=http://www.murga-linux.com/puppy/viewtopic.php?p=296352#296352]Mission[/url]

Sorry, my server is down atm!

User avatar
pakt
Posts: 1157
Joined: Sat 04 Jun 2005, 16:54
Location: Sweden

#6 Post by pakt »

I checked the code in 1.07 (which I still have as a frugal boot choice). You might try the following fix to always have Puppy start X:

Edit /etc/profile

The file ends like this:
#want to go straight into X on bootup only...
if [ ! -f /tmp/bootcnt.txt ];then
#play.tcl /usr/share/audio/2barks.au &
touch /tmp/bootcnt.txt
rm -f /etc/.XLOADED
exec xwin
fi
fi
Just add the line in bold characters before 'exec xwin' and save the file.

EDIT: Make sure you reboot once so the modified file gets saved to pup_001!

IIRC, the file /etc/.XLOADED is a 'flag' file Barry put in to prevent Puppy from re-starting X if an incorrect video mode was chosen that made the display unusable. If the file contains "true", then Puppy was not properly shutdown and the user is dropped back to the prompt so that xorgwizard can be used to fix the problem.

The fix above simply removes the flag file which should disable the mechanism and make X always start.
HTH,
Paul
Last edited by pakt on Wed 13 Dec 2006, 08:27, edited 1 time in total.
Methinks Raspberry Pi were ideal for runnin' Puppy Linux

gabev
Posts: 38
Joined: Wed 15 Nov 2006, 18:15
Location: New York, NY

#7 Post by gabev »

hi pakt,

I've tried the code above and still no luck. :?

But thank you for the description of the "flag" function.
Lets see.... if .xloaded value is set to true , than xwin will not start and you get a prompt..hmm but if .xloaded value is set to false.... then u dont get a prompt.

So , the solution is to set the value of .xloaded to false.Open the file in a text editor and instead of "true" put "false"..

damm , still no luck.... who writes the .xloaded value? if i can modify the way the flag is written to the .xloaded file than I can make the xwin automatically run at start after a hard crash.

I believe is kinda like :
if xwin shuts down properly , than .xloaded value is set to false and if xwin crashed than .xloaded is set to true.so all I gotta do is write the same value regardless of how xwin shuts.

Anyone knows where is the script which writes the .xloaded value?

User avatar
pakt
Posts: 1157
Joined: Sat 04 Jun 2005, 16:54
Location: Sweden

#8 Post by pakt »

gabev, I didn't test it myself but I thought it would work. The 'flag' is written to by /usr/X11R6/bin/xwin.

I'll do a little more checking and see why my fix doesn't work.
Methinks Raspberry Pi were ideal for runnin' Puppy Linux

User avatar
pakt
Posts: 1157
Joined: Sat 04 Jun 2005, 16:54
Location: Sweden

#9 Post by pakt »

Ok, I just made a backup of my working 1.0.7 pup001 file, then re-booted into 1.0.7, modified /etc/profile as I described above and re-booted to save the change.

Then I re-booted into 1.0.7 again and when I got my desktop back, I switched off the PC with the reset button.

On the next boot, it did a "fixed unclean shutdown" routine and X started up automatically just like you wanted. No problem!

As far as I know, there were no major changes in this code between 1.0.7 and 1.09ce.

Paul
Methinks Raspberry Pi were ideal for runnin' Puppy Linux

gabev
Posts: 38
Joined: Wed 15 Nov 2006, 18:15
Location: New York, NY

#10 Post by gabev »

hi pakt,

Yes , indeed, is xwin. I looked inside and I found where the "flag" is written.I set the value to false and after a hard crash I was able to restart in x but after a second test crash , i got a corupted ext2fs.... :cry: Of course i was expecting something like that to happened.

but otherwise it might work.I'll do more testing.

I'm actually using SimplePup0.3.1. Sorry I forgot to mention that.

User avatar
Pizzasgood
Posts: 6183
Joined: Wed 04 May 2005, 20:28
Location: Knoxville, TN, USA

#11 Post by Pizzasgood »

That actually works well as a "please remember to shut down your computer appropriately" type message. The problem is it isn't intuitive how to start back up. So, why not have it give you a menu or put you in a dialog thing, letting you choose to either continue booting, or "exit to prompt"? That way it will discourage cutting the power, but not need a tech to come "fix" it.

I don't have time to do it now, but if nobody else does by the weekend I can work on it.
[size=75]Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]

User avatar
ecomoney
Posts: 2178
Joined: Fri 25 Nov 2005, 07:00
Location: Lincolnshire, England
Contact:

Startup

#12 Post by ecomoney »

I think that generally an enhanced "command prompt" menu would not be a bad thing, perhaps with numbered options like the startup menu...I remember along time ago doing menu with numbered batch files in DOS (1.bat > run xtreegold etc...by gum thats a long time ago). I suppose in linux the equivelent would be "1.sh" with a command to run xorgwizard inside, 2.sh - choose mouse etc etc.

The specific problem I have at the cybercafe though is that people leave by just switching off the power (or they just click "start>logout" which takes them back to the command prompt). I really need it to automatically return to xwindows on reboot by default in my case. What would be the possibility of making a puppy with an option of just booting into the command line from the initial startup boot menu, a bit like pressing F8 does in doze?
Puppy Linux's [url=http://www.murga-linux.com/puppy/viewtopic.php?p=296352#296352]Mission[/url]

Sorry, my server is down atm!

GuestToo
Puppy Master
Posts: 4083
Joined: Wed 04 May 2005, 18:11

#13 Post by GuestToo »

you could do something like this:

in /usr/X11R7/bin/xwin, about line 238, change this:

Code: Select all

  rm -f /etc/.XLOADED #otherwise cannot start X.
  exit
 fi
fi
to this:

Code: Select all

  rm -f /etc/.XLOADED #otherwise cannot start X.
  dialog --msgbox "Naughty ... do not turn off the power switch" 0 0
  clear
 fi
fi
and about line 342, change this:

Code: Select all

echo -n "false" > /etc/.XLOADED #see note above.
#...if PC hung, run xorgwizard at next bootup (see further up)
to this:

Code: Select all

echo -n "false" > /etc/.XLOADED #see note above.
#...if PC hung, run xorgwizard at next bootup (see further up)
dialog --yesno "Shut down?" 0 0 && exec /sbin/poweroff
clear
or maybe:

Code: Select all

echo -n "false" > /etc/.XLOADED #see note above.
#...if PC hung, run xorgwizard at next bootup (see further up)
dialog --yesno "Shut down?" 0 0 && exec /sbin/poweroff
exec xwin

User avatar
Pizzasgood
Posts: 6183
Joined: Wed 04 May 2005, 20:28
Location: Knoxville, TN, USA

#14 Post by Pizzasgood »

IceWM can be hacked to remove the logout button. If I remember right, you need to edit the source to omit the entire menu, then add a "shutdown" menu item in the menu file. You might be able to disable it in the preferences though.

If you need that, I can look into it sometime when I don't have so much stuff on my plate. I've already done something very similar, I'd just need to dig it out and look over it so I can remember how I did it.
[size=75]Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]

User avatar
ecomoney
Posts: 2178
Joined: Fri 25 Nov 2005, 07:00
Location: Lincolnshire, England
Contact:

File Restore

#15 Post by ecomoney »

Doh, have noticed something. Every time I reboot the /usr/X11R7/bin/xwin file gets reset back to its origional. Hence the changes to make it start back up are lost. Is this file on the CD or something?

I believe there are other files that run after /usr/X11R7/bin/xwin, would it be possible to start xwin from there.?
Puppy Linux's [url=http://www.murga-linux.com/puppy/viewtopic.php?p=296352#296352]Mission[/url]

Sorry, my server is down atm!

GuestToo
Puppy Master
Posts: 4083
Joined: Wed 04 May 2005, 18:11

#16 Post by GuestToo »

/usr/X11R7/bin/xwin should not be changed when Puppy boots, unless you are upgrading to a newer version of Puppy ... if it is, i don't know why it would be doing that

you could copy xwin somewhere, for example, to /root/my-applications/bin, then a line like this in rc.local would restore your modifed version of xwin every time Puppy boots:

cp -f /root/my-applications/bin/xwin /usr/X11R7/bin/

but if Puppy upgrades and has a newer version of xwin, the newer xwin will be replaced by your modifed version ... you could cp the file only if the puppyversion is still 212:

grep -q 212 /etc/puppyversion && cp -f /root/my-applications/bin/xwin /usr/X11R7/bin/

User avatar
pakt
Posts: 1157
Joined: Sat 04 Jun 2005, 16:54
Location: Sweden

Re: File Restore

#17 Post by pakt »

ecomoney wrote:Doh, have noticed something. Every time I reboot the /usr/X11R7/bin/xwin file gets reset back to its origional. Hence the changes to make it start back up are lost. Is this file on the CD or something?
ecomoney, you're running the Puppy 1.xx series - IIRC, only the /etc directory was saved to pup001 (as /root/.etc I think it was), so yes the changes are lost.

Did you ever try my suggested mod to make xwin always start even after a crash? (sixth post, first page of this thread) That mod is saved in /etc/profile and will be written to pup_001. The mod worked when I tested it 8)
Methinks Raspberry Pi were ideal for runnin' Puppy Linux

GuestToo
Puppy Master
Posts: 4083
Joined: Wed 04 May 2005, 18:11

#18 Post by GuestToo »

in Puppy 1.x, /usr is writable (the changes are saved in /root/.usr) ... but Puppy 1.x does not have /usr/X11R7/bin/, Puppy 1.x uses X11R6

i think that either you are running Puppy 2.x or you have an X11R7 directory that does not belong in Puppy 1.x ... i think changes made to X11R7 will be saved, but that the changes will not affect Puppy at all

if you have Puppy 1.x, xwin is in /usr/X11R6/bin/
in Puppy 2.x, xwin is in /usr/X11R7/bin/

GuestToo
Puppy Master
Posts: 4083
Joined: Wed 04 May 2005, 18:11

#19 Post by GuestToo »

pakt's method:
http://murga-linux.com/puppy/viewtopic. ... 0698#80698
should work for any version of Puppy

if you upgrade Puppy, /etc/profile will probably be replaced by a new /etc/profile file, so it might be better to put the line in /etc/profile.local, or /etc/rc.d/rc/local ... those files should not be changed by an upgrade

User avatar
pakt
Posts: 1157
Joined: Sat 04 Jun 2005, 16:54
Location: Sweden

#20 Post by pakt »

G2, thanks for refreshing my memory (it leaks like a sieve and age hasn't improved it :?)

ecomoney stated on the prevous page
I should have put theyre still using puppy 1.09ce
so I think he meant X11R6.

Paul
Methinks Raspberry Pi were ideal for runnin' Puppy Linux

Post Reply