Remove packages failure

Hi all,

I had some problems while installing remote.it and although I used the service without a problem for a couple of days now I want to remove all packages and start from the beginning.

Thus I am trying to do the following with the errors as shown :

  1. Remove connectd

#apt purge connectd
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages will be REMOVED:
connectd*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
(Reading database … 162450 files and directories currently installed.)
Removing connectd (2.5.37) …
/usr/bin/connectd_stop_all: 22: .: Can’t open /usr/bin/connectd_options
dpkg: error processing package connectd (–remove):
installed connectd package pre-removal script subprocess returned error exit status 127

================================================================================
Run “sudo connectd_installer” to interactively install remote.it Services on this device.

See https://docs.remote.it for more information.

================================================================================
Errors were encountered while processing:
connectd
E: Sub-process /usr/bin/dpkg returned an error code (1)

  1. Remove remoteit

#apt purge remoteit
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages were automatically installed and are no longer required:
avahi-utils jq libjq1 libonig5
Use ‘sudo apt autoremove’ to remove them.
The following packages will be REMOVED:
remoteit*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
(Reading database … 162450 files and directories currently installed.)
Removing remoteit (1.0.14) …
∘ Login with remote.it account
∘ Remove services
∘ UnRegister device ‘’
∘ Remoteit Agent - Stop
∘ Remoteit Agent - Uninstall
∘ Remove dependencies
✓ DONE: remote.it has been removed from your system
Failed to disable unit: Unit file remoteit-headless.service does not exist.
dpkg: error processing package remoteit (–remove):
installed remoteit package pre-removal script subprocess returned error exit status 1
/var/lib/dpkg/info/remoteit.postinst: 11: /var/lib/dpkg/info/remoteit.postinst: /usr/share/remoteit/connectd: not found
dpkg: error while cleaning up:
installed remoteit package post-installation script subprocess returned error exit status 127
Errors were encountered while processing:
remoteit
E: Sub-process /usr/bin/dpkg returned an error code (1)

It seems to me that some necessary files are missing. Can someone share his/hers experience and thoughts on how to make a clean installation from scratch (other than building my Pi from the beginning)?

Looking forward for your answers!

Regards

Yeah, sorry about that… there’s an issue - exactly as you’ve noted, when trying to uninstall either package if both are installed. Let me spend some time on this and see if I can come up with a way to force the uninstall.

The first thing I noticed is that you are not using “sudo” with the “apt purge” command. Or at least, it looks that way.

1 Like

Hi Gary!

Thanks for your help.

As for the following:

I have already used “sudo su” so all commands are running as “root”.

Engineer’s suggestion would be to reinstall connectd, then reinstall remoteit, purge remoteit, then purge connectd.

I just tried it here in that order and it worked.

Unfortunately I cannot verify the solution!

Here is what I have done :

  1. Re-Install “connectd” (using the “/var/cache/apt/archives” packages)

#dpkg -i connectd_2.5.37_armhf.deb
(Reading database … 162451 files and directories currently installed.)
Preparing to unpack connectd_2.5.37_armhf.deb …
Unpacking connectd (2.5.37) over (2.5.37) …
Setting up connectd (2.5.37) …

================================================================================
Run “sudo connectd_installer” to interactively install remote.it Services on this device.

See https://docs.remote.it for more information.

================================================================================

  1. Re-Install “remoteit” (using the “/var/cache/apt/archives” packages)
    #dpkg -i remoteit_1.0.14_armhf.deb
    (Reading database … 162451 files and directories currently installed.)
    Preparing to unpack remoteit_1.0.14_armhf.deb …
    Unpacking remoteit (1.0.14) over (1.0.14) …
    Setting up remoteit (1.0.14) …
    you already have the latest connectd version
    installing muxer version 0.3
    you already have the latest remoteit version
    you already have the latest desktop version
    Created symlink /etc/systemd/system/multi-user.target.wants/avahi-alias@remoteit.local.service → /etc/systemd/system/avahi-alias@remoteit.local.service.
    ================================================================================

Continue your device registration at http://find.remote.it
or hxxp://xxxxxx:29999 (removed URL due to forum restrictions)
or hxxp://xxxxxx:29999 (removed URL due to forum restrictions)

================================================================================

  1. Tried to remove “remoteit” with error again (have a look below):

