LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 02-20-2019, 08:36 AM   #1
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,310
Blog Entries: 3

Rep: Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722
usbmount not running hook scripts


usbmount is finding devices and mounting them just fine, but it is not running any hook scripts I have put in /etc/usbmount/mount.d/ The scripts there have execute permissions and can run standalone manually. Here is a log snippet:
Code:
Feb 20 18:25:06 d usbmount[1255]: mountpoint /media/usb0 is available for /dev/sda4
Feb 20 18:25:06 d usbmount[1255]: executing command: mount -text4 -osync,noexec,nodev,noatime,nodiratime,ro /dev/sda4 /media/usb0
Feb 20 18:25:06 d kernel: [  602.601902] EXT4-fs (sda4): mounted filesystem with ordered data mode. Opts: (null)
Feb 20 18:25:06 d usbmount[1255]: executing command: run-parts /etc/usbmount/mount.d
Feb 20 18:25:06 d usbmount[1255]: usbmount execution finished
Despite what is reported in the logs nothing seems to happen. The script is not run.

What should I be looking at to get the script there (or anywhere elese) to execute?

This is on Raspbian GNU/Linux 9.8 (stretch) and I've already done the /etc/systemd/system/systemd-udevd.service.d/override.conf hack to get systemd to stop blocking the mounts. Is there something else to change or remove to get usbmount to run a script?

Edit: daemon logs:

Code:
Feb 20 18:25:05 d systemd-udevd[1232]: Process '/usr/share/usbmount/usbmount add' failed with exit code 1.

Last edited by Turbocapitalist; 02-20-2019 at 11:53 AM.
 
Old 02-20-2019, 01:45 PM   #2
hoes
Member
 
Registered: Sep 2005
Distribution: debian, linux from scratch
Posts: 190

Rep: Reputation: 51
Have you looked at the manual of run-parts?
 
Old 02-20-2019, 01:48 PM   #3
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,310

Original Poster
Blog Entries: 3

Rep: Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722
Yes, and if I manually run run-parts using the line as given in the log then the script(s) run fine there. The scripts themselves seem to be OK. The weird part is that they ran once automatically today just fine.
 
Old 02-20-2019, 02:17 PM   #4
hoes
Member
 
Registered: Sep 2005
Distribution: debian, linux from scratch
Posts: 190

Rep: Reputation: 51
Still sounds very strange.
How do you check that your scripts ran?
You could also inspect the usbmount source code to get a better understanding of the flow.
 
Old 02-20-2019, 03:25 PM   #5
r37
LQ Newbie
 
Registered: Mar 2015
Distribution: in the past Mandrake, Debian, Knoppix, Antix, now Devuan
Posts: 21

Rep: Reputation: Disabled
Are you sure that it is a usbmount-related problem? Cannot it be caused by weird systemd behavior?
Honestly, I do not know whether it is possible to get rid of systemd on Raspbian, but maybe it is worth testing on another system, e.g. on Devuan...

Last edited by r37; 02-20-2019 at 03:35 PM.
 
Old 02-21-2019, 12:39 AM   #6
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,310

Original Poster
Blog Entries: 3

Rep: Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722
I'm also guessing that it is a systemd problem blocking the script somehow. It's not possible to remove systemd, it is neither an init system nor modular, so a distro either goes all-in or avoids it completely. The mounting works fine, it's just that the script won't run (though it did run once) and I've found a systemd work-around.

There seems to be a Devuan GNU/Linux 2.0 (ascii) image for the Raspberry Pi Zero. I will give that a test parallel to this, but I would really like to find a solution or non-systemd work-around for Raspbian.
 
Old 04-24-2020, 07:35 AM   #7
boncye
LQ Newbie
 
Registered: Apr 2020
Posts: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by Turbocapitalist View Post
I'm also guessing that it is a systemd problem blocking the script somehow. It's not possible to remove systemd, it is neither an init system nor modular, so a distro either goes all-in or avoids it completely. The mounting works fine, it's just that the script won't run (though it did run once) and I've found a systemd work-around.

There seems to be a Devuan GNU/Linux 2.0 (ascii) image for the Raspberry Pi Zero. I will give that a test parallel to this, but I would really like to find a solution or non-systemd work-around for Raspbian.
Hi Turbocapitalist, i have exactly the same problem. Can you tell me your workaround?
 
Old 04-24-2020, 07:56 AM   #8
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,310

Original Poster
Blog Entries: 3

Rep: Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722
Perhaps. That was over a year ago and there were several similar projects going concurrently. So I have no clear recollection.

Going through some old notes, the work-around might have been this systemd unit file:

Code:
[Unit]
Description=flashdrive script trigger
Requires=media-usb0.mount
After=media-usb0.mount

[Service]
ExecStart=/usr/local/bin/myownscript.sh

[Install]
WantedBy=media-usb0.mount
If that was not it, then the solution was probably upgrading the distro to Devuan.

Last edited by Turbocapitalist; 04-24-2020 at 07:58 AM.
 
  


Reply

Tags
systemd, usbmount



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Naming scripts for use with run-parts under usbmount Turbocapitalist Linux - Server 5 12-20-2018 08:59 AM
[SOLVED] scripts is not running thriugh cron ...manually running fine ghoshdastidar1980 Linux - Newbie 3 09-27-2012 02:42 AM
announce: usbmount for Slackware 12.2 freejack Slackware 2 01-03-2009 12:34 AM
automounting usb devices with usbmount works well but i have one problem mechmg93 Debian 9 10-23-2005 07:24 AM
Need help running scripts from scripts sdouble Linux - Newbie 3 05-31-2004 12:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 01:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration