The officially official Devuan Forum!

You are not logged in.

#1 Today 14:28:30

Ron
Member
Registered: 2018-04-22
Posts: 564  

[SOLVED] Want external drive to automatically mount when plugged in

So when I was running Devuan 5 all of my devices (usb stick + external hard drive) would mount automatically when I plugged them in. Now with version 6 my external hard drive does not (usb stick still does though). It does show up in Mate's side pane, and when I click on it there, it gets mounted. So this is not too big of a deal, but I would still like it to mount when plugged in. I did a search and found this on the itsfoss website >Link Here< "Method 2: Automount Using Udev Rules and autofs" but it seems that there should be an easier simpler way to do this. Is there? Or should I just try the info from itsfoss?

Last edited by Ron (Today 16:04:00)

Online

#2 Today 14:57:45

rolfie
Member
Registered: 2017-11-25
Posts: 1,373  

Re: [SOLVED] Want external drive to automatically mount when plugged in

Hi there, I guess the drive that isn't automounted is ext(x)-formatted, isn't it? Well, there is a new quirk in the udev rules from corporate actors inhibiting automount for ext(x)-partitions and others coming in with Trixie. Found that on the German Debian forum.

Check out for a file /usr/lib/udev/rules.d/64-ext4.rules, it reads:

# SPDX-License-Identifier: GPL-2.0-or-later
#
# Copyright (C) 2023 Oracle.  All rights reserved.
# Author: Darrick J. Wong <djwong@kernel.org>
#
# Don't let udisks automount ext4 filesystems without even asking a user.
# This doesn't eliminate filesystems as an attack surface; it only prevents
# evil maid attacks when all sessions are locked.
#
# According to http://storaged.org/doc/udisks2-api/latest/udisks.8.html,
# supplying UDISKS_AUTO=0 here changes the HintAuto property of the block
# device abstraction to mean "do not automatically start" (e.g. mount).
SUBSYSTEM=="block", ENV{ID_FS_TYPE}=="ext2|ext3|ext4|ext4dev|jbd", ENV{UDISKS_AUTO}="0"

To override this rule you either change the "0" into a "1" with the risk that your change is overwritten from another update, or better write your own rule and save it to /etc/udev/rules.d/65-ext4.rules:

# extX-Dateisysteme automatisch mounten
SUBSYSTEM=="block", ENV{ID_FS_TYPE}=="ext2|ext3|ext4|ext4dev|jbd", ENV{UDISKS_AUTO}="1" 

HTH

Last edited by rolfie (Today 14:58:20)

Offline

#3 Today 15:10:23

Ron
Member
Registered: 2018-04-22
Posts: 564  

Re: [SOLVED] Want external drive to automatically mount when plugged in

I don't have a /etc/udev/rules.d/65-ext4.rules file. Do I just create it?

I'm assuming a reboot will be necessary?

Online

#4 Today 15:21:05

Ron
Member
Registered: 2018-04-22
Posts: 564  

Re: [SOLVED] Want external drive to automatically mount when plugged in

So I went ahead and just did it, and it works. Thanks rolfie. Now I have something new to add to my list of things to do after a reinstall. I really hate these things that "corporate actors" (to use your phrase) do trying to protect the user from himself. It sucks for those of us who have a clue of what we're doing.

Online

#5 Today 15:35:44

rolfie
Member
Registered: 2017-11-25
Posts: 1,373  

Re: [SOLVED] Want external drive to automatically mount when plugged in

Yes it sucks. In the meantime I have a long document describing all these tweaks.

BTW: yes you have to create that edit unter /etc yourself. To make it work, either reboot or try a:

# udevadm control –reload
# udevadm trigger

Last edited by rolfie (Today 15:41:43)

Offline

#6 Today 15:42:29

Ron
Member
Registered: 2018-04-22
Posts: 564  

Re: [SOLVED] Want external drive to automatically mount when plugged in

rolfie wrote:

I have a long document describing all these tweaks.

I might be interested in that.

Online

#7 Today 16:03:41

Ron
Member
Registered: 2018-04-22
Posts: 564  

Re: [SOLVED] Want external drive to automatically mount when plugged in

I don't know what's going on, but now when I browse to /etc/udev/rules.d it shows the folder as completely empty. However, the fix still works. Any clue what's going on? (In the meantime I unmarked it as "SOLVED" even though it still is working.)

EDIT
I see what I did. I put the fix in /usr/lib/udev/rules.d and not /etc/udev/rules.d. But it's working. Should I leave well enough alone? Or will an update erase the file in /usr/lib/udev/rules.d?

Last edited by Ron (Today 16:08:23)

Online

#8 Today 16:10:36

rolfie
Member
Registered: 2017-11-25
Posts: 1,373  

Re: [SOLVED] Want external drive to automatically mount when plugged in

Ron wrote:

I might be interested in that.

Well, its a LO document in German, and it contains one or the other more or less private comment I don't want to share. I am happy on helping here in the forum on topics I understand and have experience with.

Offline

#9 Today 16:13:22

Ron
Member
Registered: 2018-04-22
Posts: 564  

Re: [SOLVED] Want external drive to automatically mount when plugged in

rolfie wrote:

Well, its a LO document in German, and it contains one or the other more or less private comment I don't want to share.

I understand. smile By the way, did you see what I did in my post directly above your post? I put the fix in the wrong place. Should I correct that or just leave it alone?

Online

#10 Today 16:13:50

rolfie
Member
Registered: 2017-11-25
Posts: 1,373  

Re: [SOLVED] Want external drive to automatically mount when plugged in

Well, what I got from the debianforum.de, the rules in /etc/udev/rules.d have higher priority. Don't know if that is true.

My preference would be to leave the system directory /usr/lib/udev/rules.d alone and save my tweaks in /etc/udev/rules.d, clear distinction. That also was the suggestion from a very experienced person that looked at the problem and suggested the fix.

Last edited by rolfie (Today 16:22:36)

Offline

#11 Today 17:00:19

Ron
Member
Registered: 2018-04-22
Posts: 564  

Re: [SOLVED] Want external drive to automatically mount when plugged in

Okay, so I deleted it in /usr/lib/udev/rules.d where I accidentally put it, and then put it in /etc/udev/rules.d where it should be. Rebooted and works (again). Remarked as "SOLVED." Thanks again rolfie.

[Maybe I don't have as much of a clue as I thought I did to put it in the wrong place. smile ]

Online

Board footer