Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm building an install key for a Debian based system. The install key basically copies a disk image onto the system and then in a chroot installs a number of packages that are copied onto the install key during the build process.

One of the things the install key does is wipe the existing ssh keys (so we don't create a bunch of "identical" ssh servers). To try and stick with the debian way of doing things I run dpkg-reconfigure openssh-server to regenerate the keys but at the end of the reconfigure it attempts to restart the server which of course isn't running in the install key chroot.

Is it possible to tell debconf to reconfigure but don't restart services?

share|improve this question
    
Hmm, I suspect it's not possible without packaging a custom version of openssh with a modified postinst script. –  stsquad Oct 16 '09 at 11:57

3 Answers 3

up vote 0 down vote accepted

What you are asking isn't a function of debconf or dpkg-reconfigure, directly. If you download the .deb for openssh-server and extract the files from control.tar.gz you will see that the 'postinst' script executes invoke-rc.d or /etc/init.d/ssh:

Line 418:

setup_init() {
  if [ -x /etc/init.d/ssh ]; then
    update-rc.d ssh start 16 2 3 4 5 . stop 84 1 . >/dev/null
    if [ -x /usr/sbin/invoke-rc.d ]; then
      invoke-rc.d ssh restart
    else
      /etc/init.d/ssh restart
    fi
  fi
}
share|improve this answer
    
Yes, but it's possible to change whether invoke-rc.d actually starts anything. See serverfault.com/questions/75114/… –  Teddy Mar 14 '11 at 17:44

From what this document says, you should create a /usr/sbin/policy-rc.d script in the chroot which does exit 101.

share|improve this answer

Worthy of note: a service won't be started by invoke-rc.d if you're not in a runlevel which shouldn't have that service running. So one idea might be to convince the chroot that it's in single-user mode.

share|improve this answer

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.