1

I am building a minimal Debian image with debootstrap, chroot in it and installing grub.

Now I need to install some custom self created debian packages. These packages have postinst scripts running database migrations. BUT in my chroot env the postgresql of course is not running.

I tried systemd-nspawn but without the -b flag the container is not booted and again the postgresql is not running.

Of course apt install ... fails and running apt install during the first real boot would probably rerun the postinst successfully but it feels ugly.

Is there a better way how to prepare a minimal clean bootable already configured image?

0

Why not start PostgreSQL within your chroot before installing your custom packages?

By default systemd services won't run within a chroot, but you can still manually start PostgreSQL, e.g. something like this:

 su postgres -c 'pg_ctl start -D /usr/local/pgsql/data -l serverlog'

(Command taken from PostgreSQL 11 docs)

If it fails to start, check the serverlog file as to why.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.