# sysutils/automount - major rewrite and 1.7.0 version



## vermaden (Aug 28, 2019)

Thanks to _Rozhuk Ivan_ who reworked some of *sysutils/automount* code the new *1.7.0* version is now ready and available.

The changelog is pretty impressive this time:

    New options available in automount.conf config file.
    Filesystem detection/mounting reworked totally with file(1)/dd(1)/fstyp(8) as backends.
    Notifications are now possible with libnitify(8) library.
    Automatic detection of DISPLAY variable.
    New automatic wait for device appearance.
    New detection if device is a block device.
    Introduction of CD-ROM support.
    Automatic detection of File Manager with exo-open(1).
    Option REMOVEDIRS is deprecated now.
    Handle ‘-o large’ option for FAT under FreeBSD 11.x and 12.x versions.
As its not yet available in the FreeBSD Ports please use manual procedure.

Download and unpack the *automount-1.7.0.tar.gz* file.

Then copy its files to appropriate places as shown below.


```
# cp automount.conf      /usr/local/etc/automount.conf
# cp automount_devd.conf /usr/local/etc/devd/automount_devd.conf
# cp automount           /usr/local/sbin/automount
# chmod +x               /usr/local/sbin/automount
# /etc/rc.d/devd restart
```


----------



## twllnbrck (Aug 28, 2019)

Dear @vermaden , thanks a lot for all your great work from a happy sysutils/automount (and sysutils/beadm) user. I've tried the 1.7.0 update and works fine with fat and usb. But Im not able to mount mtp (Android) devices anymore. Has something changed? 
I think it tries to mount it as cd9660 but I dont know why.
Here is the log:

```
2019-08-28 22:04:55 /dev/ugen0.4: attach
2019-08-28 22:04:55 /dev/ugen0.4: not a block device
2019-08-28 22:04:55 /dev/cd1: attach
2019-08-28 22:04:55 /dev/cd1: create '/media/cd1' dir
2019-08-28 22:04:56 /dev/cd1: filesystem mount retry: 1/3
2019-08-28 22:04:57 /dev/cd1: filesystem mount retry: 2/3
2019-08-28 22:04:58 /dev/cd1: filesystem mount retry: 3/3
2019-08-28 22:04:58 /dev/cd1: mount FAIL: 'mount -t cd9660 -e -C=UTF-8 /dev/cd1 /media/cd1'
```


----------



## vermaden (Aug 28, 2019)

twllnbrck said:


> Dear @vermaden , thanks a lot for all your great work from a happy sysutils/automount (and sysutils/beadm) user. I've tried the 1.7.0 update and works fine with fat and usb. But Im not able to mount mtp (Android) devices anymore. Has something changed?
> I think it tries to mount it as cd9660 but I dont know why.
> Here is the log:
> 
> ...


Generally almost everything changed (77% according to GitHub).

I forgot that Android devices sometimes 'publish' their devices as CD-ROM ... I will rework the code and come back with 1.7.1 as soon as possible.

Regards,
vermaden


----------



## Criosphinx (Aug 28, 2019)

I  rarely use them anymore but tried some CDs/DVDs and they show the same error:

```
2019-08-28 16:02:25 /dev/cd0: attach
2019-08-28 16:02:31 /dev/cd0: create '/media/cd0' dir
2019-08-28 16:02:34 /dev/cd0: filesystem mount retry: 1/3
2019-08-28 16:02:35 /dev/cd0: filesystem mount retry: 2/3
2019-08-28 16:02:36 /dev/cd0: filesystem mount retry: 3/3
2019-08-28 16:02:36 /dev/cd0: mount FAIL: 'mount -t cd9660 -e -C=UTF-8 /dev/cd0 /media/cd0'
```

My Android Phone:

```
2019-08-28 16:05:39 /dev/ugen0.2: attach
2019-08-28 16:05:39 /dev/ugen0.2: not a block device
```

From the USB Thumb drives I have, the one with a Linux distro:

```
2019-08-28 16:15:31 /dev/ugen0.2: attach
2019-08-28 16:15:31 /dev/ugen0.2: not a block device
2019-08-28 16:15:32 /dev/da0: attach
2019-08-28 16:15:32 /dev/da0: not a block device
2019-08-28 16:15:32 /dev/da0s1: attach
2019-08-28 16:15:33 /dev/da0s1: create '/media/da0s1' dir
2019-08-28 16:15:33 command 'fsck.ext4' not found
```

fat, exFAT, NTFS, and UFS work fine.


----------



## twllnbrck (Aug 29, 2019)

vermaden said:


> I will rework the code and come back with 1.7.1 as soon as possible.


Ok, thanks for your efforts! I'll wait for 1.7.1 until Im going to do the upgrade.

Criosphinx, I use sysutils/fusefs-lkl to mount ext4 manually cause you'll get rw support (for every Linux fs btw).


----------



## vermaden (Aug 30, 2019)

twllnbrck said:


> Dear @vermaden , thanks a lot for all your great work from a happy sysutils/automount (and sysutils/beadm) user. I've tried the 1.7.0 update and works fine with fat and usb. But Im not able to mount mtp (Android) devices anymore. Has something changed?
> I think it tries to mount it as cd9660 but I dont know why.
> Here is the log:
> 
> ...


Could you send me outputs of these commands please?


```
# file -r -b -L -s    /dev/cd1
# file -k -r -b -L -s /dev/cd1
# fstyp               /dev/cd1
# dd if=/dev/cd1 conv=sync count=1 bs=1k 2> /dev/null | strings | head -10
```


----------



## vermaden (Aug 30, 2019)

Criosphinx said:


> I  rarely use them anymore but tried some CDs/DVDs and they show the same error:
> 
> ```
> 2019-08-28 16:02:25 /dev/cd0: attach
> ...



Could you send me outputs of these commands please?


```
# file -r -b -L -s    /dev/cd0
# file -k -r -b -L -s /dev/cd0
# fstyp               /dev/cd0
# dd if=/dev/cd0 conv=sync count=1 bs=1k 2> /dev/null | strings | head -10
```


```
# file -r -b -L -s    /dev/ugen0.2
# file -k -r -b -L -s /dev/ugen0.2
# fstyp               /dev/ugen0.2
# dd if=/dev/ugen0.2 conv=sync count=1 bs=1k 2> /dev/null | strings | head -10
```


```
# file -r -b -L -s    /dev/da0s1
# file -k -r -b -L -s /dev/da0s1
# fstyp               /dev/da0s1
# dd if=/dev/da0s1 conv=sync count=1 bs=1k 2> /dev/null | strings | head -10
```


----------



## twllnbrck (Aug 30, 2019)

vermaden said:


> Could you send me outputs of these commands please?


Sure, gladly. I need to reinstall 1.7.1 cause I switched back to 1.6.1 temporary.


----------



## twllnbrck (Aug 30, 2019)

Okay. Don't need 1.7.1. Checked the message at my phone and I have only skimmed through .
Anyway, here's the output:


```
# file -r -b -L -s /dev/cd1
ISO 9660 CD-ROM filesystem data 'CDROM'

# file -k -r -b -L -s /dev/cd1
ISO 9660 CD-ROM filesystem data 'CDROM' (Lepton 2.x), scale 0-0, spot
sensor temperature 0.000000, unit celsius, color scheme 0, calibration:
offset 0.000000, slope 0.000000 (Lepton 3.x), scale 0-0, spot sensor
temperature 0.000000, unit celsius, color scheme 0, calibration: offset
0.000000, slope 0.000000

# fstyp /dev/cd1
cd9660

# dd if=/dev/cd1 conv=sync count=1 bs=1k 2> /dev/null | strings | head -10
Ambiguous output redirect.
```


----------



## Criosphinx (Aug 30, 2019)

This is with an HP printer drivers CD although its the same with any CDROM,DVD+R, -RW, etc.

```
$ file -r -b -L -s /dev/cd0
ISO 9660 CD-ROM filesystem data 'HPDJ2520'
$ file -k -r -b -L -s /dev/cd0
ISO 9660 CD-ROM filesystem data 'HPDJ2520' Apple Driver Map, blocksize 2048, blockcount 1158742272, devtype 0, devid 0, driver count 0, contains[@0x200]:
Apple Partition Map, map block count 2, start block 1, block count 63, name Apple, type Apple_partition_map, contains[@0x400]: Apple Partition Map, map block
count 2, start block 517268, block count 279828, name DiscRecording  6.0.4d1, type Apple_HFS, valid, allocated, in use, readable, writable, pic boot code, mount
at startup DOS 2.0 backup id file, sequence 82 (Lepton 2.x), scale 0-0, spot sensor temperature 0.000000, unit celsius, color scheme 0, calibration: offset 0.000000,
slope 0.000000 (Lepton 3.x), scale 0-0, spot sensor temperature 0.000000, unit celsius, color scheme 0, calibration: offset 0.000000, slope 0.000000
- data
$ fstyp /dev/cd0
cd9660
$ dd if=/dev/cd0 conv=sync count=1 bs=1k 2> /dev/null | strings | head -10
```

My Android phone:

```
$ doas file -k -r -b -L -s /dev/ugen0.2
Password:
ERROR: cannot read `/dev/ugen0.2' (Input/output error)
$ doas fstyp /dev/ugen0.2
Password:
fstyp: /dev/ugen0.2: not a disk
```

The Linux drive:

```
file -r -b -L -s /dev/da0s1
Linux rev 1.0 ext4 filesystem data, UUID=698619e7-7638-4282-b3c1-743acf73e189 (extents) (large files) (huge files)
$ file -k -r -b -L -s /dev/da0s1
Linux rev 1.0 ext4 filesystem data, UUID=698619e7-7638-4282-b3c1-743acf73e189 (extents) (large files) (huge files) (Lepton 2.x), scale 0-0, spot sensor temperature
0.000000, unit celsius, color scheme 0, calibration: offset 0.000000, slope 0.000000 (Lepton 3.x), scale 0-0, spot sensor temperature 0.000000, unit celsius, color scheme
0, calibration: offset 0.000000, slope 0.000000
- data
$ fstyp /dev/da0s1
ext2fs
$ dd if=/dev/da0s1 conv=sync count=1 bs=1k 2> /dev/null | strings | head -10
```

The dd commands don't give any output.

My phone and the usb drive work well with 1.6.1

The CDs I don't mount them very often and I always do it with mount_cd9660. In fact I tried:

```
mount -t cd9660 -e -C UTF-8 /dev/cd0 /media/cd0
mount: illegal option -- e
```
While 
	
	



```
mount_cd9660 -e -C UTF-8 /dev/cd0 /media/cd0
```
 works fine.


----------



## zwieblum (Oct 15, 2019)

Just upgraded a machine to FreeBSD 12 p10, which changed automount from 1.5.8 to 1.7.0. This was a most unpleasent experience:
Looks like automount does depend on Xorg running, otherwise $FM will not be executed. And it does not run $FM as $USER - iike in 1.5.8 -  but in sequence for all users that have Xorg running - that is a plain nightmare.

Any chance to get that fixed?


----------



## vermaden (Oct 16, 2019)

Thanks for this input. The 1.7 is generally re-thought of the whole idea of mounting. For example USER is not needed anymore and GROUP is used.

You can revert to old version by fetching the 1.6.1 version by hand:

`#  fetch -o /usr/local/sbin/automount https://raw.githubusercontent.com/vermaden/automount/1.6.1/automount`

I did not had time recently to fix automount more, but I will have some free time after two weeks from now.

Regards.


----------



## zwieblum (Oct 29, 2019)

Thank you for the quick fix.

@ "User is not needed any more": My usecaes is this: Server has a RDX drive. When a medium is inserted, a backup is written to it as user "root". WIll this work again with newer versions?


----------



## PMc (Oct 29, 2019)

I agree, the upgrade was a slight bit of effort. 
It appears the `LOG` parameter in the config-file has changed to `LOG_FILE`.
Also, I now need to set `USER` and `MNT_GROUP` in the config file to get my desired ownership back.
Also, the devd config file gets overwritten on reinstall.

But then, I have to patch the piece anyway, because I also want
1. mounting to a well-defined mountpoint (treated as bareos device) NOT containing the devicename.
2. reporting to syslog

Anyway, it seems to work now just as good as it did before.


----------



## vermaden (Dec 3, 2019)

*UPDATE 5 – Minor sysutils/automount 1.7.1 Update*

The major rewrite of *sysutils/automount* 1.7.0 bring some limitations and problems. This is where 1.7.1 comes with small needed updates.


The changelog is quite small this time:



Fixed the mounts with USER option from config file.
Made MTP filesystem detection and mount better.
Add another check if filesystem is not already mounted.

I have already made a PR so it should be soon available in the FreeBSD Ports.
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=242405


… but if you want to get it faster, then download and unpack the automount-1.7.1.tar.gz file.


Then copy its files to appropriate places as shown below.

# *cp automount.conf      /usr/local/etc/automount.conf*
# *cp automount_devd.conf /usr/local/etc/devd/automount_devd.conf*
# *cp automount           /usr/local/sbin/automount*
# *chmod +x               /usr/local/sbin/automount*
# */etc/rc.d/devd restart*


Regards.


----------



## userxbw (Dec 13, 2019)

how to get it to accept usb external drives??

```
Error opening directory “/media/da0s2”: Operation not permitted
```
I am thinknig something got screwy in v 12.1 now I am unable to automount external drives in my usb port.

dmesg

```
ugen0.9: <JMicron External Disk 3.0> at usbus0
umass0 on uhub4
umass0: <JMicron External Disk 3.0, class 0/0, rev 3.00/4.07, addr 11> on usbus0
umass0:  SCSI over Bulk-Only; quirks = 0x8100
umass0:2:0: Attached to scbus2
da0 at umass-sim0 bus 0 scbus2 target 0 lun 0
da0: <JMicron Tech 0407> Fixed Direct Access SPC-4 SCSI device
da0: Serial Number 0000000045A9
da0: 400.000MB/s transfers
da0: 1907729MB (3907029168 512 byte sectors)
da0: quirks=0x2<NO_6_BYTE>
userx@FreeBSD12.1.org:~
```
log

```
$ tail /var/log/automount.log
2019-12-13 09:39:28 /dev/ugen0.9: attach
2019-12-13 09:39:28 command 'simple-mtpfs' not found
2019-12-13 09:39:29 /dev/da0: attach
2019-12-13 09:39:29 ASD
2019-12-13 09:39:29 /dev/da0: not a block device
2019-12-13 09:39:29 /dev/da0s2: attach
2019-12-13 09:39:30 /dev/da0s2: create '/media/da0s2' dir
2019-12-13 09:39:31 /dev/da0s2: fsck.ext4 extdata01: clean, 1094702/122101760 files, 389485909/488378112 blocks
2019-12-13 09:39:31 /dev/da0s2: mount OK: 'ext4fuse /dev/da0s2 /media/da0s2'
2019-12-13 09:39:42 /dev/da0s2: chown '/media/da0s2' dir with 'userx:wheel' rights
```
in log it says no simple-mtpfs

```
$ sudo pkg install simple-mtpfs 
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
pkg: No packages available to install matching 'simple-mtpfs' have been found in the repositories
```


----------



## Criosphinx (Dec 13, 2019)

The package is called sysutils/fusefs-simple-mtpfs 

But I think there is a problem with libmtp, at least with my phone I can mount and see the folders but can't browse them.


----------



## userxbw (Dec 13, 2019)

I keep getting between a good mount not permitted when I try opening in a file manager to need to have read write permissions. it is frustrating, and as you showed that is for Phones, not a HDD plugged into the usb port, I can manually mount and it works fine, but that defeats automount.

mount -t ext2fs /dev/da0s1 /mnt


----------



## vermaden (Dec 13, 2019)

@ userxbw

Try using the latest 1.7.1 version of *automount* and report issues.

Regards.


----------



## userxbw (Dec 14, 2019)

vermaden said:


> @ userxbw
> 
> Try using the latest 1.7.1 version of *automount* and report issues.
> 
> Regards.


that was 1.7.1 above post #15 I'll redo and get current results and post back.
setup
*17.4.2. Automounting Removable Media*








						Chapter 19. Storage
					

This chapter covers the use of disks and storage media in FreeBSD. This includes SCSI and IDE disks, CD and DVD media, memory-backed disks, and USB storage devices.




					www.freebsd.org
				





```
/etc/auto_master:
/media        -media        -nosuid

   /etc/devd.conf:
notify 100 {
    match "system" "GEOM";
    match "subsystem" "DEV";
    action "/usr/sbin/automount -c";
};

/etc/rc.conf
autofs_enable="YES"
# service automount restart
# service devd restart
# service automount start
# service automountd start
# service autounmountd start
# service devd start
```









						FreeBSD Desktop – Part 17 – Configuration – Automount Removable Media
					

In this article in the FreeBSD Desktop series I will introduce various methods to automatically (or not) mount external/removable devices such as USB or eSATA disks/pendrives or SD/microSD flash ca…




					vermaden.wordpress.com
				



*


		Code:
	

cat /usr/local/etc/automount.conf
USERUMOUNT=YES
ATIME=NO
REMOVEDIRS=YES
FM="caja --browser --no-desktop"
USER=vermaden
ENCODING=pl_PL.UTF-8
CODEPAGE=cp852










						Chapter 19. Storage
					

This chapter covers the use of disks and storage media in FreeBSD. This includes SCSI and IDE disks, CD and DVD media, memory-backed disks, and USB storage devices.




					www.freebsd.org
				





		Code:
	

    /etc/devfs.rules:
[localrules=5]
add path 'da*' mode 0660 group operator
/etc/rc.conf:
devfs_system_ruleset="localrules"
    /etc/sysctl.conf:
vfs.usermount=1

# sysctl vfs.usermount=1
vfs.usermount: 0 -> 1


----------


		Code:
	

$ tail /var/log/automount.log
2019-12-13 18:49:07 /dev/ugen0.9: attach
2019-12-13 18:49:07 command 'simple-mtpfs' not found
2019-12-13 18:49:08 /dev/da0: attach
2019-12-13 18:49:08 ASD
2019-12-13 18:49:08 /dev/da0: not a block device
2019-12-13 18:49:08 /dev/da0s2: attach
2019-12-13 18:49:08 /dev/da0s2: create '/media/da0s2' dir
2019-12-13 18:49:09 /dev/da0s2: fsck.ext4 extdata01: clean, 1094699/122101760 files, 389087871/488378112 blocks
2019-12-13 18:49:10 /dev/da0s2: mount OK: 'ext4fuse /dev/da0s2 /media/da0s2'
2019-12-13 18:49:21 /dev/da0s2: chown '/media/da0s2' dir with 'userx:wheel' rights

operation not allowed from file manager.


		Code:
	

Error opening directory “/media/da0s2”: Operation not permitted




		Code:
	

===>>> Checking package repository for latest available version
===>>> Installing package from: /usr/ports/packages/portmaster-download/fusefs-simple-mtpfs-0.3.0_5.txz
Installing fusefs-simple-mtpfs-0.3.0_5...
Extracting fusefs-simple-mtpfs-0.3.0_5: 100%

===>>> Installation of sysutils/fusefs-simple-mtpfs (fusefs-simple-mtpfs-0.3.0_5) complete

still get same error from a file manager.
log says.


		Code:
	

$ tail /var/log/automount.log
2019-12-13 18:56:36 /dev/ugen0.9: attach
2019-12-13 18:56:37 /dev/ugen0.9: no MTP devices found
2019-12-13 18:56:37 /dev/da0: attach
2019-12-13 18:56:37 ASD
2019-12-13 18:56:37 /dev/da0: not a block device
2019-12-13 18:56:37 /dev/da0s2: attach
2019-12-13 18:56:37 /dev/da0s2: create '/media/da0s2' dir
2019-12-13 18:56:38 /dev/da0s2: fsck.ext4 extdata01: clean, 1094699/122101760 files, 389087871/488378112 blocks
2019-12-13 18:56:38 /dev/da0s2: mount OK: 'ext4fuse /dev/da0s2 /media/da0s2'
2019-12-13 18:56:50 /dev/da0s2: chown '/media/da0s2' dir with 'userx:wheel' rights

*


----------



## vermaden (Dec 14, 2019)

The *ext4* is read only, maybe that is why you get the errors?

You are also confusing *autofs*/*automountd* from FreeBSD base system with *sysutils/automount* package ... choose one but not both.


----------



## userxbw (Dec 14, 2019)

vermaden said:


> The *ext4* is read only, maybe that is why you get the errors?
> 
> You are also confusing *autofs*/*automountd* from FreeBSD base system with *sysutils/automount* package ... choose one but not both.


thanks for the clairfaction, now I got a sort it out. and ext4 is suppose to be read wirte as of before ver 12.1 I think 12 put that in. thats when I tried FreeBSD again just a few mouths ago, before it upgraded, and I had none of this problem. 

how to auto mount in FreeBSD I can see the reason behind the confusion. two different ways, with very similar names, maybe three. 

so the *17.4. USB Storage Devices* is out? 

ah which one supports read write to ext2fs?


----------



## userxbw (Dec 14, 2019)

vermaden said:


> The *ext4* is read only, maybe that is why you get the errors?
> 
> You are also confusing *autofs*/*automountd* from FreeBSD base system with *sysutils/automount* package ... choose one but not both.


thanks for the clairfaction, now I got a sort it out. and ext4 is suppose to be read wirte as of before ver 12.1 I think 12 put that in. thats when I tried FreeBSD again just a few mouths ago, before it upgraded, and I had none of this problem.

how to auto mount in FreeBSD I can see the reason behind the confusion. two different ways, with very similar names, maybe three.

so the *17.4. USB Storage Devices* is out?

ah which one supports read write to ext2fs?

```
Note:
This driver can also be used to access ext3 and ext4 file systems.  The ext2fs(5) filesystem has full read and write support for ext4 as of
FreeBSD 12.0-RELEASE.      Additionally, extended attributes and ACLs are also      supported, while journalling and encryption are not. 
Starting with FreeBSD 12.1-RELEASE, a DTrace provider will be available as well.  Prior versions of FreeBSD can access  ext4 in read and
write mode using sysutils/fusefs-ext2.
```









						Chapter 22. Other File Systems
					

This chapter shows the other filesystems supported by FreeBSD




					www.freebsd.org
				




is that some kind of separate system?
(soory for mucking up your post)
########### IMPORTANT PART#############

```
$ tail /var/log/automount.log
2019-12-14 07:31:38 /dev/da0: attach
2019-12-14 07:31:38 ASD
2019-12-14 07:31:38 /dev/da0: not a block device
2019-12-14 07:31:38 /dev/da0p2: attach
2019-12-14 07:31:38 /dev/da0p2: create '/media/da0p2' dir
2019-12-14 07:31:38 /dev/da0p2: fsck.ext4 You must have r/w access to the filesystem or be root
2019-12-14 07:31:39 /dev/da0p2: filesystem mount retry: 1/3
2019-12-14 07:31:40 /dev/da0p2: filesystem mount retry: 2/3
2019-12-14 07:31:41 /dev/da0p2: filesystem mount retry: 3/3
2019-12-14 07:31:41 /dev/da0p2: mount FAIL: 'ext4fuse /dev/da0p2 /media/da0p2'
```
after i removed everything I could find on both, then rebooted, redid this automount with the files and binary chmod and restart and that is what I am getting.

```
userx@FreeBSD.efi.net:~/Documents/automount-1.7.1
$ id
uid=1000(userx) gid=1000(userx) groups=1000(userx),0(wheel),5(operator),44(video)
```
running this silly little script I wrote yesturday

```
$ cat ~/bin/mntd
#!/usr/bin/env bash

whichdrive=$(ls /dev/da[0-9][a-z]*)
echo $whichdrive
drive=$HOME/drive
fstype=$(fstyp $whichdrive)
echo $fstype

if [[ $fstype = "ext2fs" ]] && [[ -n $whichdrive ]] ; then
        mkdir -p "$drive"
        sudo mount -t ext2fs $whichdrive "$drive"
    fi
ck=$?
if [[ $ck = 1 ]] ; then
    sudo umount "$drive"
    rmdir -v "$drive"
    echo "$? : Unmounted drive"
fi
echo $ck
[ $ck = 0 ] && ls "$drive"


###
$ mntd
/dev/da0p2
0
```
 it gets mounted  read / write, but that defets automount'ing a USB Port drive/stick/whatever. Just saying.


I've got two FreeBSDs on this laptop for now, one is  using your automount, it is not working as posted in above message for its log?

on the other freebsd os I have autofs setup now removed your automount conf's and automount binary (or script). it is mounting without issues on that one.

I'm going to leave this os with your automount setup so hopefully I can with your help get this sorted out as to why I am not having root privs to mount usb port plugins. why is this showing up?

```
2019-12-14 07:31:38 /dev/da0p2: fsck.ext4 You must have r/w access to the filesystem or be root
```
and how to get rid of it so your automount works on this laptop.


----------



## vermaden (Dec 14, 2019)

I will look into that, thanks.


----------



## vermaden (Dec 15, 2019)

Try now with this version:




```
# fetch -o /usr/local/sbin/automount https://raw.githubusercontent.com/vermaden/automount/master/automount

# chmod +x /usr/local/sbin/automount
```


----------



## userxbw (Dec 15, 2019)

vermaden said:


> Try now with this version:
> 
> 
> 
> ...




```
umass0: <JMicron External Disk 3.0, class 0/0, rev 3.00/4.07, addr 10> on usbus0
umass0:  SCSI over Bulk-Only; quirks = 0x8100
umass0:2:0: Attached to scbus2
da0 at umass-sim0 bus 0 scbus2 target 0 lun 0
da0: <JMicron Tech 0407> Fixed Direct Access SPC-4 SCSI device
da0: Serial Number 0000000045A9
da0: 400.000MB/s transfers
da0: 1907729MB (3907029168 512 byte sectors)
da0: quirks=0x2<NO_6_BYTE>
userx@FreeBSD.efi.net:~
$ tail /var/log/automount.log
2019-12-15 14:31:16 /dev/da0s2: detach
2019-12-15 14:31:26 /dev/ugen0.9: attach
2019-12-15 14:31:26 command 'simple-mtpfs' not found
2019-12-15 14:31:27 /dev/da0: attach
2019-12-15 14:31:27 /dev/da0: not a block device
2019-12-15 14:31:27 /dev/da0s2: attach
2019-12-15 14:31:27 /dev/da0s2: create '/media/da0s2' dir
2019-12-15 14:31:27 /dev/da0s2: fsck.ext4 You must have r/w access to the filesystem or be root
2019-12-15 14:31:27 command 'lklfuse' not found
2019-12-15 14:31:27 please install 'sysutils/fusefs-lkl' port or package
```
Compare to post #23 read out of log.
it is not finding mtpfs lklfuse (anymore )/(either)...
So I Installed them two missing pkg and

```
$ tail /var/log/automount.log
2019-12-15 16:05:55 /dev/ugen0.9: no MTP devices found
2019-12-15 16:05:55 /dev/da0: attach
2019-12-15 16:05:56 /dev/da0: not a block device
2019-12-15 16:05:56 /dev/da0s2: attach
2019-12-15 16:05:56 /dev/da0s2: create '/media/da0s2' dir
2019-12-15 16:05:56 /dev/da0s2: fsck.ext4 You must have r/w access to the filesystem or be root
2019-12-15 16:05:57 /dev/da0s2: filesystem mount retry: 1/3
2019-12-15 16:05:57 /dev/da0s2: mount OK: 'lklfuse -o type=ext4 -o allow_other -o intr -o uid=1000 -o gid=0 -o umask=002 /dev/da0s2 /media/da0s2'
2019-12-15 16:05:59 /dev/da0s2: chown '/media/da0s2' dir with 'userx:wheel' rights
2019-12-15 16:05:59 /dev/da0s2: starting 'pcmanfm' file manager
```
 it did pop open the file manager but as it says I am missing root privs or whatever I need to access the USB Port drive.

#####
Okay I thought I had does this to this OS too. made users and 100 gid to match the ownsership of the use on the drive, when I cahecked and seen it was not in this system as such I added users 100

```
$ id
uid=1000(userx) gid=1000(userx) groups=1000(userx),0(wheel),5(operator),44(video),100(users)
```
unplugged and logged out logged in and plugged it back in and voila!!! 


```
$ tail /var/log/automount.log
2019-12-15 16:15:57 /dev/ugen0.9: no MTP devices found
2019-12-15 16:15:58 /dev/da0: attach
2019-12-15 16:15:58 /dev/da0: not a block device
2019-12-15 16:15:58 /dev/da0s2: attach
2019-12-15 16:15:58 /dev/da0s2: create '/media/da0s2' dir
2019-12-15 16:15:58 /dev/da0s2: fsck.ext4 You must have r/w access to the filesystem or be root
2019-12-15 16:15:59 /dev/da0s2: filesystem mount retry: 1/3
2019-12-15 16:15:59 /dev/da0s2: mount OK: 'lklfuse -o type=ext4 -o allow_other -o intr -o uid=1000 -o gid=0 -o umask=002 /dev/da0s2 /media/da0s2'
2019-12-15 16:16:01 /dev/da0s2: chown '/media/da0s2' dir with 'userx:wheel' rights
2019-12-15 16:16:01 /dev/da0s2: starting 'pcmanfm' file manager
```

I'm seeing everything now, and it appears to be reading and writing to it without issues. 
thanks


----------



## vermaden (Dec 15, 2019)

Maybe these settings will help:


```
% grep desktop /etc/rc.conf
devfs_system_ruleset=desktop

% cat /etc/devfs.rules     
[desktop=10]
add path 'acd*'      mode 0660 group operator
add path 'cd*'       mode 0660 group operator
add path 'da*'       mode 0660 group operator
add path 'pass*'     mode 0660 group operator
add path 'xpt*'      mode 0660 group operator
add path 'fd*'       mode 0660 group operator
add path 'md*'       mode 0660 group operator
add path 'uscanner*' mode 0660 group operator
add path 'lpt*'      mode 0660 group cups
add path 'ulpt*'     mode 0660 group cups
add path 'unlpt*'    mode 0660 group cups
add path 'ugen*'     mode 0660 group operator
add path 'usb/*'     mode 0660 group operator
add path 'video*'    mode 0660 group operator
add path 'cuse*'     mode 0660 group operator

% id vermaden
uid=1000(vermaden) gid=1000(vermaden) groups=1000(vermaden),0(wheel),5(operator),44(video),69(network),920(vboxusers)
```


----------



## userxbw (Dec 15, 2019)

vermaden said:


> Maybe these settings will help:
> 
> 
> ```
> ...


I'll check and toss them, I don't think it will hurt to have a bunch of them telling the system to mount everything under the sun. Not inmy option anyways.

I still have never had any luck (auto)mounting the mmc (SD Card)


vermaden

is that an arbitrary word?
devfs_system_ruleset=*desktop*


----------



## vermaden (Dec 16, 2019)

userxbw said:


> I'll check and toss them, I don't think it will hurt to have a bunch of them telling the system to mount everything under the sun. Not inmy option anyways.
> 
> I still have never had any luck (auto)mounting the mmc (SD Card)
> 
> ...



Because the section on /etc/devfs.rules file is named like that [desktop=10].


----------



## userxbw (Dec 16, 2019)

vermaden 
free install of freeBSD and well .... 

```
$ tail /var/log/automount.log
2019-12-16 14:11:56 /dev/ugen1.2: no MTP devices found
2019-12-16 14:11:56 /dev/ugen0.9: no MTP devices found
2019-12-16 14:11:56 /dev/da0: not a block device
2019-12-16 14:11:56 /dev/da0s2: attach
2019-12-16 14:11:56 /dev/da0s2: create '/media/da0s2' dir
2019-12-16 14:11:56 /dev/da0s2: fsck.ext4 You must have r/w access to the filesystem or be root
2019-12-16 14:11:58 /dev/da0s2: filesystem mount retry: 1/3
2019-12-16 14:11:59 /dev/da0s2: filesystem mount retry: 2/3
2019-12-16 14:12:00 /dev/da0s2: filesystem mount retry: 3/3
2019-12-16 14:12:00 /dev/da0s2: mount FAIL: 'lklfuse -o type=ext4 -o allow_other -o intr -o uid=1000 -o gid=0 -o umask=002 /dev/da0s2 /media/da0s2'
```
I did a freebsd install giving it the entire SDD and that is what i am dealing with now, I created the files, users giu=100 added the pkg to mount rc.conf added then entries ,  updated the system to p1, reboot(ed) a few time between and I am still getting this.


----------



## vermaden (Dec 16, 2019)

This is interesting:
*fsck.ext4 You must have r/w access to the filesystem or be root*

I have never seen such error message.

Seems that your pendrive is read only? Or damaged maybe?


----------



## userxbw (Dec 16, 2019)

I do not know either, I did the other automount and that works. I have no idea about the why it worked on the other install and not this one.  don't lose any sleep over it.


----------



## vermaden (Dec 17, 2019)

Have you tried other/different USB drives?


----------



## userxbw (Dec 17, 2019)

JUst couldn't sleep could you?

I know the feeling, when something isn't working that I worked on and it just bugs me to no ends.

well  that I did was, the  hdd in question, had mixed ownership on the group end of it, and a few files with root owndership, I changed it all to current user:group booted into this install of FreeBSD commented out

```
#autofs_enable="YES"
```
 left the rest i added , rebooted, plugged that one in, and yes it worked, unplugged it, then I took a different one plugged it in and it worked, check its ownsership and that one is userx:wheel so I must have made sure that hdd was like that in ownership of just used it with freebsd.

-- to be clear with your automount the only things that are needed to be done are on your page here








						FreeBSD Desktop – Part 17 – Configuration – Automount Removable Media
					

In this article in the FreeBSD Desktop series I will introduce various methods to automatically (or not) mount external/removable devices such as USB or eSATA disks/pendrives or SD/microSD flash ca…




					vermaden.wordpress.com
				




the only things that are needed to be done is install automount, automount.conf , automount_devd.conf --

then you showed me you etc/devfs.rules and rc.conf to match it, that is what I did, it did not work, I added
from this page https://www.freebsd.org/doc/handbook/usb-disks.html

```
/etc/sysctl.conf
vfs.usermount=1
# sysctl vfs.usermount=1
vfs.usermount: 0 -> 1

 /etc/auto_master
/media        -media        -nosuid

/etc/devd.conf
notify 100 {
    match "system" "GEOM";
    match "subsystem" "DEV";
    action "/usr/sbin/automount -c";
};


/etc/rc.conf
autofs_enable="YES"
```
commented out that autofs_enabled=yes fixed permissions on that hdd rebooted into freeBSD back in business it mounts and is read and write, but it now has to be a mixed automount. As I was trying to see the only thing I needed to do to get your automount to work. so ... that is where I am at on this at the time of this posting.


----------



## Yampress (Dec 18, 2019)

When , I have mounted  usbkey under xfce, there isn't  USB icon on the desktop.. On mate desktop there is USB icon

I have problems to mount ext4 system too
FreeBSD 12.1 / sysutils/automount 1.7  from ports / xfce 4.14 /  clear system, without hald  and another mount programs.


----------

