You are not logged in.

#1 2015-09-19 19:19:33

LeftyAce
Member
Registered: 2012-08-18
Posts: 162

USB devices automounting despite noauto in /etc/fstab

Hi all,

I have my /boot partition on a USB key, and I set it up so that it does not automount. This means I can unplug it as soon as the computer finishes booting. I accomplished this with a line in /etc/fstab:

UUID=19968ab9-e0cd-4627-9f9e-69f3fd686d3f               /boot                           ext2    defaults,noauto

Recently the USB key has started automounting. Any idea why the noauto is getting ignored?

Initial googling indicates that maybe I shouldn't be using fstab anymore? I should be using udisks or udisks2? Why is that? I have udisks2 installed, but the only rules file I can find is /usr/lib/udev/rules.2/80-udisks.rules, which says not to edit it as it will be overwritten on updates.

So, what should I do?

Offline

#2 2015-09-19 20:11:34

mich41
Member
Registered: 2012-06-22
Posts: 796

Re: USB devices automounting despite noauto in /etc/fstab

You should use /etc/udev/rules.d/ for custom rules. If both directories contain a .rules file with the same name, the file in /usr/lib/ is ignored. See man udev for details.

Offline

#3 2015-09-20 11:10:04

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: USB devices automounting despite noauto in /etc/fstab

First you need to find out what is mounting the partition. It might be that your DE is trying to be smart and automounting it for you.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#4 2015-09-21 13:28:15

LeftyAce
Member
Registered: 2012-08-18
Posts: 162

Re: USB devices automounting despite noauto in /etc/fstab

I don't have a DE (running stumpwm). How can I find out what's automounting it?

Offline

#5 2015-09-22 01:43:09

LeftyAce
Member
Registered: 2012-08-18
Posts: 162

Re: USB devices automounting despite noauto in /etc/fstab

Ok, some more questions:

mich41, you said I should use /etc/udev/rules.d for custom rules. Should I need a custom rule to prevent a drive from automounting?
Is /etc/udev/rules.d the new place to put things like "always mount this UUID to /boot"? (Replacing use of /etc/fstab).

Is /ect/fstab being phased out?

I appear to have a /etc/udev, /etc/udisks, and /etc/udisks2 directories. Based on the wiki, udisks has been superceded by udisks2; is there any reason _not_ to just uninstall udisks and delete that directory?
And what is the relationship between udisks and udev?

Sorry for the dumb questions!

Offline

#6 2015-09-22 07:15:27

mich41
Member
Registered: 2012-06-22
Posts: 796

Re: USB devices automounting despite noauto in /etc/fstab

LeftyAce wrote:

mich41, you said I should use /etc/udev/rules.d for custom rules. Should I need a custom rule to prevent a drive from automounting?

I don't know, I don't use systemd and it's been a few years since I last cared what's the flavor of the month in automounting daemons.

I assumed that you already know what rules you want to add and just aren't sure where to put them.

I don't know what mounts your disk. Is it mounted on /boot as instructed by fstab or somewhere else? Maybe there is some systemd-specific fstab replacement with (apparently buggy) fstab compatibility? No idea. This website or Arch wiki may help smile

Last edited by mich41 (2015-09-22 07:20:46)

Offline

#7 2015-09-22 09:20:09

berbae
Member
From: France
Registered: 2007-02-12
Posts: 1,304

Re: USB devices automounting despite noauto in /etc/fstab

I think /boot is mounted at boot time and it is not unmounted after that until shutdown.

So using /etc/fstab with noauto option is useless in this case, /boot is already mounted when /etc/fstab is read.

To do what you want, you need to unmount it manually and plug the USB key out.

AFAIK /etc/fstab is not deprecated, but in your case it is not the way to go.

Last edited by berbae (2015-09-22 14:40:25)

Offline

#8 2015-09-22 13:12:27

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: USB devices automounting despite noauto in /etc/fstab

berbae wrote:

So using /etc/fstab with noauto option is useless in this case, /boot is already mounted when /etc/fstab is read.

My experience contradicts this. I added noauto to my fstab /boot line and it was not automounted next boot.


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#9 2015-09-22 13:36:41

LeftyAce
Member
Registered: 2012-08-18
Posts: 162

Re: USB devices automounting despite noauto in /etc/fstab

Thanks for the clarification, mich. I uninstalled udisks, udisks2 and udiskie, and everything is back to normal. Once I have some time, I'll go back through figuring out how to get generic USB devices to mount/automount properly (given that they have unpredictable /dev/sdX assignments).

berbae and alphaniner: "normal" is what alphaniner describes. With noauto specified, once bootup is complete the /boot disk is not mounted, which is what I want, and is how my system was behaving up until a system update last weekend. So yes, it seems like one of the automounting setups was not respecting fstab properly.

Offline

#10 2015-09-22 14:49:41

berbae
Member
From: France
Registered: 2007-02-12
Posts: 1,304

Re: USB devices automounting despite noauto in /etc/fstab

I removed the first part of my post #7, I answered too quickly.

Looking more closely at my systemd journal, I see that /boot is mounted by systemd using /etc/fstab when it mounts all the partitions which have entries in fstab.

But I could not find explanations on how /boot is used before that, during the boot sequence; how it is mounted/unmounted to find the kernel and initial ram system.
If someone could provide a link, it would be nice, thanks.

Offline

#11 2015-09-22 15:38:11

mich41
Member
Registered: 2012-06-22
Posts: 796

Re: USB devices automounting despite noauto in /etc/fstab

Files in /boot are loaded by the bootloader (e.g. grub), which obviously uses its own filesystem drivers because Linux isn't even loaded to RAM yet.

If you don't care about being able to update the kernel, you can omit /boot from fstab and never mount it - everything else will work.

Offline

#12 2015-09-22 16:09:09

LeftyAce
Member
Registered: 2012-08-18
Posts: 162

Re: USB devices automounting despite noauto in /etc/fstab

In general I don't mount /boot, but I learned the hard way that if I accidentally leave it unmounted while doing a pacman -Syu that updates the kernel, all kinds of bad things happen.

Offline

Board footer

Powered by FluxBB