14

I am trying to install ack via apt but it seems it's no longer available in the repos. Both:

sudo apt install ack
sudo apt install ack-grep

give the following error:

E: Package 'ack-grep' has no installation candidate

Is it no longer available in the 17.10 repositories?

Axel Beckert
  • 252
  • 2
  • 10
  • First, try `sudo apt update`. – arupgsh Nov 02 '17 at 11:34
  • 1
    @muru Thanks but your link shows it's _not_ available since `artful` is not listed, correct? https://packages.ubuntu.com/search?suite=artful&keywords=ack –  Nov 02 '17 at 12:24
  • 3
    Hmm, yes, https://launchpad.net/ubuntu/+source/ack/2.14-5/+publishinghistory indicates it was removed due to being broken – muru Nov 02 '17 at 14:58
  • 3
    Hi, creator of ack here. I'm aware of the situation, but I don't know what if anything I personally can do about it. Here's a ticket in the ack bug tracker with more info: https://github.com/beyondgrep/ack2/issues/652 – Andy Lester Nov 03 '17 at 14:01

5 Answers5

12

Ack has a test failure in Ubuntu 17.10 Artful and it has been excluded from Ubuntu until it passes. Perl is upgraded on Artful and the old ack version isn't supported by the new Perl. The new version doesn't pass all its tests. The test failure is caused by problems with the testing framework as run under Ubuntu (even when it works fine in Debian.) A new version that passes will be released soon.

In the meantime, a workaround is to install it through CPAN as suggested on the ack homepage. If you don't already have CPAN installed, you need to install it first:

sudo apt install cpanminus

Then you can use it to install ack:

sudo cpanm install App::Ack

It will build and test it, so it take about 2 minutes, but after it is done it will be in your path at /usr/local/bin/ack.

I like this installation option because it uses standard apt and cpan repositories. It uses Perl libraries that will get upgraded by automated tools. It can be easily implemented in automated tools such as Ansible.

Stephen Ostermiller
  • 4,083
  • 2
  • 37
  • 52
  • 2
    Presumably if you are installing cpanminus you actually want to then install using it: `sudo cpanm App::Ack`. – Joel Berger Dec 12 '17 at 21:02
  • 3
    Actually, as it currently stands it is *not* a problem with Perl or Ack (tests pass with the same versions in the almost identical Debian build system). Currently it's assumed to be a bug in the Ubuntu build system. – mniess Dec 12 '17 at 23:22
6

Sadly ack is not in 17.10 repositories. A workaround is to install it manually as per the instructions on its website.

Here's what I did:

$ sudo su
# curl https://beyondgrep.com/ack-2.18-single-file > /usr/local/bin/ack && chmod 0755 /usr/local/bin/ack
Pēteris Caune
  • 261
  • 1
  • 5
  • 2
    Although it looks kind of questonable to install software from random websites, beyondgrep.com is the official ack website. – Stephen Ostermiller Dec 04 '17 at 10:38
  • 1
    The single file version of ack uses its own copies of required libraries that won't get automatically updated if a security flaw is found in them. It is using the library versions as of when ack was built, which may not be the most up to date versions even at the time you install. If you use this solution, you should be aware that there are additional security concerns with single-file installs. – Stephen Ostermiller Dec 04 '17 at 10:41
  • A one liner instead of using `sudo su`: `ack="/usr/local/bin/ack" && curl -s https://beyondgrep.com/ack-2.18-single-file | sudo tee "$ack" > /dev/null && sudo chmod 0755 "$ack"` – Stephen Ostermiller Dec 04 '17 at 10:46
  • Please don't. Rather use the ack .deb package from another Ubuntu release (or even Debian). So you at least get security updates for all used libraries. – Axel Beckert Dec 13 '17 at 01:06
  • This was the only method that worked for me. – Theodore R. Smith Mar 12 '18 at 16:09
4

Packages which fail Ubuntu's automatic as-installed package testing are not included in a release, at least those not from the universe archive (which is imported regularily and automated from Debian Unstable).

Due to a change during the Ubuntu 17.10 Artful Release cycle something broke ack's autopkgtest in Ubuntu and hence stopped ack from being included in Ubuntu releases. You can't even find it in the current development snapshot bionic, but you can install it if you add a line for bionic-proposed to your sources.list.

It is still unclear, what exactly that change was, respectively what the reason (maybe a bug in Ubuntu's autopkgtest infrastructure) and what the trigger is. (Maybe the switch to Perl 5.26 exhibited an issue in Ubuntu's autopkgtest infrastructure.)

What is clear though is that this issue is ubuntu-specific since ack's autopkgtest in Debian passes without any issues. And running autopkgtest locally on a development snapshot of Ubuntu 18.04 Bionic doesn't exhibit these test failures either. (And it seems to build on Ubuntu. And the very same test suite is run at build-time, too, and if it didn't pass, the package wouldn't build which is considered a much more severe issue.)

Another hint that the issue is hidden somewhere in Ubuntu's autopkgtest infrastucture is the fact that most test failures regard their input suddenly as STDIN instead of the expected files.

Any hint on the underlying reasons for these strange ubuntu-autopkgtest-specific test failures is very appreciated in either the according launchpad bug report or in the according upstream bug report.

Axel Beckert
  • 252
  • 2
  • 10
2

As @muru indicated in the comments above the package has been removed since it's broken in 17.10, so yes, no ack in the 17.10 repositories for now.

Guess I should keep an eye on https://packages.ubuntu.com/search?suite=artful&keywords=ack to know when it will be available again.

  • 1
    It probably won't be. It's extremely rare for a package that isn't already in the repos to be made available via backports. You could keep an eye on https://launchpad.net/ubuntu/bionic/+source/ack/ to see if it makes the cut for 18.04 (since that's an lts, perhaps more effort might be put into making it work) – muru Nov 02 '17 at 15:19
  • As far as I can tell, the "broken" that caused this problem was a spelling error that tripped up the Debian packaging. – Andy Lester Nov 03 '17 at 14:03
  • 1
    @AndyLester: No, that spelling error had nothing to do with it. It was even marked as false positive via an Lintian Override by the Debian Perl Team. – Axel Beckert Dec 13 '17 at 01:04
  • "broken" (Cc @muru) means in this case that it failed automatic as-installed package testing (short: autopkgtest). The relevant page to keep an eye on is https://autopkgtest.ubuntu.com/packages/ack and it's sub pages. And this is clearly an Ubuntu-specific issue as ack passes [Debian's autopkgtest](https://ci.debian.net/packages/a/ack/). – Axel Beckert Dec 13 '17 at 01:10
  • @AxelBeckert I know. We've discussed this on the ticket page. I wrote that spelling comment six weeks ago. – Andy Lester Dec 14 '17 at 15:26
1

I was able to install the Ubuntu 18.04 package on my Ubuntu 17.10 box:

$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=17.10
DISTRIB_CODENAME=artful
DISTRIB_DESCRIPTION="Ubuntu 17.10"
$ sudo apt install libfile-next-perl
...snip...
$ wget https://launchpad.net/ubuntu/+archive/primary/+files/ack_2.18-2_all.deb
...snip...
$ sudo dpkg -i ack_2.18-2_all.deb
...snip...
$ ack --version
ack 2.18
Running under Perl 5.26.0 at /usr/bin/perl

Copyright 2005-2017 Andy Lester.

This program is free software.  You may modify or distribute it
under the terms of the Artistic License v2.0.

If the dpkg command fails for you, it's probably because you're missing some dependency that I already have. Try to apt install any missing dependencies and then run the dpkg line again.

I like this approach better than using CPAN, because APT/dpkg can still see this package is installed and will be able to upgrade it later once Ubuntu gets their build situation sorted out.

(Thanks Axel Beckert for posting link to the Launchpad bug report, which is where I got this idea.)

Mark E. Haase
  • 884
  • 1
  • 7
  • 19