Menu

#307 Amazon Linux will be detected as Ubuntu if with package redhat-lsb-core-4.0-7.14.amzn1.x86_64

v3.5.33
closed-fixed
nobody
None
3
2018-04-13
2018-03-15
Bin Yi
No

Trying to install tanuki service on Amazon AMI, normally it was detected as generic Linux:
Detected Linux:
But if with the package redhat-lsb-core-4.0-7.14.amzn1.x86_64 installed:
sudo yum install -y redhat-lsb-core-4.0-7.14.amzn1.x86_64
since a file /etc/lsb-release will be created, the OS is detected as Ubuntu now and install with init.d failed:
Detected Ubuntu or Debian: Installing the SumoLogic Collector daemon using init.d.. ./collector: line 1822: update-rc.d: command not found

Discussion

  • Maxime Andrighetto

    Thank you for reporting this issue.

    Could you try updating your shell script to test if the update-rc.d command exists before falling into the "Ubuntu - Debian" case?

    Please replace

    elif [ -f /etc/lsb-release -o -f /etc/debian_version -o -f /etc/debian_release ] ; then

    by

    elif [ -f /etc/lsb-release -o -f /etc/debian_version -o -f /etc/debian_release ] && [ "Xcommand -v update-rc.d" != "X" ] ; then

    (3 places in the shell scripts).

    Please let me know if this fix your issue.

    Best Regards,

    Maxime

     

    Last edit: Maxime Andrighetto 2018-03-16
  • Bin Yi

    Bin Yi - 2018-03-16

    Thanks for your reply.
    I get what you means but the line I'm using is

    elif [ -f /etc/lsb-release -o -f /etc/debian_version -o -f /etc/debian_release ] && [ "X$(command -v update-rc.d)" != "X" ] ; then

    And it works.
    By looking your line I guess the format ate your left quote marks

    I think this fix is good enough. Our customer suggested consider the Amazon AMI is widely used today, it's better do a more initiative detection for it other than fall it into "other Linux".

    Anyway. Thanks a lot for your quick response

     
  • Maxime Andrighetto

    • status: open --> closed-fixed
     

Log in to post a comment.