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.

On my Debian server, I have no network shares (NFS, SMB, ...). I am trying to optimize and simplify my boot process. Is it OK to remove the following init scripts?

/etc/rcS.d/S12mountnfs.sh
/etc/rcS.d/S13mountnfs-bootclean.sh

AFAICT, these are only needed, when NFS is to be mounted. However, I am not sure what purpose the mountnfs-bootclean.sh script has.

Anyway, Is it safe to remove both these scripts, i.e.:

chkconfig mountnfs-bootclean.sh off
chkconfig mountnfs.sh off
share|improve this question
    
This answer might be useful. Though, I am still trying to find what the file does, it has some information regarding the files. unix.stackexchange.com/a/55459/47538 –  Ramesh Apr 24 at 21:43
1  
Removing those will not achieve any noteworthy effect. Thousands of others would have to profit from this question until the time saved during boot amounts to the time we take discussing it. If you want to speed up/optimise things, get rid of those init scripts that start services, i.e. daemons, in the background, but you don't use/need. –  Bananguin Apr 24 at 21:51
    
@Bananguin - I understand your point. On the other hand, if I will never use NFS on this particular server, what use is it to check for cases which will never occur? I am just trying to simplify the process. I am adding several init scripts of my own, and the simpler I keep it, the easier it will be to maintain it for me. –  Martin Vegter Apr 24 at 22:00
    
@MartinVegter: It is a misbelief that diverging from your distribution's standard set-up yields any benefit for something you neither need nor care about nor see any effects after the boot process has completed. If it ain't broken, don't fix it. –  Bananguin Apr 25 at 7:28
add comment

5 Answers 5

up vote 5 down vote accepted

You won't really optimize anything by removing these scripts. The time they take is negligible.

The *-bootclean.sh scripts clean up files that must or should not survive a reboot: files in /var/run, /var/lock, /tmp, etc. In Debian with SysVinit, there are three such scripts:

  • checkroot-bootclean.sh runs just after the root filesystem is mounted (which can remove spurious files created under directories that will soon become mount points, such as /run and potentially /tmp)
  • mountall-bootclean.sh runs after local filesystems have been mounted (including e.g. a local separate /tmp or /var — or tmpfs filesystems, but there's nothing to clean on these)
  • mountnfs-bootclean.sh runs after remote filesystems have been mounted (including e.g. /var over NFS).

Disabling mountnfs.sh and mountnfs-bootclean.sh will not harm your system. However, to determine that, you need to study them carefully. Furthermore, this only applies under the assumption that you will never ever put an NFS filesystem in your fstab. If you know that this is true, then I would very much like you to imbue me with your divination abilities. If you merely believe that this is true, then you need to take into account the risk that your belief proves unfounded at some point.

Every default that you change in the distribution makes your system different, so part of the documentation no longer applies, the testing that others have conducted may no longer apply, the support that you might get could be invalidated, etc. Any change to a default setting is inherently an added complication, and thus should only be performed if there is an actual benefit to be derived from it. Your assertion that removing these scripts will simplify your boot process is false, because you did not take this into account.

share|improve this answer
    
The testing that others have done would never happen in the first place if people didnt test things.I consider it unwise to box in your experience. There's nothing special about computers - they're just equipment. Why shouldn't this guy or any other do whatever they want with their own computer? And besides, most "default settings" are "unnecessary complications" included more for wider spread compatibility as opposed to usefulness. –  mikeserv Apr 25 at 0:13
3  
@mikeserv Martin can do whatever he wants with his computer. I merely state that it would not be a simplification. I do not dispute his right to make his life more complex. –  Gilles Apr 25 at 0:15
    
But it might be a simplification - and it often is. A lot of the options included with systems are only there to handle edge cases - which never occur on a sane person's machine. In the same way you and I will puzzle endlessly over how to deal with a newline in a pathname - which has never happened to me personally - so also do distribution maintainers compromise. Which is right and good - but nobody says we have to keep it that way. –  mikeserv Apr 25 at 0:18
    
@Gilles - I am trying to disable services that I don't need. Same as disabling daemons, and uninstalling unused packages/libraries. The fewer packages are installed and services run, the fewer opportunities for bugs. And in the process, I learn new things from smart people like you. –  Martin Vegter Apr 25 at 7:35
    
It's a mistake to assume that removing code will necessarily reduce the opportunity for bugs, especially if that code is for a rare case. –  pjc50 Apr 25 at 14:40
show 1 more comment

I would never outright remove init.d scripting.....What I would do is de-install the package that you no longer need. The init.d file should be removed as a result of the package removal.

Package removal meets your need of simplification and possibly removal of some needed disk space.

share|improve this answer
add comment

I don't see any performance gain in removing those initscripts. The function do_wait_async_mount() parses fstab and if doesn't find nfs filesystems it just do nothing. Executing the script takes less than half of second on my system, that also doesn't have any NFS mount:

➜  ~  sudo time /etc/init.d/mountnfs-bootclean.sh start 
0.00user 0.00system 0:00.11elapsed 0%CPU (0avgtext+0avgdata 1400maxresident)k
24inputs+0outputs (0major+1857minor)pagefaults 0swaps
➜  ~  sudo time /etc/init.d/mountnfs.sh start 
0.00user 0.00system 0:00.07elapsed 10%CPU (0avgtext+0avgdata 1400maxresident)k
0inputs+0outputs (0major+1866minor)pagefaults 0swaps

You can remove them, but the performance gain doesn't worth the effort.

share|improve this answer
    
I am not so much trying to speed up the boot process, but rather simplify it. In my philosophy, if I don't need functionality X, I like to disable it. And by the way, do you understand what purpose the script mountnfs-bootclean.sh serves? –  Martin Vegter Apr 24 at 21:52
1  
@MartinVegter "Clean temporary filesystems after network filesystems have been mounted." It executes the clean_all() function of /lib/init/bootclean.sh. It's rather simple already, and is not a background process. –  Braiam Apr 24 at 21:56
add comment

Backing up is simple - and should already be done anyway. Restoring is a simple affair. Your risks are near nil, but what you stand to gain - even in the event of failure - is experiential knowledge. I say go for it. I say remove every single script until the machine refuses to boot. I will go one step further and say I take no responsibility for the outcome, but, seriously, the worst that can happen is you learn something.

share|improve this answer
add comment

To address the simplicity issue:

  • Removing scripts which were created by a minimal distro or package installation is usually a bad idea - you don't know which processes may be relying on them.
  • Removing the package which created the files might be perfectly sensible. To find out:

    yum provides /etc/rcS.d/S12mountnfs.sh /etc/rcS.d/S13mountnfs-bootclean.sh
    
  • If you can't achieve the desired simplicity with Debian, or you want to learn more about how the boot process works, you may want to try a barebones distro like Arch.
share|improve this answer
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.