LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   changed default runlevel from 3 to 4 in inittab- now I'm stuck in a loop (https://www.linuxquestions.org/questions/linux-newbie-8/changed-default-runlevel-from-3-to-4-in-inittab-now-i%27m-stuck-in-a-loop-203605/)

Earl Parker II 07-11-2004 01:25 AM

changed default runlevel from 3 to 4 in inittab- now I'm stuck in a loop
 
I'm running Slackware 10.0 on a Pentium 350. While doing some experimenting I changed the default runlevel in inittab from 3 (multiuser) to 4 (X11) to launch X11. The problem is that whenever I log out of KDE to go back to command line X11 is automatically launched again. I've tried both runlevel 3 and 5 (configured like 3) to no avail. Can anyone tell me how to break out of this loop? Any help would be greatly appreciated.

BTW, the reason I tried this to begin with was that typing 'startx' at the prompt, right after booting, would launch KDE but if I logged out of KDE and entered 'startx' at the prompt again I'd get 'command not found'. Anyone have any ideas on this point?

MasterC 07-11-2004 01:56 AM

Not sure I understand the second part, however, I can give a few suggestions on changing runlevels.

First, if you have /etc/inittab setup for runlevel 4, you can switch to another runlevel without rebooting with:
telinit 3
To switch to runlevel 3. You'll need to first:
CTRL + ALT + F2
To switch to a console, login as root, then run the command above. You can always switch back the same way.

If you want to setup /etc/inittab to boot straight into the console and then startx from there, then you should have /etc/inittab set to rl 3.

Cool

ppuru 07-11-2004 02:29 AM

At runlevel 4, the default slackware inittab has only a couple of consoles on... tty6 If I am correct.... You can check your inittab to find the active console (the getty part)

# These are the standard console login getties in multiuser mode:
#c1:1235:respawn:/sbin/agetty 38400 tty1 linux
c6:12345:respawn:/sbin/agetty 38400 tty6 linux

You can CTRL-ALT-F6 to use a console.

if you want all consoles active on runlevel4, you can insert 4 between 3 & 5
for example,
Code:

c2:1235:respawn:/sbin/agetty 38400 tty2 linux
to
c2:12345:respawn:/sbin/agetty 38400 tty2 linux


high_hopes 07-11-2004 08:28 AM

I got the same problem that Earl mentions in the second paragraph. I recently updated my Slackware 9.1 using swaret--update and swaret--upgrade. After doing this, the computer boots up normally and KDE starts from the prompt with startx. If I logout and try startx again I get "command not found". I tried switching to root and trying from there but I get the same message. I have to reboot for the startx command to work again.
Any help is greatly appreciated.
Thanks.

ppuru 07-11-2004 08:42 AM

Try this ...

before you give the startx command the very first time, run
Code:

which startx
you will get the full path to the startx command. perhaps /usr/X11R6/bin/startx

also find out the value of the PATH variable
Code:

echo $PATH
note these down.

Now run startx, exit the X mode, return to console mode

run
Code:

echo $PATH
compare the contents with what you had earlier noted down.

Run
Code:

/usr/X11R6/bin/startx
does this work?

And let us know what you have found.

high_hopes 07-11-2004 09:30 AM

ppuru thank you for the quick reply. I tried what you suggested. When I first logged into my regular non-root account I ran "which startx" and got /usr/X11R6/bin/startx . I also ran "echo $PATH" and got the following

/usr/local bin
/usr/bin
/bin
/usr/X11R6/bin
/usr/games
/opt/www/htdig/bin
/usr/lib/java/bin
/usr/lib/java/jre/bin
/opt/kde/bin
/usr/lib/qt-3.2.1/bin
/usr/share/texmf/bin

I tried going in and out of x a couple of times and everything worked as it supposed to. When I swiched to root account at the console (outside x) and tried startx it said "command not found". I have tried "echo $PATH" still in the root account and got

/usr/local/sbin
/usr/local/bin
/sbin
/usr/sbin
/bin
/usr/bin

I swiched back to my user account and tried startx and got the same "command not found". I typed "echo $PATH" and got

/usr/local/bin
/usr/bin
/bin

Then I tried running /usr/X11R6/bin/startx and I got the following

/usr/X11R6/bin/startx : line 133 : xauth : command not found
/usr/X11R6/bin/startx : line 134 : xauth : command not found
/usr/X11R6/bin/startx : line 133 : xauth : command not found
/usr/X11R6/bin/startx : line 134 : xauth : command not found
/usr/X11R6/bin/startx : line 142 : xinit : command not found
/usr/X11R6/bin/startx : line 145 : xauth : command not found


That's where I stopped. I am really grateful for your help. Thanks.

Earl Parker II 07-11-2004 11:25 AM

You have no idea how much I appreciate the responses. Now, in order...

MasterC,
I understand the confusion- I posted this about 2:30 this AM after a few hours of frustration. Not trying to anticipate you, believe me, but the first thing I did was switch go console and enter 'telinit 3', which didn't seem to make any difference- when I rebooted, it went straight to KDE (boot messages indicated runlevel was still 4). My next move was to get into inittab and set the runlevel to 5 (should have been the same as 3), just to see what would happen. I rebooted and it still went to KDE, so I gave up for the evening... (end of story below).

ppuru,
I checked my inittab and at runlevel 3 (I finally fixed it, end of story below) the only active console at runlevel 4 was indeed tty6. I'll definitely remember this and I also appreciate the tip concerning how to make different consoles active at different runlevels- something I didn't know but will make use of in the furture.

high_hopes,
So I'm not the only one with this problem! Here's what I've found- if I boot to command line, logon as root and enter startx, it works fine. If logout of KDE and enter starttx again, it will work (BTW, this just started happening this morning). However, if I logout of KDE and su to my regular user name, startx won't work again (in user or root) until I reboot.

ppuru,
I believe you've found the problem. The command 'which startx' yields
Code:

/usr/X11R6/bin/startx
, as it should. Entering 'echo $PATH' results in a long string that includes
Code:

/usr/X11R6/bin
. After issuing the 'startx' command as root and loggin out of KDE, the path is exactly the same. However, if I su to regular user name, the path is greatly abbreviated, /user/X11R6/bin/ is not present and, apparently, that's why startx won't work if I su to my regular user name. If I su back to root there are more items in the path but, again, no /usr/X11R6/bin.

The end of the story- if I changed the runlevel in inittab and restarted the machine, no change, but if I completely powered down and rebooted, it would work. At any rate, I believe ppuru has stated the cause of the problem that both high_hopes and I have been experiencing.

Bottom line- after more checking is can login as root or username and /usr/X11R6/bin is in the path. However, if I su from one to the other, this path is no longer used. I played with /etc/profile a bit but didn't get anywhere. So, this apparently is the problem - now, how do we fix it?

Earl Parker II 07-11-2004 11:39 AM

May have stumbled onto part of the problem- when I enter
Code:

useradd <username>
the directory /home/<username> isn't created. Entering it with the -d option doesn't make any difference. I'm thinking that wiithout the /home/<username> that the same types of files you find under /root wouldn't exist and that is at least contributing to the problem.

high_hopes 07-11-2004 02:47 PM

It is strange that this started to happen only after I upgraded using swaret. Anyone has any suggestions on how to fix this?

high_hopes 07-11-2004 02:53 PM

Hei, I think I have made a step forward in solving this issue. I tried switching the user with su - back and forth to root and user accounts and the PATH gets exported correctly. Using only su changes the PATH in both directions and leaves commands like startx unusable.
Let me know if it works for you Earl. Thanks,
hh.

Earl Parker II 07-11-2004 08:50 PM

high_hopes,

Works for me- I can sign in as root or username and when I su the path stays the same. However, now KDE won't launch. I'm getting a number of error messages and dialog boxes that point directly to the fact that there is no directory created under /home for a user when one is added (more correctly, there are none of the needed files). When you add a user to your machine is a directory created for the user in /home? I have two machines running Slackware 10.0- when I add a user in either one the appropriate dierectory is not created. If you don't mind, add a user to your system and see if you have the same problem.


Tinkster 07-11-2004 09:23 PM

Use Pat's little helper adduser instead of
useradd ... with useradd you need to specify
EVERYTHING explicitly, adduser makes a few
sensible decisions on your behalf :}



Cheers,
Tink

ppuru 07-11-2004 10:18 PM

You may try running
Code:

source /etc/profile
as a temporary fix. /etc/profile will (re)set your environment.
Quote:

the directory /home/<username> isn't created.
Earl, perhaps you have found the root of the problem - non-availability of home directory.
You can
Code:

mkdir -p /home/<newuser>; chown <newuser> /home/<newuser>; chmod 750 /home/<newuser>
prior to useradd or immediately after that.

Earl Parker II 07-12-2004 12:38 AM

Much to my amazement I seem to have fixed the problem. To summarize, when I added myself with useradd (regardless of the options used), the /home/earl directory was never created. Thanks to Tinkster's suggestion I tried adduser- what an improvement! I now had a /home/earl directory but it only contained the .screenrc file.

The error messages I'd been getting when I tried to start KDE indicted that it couldn't save any settings and/or configurations because the files it needed weren't present in /home/earl. Specifically, it was looking for the subdirectory .kde, along with it's various subdirectories and files. Since KDE worked fine when I was logged in as /root, I looked in the /root directory and, sure enough, there was a .kde directory that seemed to have the subdirectories and files that KDE required in order to save said settings/configurations.

Lacking a better plan, I simply copied the .kde subdirectory from /root to /home/earl and... KDE still had the same problem. Back to /home/earl, ls -la, stared at it for a minute and finally realized tha if I changed the owner/group from root/root to earl/users that the odds might improve. A few keystrokes, enter startx, hit enter and all is right with the world (at least for the moment).

My method likely leaves a lot to be desired but things seem to be working well. Thanks to all of you who took the time to impart your wisdom- it made the critical difference. I believe I'll start monitoring this forum much more closely from now on and if I can help out, I gladly will.

ppuru 07-12-2004 05:21 AM

Quote:

You can
mkdir -p /home/<newuser>; chown <newuser> /home/<newuser>; chmod 750 /home/<newuser>
prior to useradd or immediately after that.
One of those times when fingers lose contact with the brain...

Actually the chown and chmod commands will return an error if <newuser> is not found.
So chown and chmod have to be run after useradd.

adduser certainly helps avoiding the manual homedirectory creation and perms and rights assignment.


All times are GMT -5. The time now is 11:49 AM.