#apt-get remove --purge remoteit
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages were automatically installed and are no longer required:
avahi-utils jq libjq1 libonig5
Use ‘sudo apt autoremove’ to remove them.
The following packages will be REMOVED:
remoteit*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
(Reading database … 162450 files and directories currently installed.)
Removing remoteit (1.0.14) …
∘ Login with remote.it account
∘ Remove services
∘ UnRegister device ‘’
∘ Remoteit Agent - Stop
∘ Remoteit Agent - Uninstall
∘ Remove dependencies
✓ DONE: remote.it has been removed from your system
Removed /etc/systemd/system/multi-user.target.wants/avahi-alias@remoteit.local.service.
Failed to disable unit: Unit file remoteit-headless.service does not exist.
dpkg: error processing package remoteit (–remove):
installed remoteit package pre-removal script subprocess returned error exit status 1
installing connectd version 4.8
/var/lib/dpkg/info/remoteit.postinst: 25: /var/lib/dpkg/info/remoteit.postinst: /usr/share/remoteit/muxer: not found
installing muxer version
mv: cannot stat ‘/usr/share/remoteit/muxer’: No such file or directory
mv: cannot stat ‘/usr/share/remoteit/demuxer’: No such file or directory
dpkg: error while cleaning up:
installed remoteit package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
remoteit
E: Sub-process /usr/bin/dpkg returned an error code (1)

Any suggestions now?

OK, I can’t reproduce your failure at the moment, but going on this article -

Please try:

sudo dpkg --purge --force-all connectd

sudo dpkg --purge --force-all remoteit

Unfortunately not…Both of them still fail:

#dpkg --purge --force-all connectd
(Reading database … 162450 files and directories currently installed.)
Removing connectd (2.5.37) …
/usr/bin/connectd_stop_all: 22: .: Can’t open /usr/bin/connectd_options
dpkg: error processing package connectd (–purge):
installed connectd package pre-removal script subprocess returned error exit status 127

================================================================================
Run “sudo connectd_installer” to interactively install remote.it Services on this device.

================================================================================
Errors were encountered while processing:
connectd

#dpkg --purge --force-all remoteit
(Reading database … 162450 files and directories currently installed.)
Removing remoteit (1.0.14) …
∘ Login with remote.it account
∘ Remove services
∘ UnRegister device ‘’
∘ Remoteit Agent - Stop
∘ Remoteit Agent - Uninstall
∘ Remove dependencies
✓ DONE: remote.it has been removed from your system
Failed to disable unit: Unit file remoteit-headless.service does not exist.
dpkg: error processing package remoteit (–purge):
installed remoteit package pre-removal script subprocess returned error exit status 1
/var/lib/dpkg/info/remoteit.postinst: 11: /var/lib/dpkg/info/remoteit.postinst: /usr/share/remoteit/connectd: not found
dpkg: error while cleaning up:
installed remoteit package post-installation script subprocess returned error exit status 127
Errors were encountered while processing:
remoteit

Well, let’s try one things at a time. I don’t know how this happened and can’t reproduce the exact scenario here.

Check to see if that file exists, e.g.

ls -l /usr/bin/connectd_options

If it does, remove it forcefully:

sudo rm /usr/bin/connectd_options

and then replace it:

sudo su
cd /usr/bin
wget https://raw.githubusercontent.com/remoteit/installer/master/connectd/usr/bin/connectd_options

That should restore the connectd_options file, which hopefully will allow the purge of the connectd package to proceed.

Then, if purging remoteit continues to complain about:

(as root still)
cd /usr/share/remoteit
wget https://github.com/remoteit/connectd/releases/download/v4.8/connectd.arm-linaro-pi
mv connectd.arm-linaro-pi connectd

Regarding this:

I am looking at suggestions in this article: dpkg - How to remove/install a package that is not fully installed? - Ask Ubuntu

It might be easiest to delete the prerm file.

e.g.
sudo rm /var/lib/dpkg/info/remoteit.prerm

Sorry about all the trouble. Let me know what happens!

Hi Gary!

Indeed everything was a big mess and i don’t really know what has happened.

As you suggested I had to download from github the “connectd_options” and additionally the “oem_settings” since this was failing afterwards!

Then I could remove the “connectd” package.

Following the same methodology I did the same for “remoteit”
First of all I have downloaded the ones that couldn’t be found from github as suggested.
As for the error in “remoteit.prerm” regarding “remoteit-headless.service” what I did was to go in “remoteit.prerm” file and “hashed” the line referring to disablement of “remoteit-headless”.

