# DSBMD - a media mounting daemon/automounter for FreeBSD



## mrclksr (Dec 3, 2017)

*About*

sysutils/dsbmd is a media mounting daemon written for FreeBSD. It detects and monitors storage devices (like USB sticks, hard disks, CD/DVD drives, card readers, digital cameras (PTP), MTP devices like smartphones, tablets etc.), and identifies their filesystems. Its clients can request DSBMD to execute actions on those devices, like mounting and unmounting. Currently supported filesystems are ISO-9660, FAT, NTFS, UFS, Ext[2,3,4]fs, HFS+, exFAT, Btrfs, and XFS.

*Installation*

`# pkg install dsbmd` or `# cd /usr/ports/sysutils/dsbmd && make install clean`

*Setup*

DSBMD's default configuration works out of the box, and usually doesn't need any modification. Just enable it in /etc/rc.conf and start the daemon:

```
# sysrc dsbmd_enable=YES
# service dsbmd start
```
By default DSBMD mounts storage devices as regular user. This requires the sysctl variable `vfs.usermount` to be set to 1:

`# sysctl vfs.usermount=1`

To make this change permanent, set it in /etc/sysctl.conf:

`# echo "vfs.usermount=1" >> /etc/sysctl.conf`

Members of the [FONT=Courier New]wheel[/FONT] and [FONT=Courier New]operator[/FONT] group are allowed to connect to DSBMD if not configured otherwise. Since mounting of FUSE filesystems as regular user requires privileges from the [FONT=Courier New]operator[/FONT] group, add your username to the group members:

`# pw groupmod operator -m yourusername`

*Notes*​
If you are running hald, it is recommended to stop and disable it:


```
# service hald stop
 # sysrc hald_enable=NO
```

Support for ISO-9660, Ext[2,3,4], FAT, NTFS, MTPFS, PTP, and UFS is available by default. Support for additional filesystems can be selected when building from ports, or can be installed afterwards if needed:

*exFAT support (optional)*

`# cd /usr/ports/sysutils/fusefs-exfat && make install clean`

*HFS+ support (optional)*

`# cd /usr/ports/sysutils/fusefs-hfsfuse && make install clean`

*Btrfs and XFS support (optional)*

`# cd /usr/ports/sysutils/fusefs-lkl && make install clean`

*Clients*

Clients are programs that connect to DSBMD. They query information and ask DSBMD to execute actions, like mounting a device. Currently there are two standard clients you can use (of course you can also choose nc or telnet, but I do not recommend that ):

sysutils/dsbmc is a desktop environment agnostic GTK+ client for DSBMD that runs in the system tray and lets you mount, unmount, open, play, and eject media by clicking the corresponding device icons or by executing actions from their context menu respectively. Its settings menu allows you to set your preferred file manager and media players for DVDs, audio and video CDs.










*Installation*

`# pkg install dsbmc` or `# cd /usr/ports/sysutils/dsbmc && make install clean`


sysutils/dsbmc-cli allows you to use all the functions DSBMD provides from the command line. Further, it can be used to realize automounting (see below).

*Examples*

List all attached devices visible to DSBMD

`% dsbmc-cli -l
dev=/dev/da0:volid=NO_NAME:fsname=msdosfs
dev=/dev/da1s1:volid=58fd26c81bf4e5ad:fsname=ufs
dev=/dev/cd0:volid=DVD_VIDEO:fsname=cd9660:type=dvd
dev=/dev/ugen3.2:volid=GT-I9105P:fsname=mtpfs:type=mtp`

Mount /dev/da0. The device will be mounted to /media/NO_NAME.

`% dsbmc-cli -m /dev/da0`

Eject /dev/cd0

`% dsbmc-cli -e /dev/cd0`

Listen for add events, and automatically play audio CDs and DVDs, where dsbmc-cli replaces %t and %d by device type and device name respectively.

`% dsbmc-cli -L add sh -c 'case %t in audiocd) deadbeef cdda://%d;; dvd) vlc dvd://%d;; esac' \;`

*Installation*

`# pkg install dsbmc-cli` or `# cd /usr/ports/sysutils/dsbmc-cli && make install clean`

*Automount*

If you want devices to be automatically mounted by DSBMD, install sysutils/dsbmc-cli, and start `dsbmc-cli -a`
as regular user. If you also want to let dsbmc-cli automatically play audio CDs, and DVDs as they are inserted, you can extend the command as follows:

