1

I'm trying to install the mosquitto package, but when I type sudo apt-get install mosquitto it returns E: Unable to locate package mosquitto.

I already ran sudo apt-get update and sudo apt-get upgrade.

Output from apt search mosquitto:

Sortierung... Fertig
Volltextsuche... Fertig
libmosquitto1/now 1.5.7-1+deb10u1 armhf  [Installiert,lokal]
  MQTT version 3.1/3.1.1 client library

mosquitto-clients/now 1.5.7-1+deb10u1 armhf  [Installiert,lokal]
  Mosquitto command line MQTT clients

(sorry for the german parts.) It seems like it's already installed? But when I run mosquitto_sub -d -t /home/data to test, I only get Error: Connection refused

Output from cat /etc/apt/sources.list:

#deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi

Seems like there's a problem with 'apt-get update, so I tried fixing it with debsums, like in this thread, but apt-get update can't find the debsums package to install on the first hand...

hardillb
  • 1,275
  • 1
  • 9
  • 19
Schneggl
  • 13
  • 4
  • The output says that libmosquitto & the mosquitto clients are installed not the broker (they are 3 separate packages). Are there any errors in the `apt-get update` output (do they match the linked question)? – hardillb Aug 29 '21 at 12:01

1 Answers1

2

Use apt-file or as alternative the online search to search for package names.

You will find that mosquitto is indeed the correct Debian package name to install the server part. The command mosquitto_sub is provided by package mosquitto-clients.

However, the sources.list provided indicates that your installation is not based on Debian but based on Raspberry Pi OS (previously called Raspbian) in version buster. The repository contains the packages as well.

Please check carefully your file sources.list. It seems that the repository is commented out. Remove the # in the first line eventually? The file should look similar as this:

deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi
deb http://archive.raspberrypi.org/debian/ buster main

# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi
Lutz Willek
  • 653
  • 1
  • 10
  • Thank you! Editing ```sources.list``` worked. Tho I don't understand how that problem occured on the first hand... – Schneggl Aug 29 '21 at 17:50