Install Ubuntu Server .deb package without starting service using dpkg --unpack

On Debian flavors like Ubuntu, apt and dpkg default to starting a service as soon as it is installed. This is almost always a good idea, but I ran into the strange problem that the service was misconfigured. Starting it was not a good thing. Stopping and re-configuring it after it started was not working either*. I tried everything I could to prevent dpkg from starting the service during installation.

I tried each of the approaches listed here (Install packages without starting background processes and services), plus a few others. I also tried to find install flags for the product, I tried a bunch of things, but time after time none of them worked.

This is what finally worked: Use dpkg --unpack to open up the package, modify the bad configuration, then dpkg --configure to finish the installation. Here are the steps I used.

# this unpacks the installer but does not do any further configuration
sudo dpkg --unpack deb-launcher.deb

# check the folder to see if it unpacked the config file; it did
ls /etc/so-launcher/

# look at the config file. Note that it has ".dpkg-new" appended to it because it is not done installing
less /etc/so-launcher/launcher.flags.dpkg-new

# edit the config file (changed domain name)
sudo nano /etc/so-launcher/launcher.flags.dpkg-new

# use --configure --pending to configure any packages which are not yet configured
sudo dpkg --configure --pending

# check service status: it works great!
sudo service launcher.so-launcher status

Hope this helps.

*(Here's the obscure and now-funny-but-not-so-funny-then reason why nothing worked. The little -r in this helpful tip meant that the log was sorted upside-down. I kept scrolling to the bottom of the log and seeing no change in the error condition, not realizing that it was actually the top of the log. The issue had long ago been resolved by simple reconfiguration. I discovered this after I did the fix above. Blech.)

Add a comment

Fields followed by * are mandatory

HTML code is displayed as text and web addresses are automatically converted.

Page top