`% dsbmc-cli -a -L add sh -c 'case %t in audiocd) deadbeef cdda://%d;; dvd) vlc dvd://%d;; esac' \;`

To automatically execute dsbmc-cli at session start, add the preferred command to ~/.xinitrc or to your shell's login file. That's it.

*Examples for ~/.xinitrc*

```
#!/bin/sh
dsbmc-cli -a&
exec openbox-session
```


```
#!/bin/sh
dsbmc-cli -a -L add sh -c 'case %t in audiocd) deadbeef cdda://%d;; dvd) vlc dvd://%d;; esac' \;&
exec openbox-session
```

For more information see http://freeshell.de/~mk/projects/dsbmd.html​


----------



## Beno Kurniawan (Feb 8, 2018)

Dear mrclksr , I not yet try this solution yet due its late night already. But if we stop and disable hald, would this have side effect on kde?


----------



## mrclksr (Feb 8, 2018)

Hello Beno Kurniawan ,

no problems from KDE users were reported. You can of course try to use hald together with dsbmd. But if there are any problems, disable hald first.


----------



## Beno Kurniawan (Feb 9, 2018)

Dear mrclksr , I have tried the method on a fresh installed FreeBSD 11.1 system under virtualbox. I disabled hald and use dsbmd instead. The ntfs drive can now be mounted. But there were error when I tried to open the drive folder, it said;

'Couldn't execute command "thunar "/media/DriveName"": no such file or directory'

Would you please let me know and point out if I missed something?

Additional info, on this fresh system I install everyhing with pkg. The pkg installed and what i do are as below;

freebsd-update fetch install && pkg update

virtualbox-ose-additions >> add vboxguest_enable="YES" and vboxservice_enable="YES" on /etc/rc.conf

xorg
kde >> add dbus_enable="YES" and kdm4_enable="YES" on /etc/rc.conf; add proc /proc procfs rw 0 0 to /etc/fstab

dsbmd & dsbmc >> add dsbmd_enable="YES" on /etc/rc.conf; add vfs.usermount=1 on /etc/sysctl.conf
reboot
Thanks in advance for your help.


----------



## rigoletto@ (Feb 9, 2018)

I am not mrclksr but you should use sysutils/dsbmc (or sysutils/dsbmc-cli) to mount/unmount your media.

I do not know how thunar mount devices but I guess it is not issuing anything related with sysutils/dsbmd. 

But if you are expecting the device to be auto-mounted sysutils/dsbmd is not what you are looking for but _vanilla_
autofs(5) (see HERE) or sysutils/automount.


----------



## tobik@ (Feb 9, 2018)

lebarondemerde said:


> But if you are expecting the device to be auto-mounted sysutils/dsbmd is not what you are looking for but _vanilla_
> autofs(5) (see HERE) or sysutils/automount.


No, sysutils/dsbmd supports automounting just fine via sysutils/dsbmc-cli if you really need it (I'd argue that you don't really need it when you have dsbmc). You just need to run this in your session: `dsbmc-cli -a`



Beno Kurniawan said:


> 'Couldn't execute command "thunar "/media/DriveName"": no such file or directory'


