Todays best debian command


Today I spend well about 10 hours in debians dependency hell. There was a lot of issues caused by problems between the (outdated) lenny and the (current) GPLHost version of DTC.

I had tried to “fix” this a few times, but in the end I had a huge mess and mix of dovecot, postix, courier and cyrus all on the same box. The reason is mostly  that apt-get remove doesn’t remove initscripts and config files of stuff you remove  (and no, not even apt-get purge reliably does either)

Today I was finally relaxed enough to go through this with the necessary stubborness.

  • Remove ALL mailsystems except postfix
  • unwire all addons from postfix config
  • DELETE all configs, init scripts etc
  • slowly reinstall dtc-postfix-courier
  • one by one idendity about 20-30 missing dependencies (courier has a lot of dependency holes)
  • then reapply the configs using dtc scripts and manual reading

At that point I hit a wall, because the apt-get install had NOT recreated any of the init scripts etc. In a twisted, broken, not healthy way this is absolutely logical – it didn’t remove them.

That is debian at it’s best. They think it makes some weird sense to not remove an init script when I uninstall the application, so they will also not reinstall any scripts when I install the application again, later on. Because they assume I’ll do it just the magic way they came up with.

Anyway, I still have a real life and will not bend to their ways

Instead, I bring You the wonderful commands to end all problems.

Cleanly reinstalling a package on debian including config:

for pkg in $pkgs

do

apt-get purge $pkg

apt-get install --reinstall --purge $pkg
<pre>dpkg --force-confmiss -i /var/cache/apt/archivess/${pkg}_*.deb ;</pre>
done

Maybe I just went the wrong path and there is another command that’ll do this in one line.

But at least in my world, a script (and even a package management) will never assume a state, instead it will aim to reach it. If you say install, you mean install. Not something else. If you call install twice, the same thing should haven two times!

For the nitpicks: Solaris SMF is completely different from that. With SMF you say “please bring that service group” (i.e. IP services) up.

Don’t fight Debian? I just don’t care any more.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s