Artix Linux Forum

Artix Linux => Installation / Migration / Configuration => Topic started by: Lumenor on 02 March 2022, 13:54:17

Title: [SOLVED] Autmount with /etc/fstab not working
Post by: Lumenor on 02 March 2022, 13:54:17
Hello. I have installed Artix on my computer, and everything works great--except on boot my external drives are not being mounted. I have defined them in /etc/fstab, I am using UUIDs--perhaps the options I am using are wrong? They're ntfs drives with the following lines in /etc/fstab:

Code: [Select]
UUID="3F8573B3660DF881"             /home/al/mount/TRANSCEND1       ntfs    auto,uid=1000,gid=998,rw,relatime,nofail,user,exec,umask=000 0
  2

UUID="42C508CF71F9C321"         /home/al/mount/Toshiba          ntfs    auto,uid=1000,gid=998,rw,relatime,nofail,user,exec,umask=000 0      2

I did manage to get them working at one point, but when I reformatted a drive due to what I think was a filesystem error it stopped working.

Update: Nevermind. Just decided to create a runit service that runs "mount -a" on startup. Works as well as expected.
Title: Autmount with /etc/fstab not working
Post by: Lumenor on 02 March 2022, 16:38:05
Hello. I have installed Artix on my computer, and everything works great--except on boot my external drives are not being mounted. I have defined them in /etc/fstab, I am using UUIDs--perhaps the options I am using are wrong? They're mostly ntfs drives with the following lines in /etc/fstab:

Code: [Select]
UUID="50EC96FA63CCEF02"             /home/al/mount/TRANSCEND1       ntfs    auto,uid=1000,gid=998,rw,relatime,nofail,user,exec,umask=000 0
  2

UUID="42C508CF71F9C321"         /home/al/mount/Toshiba          ntfs    auto,uid=1000,gid=998,rw,relatime,nofail,user,exec,umask=000 0      2

I did manage to get them working at one point, but when I reformatted a drive due to what I think was a filesystem error it stopped working.

I did manage to automount them via a runit service that runs "mount -a" on (I think) boot, but I want to learn/know how to do this without that.

Note: I have a third device which is a USB, but I decided not to list that one since it isn't as necessary and it doesn't change much either way (I suppose).
Title: Re: Autmount with /etc/fstab not working
Post by: gripped on 02 March 2022, 18:55:38
I did manage to get them working at one point, but when I reformatted a drive due to what I think was a filesystem error it stopped working.

Pretty sure if you reformat ntfs the UUID will change.

Other than that turn on verbose logging in
/etc/rc.conf
Code: [Select]
rc_logger="YES"
rc_verbose="YES"

And check the log at
/var/log/rc.log
after booting

and check the output of dmesg maybe.

Do they mount if you issue
Code: [Select]
sudo mount --all
?

Title: Re: Autmount with /etc/fstab not working
Post by: strajder on 02 March 2022, 19:20:12
It is generally a bad idea to automount external (removable) hard drives, to a subdirectory of /home nonetheless. Just use the mount function of your DE, or, if you aren't using a DE, mount them manually as root when you need them.

Furthermore, if an ordinary user tries to mount an NTFS filesystem, the attempt will fail with the following error message:
Code: [Select]
Unprivileged user can not mount NTFS block devices using the external FUSE
library. Either mount the volume as root, or rebuild NTFS-3G with integrated
FUSE support and make it setuid root. Please see more information at
http://tuxera.com/community/ntfs-3g-faq/#unprivileged
So the user option has no effect.

Why are you using nofail? It does the following:
Quote
       nofail
           Do not report errors for this device if it does not exist.
Reporting errors is very useful for diagnosing issues like the one from this thread.

Other than that, one of the main functions of /etc/fstab is exactly automounting. All filesystems which don't have the noauto option specified should be automounted, unless there were errors.
Title: Re: Autmount with /etc/fstab not working
Post by: Lumenor on 03 March 2022, 06:44:19
Pretty sure if you reformat ntfs the UUID will change.

