mosquitto Error: Address already in use Topic is solved

Having issues with your DietPi installation or found a bug? Post it here.
Ian
Posts: 29
Joined: Thu Feb 28, 2019 12:45 pm

Re: mosquitto Error: Address already in use

Post by Ian »

Sorry I should not have said reinstall, I meant uninstall and install through dietpi-software
User avatar
Joulinar
Posts: 5087
Joined: Sat Nov 16, 2019 12:49 am

Re: mosquitto Error: Address already in use

Post by Joulinar »

can you perform an uninstall, do a reboot and check if there is still some mosquitto stuff running afterwards?

I had a look to dietpi-software script and it should remove everything. As well the software package should be purged via apt

Code: Select all

			Banner_Uninstalling
			if [[ -f '/etc/systemd/system/mosquitto.service' ]]; then

				systemctl disable --now mosquitto
				rm -R /etc/systemd/system/mosquitto.service*

			fi
			[[ -d '/etc/systemd/system/mosquitto.service.d' ]] && rm -R /etc/systemd/system/mosquitto.service.d
			G_AGP mosquitto

			[[ -f '/etc/apt/sources.list.d/dietpi-mosquitto.list' ]] && rm -v /etc/apt/sources.list.d/dietpi-mosquitto.list
			[[ -f '/etc/apt/trusted.gpg.d/dietpi-mosquitto.gpg' ]] && rm -v /etc/apt/trusted.gpg.d/dietpi-mosquitto.gpg/code]
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Ian
Posts: 29
Joined: Thu Feb 28, 2019 12:45 pm

Re: mosquitto Error: Address already in use

Post by Ian »

Just purged and rebooted.

Code: Select all

root@DietPi:~# mosquitto
-bash: mosquitto: command not found
root@DietPi:~# ps -ef | grep mosquitto
root      1107  1011  0 13:33 pts/0    00:00:00 grep mosquitto

root@DietPi:~# ss -tulpn | grep LISTEN
tcp    LISTEN     0      100    127.0.0.1:25002                 *:*                   users:(("nxclient.bin",pid=1172,fd=5))
tcp    LISTEN     0      50        *:139                   *:*                   users:(("smbd",pid=767,fd=33))
tcp    LISTEN     0      100    127.0.0.1:26002                 *:*                   users:(("nxnode.bin",pid=1153,fd=7))
tcp    LISTEN     0      128       *:22                    *:*                   users:(("dropbear",pid=552,fd=3))
tcp    LISTEN     0      128       *:1880                  *:*                   users:(("node-red",pid=799,fd=21))
tcp    LISTEN     0      128    127.0.0.1:8088                  *:*                   users:(("influxd",pid=808,fd=3))
tcp    LISTEN     0      128    127.0.0.1:7002                  *:*                   users:(("nxnode.bin",pid=1153,fd=22))
tcp    LISTEN     0      50        *:445                   *:*                   users:(("smbd",pid=767,fd=32))
tcp    LISTEN     0      100       *:4000                  *:*                   users:(("nxd",pid=586,fd=3))
tcp    LISTEN     0      100    127.0.0.1:12002                 *:*                   users:(("nxnode.bin",pid=1153,fd=16))
tcp    LISTEN     0      100    127.0.0.1:23560                 *:*                   users:(("nxserver.bin",pid=485,fd=8))
tcp    LISTEN     0      50       :::139                  :::*                   users:(("smbd",pid=767,fd=31))
tcp    LISTEN     0      32       :::21                   :::*                   users:(("proftpd",pid=680,fd=0))
tcp    LISTEN     0      128      :::8086                 :::*                   users:(("influxd",pid=808,fd=302))
tcp    LISTEN     0      128      :::22                   :::*                   users:(("dropbear",pid=552,fd=4))
tcp    LISTEN     0      128      :::3001                 :::*                   users:(("grafana-server",pid=822,fd=10))
tcp    LISTEN     0      128     ::1:7002                 :::*                   users:(("nxnode.bin",pid=1153,fd=21))
tcp    LISTEN     0      50       :::445                  :::*                   users:(("smbd",pid=767,fd=30))
tcp    LISTEN     0      100      :::4000                 :::*                   users:(("nxd",pid=586,fd=4))
root@DietPi:~# 
User avatar
Joulinar
Posts: 5087
Joined: Sat Nov 16, 2019 12:49 am

