| View previous topic :: View next topic |
| Author |
Message |
sonix Tux's lil' helper


Joined: 12 Feb 2003 Posts: 102
|
Posted: Tue Feb 07, 2006 2:07 pm Post subject: |
|
|
should i replace @USER with @myusername or myusername?
do i need my password anywhere? |
|
| Back to top |
|
 |
sonix Tux's lil' helper


Joined: 12 Feb 2003 Posts: 102
|
Posted: Tue Feb 07, 2006 2:39 pm Post subject: |
|
|
start-stop-daemon --start --pidfile /var/run/autostartx.pid --make-pidfile --exec /sbin/autostartx -- @USER
that command gives me an error "unable to start /sbin/autostartx: exec format error" anyone know how to correct this? |
|
| Back to top |
|
 |
broken_chaos Guru

Joined: 18 Jan 2006 Posts: 315 Location: Ontario, Canada
|
Posted: Tue Feb 07, 2006 9:22 pm Post subject: |
|
|
@USER should be replaced by your username (i.e. justin is mine, so it's justin that I put there, not @justin).
Also, the wrapper shell script doesn't work. Just remove it and move /sbin/autostartx-bin to /sbin/autostartx.
And you'll want to put this line as the first line of your ~/.xinitrc or whatever file you use to start X:
| Code: | | source /etc/profile |
That might not actually be necessary, but it doesn't cause any problems to be cautious. |
|
| Back to top |
|
 |
MerlinTheWizard Apprentice


Joined: 06 Apr 2003 Posts: 270
|
Posted: Mon May 08, 2006 10:11 pm Post subject: |
|
|
| Nice, but is there any way to shut down the computer without having to type the shutdown command after logging out? |
|
| Back to top |
|
 |
broken_chaos Guru

Joined: 18 Jan 2006 Posts: 315 Location: Ontario, Canada
|
Posted: Thu May 11, 2006 11:22 pm Post subject: |
|
|
Write a script to do it for you.
| Code: | #!/bin/bash
sudo /etc/init.d/autostartx stop
sudo reboot |
This assumes you have a sudoers file setup to allow your user access to those commands without a password. You could also use gksu or similar instead, to add a graphical interface to it all.
I'm working on an ebuild for this, by the way, somewhat tweaked to work a bit better.  |
|
| Back to top |
|
 |
broken_chaos Guru

Joined: 18 Jan 2006 Posts: 315 Location: Ontario, Canada
|
Posted: Thu May 18, 2006 12:01 am Post subject: |
|
|
I've found a much better way to do this, and will package this new method into an ebuild when I get the chance. For now, I'll tell the manual way. It's dead simple. And much more flexible - no environment problems!
(For lack of confusion, and so you can try this out with the other method still on your box, I've changed the name of the init script to startx.)
| /etc/init.d/startx: | #!/sbin/runscript
depend() {
need local
use xfs
}
start() {
ebegin "Starting X11 as ${X11USER}"
start-stop-daemon --start --background --quiet --pidfile ${PIDFILE} --make-pidfile --chdir ${X11HOME} --exec /bin/su -- ${X11USER} -lc "startx"
eend $?
}
stop() {
ebegin "Stopping X11 as ${X11USER}"
start-stop-daemon --stop --quiet --oknodo --user ${X11USER} --pidfile ${PIDFILE}
eend $?
} |
| /etc/conf.d/startx: | # /etc/conf.d/startx
# Set to the user you want auto-logged-in.
# Remember, this is terribly insecure.
# Only use this if you know what you're doing.
X11USER="username"
# Set this to your homedir. Probably /home/youruser.
X11HOME="/home/username"
# Pid file location. Probably don't need to touch this.
PIDFILE="/var/run/startx.pid" |
1. Make these two files in the indicated locations.
2. chmod 755 /etc/init.d/startx
3. Edit /etc/conf.d/startx as appropriate for your user.
4. "/etc/init.d/startx start" as root to test it out. "/etc/init.d/startx stop" as root to stop your X11 instance.
5. "rc-update add startx default" as root to add it to your default runlevel. Works like a charm for me. |
|
| Back to top |
|
 |
naseweis Apprentice

Joined: 04 Apr 2003 Posts: 159 Location: germany
|
Posted: Sat May 20, 2006 10:35 am Post subject: |
|
|
Looking for a way to auto-login a user (I didn't want to run startx but stay in vga), I found your threat and this *old* piece of documentation, which works like a charm: http://linuxgazette.net/issue72/chung.html
Running startx is included as well. If somebody still cares... _________________ Nothing makes a person more productive than the last minute. |
|
| Back to top |
|
 |
ryo-san l33t


Joined: 17 Feb 2005 Posts: 710
|
Posted: Fri Jul 07, 2006 5:00 am Post subject: |
|
|
hi
i do naseweis , moowei's method seems to freeze my keyboard on login with xorg 7.0, so i will give it a try.
Thx to both of you. |
|
| Back to top |
|
 |
freez n00b


Joined: 04 Sep 2002 Posts: 37 Location: austria
|
Posted: Thu Aug 31, 2006 8:46 am Post subject: |
|
|
ryo-san, does it really freeze your keyboard, or does it just send your keyboard input to another tty? _________________ apt-get is a dream but emerge is a wet dream |
|
| Back to top |
|
 |
jwyeo2 n00b


Joined: 28 Nov 2003 Posts: 9
|
Posted: Thu Sep 06, 2007 5:41 am Post subject: |
|
|
I was using moowei's autostartx-bin method for over a year and it was working fine. I brought my PVR system up to date to support schedules direct and the autostart didn't work any more. Tried a bunch of stuff, and many of them ran into the unresponsive keyboard. The reason for the keyboard issue is outlined in the comments in /etc/init.d/xdm, and indeed a garbled version my "ignored" keystrokes were being seen on vc2. Adding 'need local' to the depend() function seems to resolve the keyboard.
As a result of this, I am now using the scripts provided by broken_chaos that utilize su. I like that I no longer need to compile a helper binary. BTW, this method ran into the keyboard problem too as I had copied over some old depend() contents. Again, 'need local' fixed as posted did the trick.
Thanks to all - this is a great thread!
PS: I wondered at one point if it were possible to write a custom dm script that would work with the existing Gentoo xdm init scripts. If you were willing to place the user name in the dm script it would start, but for stopping I couldn't see a way to tell start-stop-daemon how to identify the process. Maybe someone with deeper knowledge than myself can figure it out. |
|
| Back to top |
|
 |
mudfly n00b


Joined: 26 Apr 2002 Posts: 22 Location: Austin, TX, Planet Earth
|
Posted: Thu Aug 14, 2008 2:18 pm Post subject: |
|
|
The solution that broken_chaos provided still works like a charm. This is easy enough, but was there ever an ebuild created for this or something similar? _________________ Give me your beer. |
|
| Back to top |
|
 |
linuxtnt n00b

Joined: 26 Aug 2008 Posts: 1
|
Posted: Wed Aug 27, 2008 6:04 pm Post subject: |
|
|
| Thanks broken chaos , your script works like a charm |
|
| Back to top |
|
 |
pezzzz n00b

Joined: 24 Oct 2008 Posts: 1 Location: Mirano (VE) - Italy
|
Posted: Fri Oct 24, 2008 9:21 am Post subject: |
|
|
Found a problem with framebuffer decoration: console does not switch to X when startx is called. It needs a little sleep before startx:
start() {
ebegin "Starting X11 as ${X11USER}"
start-stop-daemon --start --background --quiet --pidfile ${PIDFILE} --make-pidfile --chdir ${X11HOME} --exec /bin/su -- ${X11USER} -lc "sleep 5; startx"
eend $?
} |
|
| Back to top |
|
 |
Fenril Apprentice

Joined: 16 May 2009 Posts: 192
|
Posted: Mon May 03, 2010 10:06 am Post subject: |
|
|
Hello guys,
Sorry to up this old thread, but i would use this code to have an autologin on one of my computers. X is well launched but my locales aren't set correctly. I modified the code and put a line in autostartx-bin.c like this :
| Code: | | setenv("LANG", "fr_FR.UTF-8", 1); |
Then i recompile it, but it doesn't help anymore. Any clue please ? |
|
| Back to top |
|
 |
Fenril Apprentice

Joined: 16 May 2009 Posts: 192
|
Posted: Tue May 04, 2010 11:27 am Post subject: |
|
|
| Fenril wrote: | Hello guys,
Sorry to up this old thread, but i would use this code to have an autologin on one of my computers. X is well launched but my locales aren't set correctly. I modified the code and put a line in autostartx-bin.c like this :
| Code: | | setenv("LANG", "fr_FR.UTF-8", 1); |
Then i recompile it, but it doesn't help anymore. Any clue please ? |
OK, i do so complicated... I've fixed it. Just add "env-update" in xinitrc file before running my DE. |
|
| Back to top |
|
 |
eniac Apprentice


Joined: 11 Aug 2003 Posts: 233 Location: Belgium, Brussels
|
Posted: Sun May 16, 2010 10:51 pm Post subject: |
|
|
I was trying the same thing before finding this post.
The way I did it was edit /etc/inittab like this:
| Code: |
#c1:12345:respawn:/sbin/agetty 38400 tty1 linux
c1:12345:respawn:/sbin/agetty -n -l /root/bin/autologin 38400 tty1
|
autologin contains:
| Code: |
#!/bin/bash
exec login -f eniac
|
Next my .bash_profile contains:
| Code: |
if [[ $(expr index "$(tty)" y) -ne 0 ]];
then
startx
fi
|
_________________ Turns out the pony only had one trick. |
|
| Back to top |
|
 |
|