Log: kafka.service: Main process exited, code=exited, status=127

August 20, 2019 136 views
Kubernetes Ubuntu 18.04

Hi,

if I start the Kafka Service.
Log: kafka.service: Main process exited, code=exited, status=127/n/a Aug 16 15:12:32 ubuntu-server systemd[1]: kafka.service: Failed with result ‘exit-code’. Ubuntu

Environment: Ubuntu 18.04.2 LTS Release: 18.04 Codename: bionic

Any Idea for this problem?

1 Answer

Hi @detleffolke,

Can you please try to start the service, once it fails please run

journalctl -xe

it will provide you with the reason behind it failing to start.

Additionally, you can try

nano /etc/init.d/kafka

and provide me with the contents of the file here?

Kind regards,
Kalin D.

  • Hi Kalin,

    I follow this tutorial “How To Install Apache Kafka on Ubuntu 18.04”.
    There is no kafka file in /etc/init.d.

    This are the content from journalctl -xe:

    Aug 20 14:15:19 ubuntu-server sudo[16665]: pam_unix(sudo:session): session closed for user root
    Aug 20 14:15:19 ubuntu-server zookeeper-server-start.sh[16668]: /home/kafka/kafka/bin/kafka-run-class.sh: Zeile 306: exec: java: Nic
    Aug 20 14:15:19 ubuntu-server systemd[1]: zookeeper.service: Main process exited, code=exited, status=127/n/a
    Aug 20 14:15:19 ubuntu-server systemd[1]: zookeeper.service: Failed with result ‘exit-code’.
    Aug 20 14:15:19 ubuntu-server systemd[1]: kafka.service: Main process exited, code=exited, status=127/n/a
    Aug 20 14:15:19 ubuntu-server systemd[1]: kafka.service: Failed with result 'exit-code’.

    thanks for your support
    Detlef

    • Hi @detleffolke,

      I see, thank you for the reply.

      To further try and solve this, can you please perform a few things for me and provide me with the result here

      sudo free -mh
      
      sudo nano /etc/systemd/system/zookeeper.service
      
      sudo nano /etc/systemd/system/kafka.service
      
      sudo grep kafka /etc/passwd
      

      I’m awaiting your reply to try and further help you in the situation.

      Kind regards,
      Kalin D.

      • Hi Kalin,

        here are my results:

        sudo free -mh
        Gesamt belegt frei gemns. Puffer/Cache verfügbar
        Speicher: 1,9G 187M 468M 2,2M 1,3G 1,6G
        Auslagerungsspeicher: 2,0G 0B 2,0G

        *sudo nano /etc/systemd/system/zookeeper.service
        *

        [Unit]
        Requires=network.target remote-fs.target
        After=network.target remote-fs.target

        [Service]
        Type=simple
        User=kafka
        ExecStart=/home/kafka/kafka/bin/zookeeper-server-start.sh /home/kafka/kafka/config/zookeeper.properties
        ExecStop=/home/kafka/kafka/bin/zookeeper-server-stop.sh
        Restart=on-abnormal

        [Install]
        WantedBy=multi-user.target

        *sudo nano /etc/systemd/system/kafka.service
        *

        [Unit]
        Requires=zookeeper.service
        After=zookeeper.service

        [Service]
        Type=simple
        User=kafka
        ExecStart=/bin/sh -c ’/home/kafka/kafka/bin/kafka-server-start.sh /home/kafka/kafka/config/server.properties > /home/kafka/kafka/ka$
        ExecStop=/home/kafka/kafka/bin/kafka-server-stop.sh
        Restart=on-abnormal

        [Install]
        WantedBy=multi-user.target

        *sudo grep kafka /etc/passwd
        *

        kafka:x:1001:1001::/home/kafka:/bin/sh

        Thank you
        Detlef

Have another answer? Share your knowledge.