Re: mosquitto Error: Address already in use

Post by Joulinar »

looks like it's gone. Can you check if there is something inside /etc/mosquitto/ still
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Ian
Posts: 29
Joined: Thu Feb 28, 2019 12:45 pm

Re: mosquitto Error: Address already in use

Post by Ian »

Empty, no longer a mosquitto folder in /etc/
User avatar
Joulinar
Posts: 5087
Joined: Sat Nov 16, 2019 12:49 am

Re: mosquitto Error: Address already in use

Post by Joulinar »

Usually it should be fine to have it installed again
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Ian
Posts: 29
Joined: Thu Feb 28, 2019 12:45 pm

Re: mosquitto Error: Address already in use

Post by Ian »

Installed again, rebooted, still the same :cry:

Could I install an earlier version?

Code: Select all

1616247624: mosquitto version 2.0.9 starting
1616247624: Using default config.
1616247624: Starting in local only mode. Connections will only be possible from clients running on this machine.
1616247624: Create a configuration file which defines a listener to allow remote access.
1616247624: Opening ipv4 listen socket on port 1883.
1616247624: Error: Address already in use
1616247624: Opening ipv6 listen socket on port 1883.
1616247624: Error: Address already in use
User avatar
MichaIng
Site Admin
Posts: 3087
Joined: Sat Nov 18, 2017 6:21 pm

Re: mosquitto Error: Address already in use

Post by MichaIng »

Can you please paste the output of systemctl and top | grep mosquitto? It seems like there are two conflicting processes running concurrently. Probably the package is shipping a second service that is no systemd and no sysv service. Wound be new.
Ian
Posts: 29
Joined: Thu Feb 28, 2019 12:45 pm

Re: mosquitto Error: Address already in use

Post by Ian »

Yes sure

systemctl

Code: Select all

  UNIT                                    LOAD   ACTIVE SUB       DESCRIPTION         
     
  mnt-154220a9\x2d8eca\x2d4a5e\x2da222\x2db46db5a96923.automount loaded active waiting   mn
t-154220a9\x2d8eca\x2d4a5e\x2da222\x2db46db5a96923.automount
  mnt-Crucial_120GB.automount             loaded active running   mnt-Crucial_120GB.automou
nt
  proc-sys-fs-binfmt_misc.automount       loaded active waiting   Arbitrary Executable
 File Formats File System Automount Point
  sys-devices-platform-soc-3f201000.serial-tty-ttyAMA0-hci0.device loaded active plugged   
/sys/devices/platform/soc/3f201000.serial/tty/ttyAMA0/hci0
  sys-devices-platform-soc-3f201000.serial-tty-ttyAMA0.device loaded active plugged   /sys/
devices/platform/soc/3f201000.serial/tty/ttyAMA0
  sys-devices-platform-soc-3f202000.mmc-mmc_host-mmc0-mmc0:59b4-block-mmcblk0-mmcblk0p1.dev
ice loaded active plugged   /sys/devices/platform/soc/3f202000.mmc/mmc_host/mmc0/mmc0:59b4/
block/mmcblk0/mmcblk0p1
  sys-devices-platform-soc-3f202000.mmc-mmc_host-mmc0-mmc0:59b4-block-mmcblk0-mmcblk0p2.dev
ice loaded active plugged   /sys/devices/platform/soc/3f202000.mmc/mmc_host/mmc0/mmc0:59b4/
block/mmcblk0/mmcblk0p2
  sys-devices-platform-soc-3f202000.mmc-mmc_host-mmc0-mmc0:59b4-block-mmcblk0.device loaded
 active plugged   /sys/devices/platform/soc/3f202000.mmc/mmc_host/mmc0/mmc0:59b4/block/mmcb
