Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
inittab runlevel numbering?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
jlpoole
Guru
Guru


Joined: 01 Nov 2005
Posts: 483
Location: Salem, OR

PostPosted: Mon Mar 11, 2019 5:20 am    Post subject: inittab runlevel numbering? Reply with quote

The Linux System Administrator's Guide at The Linux Documentation Project states that there are six run levels:
Quote:
0 Halt the system.
1 Single-user mode (for special administration).
2 Local Multiuser with Networking but without network service (like NFS)
3 Full Multiuser with Networking
4 Not Used
5 Full Multiuser with Networking and X Windows(GUI)
6 Reboot.


The Gentoo Xen Guide suggests creating a run level for xen.

So I followed the recommendation and now have these runlevels:
Code:
zeta /home/jlpoole # rc-update show -v
                acpid |      default
               agetty |
               binfmt | boot
             bootmisc | boot
         busybox-ntpd |
     busybox-watchdog |
              cgroups |                                 sysinit
          consolefont |
               cronie |
                devfs |                                 sysinit
        device-mapper |
               dhcpcd |      default
                dhcpd |
             dhcrelay |
            dhcrelay6 |
                dmesg |                                 sysinit
             dmeventd |
             dropbear |
                 fsck | boot
           git-daemon |
             hostname | boot
              hwclock | boot
            ip6tables |
             iptables |
              keymaps | boot
            killprocs |                        shutdown
    kmod-static-nodes |                                 sysinit
                local |      default nonetwork
           localmount | boot
             loopback | boot
                  lvm | boot
       lvm-monitoring |
              lvmetad |
              modules | boot
             mount-ro |                        shutdown
                 mtab | boot
           net-online |
              net.br0 |      default
        net.enp0s20f0 |      default
        net.enp0s20f2 |
               net.lo |
             netmount |      default
           nullmailer |
              numlock |
     opentmpfiles-dev |                                 sysinit
   opentmpfiles-setup | boot
              osclock |
              pciparm |
               procfs | boot
            pydoc-2.7 |
            pydoc-3.6 |
                 root | boot
               rsyncd |      default
             runsvdir |
            s6-svscan |
            savecache |                        shutdown
                 sshd |      default
                 swap | boot
              swclock |
               sysctl | boot
                sysfs |                                 sysinit
            syslog-ng |      default
         termencoding | boot
                 udev |                                 sysinit
          udev-settle |
         udev-trigger |                                 sysinit
              urandom | boot
         xen-watchdog |      default                            xen
           xencommons |      default                            xen
          xenconsoled |      default                            xen
           xendomains |      default                            xen
      xendriverdomain |
       xenjlpservices |
           xenqemudev |
            xenstored |      default                            xen
zeta /home/jlpoole #


My /etc/inittab has these entries:
Quote:
zeta /home/jlpoole # cat /etc/inittab
#
# /etc/inittab: This file describes how the INIT process should set up
# the system in a certain run-level.
#
# Author: Miquel van Smoorenburg, <miquels@cistron.nl>
# Modified by: Patrick J. Volkerding, <volkerdi@ftp.cdrom.com>
# Modified by: Daniel Robbins, <drobbins@gentoo.org>
# Modified by: Martin Schlemmer, <azarah@gentoo.org>
# Modified by: Mike Frysinger, <vapier@gentoo.org>
# Modified by: Robin H. Johnson, <robbat2@gentoo.org>
# Modified by: William Hubbs, <williamh@gentoo.org>
#
# $Id$

# Default runlevel.
id:3:initdefault:

# System initialization, mount local filesystems, etc.
si::sysinit:/sbin/openrc sysinit

# Further system initialization, brings up the boot runlevel.
rc::bootwait:/sbin/openrc boot

l0u:0:wait:/sbin/telinit u
l0:0:wait:/sbin/openrc shutdown
l0s:0:wait:/sbin/halt -dhnp
l1:1:wait:/sbin/openrc single
l2:2:wait:/sbin/openrc nonetwork
l3:3:wait:/sbin/openrc default
l4:4:wait:/sbin/openrc default
l5:5:wait:/sbin/openrc default
l6u:6:wait:/sbin/telinit u
l6:6:wait:/sbin/openrc reboot
l6r:6:wait:/sbin/reboot -dkn
#z6:6:respawn:/sbin/sulogin

# new-style single-user
su0:S:wait:/sbin/openrc single
su1:S:wait:/sbin/sulogin

# TERMINALS
#x1:12345:respawn:/sbin/agetty 38400 console linux
c1:12345:respawn:/sbin/agetty 38400 tty1 linux
c2:2345:respawn:/sbin/agetty 38400 tty2 linux
c3:2345:respawn:/sbin/agetty 38400 tty3 linux
c4:2345:respawn:/sbin/agetty 38400 tty4 linux
c5:2345:respawn:/sbin/agetty 38400 tty5 linux
c6:2345:respawn:/sbin/agetty 38400 tty6 linux

# SERIAL CONSOLES
#
# 3/24/2018 jlpoole: rem'd out "s0..." since I was getting frequent
# INIT: Id "s0" respawning too fact: disabled for 5 minutes
# messages on my main console. I had used a serial console when
# grappling with EFI
# 2/25/2019 jlpoole: reactivated to get serial monitor for
# debugging Xen kernel failure
#
s0:12345:respawn:/sbin/agetty -L 115200 ttyS0 vt100
s1:12345:respawn:/sbin/agetty -L 115200 ttyS1 vt100

# What to do at the "Three Finger Salute".
ca:12345:ctrlaltdel:/sbin/shutdown -r now

# Used by /etc/init.d/xdm to control DM startup.
# Read the comments in /etc/init.d/xdm for more
# info. Do NOT remove, as this will start nothing
# extra at boot if /etc/init.d/xdm is not added
# to the "default" runlevel.
x:a:once:/etc/X11/startDM.sh
zeta /home/jlpoole #


When I boot into a Xen kernel, I specify as a parameter "softlevel=xen " as recommended in the Xen Project Guide referenced above.

I've been trying to troubleshoot problems with the Xen kernel and it erratic ability to successfully launch, see Gentoo Bug #679826. One of the problems I have been experiencing is that when I boot into Xen, I do not receive a logon prompt both in the console attached to the server and the serial console. I'm suspecting that the reasons I do not have a console when specifying the "xen" run level is that my inittab specifications for a console do not include the id of the runlevel for Xen.

My question is: how are the numeric ids of the runlevel, e.g. 0-7, mapped to the names of the run levels as shown in the output above from rc-update or the following directory listing. My /etc/runlevels shows six named levels:
Quote:
zeta /home/jlpoole # ls /etc/runlevels/
boot default nonetwork shutdown sysinit xen
zeta /home/jlpoole #


The Linux System Administrators Guide, id., states runlevel 6 is "Reboot", but I'm suspecting in Gentoo, runlevel 6 in my case is Xen. I am unable to find anything that specifies how the numeric runlevels are mapped to the named runlevels.

Does the output of "rc-update show" have columns mapped to the numeric run levels? If so, then with "xen" being in the 6th column, it would have a run level of 6; likewise "shutdown" in column 4 would have a runlevel of 4. Right?


Last edited by jlpoole on Mon Mar 11, 2019 10:06 pm; edited 1 time in total
Back to top
View user's profile Send private message
jlpoole
Guru
Guru


Joined: 01 Nov 2005
Posts: 483
Location: Salem, OR

PostPosted: Mon Mar 11, 2019 5:45 am    Post subject: Reply with quote

Just for the record. So I punted and tried adding 6 to the levels in /etc/inittab hoping that the addition of "6" would cause a login prompt to appear both in the monitor attached to the server and in the serial console:
Code:
#
# 3/10/2019 jlpoole: Adding 6 to c1 line to see if login
# appears during boot of Xen kernel
# originals are immediately below rem'd out:
#c1:12345:respawn:/sbin/agetty 38400 tty1 linux
#c2:2345:respawn:/sbin/agetty 38400 tty2 linux
c1:123456:respawn:/sbin/agetty 38400 tty1 linux
c2:23456:respawn:/sbin/agetty 38400 tty2 linux
c3:2345:respawn:/sbin/agetty 38400 tty3 linux


