LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 05-18-2003, 12:22 PM   #1
itsjustme
Senior Member
 
Registered: Mar 2003
Location: Earth
Distribution: Slackware, Ubuntu, Smoothwall
Posts: 1,571

Rep: Reputation: 45
Where is 'init' run from? (slackware 9.0)


In the Slackware Linux Essentials book there is:

"The first program to run under Slackware besides the Linux kernel is init(8)."

I haven't been able to find what calls this program. Is this called from /boot/vmlinuz?

In the man pages for init it says:

"Init is the parent of all processes."

So, I assume that vmlinuz is the first thing that happens after boot up, or as a part of boot up. And then init is called from there and the system setup branches out from that point. Or is init called from some other program that /boot/vmlinuz launches?

Thanks...
 
Old 05-18-2003, 01:34 PM   #2
itsjustme
Senior Member
 
Registered: Mar 2003
Location: Earth
Distribution: Slackware, Ubuntu, Smoothwall
Posts: 1,571

Original Poster
Rep: Reputation: 45
Uh.. Actually, I can't find 'init' either. I did find several 'init.c' files in /usr/src/linux-2.4.20/arch'. So, I am assuming (again) that vmlinuz (the actual kernel ??) calls, or runs, the 'init.c' in

'/usr/src/linux-2.4.20/arch/i386/mm'

on this Pentium III machine.

Thanks for any comments/input as I get into this 'guts' level investigation of linux.


Hmmmm... Now I don't know. I searched through init.c for the string 'inittab' and didn't get a hit. And, I read:

"The first program to run under Slackware besides the Linux kernel is init(8). This program reads the /etc/inittab(5) file to see how to run the system."

 
Old 05-18-2003, 01:50 PM   #3
MasterC
Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 64
whereis init
I get:
Code:
bash-2.05a$ whereis init
init: /usr/src/linux-2.4.20-lq1/init /usr/src/linux/init /sbin/init /usr/man/man8/init.8.gz /usr/share/man/man8/init.8.gz
One pointing to my kernel source, another to the symlink to my kernel source, and finally the init program itself:
/sbin/init

HTH

Cool
 
Old 05-18-2003, 02:08 PM   #4
itsjustme
Senior Member
 
Registered: Mar 2003
Location: Earth
Distribution: Slackware, Ubuntu, Smoothwall
Posts: 1,571

Original Poster
Rep: Reputation: 45
d'oh!!

here's what I did:
[root@bsslack ~] $ find / -name 'init' -print
/usr/src/linux-2.4.20/init
/usr/src/linux-2.4.20/include/config/msndclas/init
/usr/src/linux-2.4.20/include/config/msndpin/init
/sbin/init
[root@bsslack ~] $

