rabbitmq / erlang-debian-package

Fork of the official Debian package for Erlang
https://launchpad.net/~rabbitmq/+archive/ubuntu/rabbitmq-erlang
Apache License 2.0
13 stars 10 forks source link

Ubuntu packages miss a dependency on libtinfo #25

Closed aquarhead closed 6 months ago

aquarhead commented 3 years ago

I followed https://www.rabbitmq.com/install-debian.html#apt-quick-start-cloudsmith but rabbitmq-server failed to start up (I'm using Packer hence the amazon-ebs: prefix)

    amazon-ebs: Setting up erlang-xmerl (1:24.0.2-1) ...
    amazon-ebs: Setting up erlang-syntax-tools (1:24.0.2-1) ...
    amazon-ebs: Setting up erlang-parsetools (1:24.0.2-1) ...
    amazon-ebs: Setting up erlang-asn1 (1:24.0.2-1) ...
    amazon-ebs: Setting up erlang-tftp (1:24.0.2-1) ...
    amazon-ebs: Setting up erlang-mnesia (1:24.0.2-1) ...
    amazon-ebs: Setting up erlang-crypto (1:24.0.2-1) ...
    amazon-ebs: Setting up erlang-runtime-tools (1:24.0.2-1) ...
    amazon-ebs: Setting up erlang-tools (1:24.0.2-1) ...
    amazon-ebs: Setting up erlang-snmp (1:24.0.2-1) ...
    amazon-ebs: Setting up erlang-public-key (1:24.0.2-1) ...
    amazon-ebs: Setting up erlang-ssl (1:24.0.2-1) ...
    amazon-ebs: Setting up erlang-os-mon (1:24.0.2-1) ...
    amazon-ebs: Setting up erlang-eldap (1:24.0.2-1) ...
    amazon-ebs: Setting up erlang-ftp (1:24.0.2-1) ...
    amazon-ebs: Setting up erlang-inets (1:24.0.2-1) ...

    amazon-ebs: Adding new user `rabbitmq' (UID 114) with group `rabbitmq' ...
    amazon-ebs: Not creating home directory `/var/lib/rabbitmq'.
    amazon-ebs: Created symlink /etc/systemd/system/multi-user.target.wants/rabbitmq-server.service → /lib/systemd/system/rabbitmq-server.service.
    amazon-ebs: Job for rabbitmq-server.service failed because the control process exited with error code.
    amazon-ebs: See "systemctl status rabbitmq-server.service" and "journalctl -xe" for details.
    amazon-ebs: invoke-rc.d: initscript rabbitmq-server, action "start" failed.
    amazon-ebs: ● rabbitmq-server.service - RabbitMQ broker
    amazon-ebs:      Loaded: loaded (/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: enabled)
    amazon-ebs:      Active: activating (auto-restart) (Result: exit-code) since Wed 2021-06-02 13:49:00 UTC; 9ms ago
    amazon-ebs:     Process: 3593 ExecStart=/usr/lib/rabbitmq/bin/rabbitmq-server (code=exited, status=127)
    amazon-ebs:    Main PID: 3593 (code=exited, status=127)
    amazon-ebs:
    amazon-ebs: Jun 02 13:49:00 ip-10-197-75-86 systemd[1]: rabbitmq-server.service: Failed with result 'exit-code'.
    amazon-ebs: Jun 02 13:49:00 ip-10-197-75-86 systemd[1]: Failed to start RabbitMQ broker.

journalctl -xe reveals missing dynamic library:

-- A start job for unit rabbitmq-server.service has begun execution.
--
-- The job identifier is 3228.
Jun 02 11:51:36 ip-10-197-75-120 rabbitmq-server[7888]: /usr/lib/erlang/erts-12.0.2/bin/beam.smp: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
Jun 02 11:51:36 ip-10-197-75-120 systemd[1]: rabbitmq-server.service: Main process exited, code=exited, status=127/n/a
-- Subject: Unit process exited

And it's the same error if I try to run erl directly:

ubuntu@ip-10-197-75-120:~$ erl
/usr/lib/erlang/erts-12.0.2/bin/beam.smp: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory

After some digging it seems installing libtinfo5 fixed the issue:

ubuntu@ip-10-197-75-86:~$ sudo apt-get install libtinfo5
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  libtinfo5
0 upgraded, 1 newly installed, 0 to remove and 30 not upgraded.
1 not fully installed or removed.
Need to get 83.0 kB of archives.
After this operation, 535 kB of additional disk space will be used.
Get:1 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu focal/universe amd64 libtinfo5 amd64 6.2-0ubuntu2 [83.0 kB]
Fetched 83.0 kB in 0s (4692 kB/s)
Selecting previously unselected package libtinfo5:amd64.
(Reading database ... 61485 files and directories currently installed.)
Preparing to unpack .../libtinfo5_6.2-0ubuntu2_amd64.deb ...
Unpacking libtinfo5:amd64 (6.2-0ubuntu2) ...
Setting up rabbitmq-server (3.8.16-1) ...
Setting up libtinfo5:amd64 (6.2-0ubuntu2) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
ubuntu@ip-10-197-75-86:~$ erl
Erlang/OTP 24 [erts-12.0.2] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [jit]

Eshell V12.0.2  (abort with ^G)
1>
User switch command
 --> q

Is this a missing dependency somewhere for the debian package?

I'm installing RabbitMQ on AWS EC2, with base image ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-20210518 (AMI ami-0213344887e47003a in eu-west-1). Let me know if you need more information.

michaelklishin commented 3 years ago

I haven't seen this reported elsewhere. We use these packages in our own pipelines using standard Ubuntu images (e.g. ubuntu:focal).

michaelklishin commented 3 years ago

libtinfo5 is a library that's been introduced in Bionic (18.04). We can add it to the list of dependencies but it is not mentioned anywhere in the upstream Debian Erlang package repository.

So I'm afraid we don't have any evidence that this is a missing dependency in the package. It must be a missing dependency in the image you use.

michaelklishin commented 3 years ago

Apparently the base Erlang package on Ubuntu does depend on libtinfo6. This is an Ubuntu-specific dependency we can add.

michaelklishin commented 3 years ago

So does Debian Buster but I'm not sure why it is never mentioned in the Debian package repo. It must be on an implicit list of system libraries somewhere.

aquarhead commented 3 years ago

Yeah looking at this https://github.com/docker-library/repo-info/blob/master/repos/ubuntu/local/focal.md it seems included in the docker image you use. Though the base AMI I used in EC2 is also "Ubuntu official".

aquarhead commented 3 years ago

Actually I just found that I'm using this

## Add apt repositories maintained by Team RabbitMQ
sudo tee /etc/apt/sources.list.d/rabbitmq.list <<EOF
## Provides modern Erlang/OTP releases
##
## "bionic" as distribution name should work for any reasonably recent Ubuntu or Debian release.
## See the release to distribution mapping table in RabbitMQ doc guides to learn more.
deb http://ppa.launchpad.net/rabbitmq/rabbitmq-erlang/ubuntu bionic main
deb-src http://ppa.launchpad.net/rabbitmq/rabbitmq-erlang/ubuntu bionic main

## Provides RabbitMQ
##
## "bionic" as distribution name should work for any reasonably recent Ubuntu or Debian release.
## See the release to distribution mapping table in RabbitMQ doc guides to learn more.
deb https://packagecloud.io/rabbitmq/rabbitmq-server/ubuntu/ bionic main
deb-src https://packagecloud.io/rabbitmq/rabbitmq-server/ubuntu/ bionic main
EOF

Switching those bionic to focal seems to fix the issue... I'll do a few more tests to confirm.

aquarhead commented 3 years ago

Can confirm it works (just tested through our CI) so it's mostly a failure of RTFM on my part :(

BTW, it seems it's not happy with debian-keyring and debian-archive-keyring for some reason:

  ==> amazon-ebs: E: Unable to locate package debian-keyring
  ==> amazon-ebs: E: Unable to locate package debian-archive-keyring

Though I can still install Erlang and RabbitMQ just fine without these 2 packages.

michaelklishin commented 3 years ago

Yes, those packages are distribution-specific as well.

michaelklishin commented 3 years ago

It's not obvious to me where this dependency comes from in both Debian (our upstream) and Ubuntu (which we do not rely on) packages. I'm afraid for the next few weeks I'd only be able to take a look at this in my spare time, so no guarantees.

If someone knows where this package should be added as a dependency, let us know. The difficult part here is deciding what's the right thing to do, not changing the control file ;)