I rebooted (had to do so about 5 or 6 times to get pas the "masked EXTINT" problem reference in the Bug I cited) and no login screen on the monitor attached to the server or in my serial console (using PuTTY on Windows).

Note: when I boot into a regular Gentoo kernel, I do have a login prompt both on the monitor attached to the server and in my serial console.
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Mon Mar 11, 2019 8:47 pm    Post subject: Re: inittab runlevel numbering? Reply with quote

jlpoole wrote:
My question is: how are the numeric ids of the runlevel, e.g. 0-7, mapped to the names of the run levels as shown in the output above from rc-update or the following directory listing.

They're not. Once SysVinit boots to runlevel 3 OpenRC ignores it entirely.
Back to top
View user's profile Send private message
nick_gentoo
Tux's lil' helper
Tux's lil' helper


Joined: 07 Jan 2019
Posts: 140

PostPosted: Mon Mar 11, 2019 10:14 pm    Post subject: Reply with quote

(this is my own understanding, please correct me if I'm wrong)

The numeric IDs of the runlevels are significant for the init process, but what each of them should do is only a convention.
What a runlevel actually does is fully defined in inittab, e.g. in
Code:
l3:3:wait:/sbin/openrc default

l3 is only a label, 3 is the runlevel number and /sbin/openrc default is a command to execute; man inittab has the details.

Now, for openrc a runlevel is a set of services to be started. The line above is saying that the init runlevel 3 should launch the openrc runlevel "default", and the associated services are defined in /etc/runlevels/default.
So according to the inittab, runlevel 1 is openrc single, runlevel 2 is openrc nonetwork and runlevels 3, 4 and 5 are all identical and correspond to openrc default. Runlevel 6 is openrc reboot.

I am not sure what the softlevel parameter does (how the "xen" name is mapped to a numbered runlevel for init), but I think you could try this just to see if it works: replace temporarily in inittab the l3 line like this:
Code:
#l3:3:wait:/sbin/openrc default
l3:3:wait:/sbin/openrc xen
Back to top
View user's profile Send private message
jlpoole
Guru
Guru


Joined: 01 Nov 2005
Posts: 483
Location: Salem, OR

PostPosted: Mon Mar 11, 2019 10:22 pm    Post subject: Reply with quote

nick_gentoo wrote:

I am not sure what the softlevel parameter does (how the "xen" name is mapped to a numbered runlevel for init), but I think you could try this just to see if it works: replace temporarily in inittab the l3 line like this:
Code:
#l3:3:wait:/sbin/openrc default
l3:3:wait:/sbin/openrc xen


I do want openrc to run the default levels and then run the xen, in addition, not in place of default. My goal is to have a login prompt both in the monitor attached to the server and the serial console. I think specifying runlevel 3 be xen only will not give me a login screen. Of course, my real problem is that it takes me many tries just to get past the bug that is hanging my xen boot-up. I just thought I'd explore this issue while I await some guidance on my bug.

Given watchman's statement about openrc ignoring runlevels one level 3 is commenced, I think I'm getting confused and will have to reread the documentation as well as read up on openrc to fully understand what watchman is stating.
Back to top
View user's profile Send private message
nick_gentoo
Tux's lil' helper
Tux's lil' helper


Joined: 07 Jan 2019
Posts: 140

PostPosted: Tue Mar 12, 2019 6:14 am    Post subject: Reply with quote

Hi, jlpoole! Just to clarify, my advice was also for exploring the issue, as I do not have a solution.
The wiki page that you mentioned advices to link the 'default' runlevel into the 'xen' one, so this should give you the services of both runlevels:
Code:
rc-update -s add default xen

Did you do that?
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
Page 1 of 1

 
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