Other than that turn on verbose logging in
/etc/rc.conf
Code: [Select]
rc_logger="YES"
rc_verbose="YES"

And check the log at
/var/log/rc.log
after booting

and check the output of dmesg maybe.

Do they mount if you issue
Code: [Select]
sudo mount --all
?



mount -a works. Gonna try your suggestion really quickly.
Title: Re: Autmount with /etc/fstab not working
Post by: Lumenor on 03 March 2022, 07:25:01
It is generally a bad idea to automount external (removable) hard drives, to a subdirectory of /home nonetheless. Just use the mount function of your DE, or, if you aren't using a DE, mount them manually as root when you need them.

Furthermore, if an ordinary user tries to mount an NTFS filesystem, the attempt will fail with the following error message:
Code: [Select]
Unprivileged user can not mount NTFS block devices using the external FUSE
library. Either mount the volume as root, or rebuild NTFS-3G with integrated
FUSE support and make it setuid root. Please see more information at
http://tuxera.com/community/ntfs-3g-faq/#unprivileged
So the user option has no effect.

Why are you using nofail? It does the following:Reporting errors is very useful for diagnosing issues like the one from this thread.

Other than that, one of the main functions of /etc/fstab is exactly automounting. All filesystems which don't have the noauto option specified should be automounted, unless there were errors.