lk0
  sys-devices-platform-soc-3f980000.usb-usb1-1\x2d1-1\x2d1.1-1\x2d1.1:1.0-net-eth0.device l
oaded active plugged   SMSC9512/9514 Fast Ethernet Adapter
  sys-devices-platform-soc-3f980000.usb-usb1-1\x2d1-1\x2d1.2-1\x2d1.2:1.0-host0-target0:0:0
-0:0:0:0-block-sdb-sdb1.device loaded active plugged   CT120BX500SSD1 primary   
  sys-devices-platform-soc-3f980000.usb-usb1-1\x2d1-1\x2d1.2-1\x2d1.2:1.0-host0-target0:0:0
-0:0:0:0-block-sdb.device loaded active plugged   CT120BX500SSD1           
  sys-devices-platform-soc-3f980000.usb-usb1-1\x2d1-1\x2d1.4-1\x2d1.4:1.0-host1-target1:0:0
-1:0:0:0-block-sda-sda1.device loaded active plugged   Ultra 1                  
  sys-devices-platform-soc-3f980000.usb-usb1-1\x2d1-1\x2d1.4-1\x2d1.4:1.0-host1-target1:0:0
-1:0:0:0-block-sda.device loaded active plugged   Ultra                    
  sys-devices-virtual-block-ram0.device   loaded active plugged   /sys/devices/virtual/bloc
k/ram0
  sys-devices-virtual-block-ram1.device   loaded active plugged   /sys/devices/virtual/bloc
k/ram1
  sys-devices-virtual-block-ram10.device  loaded active plugged   /sys/devices/virtual/bloc
k/ram10
  sys-devices-virtual-block-ram11.device  loaded active plugged   /sys/devices/virtual/bloc
k/ram11
  sys-devices-virtual-block-ram12.device  loaded active plugged   /sys/devices/virtual/bloc
k/ram12
  sys-devices-virtual-block-ram13.device  loaded active plugged   /sys/devices/virtual/bloc
k/ram13
  sys-devices-virtual-block-ram14.device  loaded active plugged   /sys/devices/virtual/bloc
k/ram14
  sys-devices-virtual-block-ram15.device  loaded active plugged   /sys/devices/virtual/bloc
k/ram15
  sys-devices-virtual-block-ram2.device   loaded active plugged   /sys/devices/virtual/bloc
k/ram2
  sys-devices-virtual-block-ram3.device   loaded active plugged   /sys/devices/virtual/bloc
k/ram3
  sys-devices-virtual-block-ram4.device   loaded active plugged   /sys/devices/virtual/bloc
k/ram4
  sys-devices-virtual-block-ram5.device   loaded active plugged   /sys/devices/virtual/bloc
k/ram5
  sys-devices-virtual-block-ram6.device   loaded active plugged   /sys/devices/virtual/bloc
k/ram6
  sys-devices-virtual-block-ram7.device   loaded active plugged   /sys/devices/virtual/bloc
k/ram7
  sys-devices-virtual-block-ram8.device   loaded active plugged   /sys/devices/virtual/bloc
k/ram8
  sys-devices-virtual-block-ram9.device   loaded active plugged   /sys/devices/virtual/bloc
k/ram9
  sys-devices-virtual-misc-rfkill.device  loaded active plugged   /sys/devices/virtual/misc
/rfkill
  sys-devices-virtual-tty-ttyprintk.device loaded active plugged   /sys/devices/virtual/tty
/ttyprintk
  sys-module-configfs.device              loaded active plugged   /sys/module/configfs     
  sys-subsystem-bluetooth-devices-hci0.device loaded active plugged   /sys/subsystem/blueto
oth/devices/hci0
  sys-subsystem-net-devices-eth0.device   loaded active plugged   SMSC9512/9514 Fast E
thernet Adapter
  -.mount                                 loaded active mounted   Root Mount               
  boot.mount                              loaded active mounted   /boot                    
  dev-mqueue.mount                        loaded active mounted   POSIX Message Queue File 
System
  mnt-Crucial_120GB.mount                 loaded active mounted   /mnt/Crucial_120GB       
● mnt-Dietpi.mount                        loaded failed failed    /mnt/Dietpi              
  run-user-0.mount                        loaded active mounted   /run/user/0              
  run-user-113.mount                      loaded active mounted   /run/user/113            
  sys-kernel-config.mount                 loaded active mounted   Configuration File System
  sys-kernel-debug.mount                  loaded active mounted   Debug File System        
  tmp.mount                               loaded active mounted   /tmp                     
  var-log.mount                           loaded active mounted   /var/log                 
  systemd-ask-password-console.path       loaded active waiting   Dispatch Password Requests to Console Directory Watch
  systemd-ask-password-wall.path          loaded active waiting   Forward Password Requests to Wall Directory Watch
  init.scope                              loaded active running   System and Service Manager
  session-c2.scope                        loaded active running   Session c2 of user root  
  session-c3.scope                        loaded active running   Session c3 of user nx    
  bluetooth.service                       loaded active running   Bluetooth service        
  console-setup.service                   loaded active exited    Set console font and keymap
  cron.service                            loaded active running   Regular background program processing daemon
  dbus.service                            loaded active running   D-Bus System Message Bus 
  dietpi-boot.service                     loaded active exited    DietPi-Boot              
  dietpi-postboot.service                 loaded active exited    DietPi-PostBoot          
  dietpi-preboot.service                  loaded active exited    DietPi-PreBoot           
  dietpi-ramlog.service                   loaded active exited    DietPi-RAMlog            
● dietpi-wifi-monitor.service             loaded failed failed    DietPi-WiFi-Monitor      
  dropbear.service                        loaded active running   LSB: Lightweight SSH server
  getty@tty1.service                      loaded active running   Getty on tty1            
  grafana-server.service                  loaded active running   Grafana instance         
  hciuart.service                         loaded active running   Configure Bluetooth Modems connected by UART
  ifup@eth0.service                       loaded active exited    ifup for eth0            
  influxdb.service                        loaded active running   InfluxDB is an open-source, distributed, time series database
  keyboard-setup.service                  loaded active exited    Set the console keyboard layout
  kmod-static-nodes.service               loaded active exited    Create list of required static device nodes for the current kernel
  mosquitto.service                       loaded active running   Mosquitto MQTT Broker    
  networking.service                      loaded active exited    Raise network interfaces 
  nmbd.service                            loaded active running   Samba NMB Daemon         
  node-red.service                        loaded active running   Node-Red (DietPi)        
  nxserver.service                        loaded active running   NoMachine Server daemon  
  openvpn.service                         loaded active exited    OpenVPN service          
  polkit.service                          loaded active running   Authorization Manager    
  proftpd.service                         loaded active running   LSB: Starts ProFTPD daemon
  rc-local.service                        loaded active exited    /etc/rc.local Compatibility
  resolvconf.service                      loaded active exited    Nameserver information manager
  rng-tools.service                       loaded active running   rng-tools.service        
  smbd.service                            loaded active running   Samba SMB Daemon         
  systemd-fsck-root.service               loaded active exited    File System Check on Root Device
  systemd-fsck@dev-disk-by\x2dpartuuid-b8ef7a27\x2d01.service loaded active exited    File System Check on /dev/disk/by-partuuid/b8ef7a27-01
  systemd-journal-flush.service           loaded active exited    Flush Journal to Persistent Storage
  systemd-journald.service                loaded active running   Journal Service          
  systemd-logind.service                  loaded active running   Login Service            
  systemd-modules-load.service            loaded active exited    Load Kernel Modules      
  systemd-random-seed.service             loaded active exited    Load/Save Random Seed    
  systemd-remount-fs.service              loaded active exited    Remount Root and Kernel File Systems
  systemd-sysctl.service                  loaded active exited    Apply Kernel Variables   
  systemd-tmpfiles-setup-dev.service      loaded active exited    Create Static Device Nodes in /dev
  systemd-tmpfiles-setup.service          loaded active exited    Create Volatile Files and Directories
  systemd-udev-trigger.service            loaded active exited    udev Coldplug all Devices
  systemd-udevd.service                   loaded active running   udev Kernel Device Manager
  systemd-update-utmp.service             loaded active exited    Update UTMP about System Boot/Shutdown
  systemd-user-sessions.service           loaded active exited    Permit User Sessions     
  user@0.service                          loaded active running   User Manager for UID 0   
  user@113.service                        loaded active running   User Manager for UID 113 
  vmtouch.service                         loaded active running   vmtouch                  
  -.slice                                 loaded active active    Root Slice               
  system-bthelper.slice                   loaded active active    system-bthelper.slice    
  system-getty.slice                      loaded active active    system-getty.slice       
  system-systemd\x2dfsck.slice            loaded active active    system-systemd\x2dfsck.slice
  system.slice                            loaded active active    System Slice             
  user-0.slice                            loaded active active    User Slice of root       
  user-113.slice                          loaded active active    User Slice of nx         
  user.slice                              loaded active active    User and Session Slice   
  dbus.socket                             loaded active running   D-Bus System Message Bus Socket
  systemd-fsckd.socket                    loaded active listening fsck to fsckd communication Socket
  systemd-initctl.socket                  loaded active listening /dev/initctl Compatibility Named Pipe
  systemd-journald-dev-log.socket         loaded active running   Journal Socket (/dev/log)
  systemd-journald.socket                 loaded active running   Journal Socket           
  systemd-rfkill.socket                   loaded active listening Load/Save RF Kill Switch Status /dev/rfkill Watch
  systemd-udevd-control.socket            loaded active running   udev Control Socket      
  systemd-udevd-kernel.socket             loaded active running   udev Kernel Socket       
  mnt-Crucial_120GB-.swapfile.swap        loaded active active    /mnt/Crucial_120GB/.swapfile
  basic.target                            loaded active active    Basic System             
  bluetooth.target                        loaded active active    Bluetooth                
  cryptsetup.target                       loaded active active    Encrypted Volumes        
  getty.target                            loaded active active    Login Prompts            
  graphical.target                        loaded active active    Graphical Interface      
  local-fs-pre.target                     loaded active active    Local File Systems (Pre) 
  local-fs.target                         loaded active active    Local File Systems       
  multi-user.target                       loaded active active    Multi-User System        
  network-online.target                   loaded active active    Network is Online        
  network-pre.target                      loaded active active    Network (Pre)            
  network.target                          loaded active active    Network                  
  paths.target                            loaded active active    Paths                    
  remote-fs.target                        loaded active active    Remote File Systems      
  slices.target                           loaded active active    Slices                   
  sockets.target                          loaded active active    Sockets                  
  swap.target                             loaded active active    Swap                     
  sysinit.target                          loaded active active    System Initialization    
  time-sync.target                        loaded active active    System Time Synchronized 
  timers.target                           loaded active active    Timers                   
  systemd-tmpfiles-clean.timer            loaded active waiting   Daily Cleanup of Temporary Directories
top | grep mosquitto

Code: Select all

  861 mosquit+  20   0    9188   5024   4492 S   0.3  0.5   0:03.96 mosquitto                                                                                                   
  861 mosquit+  20   0    9188   5024   4492 S   0.3  0.5   0:03.97 mosquitto                                                                                                   
  861 mosquit+  20   0    9188   5024   4492 S   0.3  0.5   0:03.98 mosquitto                                                                                                   
  861 mosquit+  20   0    9188   5024   4492 S   0.3  0.5   0:03.99 mosquitto
Ian
Posts: 29
Joined: Thu Feb 28, 2019 12:45 pm

Re: mosquitto Error: Address already in use

Post by Ian »

I think you could be right, been enquiring on mosquitto GitHub and Roger Light replied:
tcp LISTEN 0 100 127.0.0.1:1883 : users:(("mosquitto",pid=5337,fd=5)) - it looks like Mosquitto is already running.
Post Reply