6

I am trying to remove an apparently-corrupt package gammu-smsd.service.

When I run sudo apt remove gammu-smsd.service, I get the following result:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package gammu-smsd.service

I got to the point of wanting to remove this package because, while I was doing some cleanup, I was confronted with issues while attempting to install and delete packages that I had selected. Here's the result of upgrading (updating is flawless).

Here's the the result of running sudo apt upgrade.

Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
0 upgraded, 0 newly installed, 0 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] Abort.

I was alerted by the 6th line (in above output) that there was a problem. Once I learned that the culprit was gammu-smsd.service, I ran systemctl status gammu-smsd.service obtaining this result:

● gammu-smsd.service - SMS daemon for Gammu
     Loaded: bad-setting (Reason: Unit gammu-smsd.service has a bad unit file setting.)
     Active: inactive (dead)
       Docs: man:gammu-smsd(1)

Jul 18 20:15:18 LolouilaLawelima systemd[1]: /lib/systemd/system/gammu-smsd.service:9: Neither a valid executable name nor an absolute path: ${CMAKE_INSTALL_FULL_BINDIR}/gammu-smsd

Jul 18 20:15:18 LolouilaLawelima systemd[1]: gammu-smsd.service: Unit configuration has fatal error, unit will not be started.

Jul 18 20:56:24 LolouilaLawelima systemd[1]: /lib/systemd/system/gammu-smsd.service:9: Neither a valid executable name nor an absolute path: ${CMAKE_INSTALL_FULL_BINDIR}/gammu-smsd

Jul 18 20:56:24 LolouilaLawelima systemd[1]: gammu-smsd.service: Unit configuration has fatal error, unit will not be started.

Jul 18 20:56:25 LolouilaLawelima systemd[1]: /lib/systemd/system/gammu-smsd.service:9: Neither a valid executable name nor an absolute path: ${CMAKE_INSTALL_FULL_BINDIR}/gammu-smsd

Jul 18 20:56:25 LolouilaLawelima systemd[1]: gammu-smsd.service: Unit configuration has fatal error, unit will not be started.

Jul 18 21:18:31 LolouilaLawelima systemd[1]: /lib/systemd/system/gammu-smsd.service:9: Neither a valid executable name nor an absolute path: ${CMAKE_INSTALL_FULL_BINDIR}/gammu-smsd

Jul 18 21:18:31 LolouilaLawelima systemd[1]: gammu-smsd.service: Unit configuration has fatal error, unit will not be started.

Jul 18 21:18:33 LolouilaLawelima systemd[1]: /lib/systemd/system/gammu-smsd.service:9: Neither a valid executable name nor an absolute path: ${CMAKE_INSTALL_FULL_BINDIR}/gammu-smsd

Jul 18 21:18:33 LolouilaLawelima systemd[1]: gammu-smsd.service: Unit configuration has fatal error, unit will not be started.

How can I remove and/or purge a package that apt cannot find?

Following the suggestion from comments and running sudo apt remove gammu-smsd, I got:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libgammu-i18n libgammu8 libgsmsd8
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  gammu-smsd
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 179 kB disk space will be freed.
Do you want to continue? [Y/n] 
(Reading database ... 737130 files and directories currently installed.)
Removing gammu-smsd (1.41.0-1) ...
Failed to stop gammu-smsd.service: Unit gammu-smsd.service not loaded.
invoke-rc.d: initscript gammu-smsd, action "stop" failed.
dpkg: error processing package gammu-smsd (--remove):
 installed gammu-smsd package pre-removal script subprocess returned error exit status 1
dpkg: too many errors, stopping
Failed to start gammu-smsd.service: Unit gammu-smsd.service has a bad unit file setting.
See system logs and 'systemctl status gammu-smsd.service' fo
r details.
invoke-rc.d: initscript gammu-smsd, action "start" failed.
● gammu-smsd.service - SMS daemon for Gammu
     Loaded: bad-setting (Reason: Unit gammu-smsd.service ha
s a bad unit file setting.)
     Active: inactive (dead)
       Docs: man:gammu-smsd(1)