So I turned off
Code: [Select]
nofail
, and it seems that the system cannot find the devices via their UUIDS on boot? However running
Code: [Select]
mount -a
works after boot.
Title: Re: Autmount with /etc/fstab not working
Post by: Lumenor on 03 March 2022, 07:31:04
At any rate, my thanks to you folks who are helping me out.
Title: Re: Autmount with /etc/fstab not working
Post by: strajder on 03 March 2022, 07:53:44
So I turned off
Code: [Select]
nofail
, and it seems that the system cannot find the devices via their UUIDS on boot? However running
Code: [Select]
mount -a
works after boot.
Most likely your initramfs isn't configured to load ntfs module, so it can't "see" the ntfs partitions at that stage of the boot process. Try including ntfs module in mkinitcpio.conf (https://wiki.archlinux.org/title/Mkinitcpio#Configuration) and rerunning mkinitcpio.
Title: Re: Autmount with /etc/fstab not working
Post by: Lumenor on 03 March 2022, 08:11:43
Most likely your initramfs isn't configured to load ntfs module, so it can't "see" the ntfs partitions at that stage of the boot process. Try including ntfs module in mkinitcpio.conf (https://wiki.archlinux.org/title/Mkinitcpio#Configuration) and rerunning mkinitcpio.
My thanks. One question, though, what line do I have to edit and what do I edit into it?
Title: Re: Autmount with /etc/fstab not working
Post by: Lumenor on 03 March 2022, 08:24:29
Is it ntfs3?
Title: Re: Autmount with /etc/fstab not working
Post by: strajder on 03 March 2022, 08:39:49
Module name is ntfs. Refer to the documentation for mkinitcpio (https://wiki.archlinux.org/title/Mkinitcpio).
Title: Re: Autmount with /etc/fstab not working
Post by: rayburn on 03 March 2022, 08:47:25
I had a similar problem with an external usb thumbdrive, and as a workaround I added this line to my root crontab:

Code: [Select]
@reboot sleep 20 && mount /dev/sdb1

It is a rather clumsy solution, but it works faultlessly for me.
Title: Re: Autmount with /etc/fstab not working
Post by: Lumenor on 03 March 2022, 10:35:58
Module name is ntfs. Refer to the documentation for mkinitcpio (https://wiki.archlinux.org/title/Mkinitcpio).
That's interesting. When I add that to /etc/mkinitcpio.conf it gives an error message. Something about not finding the module or something. And when I run
Code: [Select]
modprobe -c | vim
and search for "ntfs," the only reference is to "fs_ntfs3" and what I assume is the alias of it, "ntfs3."

Note: it works fine when I edit in "ntfs3."
Title: Re: Autmount with /etc/fstab not working
Post by: Lumenor on 03 March 2022, 11:16:18
By "works fine" I mean that mkinitcpio works, but when I reboot the drives show an error and I can't even enter my window manager.
Title: Re: Autmount with /etc/fstab not working
Post by: Lumenor on 03 March 2022, 11:24:32
It seems that adding "fuse" module to /etc/mkinitcpio.conf worked!
Title: Re: Autmount with /etc/fstab not working
Post by: strajder on 03 March 2022, 11:46:56
That's interesting. When I add that to /etc/mkinitcpio.conf it gives an error message. Something about not finding the module or something. And when I run
Code: [Select]
modprobe -c | vim
and search for "ntfs," the only reference is to "fs_ntfs3" and what I assume is the alias of it, "ntfs3."

Note: it works fine when I edit in "ntfs3."
I guess that's due to me having a kernel built from source, which has ntfs module instead of ntfs3. Whatever, use ntfs3 then.

By "works fine" I mean that mkinitcpio works, but when I reboot the drives show an error and I can't even enter my window manager.
What is the contents of your /etc/mkinitcpio.conf?

What is the exact output of
Code: [Select]
mkinitcpio -Pv | grep -i ntfs
Title: Re: Autmount with /etc/fstab not working
Post by: Lumenor on 03 March 2022, 13:54:58
Okay, that's weird. When I rebooted again the drives did not autmount. Is this expected behavior?
Title: Re: Autmount with /etc/fstab not working
Post by: Lumenor on 03 March 2022, 13:56:49
mkinitcpio -Pv | grep -i ntfs outputs:
Code: [Select]
==> ERROR: Unable to write to /boot/initramfs-linux516-tkg-pds.img
==> ERROR: Unable to write to /boot/initramfs-linux516-tkg-pds-fallback.img
==> ERROR: Unable to write to /boot/initramfs-linux.img
==> ERROR: Unable to write to /boot/initramfs-linux-fallback.img
Title: Re: Autmount with /etc/fstab not working
Post by: Lumenor on 03 March 2022, 14:01:18
Tried again with sudo. Outputs the following:
Code: [Select]
==> WARNING: Possibly missing firmware for module: xhci_pci
==> WARNING: consolefont: no font found in configuration
    adding module: ntfs3 (/lib/modules/5.16.11-246-tkg-pds/kernel/fs/ntfs3/ntfs3.ko.zst)
==> WARNING: Possibly missing firmware for module: bfa
==> WARNING: Possibly missing firmware for module: aic94xx
==> WARNING: Possibly missing firmware for module: qed
==> WARNING: Possibly missing firmware for module: wd719x
==> WARNING: Possibly missing firmware for module: qla1280
==> WARNING: Possibly missing firmware for module: qla2xxx
==> WARNING: Possibly missing firmware for module: xhci_pci
==> WARNING: consolefont: no font found in configuration
    adding module: ntfs3 (/lib/modules/5.16.11-246-tkg-pds/kernel/fs/ntfs3/ntfs3.ko.zst)
==> WARNING: Possibly missing firmware for module: xhci_pci
==> WARNING: consolefont: no font found in configuration
    adding module: ntfs3 (/lib/modules/5.16.10-artix1-1/kernel/fs/ntfs3/ntfs3.ko.zst)
==> WARNING: Possibly missing firmware for module: bfa
==> WARNING: Possibly missing firmware for module: aic94xx
==> WARNING: Possibly missing firmware for module: qed
==> WARNING: Possibly missing firmware for module: wd719x
==> WARNING: Possibly missing firmware for module: qla1280
==> WARNING: Possibly missing firmware for module: qla2xxx
==> WARNING: Possibly missing firmware for module: xhci_pci
==> WARNING: consolefont: no font found in configuration
    adding module: ntfs3 (/lib/modules/5.16.10-artix1-1/kernel/fs/ntfs3/ntfs3.ko.zst)
Title: Re: Autmount with /etc/fstab not working
Post by: strajder on 03 March 2022, 14:38:56
Code: [Select]
UUID="3F8573B3660DF881"             /home/al/mount/TRANSCEND1       ntfs    auto,uid=1000,gid=998,rw,relatime,nofail,user,exec,umask=000 0
  2

UUID="42C508CF71F9C321"         /home/al/mount/Toshiba          ntfs    auto,uid=1000,gid=998,rw,relatime,nofail,user,exec,umask=000 0      2
For ntfs3, you also need to change /etc/fstab entries so the file type is ntfs3 instead of just ntfs as above.

https://wiki.archlinux.org/title/NTFS#Explicit_file_system_type_required_to_mount

That page lists some additional troubleshooting steps if that still doesn't work.
Title: Re: Autmount with /etc/fstab not working
Post by: Lumenor on 03 March 2022, 15:20:44
Quote
For ntfs3, you also need to change /etc/fstab entries so the file type is ntfs3 instead of just ntfs as above.

https://wiki.archlinux.org/title/NTFS#Explicit_file_system_type_required_to_mount

That page lists some additional troubleshooting steps if that still doesn't work.

I've applied the fix and checked the troubleshooting steps. Both troubleshooting steps don't seem to apply, and the fix unfortunately didn't really do anything. It worked before, so I don't know what exactly changed.
Title: Re: Autmount with /etc/fstab not working
Post by: Lumenor on 03 March 2022, 15:22:37
Okay. Weird thing happened. It worked after running "sudo mkinitcpio -P" and "sudo update-grub." Gonna reboot to test if the fix is persistent.
Title: Re: Autmount with /etc/fstab not working
Post by: Lumenor on 03 March 2022, 15:24:02
It isn't persistent. That is so weird. Why does it work sometimes and not other times? Is it a hardware defect?
Title: Re: Autmount with /etc/fstab not working
Post by: strajder on 03 March 2022, 18:09:09
Okay. Weird thing happened. It worked after running "sudo mkinitcpio -P" and "sudo update-grub." Gonna reboot to test if the fix is persistent.
mkinitcpio and update-grub, like most of the administrative programs, require you to be root.

I suggest opening a root shell or using su(1) once to switch to being root for administrative tasks, rather than prefixing every command with "sudo".

What do the logs say? Are there any errors during boot? Look in the files inside /var/log for clues.

Both troubleshooting steps don't seem to apply,
What troubleshooting steps? What did you do? Be more specific.
Title: Re: Autmount with /etc/fstab not working
Post by: Lumenor on 05 March 2022, 12:37:39
I'm marking this as solved since it seems that reinstalling Artix fixes the issue. I am on a new installation of Artix on the same computer without the fstab configurations, but I'm sure it'll work if I configure it again (which I won't as while it may work properly I have discovered it could lead to potential issues.)
Title: Re: Autmount with /etc/fstab not working
Post by: Lumenor on 05 March 2022, 12:41:43
By the way, my apologies for the late reply strajder. To be clear, I simply didn't consider something in the wiki page applicable (iirc, as it's been a while.) All I did was add the following to /etc/udev/rules.d/ntfs3_by_default.rules:

Code: [Select]
SUBSYSTEM=="block", ENV{ID_FS_TYPE}=="ntfs", ENV{ID_FS_TYPE}="ntfs3"
Title: Re: Autmount with /etc/fstab not working
Post by: lq on 05 March 2022, 15:24:13
..., but I'm sure it'll work if I configure it again (which I won't as while it may work properly I have discovered it could lead to potential issues.)
Nice.
However, I still can't see what benefits you can expect when mounting filesystems from hot-plug devices using fstab.
Title: Re: Autmount with /etc/fstab not working
Post by: Lumenor on 05 March 2022, 18:17:55
It was mostly just an idea of convenience really. I don't think I'll do it again, as I think it introduced issues when it did mount the devices.