Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
init 1 >> "Give root password for maintenance"
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
benny1967
Apprentice
Apprentice


Joined: 25 Apr 2004
Posts: 224

PostPosted: Sun Sep 17, 2006 11:20 am    Post subject: init 1 >> "Give root password for maintenance&quo Reply with quote

Hi,

some years ago I got into the habit of typing
Code:
init 1
before doing unattended emerge-world-sessions overnight. (Only to shut down unnecessary services without calling the scripts manually.)

After one of the recent system updates, this doesnt work as expected any longer:
The services shut down, but then I get a
Code:
Give root password for maintenance (or type Control-D to continue)

on tty 1.

I first thought "well, if you want it, here it is", but typing the root password only caused the prompt to re-appear with each single letter I typed. Suddenly the usual bash-prompt re-appeared, only to tell me that what I'd entered is not a valid command. It seems bash and (probably) sulogin (?) are fighting for control over tty 1, resulting in the console being unusable. (BTW: my logfile is full of login errors for uid 0 when I do this.)

All of this is a more or less cosmetical problem as I still have tty 2-6 to work with. Still I'd be interested to know why this happens, what caused it after all these years and how to stop it.

Oh, yes, before you tell me: I did seach the forum and yes, there are quite a lot of posts regarding the "Give root password"-thing, but all of them have a different context: They describe a situation when either shutdown or boot will not work, which is not the case here.
Back to top
View user's profile Send private message
chrisstankevitz
Guru
Guru


Joined: 14 Dec 2003
Posts: 472
Location: Santa Barbara, CA, USA

PostPosted: Fri Oct 13, 2006 4:51 pm    Post subject: Reply with quote

Me too. Exact same problem.
Back to top
View user's profile Send private message
terminal9
Apprentice
Apprentice


Joined: 12 Oct 2006
Posts: 157

PostPosted: Sat Oct 14, 2006 1:22 pm    Post subject: Reply with quote

Code:
telinit 1

does not work either, it seems switching to runlevel 1 is broken,
https://bugs.gentoo.org/show_bug.cgi?id=95876
this bug entry says it's fixed but it's not.

How can such a fundamental operation remains broken still? or is there sth we're missing?
Back to top
View user's profile Send private message
energyman76b
Advocate
Advocate


Joined: 26 Mar 2003
Posts: 2048
Location: Germany

PostPosted: Sat Oct 14, 2006 2:44 pm    Post subject: Reply with quote

wow, and I thought, that I am the only one with that problem ...
_________________
Study finds stunning lack of racial, gender, and economic diversity among middle-class white males

I identify as a dirty penismensch.
Back to top
View user's profile Send private message
terminal9
Apprentice
Apprentice


Joined: 12 Oct 2006
Posts: 157

PostPosted: Sat Oct 14, 2006 3:19 pm    Post subject: Reply with quote

Both sulogin and agetty seem to be racing for the console, so the following line in /etc/inittab is the culprit:
Code:

c1:12345:respawn:/sbin/agetty 38400 tty1 linux

we don't want a tty handler in runlevel 1, so it should be:
Code:

c1:2345:respawn:/sbin/agetty 38400 tty1 linux


Now, please tell me there's actually a good reason to put 1 in that line, otherwise I'll be very upset to have selected Gentoo seeing it with such a crucial fault unnoticed for a long time. :?
(yeah, this is my 2nd day)
Back to top
View user's profile Send private message
energyman76b
Advocate
Advocate


Joined: 26 Mar 2003
Posts: 2048
Location: Germany

PostPosted: Sat Oct 14, 2006 3:22 pm    Post subject: Reply with quote

terminal9 wrote:
Both sulogin and agetty seem to be racing for the console, so the following line in /etc/inittab is the culprit:
Code:

c1:12345:respawn:/sbin/agetty 38400 tty1 linux

we don't want a tty handler in runlevel 1, so it should be:
Code:

c1:2345:respawn:/sbin/agetty 38400 tty1 linux


Now, please tell me there's actually a good reason to put 1 in that line, otherwise I'll be very upset to have selected Gentoo seeing it with such a crucial fault unnoticed for a long time. :?
(yeah, this is my 2nd day)


you may get an answer to that question, if you post it as a comment to the bug...
_________________
Study finds stunning lack of racial, gender, and economic diversity among middle-class white males

I identify as a dirty penismensch.
Back to top
View user's profile Send private message
terminal9
Apprentice
Apprentice


