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.

Cleaning up the boot process of a Debian squeeze installation running on kernel 3.2.0-0.bpo.3-amd64, I spotted several mountnfs scripts in /etc/init.d/:

# ls /etc/init.d/ | grep mountnfs
mountnfs-bootclean.sh
mountnfs.sh
umountnfs.sh

Removing fails, with commands like:

# update-rc.d -f mountnfs remove
update-rc.d: using dependency based boot sequencing

For "mountnfs", I have also tried: umountnfs, mountnfs-bootclean, nfs, nfs-common.

Update #1 Also tried without success: umountnfs.sh, mountnfs.sh.

The result is that the mountnfs-bootclean, mountnfs and unmountnfs.sh are still in /etc/init.d/ and their corresponding run level folders.

Just removing those files using rm doesn't seem the right way. I though that these init.d files belong to installed packages. However I can't really find any installed NFS package:

# dpkg --get-selections | grep nfs
libnfsidmap2                    install

How do I correctly remove all mountNFS scripts from init.d?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

To check which package a file belongs to, use dpkg -S:

$ dpkg -S /etc/init.d/mountnfs.sh
initscripts: /etc/init.d/mountnfs.sh

mountnfs.sh belongs to an essential package called initscripts.

Unless you wrote them, you should never remove scripts from /etc/init.d/. That is why the utility update-rc.d exists: to remove their symlinks from the /etc/rc*.d/ directories in an easier way.

update-rc.d requires you to call scripts by their names and, because of their dependencies, disabling them in this order should work:

update-rc.d mountnfs-bootclean.sh remove ### mountnfs-bootclean.sh first
update-rc.d mountnfs.sh remove
update-rc.d umountnfs.sh remove

However, I tried that last month, and it will leave you with a broken system (unable to start X, if I can remember well). The thing is that mountnfs-bootclean.sh does some needed system cleanup, although its name doesn't imply, and it depends on mountnfs.sh. So you can't disable either.

You may consider that as a bug in Debian init scripts: you are forced to have the init script without having any network filesystems. It's annoying, I know.

If you insist in removing them, and need to revert the changes, you'll have to re-enable them in reverse order, because mountnfs-bootclean.sh needs mountnfs.sh to be enabled first:

update-rc.d umountnfs.sh defaults
update-rc.d mountnfs.sh defaults
update-rc.d mountnfs-bootclean.sh defaults ### mountnfs-bootclean.sh last
share|improve this answer
    
Thanks for the warning about mountnfs-bootclean. The result of root@debian:~# update-rc.d mountnfs.sh remove update-rc.d: using dependency based boot sequencing insserv: Service mountnfs has to be enabled to start service mountnfs-bootclean insserv: exiting now! update-rc.d: error: insserv rejected the script header root@debian:~# update-rc.d umountnfs.sh remove update-rc.d: using dependency based boot sequencing is that mountnfs.sh and umountnfs.sh are still in /etc/init.d. –  Pro Backup Nov 11 '12 at 21:42
    
Adding the force parameter to update-rc.d didn't improve. Mountnfs.sh and umountnfs.sh are still in /etc/init.d/. –  Pro Backup Nov 11 '12 at 21:46
1  
You have to run on that exact order. Also, they will and should remain on /etc/init.d. They'll be unlinked from /etc/rcS.d. It is unwise to remove anything from /etc/init.d. –  Teresa e Junior Nov 11 '12 at 21:47
    
I updated my answer with more explanations. –  Teresa e Junior Nov 11 '12 at 22:21
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.