Skip to content
This repository
IgnorantGuru December 09, 2013
file 345 lines (223 sloc) 11.061 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344
README for udevil v0.4.3


Homepage:
    http://ignorantguru.github.io/udevil/

Downloads:
    https://github.com/IgnorantGuru/udevil/tree/pkg

Official Forum (for udevil & SpaceFM):
    https://sourceforge.net/p/spacefm/discussion/general/


CONTENTS

    DESCRIPTION
    PACKAGES
    INSTALLER
    BUILD
    BUILD NEXT
    CREATE DEB PACKAGE
    POST INSTALL
        Kernel Polling
        Networks and Files
        NTFS-3G
        Set SUID
        systemd Service
    ENABLE KERNEL POLLING
    UNINSTALL
    TRANSLATE
    LICENSE


DESCRIPTION

    Mounts and unmounts removable devices and networks without a password (set
    suid), shows device info, monitors device changes. Emulates mount's and
    udisks's command line usage and udisks v1's output. Includes the devmon
    automounting daemon.

    Run 'udevil --help' for usage. See /etc/udevil/udevil.conf for config.
        http://ignorantguru.github.com/udevil/udevil--help.html
        http://ignorantguru.github.com/udevil/udevil.conf.txt


PACKAGES

    Find or add packages, forum threads, and other info for your distro:
        https://github.com/IgnorantGuru/spacefm/wiki/Distros

    For other distros:
        See INSTALLER below

    NOTE: See POST INSTALL section below for post-installation steps.


INSTALLER

    A self-extracting installer is available (udevil-x.x.x-installer.sh):
        https://github.com/IgnorantGuru/udevil/tree/pkg
            (To save a file, click on its filename and click 'View Raw')

    The installer requires the build dependencies listed below in BUILD. If
    any dependencies are missing, examine the error, install missing packages,
    and try again.

    The installer MUST be run in a terminal. It automatically builds and
    installs. Run it like this:

        bash udevil-x.x.x-installer.sh

    or to see options:

        bash udevil-x.x.x-installer.sh --help

    To reinstall or upgrade, just run the latest installer again.

    NOTE: See POST INSTALL section below for post-installation steps.


BUILD

    1) Install required build dependencies (below are Debian package names -
        packages names on your distro may vary but should be similar):

            libglib2.0-0 libglib2.0-dev libudev0 (>=143) libudev-dev
            autotools-dev build-essential fakeroot intltool pkg-config

        Also recommended for network support: cifs-utils curlftpfs sshfs

        Also recommended if using devmon: eject spacefm|zenity

        configure will report anything missing when you run it as shown below.

    2) Use these commands to download the udevil tarball and build:

        # Download & Extract
        mkdir /tmp/udevil-build && cd /tmp/udevil-build
        wget -O udevil.tar.gz https://github.com/IgnorantGuru/udevil/tarball/master
        tar xzf udevil.tar.gz
        cd IgnorantGuru-udevil-*

        # Build & Install
        ./configure
        make
        sudo make install

        # Remove Temporary Files
        cd / && rm -rf /tmp/udevil-build

    NOTES:

        * If configure reports missing dependencies, install them and run
          configure again before proceeding to make.

        * By default, systemd configuration files for devmon are installed to:
              /etc/conf.d/devmon
              /usr/lib/systemd/system/devmon@.service
          To skip installation of these files, use configure option
          --disable-systemd In either case, systemd is NOT required.

        * See POST INSTALL section below for post-installation steps.


BUILD NEXT

    The git 'next' branch of udevil is a work in progress which eventually
    becomes the next release version. To build from this branch, install the
    required build dependencies listed above in BUILD, then:

    # Download & Extract
    mkdir /tmp/udevil-next && cd /tmp/udevil-next
    wget -O udevil-next.tar.gz https://github.com/IgnorantGuru/udevil/tarball/next
    tar xzf udevil-next.tar.gz
    cd IgnorantGuru-udevil-*

    # Build, & Install
    ./configure
    make
    sudo make install

    # Remove Temporary Files
    cd / && rm -rf /tmp/udevil-next


CREATE DEB PACKAGE

    To build a deb file of udevil on your Debian-based distro:

    1) Install build dependencies (see BUILD section above) plus 'debhelper'.

    2) Use these commands to download and extract the udevil tarball (be sure
        to USE A TMP BUILD PATH THAT DOES NOT CONTAIN SPACES):

        mkdir /tmp/udevil-build && cd /tmp/udevil-build # no spaces in path
        # Note: you can change "master" to "next" if you want the next branch:
        wget -O udevil.tar.gz https://github.com/IgnorantGuru/udevil/tarball/master
        tar xzf udevil.tar.gz
        cd IgnorantGuru-udevil-*

    3) Move the distros/debian directory into the source directory:

        mv distros/debian .

    4) Build package: (the package files will appear in the parent directory)

        dpkg-buildpackage -b -uc
        cd .. && rm -rf IgnorantGuru-udevil-* udevil.tar.gz

    5) To install the package you built:

        dpkg -i udevil*.deb


