LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-11-2004, 01:25 AM   #1
Earl Parker II
Member
 
Registered: Jan 2002
Location: Shelby, NC, US
Distribution: Linux Mint 19.2
Posts: 130

Rep: Reputation: 17
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?
 
Old 07-11-2004, 01:56 AM   #2
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
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
 
Old 07-11-2004, 02:29 AM   #3
ppuru
Senior Member
 
Registered: Mar 2003
Location: Beautiful BC
Distribution: RedHat & clones, Slackware, SuSE, OpenBSD
Posts: 1,791

Rep: Reputation: 50
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

Last edited by ppuru; 07-11-2004 at 02:31 AM.
 
Old 07-11-2004, 08:28 AM   #4
high_hopes
LQ Newbie
 
Registered: Jul 2004
Posts: 9

Rep: Reputation: 0
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.
 
Old 07-11-2004, 08:42 AM   #5
ppuru
Senior Member
 
Registered: Mar 2003
Location: Beautiful BC
Distribution: RedHat & clones, Slackware, SuSE, OpenBSD
Posts: 1,791

Rep: Reputation: 50
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.

Last edited by ppuru; 07-11-2004 at 08:45 AM.
 
Old 07-11-2004, 09:30 AM   #6
high_hopes
LQ Newbie
 
Registered: Jul 2004
Posts: 9

Rep: Reputation: 0
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.
 
Old 07-11-2004, 11:25 AM   #7
Earl Parker II
Member
 
Registered: Jan 2002
Location: Shelby, NC, US
Distribution: Linux Mint 19.2
Posts: 130

Original Poster
Rep: Reputation: 17
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?

Last edited by Earl Parker II; 07-11-2004 at 08:53 PM.
 
Old 07-11-2004, 11:39 AM   #8
Earl Parker II
Member
 
Registered: Jan 2002
Location: Shelby, NC, US
Distribution: Linux Mint 19.2
Posts: 130

Original Poster
Rep: Reputation: 17
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.
 
Old 07-11-2004, 02:47 PM   #9
high_hopes
LQ Newbie
 
Registered: Jul 2004
Posts: 9

Rep: Reputation: 0
It is strange that this started to happen only after I upgraded using swaret. Anyone has any suggestions on how to fix this?
 
Old 07-11-2004, 02:53 PM   #10
high_hopes
LQ Newbie
 
Registered: Jul 2004
Posts: 9

Rep: Reputation: 0
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.
 
Old 07-11-2004, 08:50 PM   #11
Earl Parker II
Member
 
Registered: Jan 2002
Location: Shelby, NC, US
Distribution: Linux Mint 19.2
Posts: 130

Original Poster
Rep: Reputation: 17
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.


Last edited by Earl Parker II; 07-11-2004 at 09:16 PM.
 
Old 07-11-2004, 09:23 PM   #12
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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
 
Old 07-11-2004, 10:18 PM   #13
ppuru
Senior Member
 
Registered: Mar 2003
Location: Beautiful BC
Distribution: RedHat & clones, Slackware, SuSE, OpenBSD
Posts: 1,791

Rep: Reputation: 50
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.

Last edited by ppuru; 07-11-2004 at 10:27 PM.
 
Old 07-12-2004, 12:38 AM   #14
Earl Parker II
Member
 
Registered: Jan 2002
Location: Shelby, NC, US
Distribution: Linux Mint 19.2
Posts: 130

Original Poster
Rep: Reputation: 17
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.
 
Old 07-12-2004, 05:21 AM   #15
ppuru
Senior Member
 
Registered: Mar 2003
Location: Beautiful BC
Distribution: RedHat & clones, Slackware, SuSE, OpenBSD
Posts: 1,791

Rep: Reputation: 50
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Grub stuck in an endless loop. dikadika Linux - General 4 02-27-2005 07:46 PM
runlevel 4 loop anadyr Slackware 6 12-17-2004 06:30 AM
Another ? from a newbie - stuck in a while loop azucarmom Programming 2 12-05-2004 08:41 PM
Stuck in a loggin loop boilinthebagboy Linux - Software 5 07-09-2003 04:36 PM
changed runlevel and no boot Goatdemon Linux - General 13 08-21-2002 02:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration