deb-preinst(5)

πŸ’… deb-preinst β€” the manual page bestie

ok so real talk: this is deb-preinst(5) from the dpkg suite, and it's about that one little file that runs before your package even gets installed. pre-installation maintainer script vibes πŸ’–


🌸 NAME 🌸

deb-preinst β€” the package pre-installation maintainer script. yes that's its whole job and it's iconic for it πŸŽ€


✨ SYNOPSIS ✨

DEBIAN/preinst

that's it. that's the whole path. slay πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea: a package can do a whole bunch of pre-installation stuff (several pre-installation actions, fr fr) using maintainer scripts. how? by putting an executable preinst file inside its control archive β€” that's DEBIAN/preinst while you're building the package. no cap, that's the whole mechanism 🫢

the script can get called in the following ways, and you need to handle all of them:

  • new-preinst install β€” gets called before the package is installed. like, right before. main character timing ✨
  • new-preinst install old-version new-version β€” gets called before a removed package is upgraded. support for new-version has been a thing since dpkg 1.18.5, iykyk 🌈
  • new-preinst upgrade old-version new-version β€” gets called before the package is upgraded. support for new-version since dpkg 1.18.5, same deal πŸ¦‹
  • old-preinst abort-upgrade new-version β€” gets called if postrm fails during an upgrade, or fails on a failed upgrade. messy but necessary πŸ˜­πŸ’€
lowkey important: make sure your preinst is executable β€” that word is doing a lot of work in that sentence πŸŽ€

πŸ‘‘ SEE ALSO πŸ‘‘

  • dpkg(1) β€” the main character herself 🌟

that's the whole page bestie, go forth and write a preinst that doesn't break everything πŸ§šπŸ’œ

signed off with love from the dpkg suite, version 1.23.11-dirty, dated 2026-09-09 πŸ“

πŸ“¦ where this page comes from