I just overlooked that tiny /sbin/init. (my eyeballs didn't do their customary carriage return/line feed!! ) The others are init directories.

So, anyway, I see it's a complicated process. Is my assumption correct that /sbin/init is called from /boot/vmlinuz ?

And, then, does the /sbin/init use the init.c in /usr/src/linux-2.4.20/arch/i386/mm ? I can't view init since it is a binary file, so I don't know what's in it.

Thanks for your patience and for bearing with me while I try to get a grasp of the initialization process.
 
Old 05-18-2003, 02:13 PM   #5
MasterC
Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 64
I doubt that /sbin/init calls anything from /usr/src since on many distros (and even on slack) this directory is/can be empty. You don't have to have your kernel source available for booting up.

As for my guess on what it calls (since I have no real idea):
/sbin/init
calls
/etc/inittab
which in turns calls it's respective runlevel defined there with the default entry;
which then calls the appropriate /etc/rc.d scripts to get the system rolling.

This is of course after the kernel (/vmlinuz or /boot/vmlinuz depending on which release you are running) has done it's thing (everything before the runlevel).

Cool
 
Old 05-18-2003, 02:22 PM   #6
itsjustme
Senior Member
 
Registered: Mar 2003
Location: Earth
Distribution: Slackware, Ubuntu, Smoothwall
Posts: 1,571

Original Poster
Rep: Reputation: 45
Quote:
Originally posted by MasterC
As for my guess on what it calls (since I have no real idea):
/sbin/init
calls
/etc/inittab
which in turns calls it's respective runlevel defined there with the default entry;
which then calls the appropriate /etc/rc.d scripts to get the system rolling.
Cool
I got this from the info I was reading, but the initial question (which is not answered in the info I was reading) remains about my assumption.

"Is my assumption correct that /sbin/init is called from /boot/vmlinuz ?"

I'm just trying to be careful with my assumptions.

Thanks...
 
Old 05-18-2003, 02:31 PM   #7
MasterC
Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 64
Looking around for the bootup to bash how to, I found this one:
http://www.tldp.org/HOWTO/BootPrompt-HOWTO.html
Which has some info on this. I'll keep looking.

Cool
 
Old 05-18-2003, 02:32 PM   #8
MasterC
Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 64
Ahh, here it is:
http://axiom.anu.edu.au/~okeefe/p2b/ (Curteousy if www.linuxfromscratch.org )

Cool
 
Old 05-18-2003, 02:52 PM   #9
itsjustme
Senior Member
 
Registered: Mar 2003
Location: Earth
Distribution: Slackware, Ubuntu, Smoothwall
Posts: 1,571

Original Poster
Rep: Reputation: 45
AH!!! I found it. I was just looking in the slackware documentation. I almost forgot I had this "Running Linux" book. (another d'oh!)

Anyway, it says quite clearly, " Once the device drivers are initialized, the kernel executes the program init , which is found in /etc, /bin, or /sbin (it's /sbin/init on most systems). init is a general-purpose program that spawns new processes.... etc."

So, RTFM applies! I was just shying away from "Running Linux" because my initial foray into it scrambled my brains as a rank newbie.
I guess I am starting to pass out of that phase.

regards...

Edit: This is in the boot prompt howto:
"Any remaining arguments that were not picked up by the kernel and were not interpreted as environment variables are then passed onto process one, which is usually the init program."
This, of course, pushed the question "where is process one called from?' onto the WTF stack. The statement didn't actaully say init was called from the kernel. It made it appear that the call to process one was after the kernel. Anyway, moot point now.

Last edited by itsjustme; 05-18-2003 at 02:58 PM.
 
Old 05-18-2003, 03:02 PM   #10
itsjustme
Senior Member
 
Registered: Mar 2003
Location: Earth
Distribution: Slackware, Ubuntu, Smoothwall
Posts: 1,571

Original Poster
Rep: Reputation: 45
AH!! some more.

That power up to bash prompt howto has some good info on init also.

Thanks...!

edit: from that howto:
"Once the kernel is loaded, the first thing it does is look for an init program to run."

Last edited by itsjustme; 05-18-2003 at 03:15 PM.
 
Old 05-18-2003, 03:15 PM   #11
MasterC
Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 64
No, thank you. I needed to add that how-to to my bookmarks.

Cool
 
Old 05-18-2003, 03:52 PM   #12
itsjustme
Senior Member
 
Registered: Mar 2003
Location: Earth
Distribution: Slackware, Ubuntu, Smoothwall
Posts: 1,571

Original Poster
Rep: Reputation: 45
Added for future searchers:

I also found the rute manual

http://linux.tnc.edu.tw/techdoc/linu...rute/rute.html

and looked up init in there. Of course, it says the last thing the kernel does involves the /sbin/init file.

Quote:
After the kernel has been unpacked into memory, it begins to execute, initializing hardware. The last thing it does is mount the root file system, which necessarily contains a program /sbin/init, which the kernel executes. init is one of the only programs the kernel ever executes explicitly; the onus is then on init to bring the UNIX system up. init always has the process ID 1.
So, last thing, first thing, who's counting?

I'm gonna understand this before I move on to runlevels!!
 
Old 05-18-2003, 04:14 PM   #13
MasterC
Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 64
I think it's confusing the 2 terms:
Once the kernel is loaded the first thing it executes is init VS
The very last thing the kernel does during loading is execute init



Cool
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
/etc/X11/xinit/.Xmodmap; run level 4 won't init script Potatopopper Slackware 5 11-27-2005 08:37 PM
init.d in Slackware l2g Slackware 4 05-14-2004 04:28 PM
init.d on slackware geb256 Slackware 1 11-03-2003 05:22 PM
init script won't run at log-off dimangi Linux - Newbie 1 10-29-2003 03:19 AM
setting script to run when system enter init 3 fowlerlfc Linux - Newbie 2 10-29-2002 04:02 PM


All times are GMT -5. The time now is 01:21 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration