4

Ubuntu 17.10 contains libmicrohttpd12 but I also need libmicrohttpd10 for kodi. Can I have both ?

Tshilidzi Mudau
  • 4,143
  • 3
  • 24
  • 32
meFrans
  • 41
  • 2

1 Answers1

3

It is available in 16.04, and installing the 16.04 version on 17.10 is likely to work (assuming you really cannot install 16.04; otherwise you should do that). However, do not just download a .deb and install it, because if a vulnerability is found in it, you will not automatically get the fix. Instead, you can add the 16.04 repositories as follows.

First, copy your current sources.list to a new file in /etc/sources.list.d:

sudo cp /etc/apt/sources.list /etc/apt/sources.list.d/xenial_for_libmicrohttpd10.list

The name of the new file is just a reminder for the future you of what its purpose is. You can also add a more elaborate comment in it.

Second, use your text editor of choice to replace all occurrences of artful in the file to xenial. For example:

printf ',s/artful/xenial/\nw\n' | sudo ed /etc/apt/sources.list.d/xenial_for_libmicrohttpd10.list

Finally, just to be sure that no Xenial package other than libmicrohttpd10 will be accidentally installed, give them a low priority by creating a file in /etc/apt/preferences.d like this:

Package: *
Pin: release n=xenial
Pin-Priority: 99

Package: libmicrohttpd10
Pin: release n=xenial
Pin-Priority: 500

Then you can do sudo apt update && sudo apt install libmicrohttpd10.

fkraiem
  • 12,344
  • 4
  • 33
  • 38
  • `sudo sed -i 's/artful/xenial/' /etc/apt/sources.list.d/xenial_for_libmicrohttpd10.list` seems simpler. Also, maybe consider adding only the `universe` repo. – muru Dec 26 '17 at 08:36
  • @muru I don't like `sed -i` because it is [non-standard](http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sed.html) (there is a joke: using `sed -i` is like alcohol-free beer, it tastes the same but you know it ain't right!). Adding only `universe` could be problematic if a dependency from `main` is needed (it is not currently the case since all the dependencies are in Artful, but some could be removed further down the line if their sonumber increases). – fkraiem Dec 26 '17 at 08:45
  • It maybe non-standard for POSIX, but it's perfectly fine for GNU, and hence Ubuntu. – muru Dec 26 '17 at 08:46
  • @muru I know that; what is your point? I said why I did not include it in my answer; I never said it does not work. – fkraiem Dec 26 '17 at 10:11
  • That your reason isn't much of a reason, after all, you stopped being POSIX only when you used sudo, so POSIX clearly doesn't matter. – muru Dec 26 '17 at 10:24
  • @muru What you think about my reason (for choosing one particular example) matters how? – fkraiem Dec 26 '17 at 10:27
  • you're the one who asked what my point was, if it didn't matter, don't ask. End of discussion. – muru Dec 26 '17 at 10:48