POST INSTALL

    Kernel Polling
    --------------

    You may need to enable kernel polling for device media to be detected by
    udevil. See ENABLE KERNEL POLLING section below.


    Networks and Files
    ------------------

    By default, /etc/udevil/udevil.conf is set to allow only local fileystems
    and ISO files to be mounted, with mounting of networks disallowed. To
    allow networks and files to be mounted, in /etc/udevil/udevil.conf set:

        allowed_types = $KNOWN_FILESYSTEMS, file, cifs, nfs, curlftpfs, sshfs, davfs

    You may also need to install curlftpfs or ftpfs (ftp://), cifs or smbfs
    (smb://), sshfs (ssh://), and davfs2 (http://).


    NTFS-3G
    -------

    If local ntfs filesystems aren't mounted writable, you may need to
    configure your system to mount ntfs with ntfs-3g (on some distros this is
    already done). For example:

        sudo ln -s /sbin/mount.ntfs-3g /sbin/mount.ntfs

        # OR if mount.ntfs-3g is located in /usr/bin:
        sudo ln -s /usr/bin/mount.ntfs-3g /usr/bin/mount.ntfs


    Set SUID
    --------

    After installing udevil, /usr/bin/udevil should have the suid bit already
    set. If not, set it like this:

        sudo chown root:root /usr/bin/udevil
        sudo chmod u+s,go-s,ugo+x /usr/bin/udevil
        ls -l /usr/bin/udevil
            -rwsr-xr-x 1 root root 226625 May 22 08:13 /usr/bin/udevil

    OR, to restrict execution of udevil to the 'plugdev' group only:

        sudo chown root:plugdev /usr/bin/udevil
        sudo chmod u+s,go-s,o-x /usr/bin/udevil
        ls -l /usr/bin/udevil
            -rwsr-xr-- 1 root plugdev 226625 May 22 08:13 /usr/bin/udevil

    OR, if you don't want to use udevil for mounting, you can unset suid:
        sudo chown root:root /usr/bin/udevil
        sudo chmod ugo-s,ugo+x /usr/bin/udevil
        ls -l /usr/bin/udevil
            -rwxr-xr-x 1 root root 226625 May 22 08:13 /usr/bin/udevil

    You can also limit users and groups by editing /etc/udevil/udevil.conf


    systemd Service
    ---------------

    To start devmon as a systemd service:
        systemctl start devmon@<user>


ENABLE KERNEL POLLING

    You may need to enable kernel polling for device media to be detected by
    udevil. For example, if you insert a CD and udevil's monitor command
    doesn't report a change to the device, or udevil doesn't see a filesystem
    on the device, this is a symptom that kernel polling is not enabled.

    Kernel polling is a new feature of the Linux kernel and udev, so most
    distros don't yet have it enabled. Even if you are using udisks, enabling
    kernel polling is recommended to eliminate the need for udisks to do
    userspace polling. Kernel polling also corrects a common issue where the
    eject button on a drive won't respond with the newer udev.

    To use kernel polling, your Linux kernel may need to be 2.6.38 or newer,
    and udev may need to be version 173 or newer.

    TO DETERMINE IF KERNEL POLLING IS ENABLED, run these commands:

        cat /sys/module/block/parameters/events_dfl_poll_msecs
        cat /sys/block/sr0/events_poll_msecs

    If you get 0 or -1 from those commands, then it's probably disabled.

    TO ENABLE KERNEL POLLING PERMANENTLY (survives a reboot), add this command
    to your /etc/rc.local file (anywhere before the 'exit' line in that file):

        echo 2000 > /sys/module/block/parameters/events_dfl_poll_msecs

    Any number between 2000 and 5000 (milliseconds) should be reasonable - the
    higher 5000 means poll every 5 seconds, which is less overhead but a little
    slower.

    OR you can pass this option to the kernel boot command line in grub:

        block.events_dfl_poll_msecs=2000


    TO ENABLE KERNEL POLLING TEMPORARILY, enable common polling for the block
    module:

        sudo bash -c 'echo 2000 > /sys/module/block/parameters/events_dfl_poll_msecs'

    OR you can enable polling just for a single device like this (/dev/sr0 in
    this example):

        sudo bash -c 'echo 2000 > /sys/block/sr0/events_poll_msecs'

    The change should be immediate - media will be detected and the eject
    button on the drive should work normally again. However, the above changes
    will be lost when you reboot.

    References:
    http://www.mail-archive.com/lfs-dev@linuxfromscratch.org/msg15714.html
    http://blogs.gentoo.org/mgorny/2011/06/20/uam-can-now-mount-cds-and-dvds/
    https://bugs.archlinux.org/task/25609


UNINSTALL

    If you installed from a package, use your package manager to remove udevil.
    Otherwise, extract the tarball and enter the directory containing
    configure:

        # first run configure with your original options if needed:
        ./configure
        sudo make uninstall
        # Note: /etc/udevil/ is not automatically removed


TRANSLATE

    To help translate udevil please visit:
        https://github.com/IgnorantGuru/spacefm/wiki/Translate
    
    At Transifex:
        https://www.transifex.com/projects/p/udevil/

    Just sign up for a free Transifex account. For instructions visit:
        http://help.transifex.com/intro/translating.html#translating


LICENSE

    udevil - Copyright (C) 2013 GPL3+

    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by the
    Free Software Foundation; either version 3 of the License, or (at your
    option) any later version.

    USE AT YOUR OWN RISK. This program is distributed in the hope that it
    will be useful, but WITHOUT ANY WARRANTY; without even the implied
    warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
    the GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along
    with this program; if not, write to the Free Software Foundation, Inc.,
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

    See COPYING file.

Something went wrong with that request. Please try again.