zfsonlinux / pkg-zfs

Native ZFS packaging for Debian and Ubuntu
https://launchpad.net/~zfs-native/+archive/daily
308 stars 55 forks source link

File zed-functions.sh is missing from zfs-zed_0.6.5.3-1~trusty_amd64.deb #180

Open mpuzio opened 8 years ago

mpuzio commented 8 years ago

File zed-functions.sh file is necessary for running zedlets included in /usr/lib/zfs-linux/zfs/zed.d/. When absent, daemon fails do run any zedlet scripts and as a result does nothing. Quick workaround: cd /etc/zfs/zed.d/ wget https://raw.githubusercontent.com/zfsonlinux/zfs/master/cmd/zed/zed.d/zed-functions.sh chmod a+x zed-functions.sh

fermulator commented 8 years ago

Need any help testing?

# dpkg --list | grep zfs | grep ii
ii  dkms                                                  2.2.0.3-1.1ubuntu5.14.04.1+zfs10~trusty                  all          Dynamic Kernel Module Support Framework
ii  libzfs2                                               0.6.5.4-1~trusty                                         amd64        Native OpenZFS filesystem library for Linux
ii  mountall                                              2.53-zfs1                                                amd64        filesystem mounting tool
ii  ubuntu-zfs                                            8~trusty                                                 amd64        Native ZFS filesystem metapackage for Ubuntu.
ii  zfs-dkms                                              0.6.5.4-1~trusty                                         amd64        Native OpenZFS filesystem kernel modules for Linux
ii  zfs-doc                                               0.6.5.4-1~trusty                                         amd64        Native OpenZFS filesystem documentation and examples.
ii  zfs-initramfs                                         0.6.5.4-1~trusty                                         amd64        Native OpenZFS root filesystem capabilities for Linux
ii  zfs-zed                                               0.6.5.4-1~trusty                                         amd64        OpenZFS Event Daemon (zed)
ii  zfsutils                                              0.6.5.4-1~trusty                                         amd64        Native OpenZFS management utilities for Linux

# cat /etc/issue
Ubuntu 14.04.3 LTS \n \l

# uname -a
Linux callaghan-desktop 3.13.0-77-generic #121-Ubuntu SMP Wed Jan 20 10:50:42 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
dlehammer commented 8 years ago

I'm also affected by this issue, I've been unable to generate any output from zed, I'm happy to assist if possible.

Adding the newest zed-functions.sh to /etc/zfs/zed.d/ (or /usr/lib/zfs-linux/zfs/zed.d/ or both) as suggested by @mpuzio hasn't fixed the issue.

I've tried enabling debugging by uncommenting ZED_DEBUG_LOG in zed.rc, but no file is generated at "/tmp/zed.debug.log".

The configuration file /etc/zfs/zed.d/zed.rc is rather confusing, as only ZED_PUSHBULLET_CHANNEL_TAG has a note regarding default behavior, ie. I've no idea if the uncommented values are the default for a given setting or needs to be uncommented for zed to work!

$ ps aux | grep zed
root      1666  0.0  0.0  29284   912 ?        S    21:30   0:00 /usr/sbin/zed

$ dpkg --list | grep zfs | grep ii
ii  dkms                                        2.2.0.3-1.1ubuntu5.14.04.1+zfs10~trusty all          Dynamic Kernel Module Support Framework
ii  libzfs2                                     0.6.5.6-1~trusty                        amd64        Native OpenZFS filesystem library for Linux
ii  mountall                                    2.53-zfs1                               amd64        filesystem mounting tool
ii  ubuntu-zfs                                  8~trusty                                amd64        Native ZFS filesystem metapackage for Ubuntu.
ii  zfs-dkms                                    0.6.5.6-1~trusty                        amd64        Native OpenZFS filesystem kernel modules for Linux
ii  zfs-doc                                     0.6.5.6-1~trusty                        amd64        Native OpenZFS filesystem documentation and examples.
ii  zfs-zed                                     0.6.5.6-1~trusty                        amd64        OpenZFS Event Daemon (zed)
ii  zfsutils                                    0.6.5.6-1~trusty                        amd64        Native OpenZFS management utilities for Linux

$ cat /etc/issue
Ubuntu 14.04.4 LTS \n \l

$ uname -a
Linux mc 3.13.0-61-generic #100-Ubuntu SMP Wed Jul 29 11:21:34 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Some side notes; I don't understand why the package doesn't replicate the structure from zed ie. configuration and zedlets all in the same zed.d/ directory as currently shown here https://github.com/zfsonlinux/zfs/tree/master/cmd/zed/zed.d (this is the easiest way to break the package caused by path changes/dependencies) Also why are there no symlinks for identical zedlets in the package - but they're here in the original source!? (those symlinks are committed 2 years ago!)

mpuzio commented 8 years ago

Here is how I had configured my setup (that works). Only all-syslog.sh is enabled (i.e. zed is only used to log events). No changes were necessary in /etc/zfs/zed.d/zed.rc, but they may be needed if you use other zedlets. What is the contents of your /etc/zfs/zed.d? Perhaps something is missing?

apt-get install zfs-zed cp -a /usr/lib/zfs-linux/zfs/zed.d/all-syslog.sh /etc/zfs/zed.d/

Download missing zed-functions.sh: cd /etc/zfs/zed.d/ wget https://raw.githubusercontent.com/zfsonlinux/zfs/master/cmd/zed/zed.d/zed-functions.sh chmod a+x /etc/zfs/zed.d/zed-functions.sh

service zed restart

dlehammer commented 8 years ago

Hi @mpuzio,

Thanks for your clarification.

I'm running a headless ZFS file-repo, so an email alert would match the rest of the alerts I've configured (S.M.A.R.T., temperature etc.).

# link all zedlets into zed zedlet directory, as it's my impression that a ZFS event should trigger a similar named zedlet
$ sudo ln -s /usr/lib/zfs-linux/zfs/zed.d/*.sh /etc/zfs/zed.d/

# retrieve missing zed-functions.sh
$ sudo wget --directory-prefix=/etc/zfs/zed.d/ https://raw.githubusercontent.com/zfsonlinux/zfs/master/cmd/zed/zed.d/zed-functions.sh

# mark zed-functions.sh as executable
$ sudo chmod a+x /etc/zfs/zed.d/zed-functions.sh

# I've configured /etc/zfs/zed.d/zed.rc as follows (rest of file is out-commented ~ ie. "default")
ZED_DEBUG_LOG="/tmp/zed.debug.log"
ZED_EMAIL_ADDR="myemail@mydomain.com"
ZED_NOTIFY_VERBOSE=1
ZED_SYSLOG_TAG="zed"

# restart zed daemon
$ sudo service zed restart
zed stop/waiting
zed start/running, process 3437

Progress since last post, a file owned by root is now created at /tmp/zed.debug.log, and contains some log - containing ex. this nugget ZED_ZEDLET_DIR=/etc/zfs/zed.d.

With the above setup a email was attempted to be sent to root@mydomain.com, zed is seemingly also ignoring the ZED_EMAIL_ADDR setting.

Changing to ZED_EMAIL_ADDR="root" (default) caused zed to trigger the ssmtp alias for root and a email was sent to that address... No additional info was logged to debug out during these zfs events, each restart just echo's the environment into the file.

So far not completely there, I'll try digging a little into the zedlets in-order to make the email hit the configured address.