Then tried the remove (purge) and was able to successfully remove it!

I think everything is now in order but what triggered my curiosity is the following quote from github:

**The easiest way to install remote.it on a Linux system is to run the following on the command line:**

curl -LkO https://raw.githubusercontent.com/remoteit/installer/master/scripts/auto-install.sh
chmod +x ./auto-install.sh
sudo ./auto-install.sh

So what is the recommended way to go? Should we install it using the aforementioned github script or should we follow the procedure described in “remote.it” which is:

sudo apt install remoteit

I had followed the later and ended up in all these kind of troubles…

So what do you think? Which one is less error prone?

Once again thank you very much for your help!!!

Best regards,

G.

There’s a bit of a terminology issue that is potentially confusing.

remote.it with a dot in the middle refers both to our company and product offering.
connectd is a package which delivers remote.it functionality.
remoteit (no dot) is a more recent package which also delivers remote.it functionality.

auto-install.sh installs the older connectd package. It’s the same thing you’d get on recent Raspbian or Raspberry Pi OS releases if you run “apt install connectd”. auto-install.sh (connectd) also supports a wider variety of Linux platforms than remoteit, such as OpenWRT, which are not Debian based. At the moment, remoteit works for Windows, Mac, and Debian based OSes running Arm or Intel/AMD CPUs. connectd does not support Windows or Mac.

The end result is slightly different.

remoteit includes the Web Admin Panel which lets you add or remove services using a browser, whereas using connectd would require you to get to a console (e.g. SSH) and run the connectd_installer package to do the same thing.

connectd supports Bulk and Auto Registration for Mass Production. Auto registration for remoteit is in the works but not ready yet.

connectd has been released and updated for the past 5 years with very few changes in its basic operation (all shell scripts).

remoteit is more recent and works a completely different way. There are some issues, such as the ones you encountered here, that I do not understand how they could have happened.

All that said, I would start again by using the remoteit package by itself, not installed over connectd. If for whatever reason you continue to face any issue, purge remoteit and install connectd. If that’s in fact what you did (installed remoteit and then all these problems happened), then just install connectd.

OK! I see what’s happening here!

I am positive that I have tried using:

sudo apt install remoteit

but not sure though. I vaguely remember that there was a “connectd” requirement and somehow I ended in this mess…(maybe both were installed in the end…)

Anyway, I am willing to try again before going down the “connectd” way but my main concern is that auto registration is not yet available for “remoteit”. Do you have any estimate for that before being into trouble again?

Thanks!

remoteit uses the connectd daemon but it should NOT have a dependency on the connectd package. We do however provide an automatic conversion if you install remote.it over a suitably recent connectd package which has already been configured using the interactive script connectd_installer.

I am not good at predicting when things will be ready. My suggestion, if you really want to get going with auto-registration, would be to use the connectd package.

Thanks!

I’ve also ran into this apt package dependency removal problem, I’ve managed to remove connectd using:

root@k3s-master-1:/usr/share/remoteit# sudo dpkg --purge --force-all connectd
dpkg: warning: ignoring request to remove connectd which isn't installed

When I then try to purge remoteit I ran into:

root@k3s-master-1:/usr/share/remoteit# sudo dpkg --purge --force-all remoteit
(Reading database ... 41518 files and directories currently installed.)
Removing remoteit (1.2.2) ...
Failed to disable unit: Unit file remoteit-headless.service does not exist.
dpkg: error processing package remoteit (--purge):
installed remoteit package pre-removal script subprocess returned error exit status 1
you already have the latest connectd version
/var/lib/dpkg/info/remoteit.postinst: 25: /var/lib/dpkg/info/remoteit.postinst: /usr/share/remoteit/muxer: not found
you already have the latest muxer version
dpkg: error while cleaning up:
installed remoteit package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
remoteit

Any tips on how to proceed?

BR,

/Janne

I tried a little bit further but still errors:

pi@k3s-master-1:/usr/share/remoteit $ which muxer
/usr/bin/muxer
pi@k3s-master-1:/usr/share/remoteit $ which remoteit
/usr/bin/remoteit
pi@k3s-master-1:/usr/share/remoteit $ cd /usr/share/remoteit/
pi@k3s-master-1:/usr/share/remoteit $ sudo ln -s /usr/bin/muxer 
pi@k3s-master-1:/usr/share/remoteit $ sudo ln -s /usr/bin/remoteit 
pi@k3s-master-1:/usr/share/remoteit $ ll
total 11628
drwxr-xr-x 2 root root     4096 Nov 22 20:23 backup
-rwxr-xr-x 1 root root   145620 Apr 22  2020 connectd
lrwxrwxrwx 1 root root       14 Nov 22 21:19 muxer -> /usr/bin/muxer
lrwxrwxrwx 1 root root       17 Nov 22 21:19 remoteit -> /usr/bin/remoteit
-rw-rw-r-- 1 root root 11753157 Oct 23 22:54 remoteit-headless.tgz
pi@k3s-master-1:/usr/share/remoteit $ sudo dpkg --purge --force-all remoteit
(Reading database ... 41518 files and directories currently installed.)
Removing remoteit (1.2.2) ...
Failed to disable unit: Unit file remoteit-headless.service does not exist.
dpkg: error processing package remoteit (--purge):
 installed remoteit package pre-removal script subprocess returned error exit status 1
you already have the latest connectd version
you already have the latest muxer version
dpkg: error while cleaning up:
 installed remoteit package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 remoteit

Failed to disable unit: Unit file remoteit-headless.service does not exist.

Doing the same fix as giorgis fixed the issue:

pi@k3s-master-1:/usr/share/remoteit $ sudo nano /var/lib/dpkg/info/remoteit.prerm

# Add # in front of
#systemctl disable --now remoteit-headless
#rm -r /opt/remoteit-headless

# Then try to remove again
pi@k3s-master-1:/usr/share/remoteit $ sudo dpkg --purge --force-all remoteit
(Reading database ... 41518 files and directories currently installed.)
Removing remoteit (1.2.2) ...
Purging configuration files for remoteit (1.2.2) ...
sh: 0: getcwd() failed: No such file or directory

The getcwd() error was also present when installing remoteit but installation then succeeded:

pi@k3s-master-1:/usr/share/remoteit $ sudo apt update 
Hit:1 https://download.docker.com/linux/raspbian buster InRelease
Hit:2 http://raspbian.raspberrypi.org/raspbian buster InRelease
Hit:3 http://archive.raspberrypi.org/debian buster InRelease
Reading package lists... Done                 
Building dependency tree       
Reading state information... Done
135 packages can be upgraded. Run 'apt list --upgradable' to see them.
pi@k3s-master-1:/usr/share/remoteit $ sudo apt install remoteit
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  remoteit
0 upgraded, 1 newly installed, 0 to remove and 135 not upgraded.
Need to get 14.5 MB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://archive.raspberrypi.org/debian buster/main armhf remoteit armhf 1.2.2 [14.5 MB]
Fetched 14.5 MB in 16s (879 kB/s)                                                                                                                                                                          
sh: 0: getcwd() failed: No such file or directory
sh: 0: getcwd() failed: No such file or directory
sh: 0: getcwd() failed: No such file or directory
sh: 0: getcwd() failed: No such file or directory
Selecting previously unselected package remoteit.
(Reading database ... 41511 files and directories currently installed.)
Preparing to unpack .../remoteit_1.2.2_armhf.deb ...
Unpacking remoteit (1.2.2) ...
Setting up remoteit (1.2.2) ...
upgrading connectd to 4.9.1601422098
you already have the latest muxer version
installing remoteit version 1.6.14
 ✓ Installed and started system service successfully
installing desktop version 2.8.2
Created symlink /etc/systemd/system/multi-user.target.wants/remoteit-headless.service → /opt/remoteit-headless/scripts/remoteit-headless.service.
Created symlink /etc/systemd/system/multi-user.target.wants/avahi-alias@remoteit.local.service → /etc/systemd/system/avahi-alias@remoteit.local.service.

So issue was resolved! :slight_smile:

1 Like

Glad you managed to solve it…It was tricky to find it out and especially that the:
/var/lib/dpkg/info/remoteit.prerm has to be edited.

Sorry about the package troubles here.

You can also delete these files:

/var/lib/dpkg/info/remoteit.prerm
/var/lib/dpkg/info/remoteit.postinst

at which point they won’t be processed at all, but the purge function will complete and you won’t get any error.

The problem happens if you upgrade remoteit over connectd. The remoteit package uses the same connectd file as the connectd package. If you are going to remove them both, you should remove remoteit first.