Jul 18 23:16:57 LolouilaLawelima systemd[1]: /lib/systemd/sy
stem/gammu-smsd.service:9: Neither a valid executable name n
or an absolute path: ${CMAKE_INSTALL_FULL_BINDIR}/gammu-smsd
Jul 18 23:16:57 LolouilaLawelima systemd[1]: gammu-smsd.serv
ice: Unit configuration has fatal error, unit will not be st
arted.
Jul 18 23:16:59 LolouilaLawelima systemd[1]: /lib/systemd/sy
stem/gammu-smsd.service:9: Neither a valid executable name n
or an absolute path: ${CMAKE_INSTALL_FULL_BINDIR}/gammu-smsd
Jul 18 23:16:59 LolouilaLawelima systemd[1]: gammu-smsd.serv
ice: Unit configuration has fatal error, unit will not be st
arted.
Jul 18 23:22:08 LolouilaLawelima systemd[1]: /lib/systemd/sy
stem/gammu-smsd.service:9: Neither a valid executable name n
or an absolute path: ${CMAKE_INSTALL_FULL_BINDIR}/gammu-smsd
Jul 18 23:22:08 LolouilaLawelima systemd[1]: gammu-smsd.serv
ice: Unit configuration has fatal error, unit will not be st
arted.
Jul 18 23:22:11 LolouilaLawelima systemd[1]: /lib/systemd/sy
stem/gammu-smsd.service:9: Neither a valid executable name n
or an absolute path: ${CMAKE_INSTALL_FULL_BINDIR}/gammu-smsd
Jul 18 23:22:11 LolouilaLawelima systemd[1]: gammu-smsd.serv
ice: Unit configuration has fatal error, unit will not be st
arted.
Jul 18 23:22:12 LolouilaLawelima systemd[1]: /lib/systemd/sy
stem/gammu-smsd.service:9: Neither a valid executable name n
or an absolute path: ${CMAKE_INSTALL_FULL_BINDIR}/gammu-smsd
Jul 18 23:22:12 LolouilaLawelima systemd[1]: gammu-smsd.serv
ice: Unit configuration has fatal error, unit will not be st
arted.
dpkg: error while cleaning up:
 installed gammu-smsd package post-installation script subpr
ocess returned error exit status 1
Errors were encountered while processing:
 gammu-smsd
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

5
  • 1
    Services and packages are not the same thing. Your formatting makes it hard to read, but you appear to be equating services with packages of the identical name (which they usually are not). Use code "{}" for copy/pastes from terminal output.
    – guiverc
    Jul 19, 2020 at 3:34
  • @guiverc, I will fix that. Thank you for the hint... I was ready to bed and wanted to post this beforehand. Regarding the service vs package distinction, I simply used the notation that apt reported to me. I didn´t post it, but I had attempted the same commands without the service moniker.
    – TheGeeko61
    Jul 19, 2020 at 3:39
  • 4
    gammu-smsd.service isn't a package, it's a service file. You'll have to identify what package installed that. The package for that is found with a simple google search and is gammu-smsd. sudo apt remove gammu-smsd
    – Thomas Ward
    Jul 19, 2020 at 4:05
  • 1
    unix.stackexchange.com/a/585041/70847
    – mchid
    Jul 19, 2020 at 4:31
  • 1
    Probably change ${CMAKE_INSTALL_FULL_BINDIR} to /usr/bin on line 9 of the file /lib/systemd/system/gammu-smsd.service - depending on what the output of which gammu-smsd is.
    – mchid
    Jul 19, 2020 at 4:35

1 Answer 1

7

It seems there was a bug opened for this problem and it is fixed in the next release but for some reason, it hasn't been released for 20.04 yet so run the following command to fix the problem:

sudo sed -i 's|${CMAKE_INSTALL_FULL_BINDIR}|/usr/bin|g' /lib/systemd/system/gammu-smsd.service

Finally, reload systemd and restart the service:

sudo systemctl daemon-reload
sudo systemctl restart gammu-smsd

Explanation:

It seems the problem is indicated in your error. The error states that the path indicated on line 9 of the file /lib/systemd/system/gammu-smsd.service is undefined.

So to find the path of gammu-smsd, you can use the command which gammu-smsd.

Then, you just need to edit the file /lib/systemd/system/gammu-smsd.service and replace the variable ${CMAKE_INSTALL_FULL_BINDIR} with the absolute path /usr/bin which is what the sed command does above.

1
  • 1
    Perfect! Thank you.
    – TheGeeko61
    Jul 19, 2020 at 13:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .