You are not logged in.

#1 2010-10-20 19:37:19

Hy Ginsberg
Member
From: Massachusetts
Registered: 2008-08-22
Posts: 74
Website

inittab run level and the PATH environment variable

When I boot to run level 3, my PATH is:

/home/hy/scripts:/bin:/usr/bin:/sbin:/usr/sbin:/usr/lib/perl5/core_perl/bin:/usr/local/bin:

(the first directory gets added by my .bashrc).  But if I change /etc/inittab to boot to run level 5, then my PATH is:

/home/hy/scripts:/usr/bin:/bin:/usr/local/bin:

I realize I can just add the directories I'm missing to .bashrc (in particular I need /sbin), but I'd like to know what's going on.  I have Arch similarly installed on two other machines and have not had the same behavior -- /sbin, at any rate, is in my path even after changing /etc/inittab to boot to level 5.

My /etc/inittab:

#
# /etc/inittab
#

#  Runlevels:
#    0    Halt
#    1(S)    Single-user
#    2    Not used
#    3    Multi-user
#    4    Not used
#    5    X11
#    6    Reboot

## Only one of the following two lines can be uncommented!
# Boot to console
id:3:initdefault:
# Boot to X11
#id:5:initdefault:

rc::sysinit:/etc/rc.sysinit
rs:S1:wait:/etc/rc.single
rm:2345:wait:/etc/rc.multi
rh:06:wait:/etc/rc.shutdown
su:S:wait:/sbin/sulogin -p

# -8 options fixes umlauts problem on login
c1:2345:respawn:/sbin/agetty -8 38400 tty1 linux
c2:2345:respawn:/sbin/agetty -8 38400 tty2 linux
c3:2345:respawn:/sbin/agetty -8 38400 tty3 linux
c4:2345:respawn:/sbin/agetty -8 38400 tty4 linux
c5:2345:respawn:/sbin/agetty -8 38400 tty5 linux
c6:2345:respawn:/sbin/agetty -8 38400 tty6 linux

# Hypervisor Virtual Console for Xen and KVM
#h0:2345:respawn:/sbin/agetty -8 38400 hvc0 linux

ca::ctrlaltdel:/sbin/shutdown -t3 -r now

# Example lines for starting a login manager
#x:5:respawn:/usr/bin/xdm -nodaemon
#x:5:respawn:/usr/sbin/gdm -nodaemon
#x:5:respawn:/usr/bin/kdm -nodaemon
#x:5:respawn:/usr/bin/slim >/dev/null 2>&1
x:5:once:/bin/su hy -l -c '/usr/bin/startx >/dev/null 2>&1'

# End of file

Last edited by Hy Ginsberg (2010-10-20 19:41:43)

Offline

#2 2010-10-20 20:17:06

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,772

Re: inittab run level and the PATH environment variable

When you say your path, I assume you are checking this after you have logged in as a user.  I further assume that in RL3, you are logging into a shell (You don't have much choice there smile )

Under RL5 I see you are starting x directly from the inittab.

In the RL3 case, you are executing ~/.bashrc (or ~/.zshrc, or whatever is appropriate for your shell)
In the RL5 case, you are executing ~/.xinitrc, Then -- when you instantiate a terminal window, you execute ~/.bashrc.

What happens if in RL5, you flip over to a console ( Control-Alt-F2) and login.  What is your path then?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2010-10-20 20:30:34

Hy Ginsberg
Member
From: Massachusetts
Registered: 2008-08-22
Posts: 74
Website

Re: inittab run level and the PATH environment variable

So, under RL5 I don't exactly "log in" as a user -- I run no login manager, just xmonad.  My .xinitrc file:

#!/bin/sh
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)

# exec gnome-session
# exec startkde
# exec startxfce4
# ...or the Window Manager of your choice
# exec xterm

# exec awesome

xsetroot -cursor_name left_ptr
exec xmonad

If I flip over to a console and log in, my PATH is the "good" one -- the one with /sbin and the other goodies in it (the RL3 PATH from my original post).

Offline

Board footer

Powered by FluxBB