Joined: 12 Oct 2006
Posts: 157

PostPosted: Sat Oct 14, 2006 3:52 pm    Post subject: Reply with quote

energyman76b wrote:
you may get an answer to that question, if you post it as a comment to the bug...

I don't get the discussion in that bug entry, they're talking about baselayout package but /etc/inittab is part of sysvinit package. It's also about hacking init so that S or s can be used directly to switch to runlevel 1, but read this from init's man page:
Quote:

runlevel 1 is used to
get the system down into single user mode. Runlevel S is not really
meant to be used directly, but more for the scripts that are executed
when entering runlevel 1.

It seems Gentoo is inventing its own understanding of the init process, too bad :(
Back to top
View user's profile Send private message
timeBandit
Bodhisattva
Bodhisattva


Joined: 31 Dec 2004
Posts: 2719
Location: here, there or in transit

PostPosted: Sat Oct 14, 2006 4:03 pm    Post subject: Reply with quote

I can't speak to the single-user-mode problem because my "maintenance mode" technique avoids it entirely. Gentoo extends the SysV init system to support an arbitrary number of "runlevels," so I created a couple of custom ones for heavy maintenance work and never bother with telinit. There's little need for true single-user mode on a desktop system anyway--as benny1967 said in the OP, it's an easy way to shut off all unnecessary services. Here's another way:

(Note that I did this years ago, but you may not need to: the Handbook suggests newer baselayouts include runlevel single, which probably gives the same end result.)

1. As root, create the runlevel directory for your new runlevel (using my admin runlevel as an example):
Code:
~ # cd /etc/runlevels/
runlevels # mkdir admin

2. Clone it from your default runlevel:
Code:
runlevels # cp -P default/* admin
cp -P copies symlinks as such, instead of following them.

3. Review the services in the new runlevel and remove the ones you don't want:
Code:
runlevels # eselect rc list admin
Init scripts to be started by runlevel admin
  acpid
  apcupsd
  atd
  bootsplash
  cupsd
  ddclient
  famd
  hplip
  local
  net.eth0
  netmount
  ntpd
  postfix
  syslog-ng
  vixie-cron
  vmware
  xdm
  xfs
runlevels # cd admin
admin # rm acpid atd bootsplash cupsd ddclient famd hplip postfix vixie-cron vmware xdm xfs

eselect rc delete <service> <runlevel> is the "right" way to do it, but removing the symlinks directly is quicker. :) I also added gpm to have mouse support on the console:
Code:
admin # eselect rc add gpm default
Adding gpm to following runlevels
  default                   [done]
Then just use rc admin to switch to your new admin runlevel, and rc default to restart everything when you're done.

One last trick: add this to root's .bash_profile to making starting/stopping individual services a little easier:
Code:
# save typing when stopping/starting services
#
function svc() {
        if [ -z "$1" ] ; then
                echo "Usage: svc <service-name> <action>"
        elif [ ! -x "/etc/init.d/$1" ] ; then
                echo "-svc: $1: No such service"
        else
                SERVICE="/etc/init.d/$1"
                shift
                $SERVICE $*
        fi
}
For example:
Code:
~ # svc ntpd stop
 * Stopping ntpd ...              [ ok ]
~ # svc ntpd start
 * Starting ntpd ...              [ ok ]
~ # svc foo status
-svc: foo: No such service
~ # svc ntpd status
 * status:  started

8)
_________________
Plants are pithy, brooks tend to babble--I'm content to lie between them.
Super-short f.g.o checklist: Search first, strip comments, mark solved, help others.


Last edited by timeBandit on Thu Aug 14, 2008 2:39 am; edited 1 time in total
Back to top
View user's profile Send private message
energyman76b
Advocate
Advocate


Joined: 26 Mar 2003
Posts: 2048
Location: Germany

PostPosted: Sat Oct 14, 2006 4:09 pm    Post subject: Reply with quote

the problem: when I borked my system with a glibc downgrade (don't do it people!), I had a hard time to get a root console, because of this misbehaviour. And no 'admin' runlevel would have safed my ass.
_________________
Study finds stunning lack of racial, gender, and economic diversity among middle-class white males

I identify as a dirty penismensch.
Back to top
View user's profile Send private message
wuzzerd
Guru
Guru


Joined: 05 Jan 2005
Posts: 467
Location: New Mexico

PostPosted: Sat Oct 14, 2006 6:19 pm    Post subject: Reply with quote

[quote="energyman76b"][quote="terminal9"]Both sulogin and agetty seem to be racing for the console, so the following line in /etc/inittab is the culprit:
Code:

c1:12345:respawn:/sbin/agetty 38400 tty1 linux

we don't want a tty handler in runlevel 1, so it should be:
Code:

c1:2345:respawn:/sbin/agetty 38400 tty1 linux


Thanks for that. I haven't needed it yet, but the way power fails around here anytime I might get kicked to single user to run fsck manually.
Back to top
View user's profile Send private message
terminal9
Apprentice
Apprentice


Joined: 12 Oct 2006
Posts: 157

PostPosted: Sun Oct 15, 2006 7:27 pm    Post subject: Reply with quote

timeBandit wrote:
I can't speak to the single-user-mode problem because my "maintenance mode" technique avoids it entirely. Gentoo extends the SysV init system ...
I don't see any extension per se, this is just plain broken. The init startup technique on un*x systems is decades old and proven. I just expect it to work as it is.

wuzzerd wrote:
Code:
c1:2345:respawn:/sbin/agetty 38400 tty1 linux
Thanks for that. I haven't needed it yet, but the way power fails around here anytime I might get kicked to single user to run fsck manually.
That eliminates race for console only. If one decides to press Ctrl-D rather than login as root after doing telinit 1, the system dies. The problem is init losing state due to directly calling sulogin in /sbin/rc, i.e.
Code:

if [[ ${SOFTLEVEL} == "single" ]] ; then
     rm -rf "${svcdir}/softscripts.new"
     /sbin/sulogin ${CONSOLE}
     exit 0
fi
should be
Code:

    ...
    /sbin/telinit S
    exit 0
fi

Finally, S should be removed from the /etc/inittab line below. init handles it.
Code:
l1:S1:wait:/sbin/rc single
Back to top
View user's profile Send private message
ppurka
Advocate
Advocate


Joined: 26 Dec 2004
Posts: 3256

PostPosted: Sun Oct 15, 2006 8:51 pm    Post subject: Reply with quote

terminal9 wrote:
The problem is init losing state due to directly calling sulogin in /sbin/rc, i.e.
Code:

if [[ ${SOFTLEVEL} == "single" ]] ; then
     rm -rf "${svcdir}/softscripts.new"
     /sbin/sulogin ${CONSOLE}
     exit 0
fi
should be
Code:

    ...
    /sbin/telinit S
    exit 0
fi

Finally, S should be removed from the /etc/inittab line below. init handles it.
Code:
l1:S1:wait:/sbin/rc single
I have noticed this problem on my system too, since one month at least.
I don't think doing the above modification is the correct approach since after executing init 1, I am provided with the "CTRL-D for maintenance" prompt, whereas I used to get the command prompt on executing init 1 earlier.

EDIT: Simply commenting out the /sbin/sulogin line in /sbin/rc seems to have fixed the problem for me. I get the earlier behaviour where I am not provided any prompt for a password, but the command prompt is available.
Back to top
View user's profile Send private message
terminal9
Apprentice
Apprentice


Joined: 12 Oct 2006
Posts: 157

PostPosted: Sun Oct 15, 2006 9:35 pm    Post subject: Reply with quote

ppurka wrote:
I have noticed this problem on my system too, since one month at least.
I don't think doing the above modification is the correct approach since after executing init 1, I am provided with the "CTRL-D for maintenance" prompt, whereas I used to get the command prompt on executing init 1 earlier.

EDIT: Simply commenting out the /sbin/sulogin line in /sbin/rc seems to have fixed the problem for me. I get the earlier behaviour where I am not provided any prompt for a password, but the command prompt is available.

Do that from a tty other than the first one, and tell me what happens. :wink:
(i.e. press Alt-F2, login as root, run init 1)
Back to top
View user's profile Send private message
ppurka
Advocate
Advocate


Joined: 26 Dec 2004
Posts: 3256

PostPosted: Sun Oct 15, 2006 10:51 pm    Post subject: Reply with quote

terminal9 wrote:
Do that from a tty other than the first one, and tell me what happens. :wink:
(i.e. press Alt-F2, login as root, run init 1)
Of course, I was not given the prompt back :P init 1 will shut down all the ttys except the one on ALT-F1.

However, I could ALT-F1 to tty1 and login as root with no problems. An init 5, and I am back to writing this post :D
Back to top
View user's profile Send private message
LoSeR_5150
Guru
Guru


Joined: 20 Mar 2005
Posts: 455
Location: San Francisco, CA

PostPosted: Wed Oct 18, 2006 3:03 am    Post subject: Reply with quote

yeah now my shutdown works properly again... thanks terminal9

update: this worked on my x86 and amd64 as both were affected
_________________
Opteron 1356@2.4Ghz
6GB DDR2 800Mhz
128MB Quadro NVS 210S
640GB Western Digital HD
*Gentoo-x86_64-2.6.30-r1

Opteron175@2.2GHz
2GB DDR 400MHz
256MB Quadro 1400 Go
(2) 80GB Segate HDs: RAID0
*Gentoo-x86_64-2.6.30-r1


Last edited by LoSeR_5150 on Tue Oct 31, 2006 3:34 am; edited 1 time in total
Back to top
View user's profile Send private message
drescherjm
Advocate
Advocate


Joined: 05 Jun 2004
Posts: 2790
Location: Pittsburgh, PA, USA

PostPosted: Wed Oct 18, 2006 1:42 pm    Post subject: Reply with quote

Thanks guys, I just checked and I have the same problem on amd64. When I get some time I will try the solutions above and report back.
_________________
John

My gentoo overlay
Instructons for overlay
Back to top
View user's profile Send private message
GWilliam
Guru
Guru


Joined: 29 Dec 2005
Posts: 350

PostPosted: Sun Jan 14, 2007 2:21 am    Post subject: Reply with quote

#NULL

Last edited by GWilliam on Sun Jul 25, 2010 3:22 pm; edited 1 time in total
Back to top
View user's profile Send private message
drescherjm
Advocate
Advocate


Joined: 05 Jun 2004
Posts: 2790
Location: Pittsburgh, PA, USA

PostPosted: Fri Jan 19, 2007 1:33 pm    Post subject: Reply with quote

I have just checked and it now works fine for me however I am not sure what I did to fix it...


Code:
 # emerge --info
Portage 2.1.2 (default-linux/amd64/2006.1, gcc-4.1.1/amd64-vanilla, glibc-2.4-r4, 2.6.18-gentoo-r2 x86_64)
=================================================================
System uname: 2.6.18-gentoo-r2 x86_64 AMD Opteron(tm) Processor 850
Gentoo Base System version 1.12.8
Timestamp of tree: Fri, 19 Jan 2007 08:00:02 +0000
distcc 2.18.3 x86_64-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
ccache version 2.3 [enabled]
app-admin/eselect-compiler: 2.0.0_rc2-r1
dev-java/java-config: 1.3.7, 2.0.31
dev-lang/python:     2.4.3-r4
dev-python/pycrypto: 2.0.1-r5
dev-util/ccache:     2.3
dev-util/confcache:  0.4.2-r1
sys-apps/sandbox:    1.2.18.1
sys-devel/autoconf:  2.13, 2.61
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.17
sys-devel/gcc-config: 2.0.0_rc1
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.17-r2
ACCEPT_KEYWORDS="amd64"
AUTOCLEAN="yes"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=k8 -O3 -pipe -fomit-frame-pointer -msse3"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.4/env /usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/lib64/mozilla/defaults/pref /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/eselect/compiler /etc/gconf /etc/java-config/vms/ /etc/revdep-rebuild /etc/splash /etc/terminfo /etc/texmf/web2c"
CXXFLAGS="-march=k8 -O3 -pipe -fomit-frame-pointer -msse3"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig candy ccache confcache distlocks metadata-transfer parallel-fetch sandbox sfperms strict"
GENTOO_MIRRORS="http://gentoo.osuosl.org/ http://gentoo.cites.uiuc.edu/pub/gentoo/ http://gentoo.chem.wisc.edu/gentoo/ http://gentoo.mirrors.tds.net/gentoo"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_EXTRA_OPTS="--progress"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage /usr/portage/local/layman/masterdriverz"
SYNC="rsync://jmd0/gentoo-portage"
USE="7z 7zip X Xaw3d a52 aac acl acpi alsa amd64 apache2 arts bacula-split-init bash-completion berkdb bitmap-fonts bzip2 cg cli cracklib crypt cups dga dlloader doc dri dvd dvdr emacs emul-linux-x86 fbcon firefox font-server fortran fuse gdbm gif gmp gnome gnomecanvas gnomedb gphoto2 gpm grammar graphviz gtk gtk2 gtkhtml gzip hddtemp iconv isdnlog java jikes joystick jpeg jpeg2k kde kexi libg++ lirc lzo lzw mjpeg mng mozilla mysql mysqli ncurses nls nptl nptlonly nsplugin opengl pam pcre perl php png ppds pppd python readline reflection samba session smp spl ssl tcpd transcode truetype truetype-fonts type1-fonts udev unicode unzip usb v4l v4l2 videos wmf wxwindows xine xinerama xml xorg xvid zlib" ALSA_CARDS="snd_ac97_bus snd_intel8x0" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="nvidia"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, LINGUAS


Code:
# equery l baselayout
[ Searching for package 'baselayout' in all categories among: ]
 * installed packages
[I--] [ ~] sys-apps/baselayout-1.12.8-r5 (0)


Code:
 # equery l shadow
[ Searching for package 'shadow' in all categories among: ]
 * installed packages
[I--] [  ] sys-apps/shadow-4.0.18.1 (0)

_________________
John

My gentoo overlay
Instructons for overlay
Back to top
View user's profile Send private message
GWilliam
Guru
Guru


Joined: 29 Dec 2005
Posts: 350

PostPosted: Sun Jan 21, 2007 1:24 am    Post subject: Reply with quote

#NULL

Last edited by GWilliam on Sun Jul 25, 2010 3:23 pm; edited 1 time in total
Back to top
View user's profile Send private message
GWilliam
Guru
Guru


Joined: 29 Dec 2005
Posts: 350

PostPosted: Sun Feb 11, 2007 8:57 pm    Post subject: Reply with quote

#NULL

Last edited by GWilliam on Sun Jul 25, 2010 3:26 pm; edited 1 time in total
Back to top
View user's profile Send private message
ppurka
Advocate
Advocate


Joined: 26 Dec 2004
Posts: 3256

PostPosted: Sun Feb 11, 2007 11:57 pm    Post subject: Reply with quote

So, it is time to put a "solved" as you promised in some other thread :D
Back to top
View user's profile Send private message
GWilliam
Guru
Guru


Joined: 29 Dec 2005
Posts: 350

PostPosted: Tue Feb 13, 2007 2:42 am    Post subject: Reply with quote

#NULL

Last edited by GWilliam on Sun Jul 25, 2010 3:23 pm; edited 1 time in total
Back to top
View user's profile Send private message
ppurka
Advocate
Advocate


Joined: 26 Dec 2004
Posts: 3256

PostPosted: Tue Feb 13, 2007 4:05 am    Post subject: Reply with quote

GWilliam wrote:
Done!--and gladly.

I know I must seem pretty down on Gentoo most of the time, but... geez... I spend more time maintaining my system than actually using it and to be brutally honest, the quality has been sucking.
I wonder how much time people spend on maintaining their systems :!:

As for me, it has been gentoo for more than 2 years. The first time I installed, I had used stage 1. The system worked nicely. However, I switched over to BobP's new stage 3 install with the "hot & new" gcc 3.4 within half a year. It is the same install I am working on at present (of course, I recompiled the whole system about twice to incorporate gcc/glibc upgrades). Nowadays, I rarely do any system upgrades (gcc/glibc) only restricting myself to upgrades in the applications. That too about once a month. I think the last time I performed a major system upgrade must have been several months ago, when there was a major upgrade for udev and dbus.

An hour or two of painful forum searching and package unmasking, and my maintainance work was over,- I let portage (and the wonderful update-world script) take care of the rest of the job :D

Over the years, I have written a couple of scripts which make my gentoo work easier. Now, I just can not be comfortable with the other distributions, since I can not get such precise control over the system.
Back to top
View user's profile Send private message
GWilliam
Guru
Guru


Joined: 29 Dec 2005
Posts: 350

PostPosted: Wed Mar 07, 2007 3:33 am    Post subject: Reply with quote

#NULL

Last edited by GWilliam on Sun Jul 25, 2010 3:23 pm; edited 2 times in total
Back to top
View user's profile Send private message
GWilliam
Guru
Guru


Joined: 29 Dec 2005
Posts: 350

PostPosted: Wed Mar 07, 2007 3:57 am    Post subject: Reply with quote

#NULL

Last edited by GWilliam on Sun Jul 25, 2010 3:23 pm; edited 1 time in total
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum