malformated LSB header in postgres: missing LSB end marker, aborting

  • Jump to comment-1
    Matthias Apitz<guru@unixarea.de>
    Mar 25, 2026, 10:48 AM UTC
    Hello,
    We use the following script as /etc/init.d/postgres on
    SuSE Linux Enterprise, SLES 15 SP7, to start PostgreSQL 16.5 server:
    $ tar tzf postgresql-16.5.tar.gz | grep start-scripts/linux
    postgresql-16.5/contrib/start-scripts/linux
    # cp postgresql-16.5/contrib/start-scripts/linux /etc/init.d/postgres
    # head -10 /etc/init.d/postgres
    #! /bin/sh
    # chkconfig: 2345 98 02
    # description: PostgreSQL RDBMS
    # This is an example of a start/stop script for SysV-style init, such
    # as is used on Linux systems. You should edit some of the variables
    # and maybe the 'echo' commands.
    #
    # Place this file at /etc/init.d/postgresql (or
    # ...
    Together with systemd services this gives the following error:
    # systemctl enable postgres.service
    Synchronizing state of postgres.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
    Executing: /usr/lib/systemd/systemd-sysv-install enable postgres
    error: malformated LSB header in postgres: missing LSB end marker, aborting.
    The service file contains:
    # cat /etc/systemd/system/postgres.service
    [Unit]
    Description=SunRise PostgreSQL server
    After=systemd-user-sessions.service
    [Service]
    ExecStart=/etc/init.d/postgres start
    ExecStop=/etc/init.d/postgres stop
    TimeoutStartSec=infinity
    RemainAfterExit=yes
    [Install]
    WantedBy=multi-user.target
    When I enhance the script with this section between BEGIN / END
    # cat /etc/init.d/postgres
    #! /bin/sh
    # chkconfig: 2345 98 02
    # description: PostgreSQL RDBMS
    ### BEGIN INIT INFO
    # Provides: postgresql
    # Required-Start: $network $named
    # Required-Stop:
    # Default-Start: 3 5
    # Default-Stop:
    # Description:
    ### END INIT INFO
    ...
    The error goes away:
    # systemctl enable postgres.service
    Synchronizing state of postgres.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
    Executing: /usr/lib/systemd/systemd-sysv-install enable postgres
    ln -sf ../postgres /etc/init.d/rc3.d/S50postgres
    ln -sf ../postgres /etc/init.d/rc5.d/S50postgres
    Any comments on this?
    Thanks
    matthias
    --
    Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045
    Public GnuPG key: http://www.unixarea.de/key.pub
    Annalena Baerbock: "We are fighting a war against Russia ..." (25.1.2023)
    I, Matthias, I am not at war with Russia.
    Я не воюю с Россией.
    Ich bin nicht im Krieg mit Russland.
    • Jump to comment-1
      Adrian Klaver<adrian.klaver@aklaver.com>
      Mar 25, 2026, 2:35 PM UTC
      On 3/25/26 3:48 AM, Matthias Apitz wrote:
      Hello,
      We use the following script as /etc/init.d/postgres on
      SuSE Linux Enterprise, SLES 15 SP7, to start PostgreSQL 16.5 server:
      $ tar tzf postgresql-16.5.tar.gz | grep start-scripts/linux
      postgresql-16.5/contrib/start-scripts/linux
      # cp postgresql-16.5/contrib/start-scripts/linux /etc/init.d/postgres
      # head -10 /etc/init.d/postgres
      #! /bin/sh
      # chkconfig: 2345 98 02
      # description: PostgreSQL RDBMS
      # This is an example of a start/stop script for SysV-style init, such
      # as is used on Linux systems. You should edit some of the variables
      # and maybe the 'echo' commands.
      #
      # Place this file at /etc/init.d/postgresql (or
      # ...
      Together with systemd services this gives the following error:
      # systemctl enable postgres.service
      Synchronizing state of postgres.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
      Executing: /usr/lib/systemd/systemd-sysv-install enable postgres
      error: malformated LSB header in postgres: missing LSB end marker, aborting.
      The service file contains:
      # cat /etc/systemd/system/postgres.service
      [Unit]
      Description=SunRise PostgreSQL server
      After=systemd-user-sessions.service
      [Service]
      ExecStart=/etc/init.d/postgres start
      ExecStop=/etc/init.d/postgres stop
      TimeoutStartSec=infinity
      RemainAfterExit=yes
      [Install]
      WantedBy=multi-user.target
      When I enhance the script with this section between BEGIN / END
      # cat /etc/init.d/postgres
      #! /bin/sh
      # chkconfig: 2345 98 02
      # description: PostgreSQL RDBMS
      ### BEGIN INIT INFO
      # Provides: postgresql
      # Required-Start: $network $named
      # Required-Stop:
      # Default-Start: 3 5
      # Default-Stop:
      # Description:
      ### END INIT INFO
      ...
      The error goes away:
      # systemctl enable postgres.service
      Synchronizing state of postgres.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
      Executing: /usr/lib/systemd/systemd-sysv-install enable postgres
      ln -sf ../postgres /etc/init.d/rc3.d/S50postgres
      ln -sf ../postgres /etc/init.d/rc5.d/S50postgres
      Any comments on this?
      From the contrib script:
      "# Proper init scripts on Linux systems normally require setting lock
      # and pid files under /var/run as well as reacting to network
      # settings, so you should treat this with care.
      "
      From the start script that the PGDG Debian/Ubuntu packages use:
      ### BEGIN INIT INFO
      # Provides: postgresql
      # Required-Start: $localfs $remotefs $network $time
      # Required-Stop: $localfs $remotefs $network $time
      # Should-Start: $syslog
      # Should-Stop: $syslog
      # Default-Start: 2 3 4 5
      # Default-Stop: 0 1 6
      # Short-Description: PostgreSQL RDBMS server
      ### END INIT INFO
      [Continued]
      Thanks
      matthias
      -- Adrian Klaver
      adrian.klaver@aklaver.com
      • Jump to comment-1
        Matthias Apitz<guru@unixarea.de>
        Apr 1, 2026, 7:32 AM UTC
        El día miércoles, marzo 25, 2026 a las 07:35:21a. m. -0700, Adrian Klaver escribió:
        From the contrib script:

        "# Proper init scripts on Linux systems normally require setting lock
        # and pid files under /var/run as well as reacting to network
        # settings, so you should treat this with care.
        "
        I've read this comment in the script before filing my question. And my
        question is: Why postgresql.org does not deliver this PGDG Debian/Ubuntu
        version of the script for Linux(!) as default:

        From the start script that the PGDG Debian/Ubuntu packages use:

        ### BEGIN INIT INFO
        # Provides: postgresql
        # Required-Start: $localfs $remotefs $network $time
        # Required-Stop: $localfs $remotefs $network $time
        # Should-Start: $syslog
        # Should-Stop: $syslog
        # Default-Start: 2 3 4 5
        # Default-Stop: 0 1 6
        # Short-Description: PostgreSQL RDBMS server
        ### END INIT INFO

        [Continued]
        Thanks
        matthias
        --
        Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045
        Public GnuPG key: http://www.unixarea.de/key.pub
        Jens Spahn (CDU, 11.3.2025 in FAZ):
        "Wir können uns verteidigen lernen oder alle Russisch lernen."
        "We can learn to defend ourselves or we can all learn Russian."
        "O podemos aprender a defendernos o todos podemos aprender ruso."
        Ich ziehe es vor, Russisch zu lernen. I prefer to learn russian.
        Yo prefiero aprender ruso.
        • Jump to comment-1
          Adrian Klaver<adrian.klaver@aklaver.com>
          Apr 1, 2026, 3:14 PM UTC
          On 4/1/26 12:32 AM, Matthias Apitz wrote:
          El día miércoles, marzo 25, 2026 a las 07:35:21a. m. -0700, Adrian Klaver escribió:
          From the contrib script:

          "# Proper init scripts on Linux systems normally require setting lock
          # and pid files under /var/run as well as reacting to network
          # settings, so you should treat this with care.
          "
          I've read this comment in the script before filing my question. And my
          question is: Why postgresql.org does not deliver this PGDG Debian/Ubuntu
          version of the script for Linux(!) as default:
          Because there are more flavors of Linux then the Debian family?
          The basic issue is that the project itself takes responsibility for delivering the source. Integration of the source with OS'es is left to others.
          What you see here:
          https://www.postgresql.org/download/
          is delivered by separate packaging teams.
          At this point end users directly building from source is, from what I understand, a very small subset of the Postgres user base. The expectation is that you will be installing from some sort of packaging system or using a pre-installed service.
          From the start script that the PGDG Debian/Ubuntu packages use:

          ### BEGIN INIT INFO
          # Provides: postgresql
          # Required-Start: $localfs $remotefs $network $time
          # Required-Stop: $localfs $remotefs $network $time
          # Should-Start: $syslog
          # Should-Stop: $syslog
          # Default-Start: 2 3 4 5
          # Default-Stop: 0 1 6
          # Short-Description: PostgreSQL RDBMS server
          ### END INIT INFO

          [Continued]
          Thanks
          matthias
          -- Adrian Klaver
          adrian.klaver@aklaver.com