rbrito / usbmount

Simple set of scripts to automount removable devices for a Linux system
274 stars 88 forks source link

Failed to add dependency on .device, ignoring: Invalid argument #12

Closed robp2175 closed 6 years ago

robp2175 commented 6 years ago

From journalctl -xe


[/lib/systemd/system/usbmount.service:2] Failed to add dependency on .device, ignoring: Invalid argument
May 24 07:53:43 JukeBox systemd[1]: [/lib/systemd/system/usbmount.service:3] Failed to add dependency on .device, ignoring: Invalid argument
May 24 07:53:43 JukeBox systemd[1]: Starting usbmount.service...
-- Subject: Unit usbmount.service has begun start-up
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Unit usbmount.service has begun starting up.
May 24 07:53:43 JukeBox systemd[1]: usbmount.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
May 24 07:53:43 JukeBox systemd[1]: Failed to start usbmount.service.
-- Subject: Unit usbmount.service has faile

Debain stretch

Also, I built the package without issues, but when I install it none of the config files were installed. I had to copy all of them myself. This is the first time I have used this method so maybe I am doing something wrong?
mathieulj commented 6 years ago

As the message says ".device" without any prepended device name, I assume you renamed the service template and tried to systemctl start usbmount.service? The service file is a template that is triggered by a udev rule for the device insertion (aka /bin/systemd-escape -p --template=usbmount@.service $env{DEVNAME}). You obviously have a corrupt installation if you had missing files. How did you build and install? On what distrubution/version are you running?

robp2175 commented 6 years ago

You are correct, I did misunderstanding how this worked. That makes sense now.

I am using Debian Stretch

This is how I build it apt-get update && sudo apt-get install -y debhelper git clone https://github.com/rbrito/usbmount.git cd usbmount dpkg-buildpackage -us -uc -b dpkg -i ../usbmount_0.0.24_all.deb

Everything seems to install without a problem except some of the files are not installed where they should be. Specifically the conf files.

`` /opt/usbmount# ls -la /etc/usbmount/ total 16 drwxr-xr-x 4 root root 4096 May 24 09:41 . drwxr-xr-x 117 root root 4096 May 24 09:41 .. drwxr-xr-x 2 root root 4096 May 24 09:41 mount.d drwxr-xr-x 2 root root 4096 May 24 09:41 umount.d

/opt/usbmount# ls -la /etc/usbmount/mount.d/ total 8 drwxr-xr-x 2 root root 4096 May 24 09:41 . drwxr-xr-x 4 root root 4096 May 24 09:41 ..

/opt/usbmount# ls -la /etc/usbmount/umount.d/ total 8 drwxr-xr-x 2 root root 4096 May 24 09:41 . drwxr-xr-x 4 root root 4096 May 24 09:41 ..

Of course I went ahead and copied them over, but usbmount does not seem to work.

mathieulj commented 6 years ago

It seems this is a dependency issue. dpkg does not install dependencies of a given local deb file so your installation is likely incomplete due to missing dependencies. There are a few ways to deal with this when installing files directly, ex:

Option 1: let apt-get fix missing dependencies.

# Try install, will not necessarily complete if you're missing a dependency
dpkg -i <package>.deb
# Will install missing dependencies and finish the install process
apt-get install -f

Option 2: use a package installer that fetches dependencies even for local packages (ex. gdebi).

# Only required the first time you do this with any package
apt-get install gdebi
# Actually install the package
gdebi <package>.deb