dsbmc has a setting for this. Under File->Preferences just replace `thunar` with `dolphin` (I'm assuming you use KDE) and it should work.


----------



## Beno Kurniawan (Feb 9, 2018)

Dear lebarondemerde ,
Thanks for trying to help. It was great for a newbie as me to get as much as possible input from more experienced users so I could learn alot.
Previously I successfully auto-mounting my USB (fat32 format) with autofs. But then find problems when tried to mount my portable hdd (ntfs format) in which I regularly backup all my important files there. Tried to search and read within the forums about ntfs, installing fusefs-ntfs but still, there were no solution up till mrclksr redirect me to this link.

Dear tobik@ ,
Many thanks for your instruction to replace thunar with dolphin, it did works and solved my problem. I finally able to transfer file from and to my ntfs external drive in virtualbox.
Later on after I'm getting more confident and could solve some other problem with the touchpad and bugging ath0 bad rate messages, I will then ready to reinstall FreeBSD on my daily working laptop.


----------



## mrclksr (Feb 14, 2018)

I'm please to announce that DSBMD was mentioned in The Meltdown of Spectre | BSD Now 229 starting at 1:29:28. Thanks, guys!


----------



## obsigna (Feb 15, 2018)

mrclksr, yesterday I installed sysutils/dsbmd and sysutils/dsbmc-cli, and I use it together with x11-fm/nautilus in an x11-wm/openbox environment.

I found the -L option of dsbmc-cli specially useful for the purpose of deleting the .Trash-<UID> directory which is arbitrarily placed by nautilus when deleting something on the removable media.

In the moment I have in my ~/.xinitrc the following line:
`dsbmc-cli -a -L mount rm -rf "%m/.Trash-`id -u`" ';'&`
This one deletes the Trash on the next mount, and it works because the action is triggered post factum. Having the remove command triggered by the unmount event does not work in a similar fashion, because in this case it must be executed before the fact, otherwise the mount point has gone already.

Question, would it be somehow possible to reverse the sequence in case of the unmount event or implement sort of a will_unmount event?


----------



## Minbari (Feb 15, 2018)

mrclksr could you add more properties to dsbmixer? Because when I run xprop to find the WM_CLASS can't find it like I'm finding for dsbmd (WM_CLASS(STRING) = "dsbmc", "Dsbmc") and can make the window float in i3wm. Thank and sorry for off topic.


----------



## mrclksr (Feb 15, 2018)

Hi obsigna ,


obsigna said:


> Question, would it be somehow possible to reverse the sequence in case of the unmount event or implement sort of a will_unmount event?


This is not trivial. I will think about that.


----------



## mrclksr (Feb 15, 2018)

Hi  Minbari ,


Minbari said:


> mrclksr could you add more properties to dsbmixer? Because when I run xprop to make find the WM_CLASS can't find it like I'm finding for dsbmd (WM_CLASS(STRING) = "dsbmc", "Dsbmc") and can make the window float in i3wm. Thank and sorry for off topic.


Qt provides no API for doing that, but there is a workaround. Start dsbmixer as follows:

```
% dsbmixer -- DSBMixer
```


----------



## Minbari (Feb 15, 2018)

mrclksr said:


> Hi  Minbari ,
> 
> Qt provides no API for doing that, but there is a workaround. Start dsbmixer as follows:
> 
> ...


Thank you unfortunately it's not working. I'll try to research to find another way to make the window floate.


----------



## mrclksr (Feb 15, 2018)

I read setting the window size fixed will set the window floating in i3. Try this one:

```
# cp -r /usr/ports/audio/dsbmixer /tmp && mkdir /tmp/dsbmixer/files && cp patch-mainwin.cpp.txt /tmp/dsbmixer/files
# cd /tmp/dsbmixer && make deinstall clean && make install
```


----------



## mrclksr (Feb 22, 2018)

Hello obsigna ,


obsigna said:


> Question, would it be somehow possible to reverse the sequence in case of the unmount event or implement sort of a will_unmount event?


The big problem is that this is almost impossible if devices are being unmounted without using DSBMD. If DSBMD interaction is guaranteed the protocol can be modified by implementing a `will_unmount` event and a `lock` and `unlock` command.

Best regards,
Marcel


----------



## obsigna (Feb 22, 2018)

mrclksr, thank you very much for looking into this.

I thought already that this might be very difficult without touching devd and the unmount mechanism by the kernel. My actual workaround, i.e. deleting the /.Trash-<UID> on the next mount of a media, is not that bad. And anyway, all this only ment to be a workaround for I am not being able to get x11-fm/nautilus to treat the Trash Can properly on FreeBSD.


----------



## mrclksr (Aug 12, 2018)

*DSBMD-1.4 released!*

*Changes since 1.3:*

Support for bootable USB drives with ISO-9660 has been added. Thanks to jmp-2.
Support for nvd(4) and uzip memory disks has been added.
Detach md(4) devices when they are ejected.
Open listening socket before scanning attached devices, so that clients can connect even if DSBMD is busy with slow devices.
Ignore the deprecated [FONT=Courier New]large[/FONT] mount option for [FONT=Courier New]msdosfs[/FONT] on FreeBSD >= 12. This is necessary for users upgrading their system to FreeBSD 12 without adjusting dsbmd.conf. Thanks to Samy Mahmoudi for pointing this out.


----------



## mrclksr (Sep 4, 2018)

*DSBMD-1.5 released!*
*Changes:*

The [FONT=Courier New]mdattach[/FONT] command has been added which creates a memory disk device (md(4)) from a given disk image. This allows users of DSBMC >= 0.5 to easily access them.


----------



## tankist02 (Sep 5, 2018)

What are the differences between this and automount and autofs? Which one should I use and why?


----------



## mrclksr (Sep 6, 2018)

Hi tankist02,



tankist02 said:


> What are the differences between this and automount and autofs?


I have no experience with autofs/automount(d), so please correct me if I'm wrong:

The autofs/automountd approach is modular, and requires a little bit more configuration. Basically, you have a /media directory under which mountpoints are created. If you plug in a storage device and access /media, a new mountpoint is created, and the device gets mounted on /media/disklabel. autofs/automountd supports NFS, which DSBMD does not.

The DSBMD approach is monolithic, with a simple configuration file, and should work out-of-the-box. It also takes care to load the necessary kernel modules, and makes sure to change the ownership of the mounted devices depending on the user. Unlike autofs/automount(d) DSBMD needs a client to tell it what the user wants.



tankist02 said:


> Which one should I use and why?


I suggest to try both, and see what fits your needs better. For autofs/automountd see ILUXA's Thread autofs-share-your-experience.61251. If you're trying DSBMD with DSBMC and/or DSBMC-Cli, feedback is always welcome


----------



## Ogis (Dec 24, 2018)

Hello. First of all, I would like to sincerely thank the developers of this program for their ingeniously simple and functional product that makes life easier for newcomers (and not only). I installed this program today. And here's my impression. External usb-hdd automounted without problems. Same with my Android mobile phone.


----------



## rsronin (Dec 30, 2018)

A big thank you to mrclksr (now on the forum)! Without your programs my FreeBSD ride would be even more bumpier.


----------



## mrclksr (Dec 31, 2018)

Thank you, Ogis and rsronin, for your kind comments. It's great to read that someone likes what I do. There have been times I was about to quit, but feedback like yours keeps me working on projects like this. I appreciate that.


----------



## elimelech007 (Mar 17, 2019)

```
dsbmd: *****************************************************************
dsbmd: WARNING
dsbmd: 
dsbmd: Your dsbmd.conf seems to be outdated. Please recreate it from
dsbmd: dsbmd.conf.sample, or merge the files.
dsbmd: 
dsbmd: *****************************************************************
```
And as it is written, but nothing helped, this inscription appears back when loading. what to do?


----------



## mrclksr (Mar 17, 2019)

elimelech007 said:


> ```
> dsbmd: *****************************************************************
> dsbmd: WARNING
> dsbmd:
> ...


[FONT=courier new]cfgversion[/FONT] wasn't increased in the config file template with the latest release. Just set [FONT=courier new]cfgversion[/FONT] to 1006.


----------



## ionutm80 (Jun 4, 2019)

Big thanks also from me, nice tool, I've also tried automount and autofs but in the end I settled for DSBMD/DSBMC. I do have however one question: do I have to do anything special in the conf file in order to show also DVD/CD disks? Now only USB HDD and USB memory sticks are working but if I insert a DVD I do not see it in DSBMC to be able to mount it. However I can mount it manually with # mount -t cd9660 /dev/cd0 /media/cdrom.


----------



## Minbari (Jun 4, 2019)

ionutm80 said:


> Big thanks also from me, nice tool, I've also tried automount and autofs but in the end I settled for DSBMD/DSBMC. I do have however one question: do I have to do anything special in the conf file in order to show also DVD/CD disks? Now only USB HDD and USB memory sticks are working but if I insert a DVD I do not see it in DSBMC to be able to mount it. However I can mount it manually with # mount -t cd9660 /dev/cd0 /media/cdrom.


I think you can see CD/DVD's by editing (adding the path) the /usr/local/etc/dsbmd.conf.


----------



## Lamia (Jun 4, 2019)

I tried it a few times in the past but it went belly up.
It was at that time I jumped on the syncthing bandwagon. It looks nice and worth trying again.


----------



## ionutm80 (Jun 4, 2019)

Minbari said:


> I think you can see CD/DVD's by editing (adding the path) the /usr/local/etc/dsbmd.conf.



Do you mean something like this in dsbmd.conf?

*cd9660_mount_cmd = "mount -t cd9660 /dev/cd0 /media/cdrom "

or

cd9660_mount_cmd = "mount -t  cd9660 \"uid=${DSBMD_UID},gid=${DSBMD_GID}\" ${DSBMD_DEVICE} \"${DSBMD_MNTPT}\"" *


----------



## mrclksr (Jun 4, 2019)

ionutm80 said:


> Big thanks also from me, nice tool, I've also tried automount and autofs but in the end I settled for DSBMD/DSBMC. I do have however one question: do I have to do anything special in the conf file in order to show also DVD/CD disks? Now only USB HDD and USB memory sticks are working but if I insert a DVD I do not see it in DSBMC to be able to mount it. However I can mount it manually with # mount -t cd9660 /dev/cd0 /media/cdrom.


Usually, DSBMD detects and shows CDs/DVDs without additional configuration. However, a user reported that it does work with his regular DVD drive, but doesn't work with his BluRay USB 3.0 drive. I'm working on it. What kind of drive do you use?


----------



## ionutm80 (Jun 4, 2019)

mrclksr said:


> Usually, DSBMD detects and shows CDs/DVDs without additional configuration. However, a user reported that it does work with his regular DVD drive, but doesn't work with his BluRay USB 3.0 drive. I'm working on it. What kind of drive do you use?



 Blu-Ray USB 3.0 drive ... bad luck for me.


----------



## mrclksr (Jun 4, 2019)

ionutm80 said:


> Blu-Ray USB 3.0 drive ... bad luck for me.


At least the problem seems to be consistent. I will fix it in the next few days.


----------



## ionutm80 (Jun 4, 2019)

mrclksr said:


> At least the problem seems to be consistent. I will fix it in the next few days.



Thanks, hardly waiting!


----------



## abishai (Jun 4, 2019)

Is it possible to blacklist EFI partition ? It's mounted by `dsbmc-cli -a`


----------



## Yampress (Jun 4, 2019)

*mrclksr*

I think you should add options in the configuration, so that the DSBMC client does not display partitions / disks that do not want to be visible / the ability to mount them. For example, I have a second disk with linux and three partitions and they show me in the window of the clown, and I do not want the partitions to show up there. And of course, mounting cd / dvd would be recommended to work.


----------



## mrclksr (Jun 4, 2019)

abishai said:


> Is it possible to blacklist EFI partition ? It's mounted by `dsbmc-cli -a`


Unfortunately, no. But I will think about that feature.


----------



## mrclksr (Jun 4, 2019)

Yampress said:


> *mrclksr*
> 
> I think you should add options in the configuration, so that the DSBMC client does not display partitions / disks that do not want to be visible / the ability to mount them. For example, I have a second disk with linux and three partitions and they show me in the window of the clown, and I do not want the partitions to show up there. And of course, mounting cd / dvd would be recommended to work.


You can add those partitions to the ignore list in dsbmc (_File_ -> _Preferences_ -> _Ignore mount points/devices_). It's a simple comma-separated list. Example: "/var/run/user/UID/gvfs", "/home/username/.gvfs", "/usr/home/username/.gvfs", "/dev/nvd0p1"


----------



## mrclksr (Jun 4, 2019)

abishai said:


> Is it possible to blacklist EFI partition ? It's mounted by `dsbmc-cli -a`


I just added a blacklist option (-b) which allows you to define a comma-separated list of devices to ignore if the -a option is give.


----------



## Lamia (Jun 6, 2019)

Lamia said:


> I tried it a few times in the past but it went belly up.
> It was at that time I jumped on the syncthing bandwagon. It looks nice and worth trying again.


I gave it a shot again. It works! Thanks mrclksr for the great job.


----------



## Lamia (Jun 6, 2019)

Lamia said:


> I got gave it a shot again. It works! Thanks mrclksr for the great job.





Lamia said:


> I got gave it a shot again. It works! Thanks mrclksr for the great job.


Has anyone tried it with Android phones? That's the only exception from here.


----------



## twllnbrck (Jun 6, 2019)

Lamia said:


> Has anyone tried it with Android phones? That's the only exception from here.


Did you install fusefs-simple-mtpfs?


----------



## mrclksr (Jun 8, 2019)

abishai said:


> Is it possible to blacklist EFI partition ? It's mounted by `dsbmc-cli -a`


dsbmc-cli-0.4 which supports black listing of devices and volume labels is now in the ports tree.


----------



## Lamia (Jun 8, 2019)

twllnbrck said:


> Did you install fusefs-simple-mtpfs?


No luck for both the gui and cli!
% dsbmc-cli -a

```
dsbmc-cli: Mouting of /dev/ada1s1 failed: Mount command failed                 
dsbmc-cli: Mouting of /dev/ugen2.2 failed: Mount command failed                
dsbmc-cli: Mouting of /dev/ugen2.2 failed: Mount command failed                
dsbmc-cli: Mouting of /dev/ugen2.2 failed: Mount command failed
```


----------



## mrclksr (Jun 8, 2019)

Lamia said:


> No luck for both the gui and cli!
> % dsbmc-cli -a
> 
> ```
> ...


Please post the last few lines of /var/log/dsbmd.log:

```
% tail -30 /var/log/dsbmd.log
```


----------



## Lamia (Jun 8, 2019)

mrclksr said:


> Please post the last few lines of /var/log/dsbmd.log:
> 
> ```
> % tail -30 /var/log/dsbmd.log
> ```




```
# tail -30 /var/log/dsbmd.log                                           
dsbmd: dsbmd exited on Fri Jun  7 09:29:33 2019                                 
dsbmd: dsbmd started on Sat Jun  8 08:51:14 2019                                
dsbmd: ioctl(/dev/cd0, CDRIOCREADSPEED): Device not configured on Sat Jun  8 08:
51:14 2019                                                                      
dsbmd: getfs(): fread(): Invalid argument                                       
dsbmd: getfs(): Invalid argument                                                
dsbmd: getfs(): fread(): Invalid argument                                       
dsbmd: getfs(): Invalid argument
dsbmd: getfs(): fread(): Invalid argument                                      
dsbmd: getfs(): Invalid argument
dsbmd: ioctl(/dev/cd1, CDRIOCREADSPEED): Device not configured on Sat Jun  8 09:03:24 2019
dsbmd: Client with UID 1001 connected on Sat Jun  8 09:06:49 2019              
dsbmd: Command /usr/local/bin/simple-mtpfs ${DSBMD_DEVICE} "${DSBMD_MNTPT}" executed by UID 1001 failed with code 256: No error: 0 on Sat Jun  8 09:07:49 2019 
dsbmd: Command /usr/local/bin/simple-mtpfs ${DSBMD_DEVICE} "${DSBMD_MNTPT}" executed by UID 1001 failed with code 256: No error: 0 on Sat Jun  8 09:07:55 2019 
dsbmd: Command /usr/local/bin/simple-mtpfs ${DSBMD_DEVICE} "${DSBMD_MNTPT}" executed by UID 1001 failed with code 256: No error: 0 on Sat Jun  8 09:08:34 2019 
dsbmd: Client with UID 1001 disconnected on Sat Jun  8 09:08:48 2019           
dsbmd: Client with UID 1001 connected on Sat Jun  8 09:09:25 2019              
dsbmd: Command /usr/local/bin/simple-mtpfs ${DSBMD_DEVICE} "${DSBMD_MNTPT}" executed by UID 1001 failed with code 256: No error: 0 on Sat Jun  8 09:09:33 2019 
dsbmd: Client with UID 1001 disconnected on Sat Jun  8 09:09:39 2019           
dsbmd: Client with UID 1001 connected on Sat Jun  8 09:21:01 2019              
dsbmd: Device /dev/ada1 mounted on /media/ada1 by UID 1001 on Sat Jun  8 09:21:01 2019
dsbmd: Command /sbin/mount_fusefs auto "${DSBMD_MNTPT}" fuse-ext2 -o 'rw+' ${DSBMD_DEVICE} "${DSBMD_MNTPT}" executed by UID 1001 failed with code 256: No error: 0 on Sat Jun  8 09:21:02 2019
dsbmd: Command /usr/local/bin/simple-mtpfs ${DSBMD_DEVICE} "${DSBMD_MNTPT}" executed by UID 1001 failed with code 256: No error: 0 on Sat Jun  8 09:21:04 2019 
dsbmd: Command /usr/local/bin/simple-mtpfs ${DSBMD_DEVICE} "${DSBMD_MNTPT}" executed by UID 1001 failed with code 256: No error: 0 on Sat Jun  8 09:21:22 2019 
dsbmd: Command /usr/local/bin/simple-mtpfs ${DSBMD_DEVICE} "${DSBMD_MNTPT}" executed by UID 1001 failed with code 256: No error: 0 on Sat Jun  8 09:21:25 2019 
dsbmd: Client with UID 1001 disconnected on Sat Jun  8 09:21:55 2019           
dsbmd: Client with UID 1001 connected on Sat Jun  8 09:22:00 2019        
dsbmd: Command /usr/local/bin/simple-mtpfs ${DSBMD_DEVICE} "${DSBMD_MNTPT}" executed by UID 1001 failed with code 256: No error: 0 on Sat Jun  8 09:21:25 2019 
dsbmd: Client with UID 1001 disconnected on Sat Jun  8 09:21:55 2019           
dsbmd: Client with UID 1001 connected on Sat Jun  8 09:22:00 2019              
dsbmd: Command /sbin/mount_fusefs auto "${DSBMD_MNTPT}" fuse-ext2 -o 'rw+' ${DSBMD_DEVICE} "${DSBMD_MNTPT}" executed by UID 1001 failed with code 256: No error:  0 on Sat Jun  8 09:22:57 2019 dsbmd: Command /usr/local/bin/simple-mtpfs ${DSBMD_DEVICE} "${DSBMD_MNTPT}" executed by UID 1001 failed with code 256: No error: 0 on Sat Jun  8 09:23:09 2019
dsbmd: Command /sbin/mount_fusefs auto "${DSBMD_MNTPT}" fuse-ext2 -o 'rw+' ${DSBMD_DEVICE} "${DSBMD_MNTPT}" executed by UID 1001 failed with code 256: No error: 0 on Sat Jun  8 09:23:14 2019
dsbmd: Command /usr/local/bin/simple-mtpfs ${DSBMD_DEVICE} "${DSBMD_MNTPT}" executed by UID 1001 failed with code 256: No error: 0 on Sat Jun  8 10:38:45 2019
```


----------



## mrclksr (Jun 8, 2019)

Lamia: Is your user member of the operator group? If not:

```
# pw groupmod operator -m yourusername
```
and try again.


----------



## abishai (Jun 8, 2019)

mrclksr said:


> dsbmc-cli-0.4 which supports black listing of devices and volume labels is now in the ports tree.


Yep, I've seen dsbmc version bump. Good work; I always feared break something in EFI partition


----------



## Lamia (Jun 8, 2019)

mrclksr said:


> Lamia: Is your user member of the operator group? If not:
> 
> ```
> # pw groupmod operator -m yourusername
> ...


Is there no other way to it? I won't want to add the user to operator, more like sudo, just to access pendrives.


----------



## Lamia (Jun 8, 2019)

Lamia said:


> Is there no other way to it? I won't want to add the user to operator, more like sudo, just to access pendrives.


It worked though. Thanks.


----------



## mrclksr (Jun 8, 2019)

Lamia said:


> Is there no other way to it? I won't want to add the user to operator, more like sudo, just to access pendrives.


This is only necessary for filesystems that are mounted using a FUSE daemon. But I can think of a way to change that in a future release.


----------



## abishai (Jun 8, 2019)

I believe if you own fuse node or have write access to it, the command will succeed.


----------



## mrclksr (Jun 9, 2019)

abishai said:


> I believe if you own fuse node or have write access to it, the command will succeed.











						Allow non-members of the operator group to mount via fuse daemon by t… · mrclksr/DSBMD@5e491cf
					

…emporarily changing the owner of the fuse device. Restore the ownership right after the mount command has finished.




					github.com


----------



## abishai (Jun 10, 2019)

Probably, this is user responsibility. We can set nesessary rights in /etc/devfs.rules.


----------



## mrclksr (Jun 10, 2019)

abishai said:


> Probably, this is user responsibility. We can set nesessary rights in /etc/devfs.rules.


If you did so, /dev/fuse would be owned by this very user all the time. dsbmd just changes the ownership for a 10th of a second. As soon as the mount command returned, the ownership is restored.


----------



## abishai (Jun 10, 2019)

dsbmd is not the only consumer of fuse, gvfs uses it too. Proper access to dev nodes is a part of setting up a workstation/server. We use devfs rules for our scanner (usb), for libinput, for nut and so on. Attempt to do all of this automagically is pandora box. IMHO.


----------



## mrclksr (Jun 10, 2019)

abishai said:


> dsbmd is not the only consumer of fuse, gvfs uses it too. Proper access to dev nodes is a part of setting up a workstation/server.


I agree, but where do you exactly see the problem with the current approach?


> We use devfs rules for our scanner (usb), for libinput, for nut and so on. Attempt to do all of this automagically is pandora box. IMHO.


dsbmd of course restores the rights set in /etc/devfs.rules regarding /dev/fuse.


----------



## mrclksr (Jun 10, 2019)

I've added a boolean chown_fuse variable which allows the user to control the discussed behavior via /usr/local/etc/dsbmd.conf. Setting `chown_fuse = "no"` leaves the permission issue to the user.


----------



## golpemortal (Oct 16, 2019)

Nice!!!!


----------



## Minbari (Jan 9, 2020)

After the last update the GUI version of sysutils/dsbmc doesn't set the window class, it's not floating and give the following message: 

```
QSystemTrayIcon::setVisible: No Icon set
```
 and the error messages: 
	
	



```
Fatal error: uconnect(/var/run/dsbmd.socket): Error: connect(/var/run/dsbmd.socket): Connection refused
```
I've restarted the daemon but it give the same error.

The terminal version sysutils/dsbmc-cli is not working either:

```
dsbmc-cli: Error: dsbmc_mount(/dev/ada0p1): Error: read_event(): Lost connection to DSBM
```


----------



## mrclksr (Jan 9, 2020)

Minbari said:


> After the last update the GUI version of sysutils/dsbmc doesn't set the window class, it's not floating and give the following message:
> 
> ```
> QSystemTrayIcon::setVisible: No Icon set
> ...



Could you please post the last 100 lines of /var/log/dsbmd.log or run dsbmd in foreground via `dsbmd -f` and post the output?


----------



## Minbari (Jan 9, 2020)

`dsbmd -F
dsbmd: Command not found.`

`service dsbmd status
dsbmd is running as pid 8278.`


----------



## mrclksr (Jan 9, 2020)

For some reason dsbmd can't create a directory under /media due to a permission error. Did you set the immutable flag on /media?
Could please post the output of

`ls -lo / | grep media` and `stat /media`?


----------



## Minbari (Jan 9, 2020)

mrclksr said:


> For some reason dsbmd can't create a directory under /media due to a permission error. Did you set the immutable flag on /media?
> Could please post the output of
> 
> `ls -lo / | grep media` and `stat /media`?




```
ls -lo / | grep media
drwxr-xr-x  3 root  512 Jan  9 09:35 media
```

and 

```
stat /media                                                                                                                                                     
18446744072887533316 1 drwxr-xr-x 3 root wheel 0 512 "Jan  9 09:35:56 2020" "Jan  9 09:35:56 2020" "Jan  9 09:35:56 2020" "Jan  9 09:35:56 2020" 4096 1 0 /media
```
I did not mess with the writing/reading permissions of that directory, just update the port on 2 jan and the following day I see that dsbmc window can't float like always do when i3 starts and it was stop working properly.


----------



## mrclksr (Jan 9, 2020)

Minbari said:


> I did not mess with the writing/reading permissions of that directory, just update the port on 2 jan


That's odd. The changes in 1.10 can't explain the problem you have. Is there some other filesystem mounted on /media (`mount | grep /media`)? can you create a directory (as root) under /media?



Minbari said:


> I see that dsbmc window can't float like always do when i3 starts and it was stop working properly.


DSBMC was rewritten using Qt5, and there is no way to set the WM_CLASS via the API, afaik. I will add a workaround to support float.


----------



## Minbari (Jan 9, 2020)

It does not permit me to create a directory in /media. The only filesystem mounted on /media it's the efi partition but that was also mounted before.


----------



## mrclksr (Jan 9, 2020)

Minbari said:


> It does not permit me to create a directory in /media. The only filesystem mounted on /media it's the efi partition but that was also mounted before.


Could please post the output of `mount | grep /media`? And just to make sure:
unmount all filesystems mounted on subdirectories under /media, and finally:

```
# umount /media
# chflags noschg /media
```
Then try to again to create a directory under /media. If it works, dsbmd can do its job again.


----------



## Minbari (Jan 9, 2020)

The output of `mount | grep /media` does not show anything but after I change flags it lets me can create directories in /media.

Problem solved sysutils/dsbmc and sysutils/dsbmc-cli are working now. The only problem for dsbmc it's WM_CLASS implementation for qt5, but I can live with the window without floating or I just use dsbmc-cli. Thank you for help.


----------



## mrclksr (Jan 11, 2020)

Minbari said:


> The only problem for dsbmc it's WM_CLASS implementation for qt5, but I can live with the window without floating or I just use dsbmc-cli.


If you start dsbmc as `dsbmc -- "DSBMC"`, WM_CLASS will be set.


----------



## Minbari (Jan 14, 2020)

mrclksr said:


> If you start dsbmc as `dsbmc -- "DSBMC"`, WM_CLASS will be set.


Still not working but it's OK, `dsbmc-cli` does a good job.


----------

