Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm trying to understand the init/boot process. My system is LMDE, so I presume it will be pretty much standard Debian in that regard. I believe I more or less understand the basics of the init scripts, /etc/init.d/, /etc/defaults/ and so on, but there's this strange use of /lib/init/ for a few of the scripts that look to me like they should be in /etc/init.d/ with all the rest. Can someone explain the logic of this? There's lots of discussion of /lib/init/rw/ but none that I can find about /lib/init/ itself.

This is all that's in there:

drwxr-xr-x 3 root 4.0K 2013-12-25//15:20:41 rw/
-rw-r--r-- 1 root 1.3K 2014-01-21//07:37:07 vars.sh
-rw-r--r-- 1 root 3.3K 2014-01-21//07:37:07 tmpfs.sh
-rw-r--r-- 1 root  741 2014-01-21//07:37:07 swap-functions.sh
-rw-r--r-- 1 root  17K 2014-01-21//07:37:07 mount-functions.sh
-rw-r--r-- 1 root 4.4K 2014-01-21//07:37:07 bootclean.sh

Running dpkg-query -S /lib/init returns:

initscripts: /lib/init
share|improve this question
    
Which scripts do you have in /lib/init? –  terdon Jan 21 at 16:50
    
Running dpkg-query -S /lib/init will give some hints where/what to look at/into. –  Sami Laine Jan 21 at 18:18
    
This is all that's in there: drwxr-xr-x 3 root 4.0K 2013-12-25//15:20:41 rw/ -rw-r--r-- 1 root 1.3K 2014-01-21//07:37:07 vars.sh -rw-r--r-- 1 root 3.3K 2014-01-21//07:37:07 tmpfs.sh -rw-r--r-- 1 root 741 2014-01-21//07:37:07 swap-functions.sh -rw-r--r-- 1 root 17K 2014-01-21//07:37:07 mount-functions.sh -rw-r--r-- 1 root 4.4K 2014-01-21//07:37:07 bootclean.sh. dpkg-query reports "initscripts: /lib/init" –  rayandrews Jan 22 at 1:01
    
Sorry about the mess, I wish comment boxes took formatting. –  rayandrews Jan 22 at 1:14
add comment

2 Answers

You can just open the scripts. /etc/init.d handle the daemons and any process that should start or stop during the boot or changing the runlevel.

But those scripts in /lib/init performs tasks related with cleaning .pid and lock files, mount/umount swap and cleaning the system between runlevels.

share|improve this answer
    
Yet, since all that is part of init, it seems that they should be under /etc along with everything else, no? There is an /etc/init as well. I'm just wondering what the logic of this arrangement is. –  rayandrews Jan 22 at 2:49
    
I agree with you. IMO just the init process use those scripts. That's why they put in a init directory. –  Willian Paixao Jan 22 at 2:51
    
I'm tinkering with the bootlogd system, thus editing all the init scripts, and it bugs me no end that I hafta make changes outside of /etc/init.d ... oh well, I tend to agonize over things like this ... Say, do you think I could move them and use symlinks in /lib/init pointing back to /etc/init.d? ... or would that reek havoc? –  rayandrews Jan 22 at 3:33
add comment

Just like pretty much anything else in a lib directory, they are libraries.

In this case, each of those files is filled with functions and nothing else. They're sourced by other shell scripts to get access to those functions. Since the files are only filled with functions they won't do anything if you run them directly.

So to answer your question, they are a suite of shell library functions that are used by various init scripts.

share|improve this answer
    
I know what they do, what I wonder is why they are not in /etc/init.d along with all other init stuff. I've moved them into /etc/init.d with just links left in the old directory. Ditto /lib/lsb/. Because I'm doing some work on those files, having the whole init script collection in one place is very handy. –  rayandrews Jan 24 at 4:14
    
Because they are libraries. That's why they're in lib. You can of course do whatever you like on your system. But as far as your question "why are they there", I think has been pretty clearly answered. –  bahamat Jan 24 at 18:39
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.