martin-ueding/thinkpad-scripts

Postdock hook not given "on" state automatically

monte-monte opened this issue · 8 comments

I've written my postdock hook which is executed perfectly, only not if thinkpad-dock runs automatically on laptop docking. To be clear I've tested with one simple command in hook which sends notify-osd with text "Dock is On" or "Dock is Off". It behaves this way:

  1. Undock button is pressed, laptop disconnected from dock - main script works, hook works, notification is present;
  2. Laptop is putted back to dock - main script works, hook doesn't, notification not present;
  3. <thinkpad-dock on> is executed in terminal - main script works, hook works, notification is present.

My postdock hook has this structure:

#!/bin/bash
case "$1" in
    on)
             notify-send -u normal -t 3000 "Dock is ON" 
             ;;
    off)
             notify-send -u normal -t 3000 "Dock is OFF" 
             ;;
esac

My first guess is that this has something to do with the missing environment variables for DBus. When you call the script manually, it has the correct environment variables. The notifications are ususally sent through DBus which needs a special environment variable such that the notification actually shows up on your desktop, and not the one of root or udev.

The strange thing is that it works with the hardware docking in one direction only. Could you please add the line

env | logger -t postdock-hook

to your postdook hook? This will dump all your environment variables into the syslog. Then you can do a docking on and docking off and look into /var/log/syslog. It would be interesting to see the output.

I think this might be related to #73 if it was not one way only …

I've pointed that hook for "off" state works good. That because I've listed all needed vars in script and even call 2 of 3 commands with sudo -u -E. But only "off" part of the script is processed.
So now, after you suggested output to syslog, I am sure that it isn't my fault:)

Dec 22 18:34:28 monte-X230 thinkpad-dock: Event caught: off
Dec 22 18:34:28 monte-X230 kernel: [ 3722.336265] thinkpad_acpi: undocked from hotplug port replicator
Dec 22 18:34:28 monte-X230 kernel: [ 3722.336338] ACPI: \_SB_.GDCK: undocking
Dec 22 18:34:28 monte-X230 postdock-hook: SHELL=/bin/bash
Dec 22 18:34:28 monte-X230 postdock-hook: TERM=unknown
Dec 22 18:34:28 monte-X230 postdock-hook: USER=monte
Dec 22 18:34:28 monte-X230 postdock-hook: SUDO_USER=root
Dec 22 18:34:28 monte-X230 postdock-hook: SUDO_UID=0
Dec 22 18:34:28 monte-X230 postdock-hook: USERNAME=monte
Dec 22 18:34:28 monte-X230 postdock-hook: MAIL=/var/mail/monte
Dec 22 18:34:28 monte-X230 postdock-hook: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Dec 22 18:34:28 monte-X230 postdock-hook: _=/usr/bin/env
Dec 22 18:34:28 monte-X230 postdock-hook: QT_QPA_PLATFORMTHEME=appmenu-qt5
Dec 22 18:34:28 monte-X230 postdock-hook: PWD=/home/monte
Dec 22 18:34:28 monte-X230 postdock-hook: HOME=/home/monte
Dec 22 18:34:28 monte-X230 postdock-hook: SUDO_COMMAND=/bin/bash -c env DISPLAY=:0.0 /usr/bin/thinkpad-dock off
Dec 22 18:34:28 monte-X230 postdock-hook: SHLVL=2
Dec 22 18:34:28 monte-X230 postdock-hook: LOGNAME=monte
Dec 22 18:34:28 monte-X230 postdock-hook: DISPLAY=:0.0
Dec 22 18:34:28 monte-X230 postdock-hook: SUDO_GID=0
Dec 22 18:34:32 monte-X230 NetworkManager[1000]: <info> (eth0): device state change: activated -> unavailable (reason 'carrier-changed') [100 20 40]
Dec 22 18:34:32 monte-X230 NetworkManager[1000]: <info> (eth0): deactivating device (reason 'carrier-changed') [40]
Dec 22 18:34:32 monte-X230 NetworkManager[1000]: <info> (eth0): canceled DHCP transaction, DHCP client pid 19199
Dec 22 18:34:32 monte-X230 NetworkManager[1000]: <info> Policy set 'monte_wlan_ddwrt' (wlan0) as default for IPv4 routing and DNS.
Dec 22 18:34:32 monte-X230 avahi-daemon[1039]: Withdrawing address record for 192.168.0.101 on eth0.
Dec 22 18:34:32 monte-X230 avahi-daemon[1039]: Leaving mDNS multicast group on interface eth0.IPv4 with address 192.168.0.101.
Dec 22 18:34:32 monte-X230 avahi-daemon[1039]: Interface eth0.IPv4 no longer relevant for mDNS.
Dec 22 18:34:32 monte-X230 NetworkManager[1000]: <info> Writing DNS information to /sbin/resolvconf
Dec 22 18:32:32 monte-X230 dnsmasq[2226]: using nameserver 192.168.0.1#53
Dec 22 18:34:32 monte-X230 dnsmasq[2226]: setting upstream servers from DBus
Dec 22 18:34:32 monte-X230 dnsmasq[2226]: using nameserver 192.168.0.1#53
Dec 22 18:34:32 monte-X230 dbus[832]: [system] Activating service name='org.freedesktop.nm_dispatcher' (using servicehelper)
Dec 22 18:34:32 monte-X230 dbus[832]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Dec 22 18:34:33 monte-X230 ntpd[19399]: Deleting interface #3 eth0, 192.168.0.101#123, interface stats: received=4, sent=10, dropped=0, active_time=110 secs
Dec 22 18:34:33 monte-X230 ntpd[19399]: peers refreshed
Dec 22 18:34:41 monte-X230 thinkpad-dock: Event caught: on
Dec 22 18:34:41 monte-X230 kernel: [ 3735.992972] ACPI: \_SB_.GDCK: docking
Dec 22 18:34:41 monte-X230 kernel: [ 3736.177025] usb 2-1.3: new high-speed USB device number 25 using ehci-pci
Dec 22 18:34:41 monte-X230 kernel: [ 3736.269321] usb 2-1.3: New USB device found, idVendor=0424, idProduct=2514
Dec 22 18:34:41 monte-X230 kernel: [ 3736.269326] usb 2-1.3: New USB device strings: Mfr=0, Product=0, SerialNumber=0
Dec 22 18:34:41 monte-X230 kernel: [ 3736.269634] hub 2-1.3:1.0: USB hub found
Dec 22 18:34:41 monte-X230 kernel: [ 3736.269690] hub 2-1.3:1.0: 4 ports detected
Dec 22 18:34:42 monte-X230 kernel: [ 3736.541247] usb 2-1.3.2: new full-speed USB device number 26 using ehci-pci
Dec 22 18:34:42 monte-X230 kernel: [ 3736.639558] usb 2-1.3.2: New USB device found, idVendor=046d, idProduct=0a17
Dec 22 18:34:42 monte-X230 kernel: [ 3736.639562] usb 2-1.3.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Dec 22 18:34:42 monte-X230 kernel: [ 3736.639564] usb 2-1.3.2: Product: Logitech G330 Headset
Dec 22 18:34:42 monte-X230 kernel: [ 3736.639567] usb 2-1.3.2: Manufacturer: Logitech
Dec 22 18:34:42 monte-X230 kernel: [ 3736.749380] usb 2-1.3.3: new low-speed USB device number 27 using ehci-pci
Dec 22 18:34:42 monte-X230 kernel: [ 3736.874712] usb 2-1.3.3: New USB device found, idVendor=04f2, idProduct=0402
Dec 22 18:34:42 monte-X230 kernel: [ 3736.874716] usb 2-1.3.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Dec 22 18:34:42 monte-X230 kernel: [ 3736.874719] usb 2-1.3.3: Product: USB Keyboard
Dec 22 18:34:42 monte-X230 kernel: [ 3736.874721] usb 2-1.3.3: Manufacturer: Chicony
Dec 22 18:34:42 monte-X230 kernel: [ 3736.883612] input: Chicony USB Keyboard as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.3/2-1.3.3/2-1.3.3:1.0/0003:04F2:0402.001B/input/input41
Dec 22 18:34:42 monte-X230 kernel: [ 3736.883734] hid-generic 0003:04F2:0402.001B: input,hidraw2: USB HID v1.11 Keyboard [Chicony USB Keyboard] on usb-0000:00:1d.0-1.3.3/input0
Dec 22 18:34:42 monte-X230 kernel: [ 3736.904676] input: Chicony USB Keyboard as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.3/2-1.3.3/2-1.3.3:1.1/0003:04F2:0402.001C/input/input42
Dec 22 18:34:42 monte-X230 kernel: [ 3736.904813] hid-generic 0003:04F2:0402.001C: input,hiddev0,hidraw3: USB HID v1.11 Device [Chicony USB Keyboard] on usb-0000:00:1d.0-1.3.3/input1
Dec 22 18:34:42 monte-X230 mtp-probe: checking bus 2, device 26: "/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.3/2-1.3.2"
Dec 22 18:34:42 monte-X230 mtp-probe: bus: 2, device: 26 was not an MTP device
Dec 22 18:34:42 monte-X230 mtp-probe: checking bus 2, device 27: "/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.3/2-1.3.3"
Dec 22 18:34:42 monte-X230 mtp-probe: bus: 2, device: 27 was not an MTP device
Dec 22 18:34:43 monte-X230 kernel: [ 3737.434494] thinkpad_acpi: EC reports that Thermal Table has changed
Dec 22 18:34:43 monte-X230 anacron[19915]: Anacron 2.3 started on 2014-12-22
Dec 22 18:34:43 monte-X230 anacron[19915]: Normal exit (0 jobs run)
Dec 22 18:34:44 monte-X230 kernel: [ 3739.132160] e1000e: eth0 NIC Link is Up 100 Mbps Full Duplex, Flow Control: Rx/Tx
Dec 22 18:34:44 monte-X230 kernel: [ 3739.132168] e1000e 0000:00:19.0 eth0: 10/100 speed: disabling TSO
Dec 22 18:34:44 monte-X230 NetworkManager[1000]: <info> (eth0): carrier now ON (device state 20)
Dec 22 18:34:44 monte-X230 NetworkManager[1000]: <info> (eth0): device state change: unavailable -> disconnected (reason 'carrier-changed') [20 30 40]
Dec 22 18:34:44 monte-X230 NetworkManager[1000]: <info> Auto-activating connection 'Wired connection 1'.
Dec 22 18:34:44 monte-X230 NetworkManager[1000]: <info> Activation (eth0) starting connection 'Wired connection 1'
Dec 22 18:34:44 monte-X230 NetworkManager[1000]: <info> (eth0): device state change: disconnected -> prepare (reason 'none') [30 40 0]
Dec 22 18:34:44 monte-X230 NetworkManager[1000]: <info> Activation (eth0) Stage 1 of 5 (Device Prepare) scheduled...
Dec 22 18:34:44 monte-X230 NetworkManager[1000]: <info> Activation (eth0) Stage 1 of 5 (Device Prepare) started...
Dec 22 18:34:44 monte-X230 NetworkManager[1000]: <info> Activation (eth0) Stage 2 of 5 (Device Configure) scheduled...
Dec 22 18:34:44 monte-X230 NetworkManager[1000]: <info> Activation (eth0) Stage 1 of 5 (Device Prepare) complete.
Dec 22 18:34:44 monte-X230 NetworkManager[1000]: <info> Activation (eth0) Stage 2 of 5 (Device Configure) starting...
Dec 22 18:34:44 monte-X230 NetworkManager[1000]: <info> (eth0): device state change: prepare -> config (reason 'none') [40 50 0]
Dec 22 18:34:44 monte-X230 NetworkManager[1000]: <info> Activation (eth0) Stage 2 of 5 (Device Configure) successful.
Dec 22 18:34:44 monte-X230 NetworkManager[1000]: <info> Activation (eth0) Stage 3 of 5 (IP Configure Start) scheduled.
Dec 22 18:34:44 monte-X230 NetworkManager[1000]: <info> Activation (eth0) Stage 2 of 5 (Device Configure) complete.
Dec 22 18:34:44 monte-X230 NetworkManager[1000]: <info> Activation (eth0) Stage 3 of 5 (IP Configure Start) started...
Dec 22 18:34:44 monte-X230 NetworkManager[1000]: <info> (eth0): device state change: config -> ip-config (reason 'none') [50 70 0]
Dec 22 18:34:44 monte-X230 NetworkManager[1000]: <info> Activation (eth0) Beginning DHCPv4 transaction (timeout in 45 seconds)
Dec 22 18:34:44 monte-X230 NetworkManager[1000]: <info> dhclient started with pid 19944
Dec 22 18:34:44 monte-X230 NetworkManager[1000]: <info> Activation (eth0) Beginning IP6 addrconf.

Thanks for all the data!

I find it a bit odd that there is no output from the thinkpad-scripts themselves. Did you disable the logging to syslog in the configuration file? It would be really helpful to have the full logging output of the scripts from the syslog. In case that you did not disable it, does the stuff show up in syslog when you call the scripts manually?

You wrote in the first post that the hook for on works when you invoke thinkpad-dock on manually in the command line. It just does not work when udev calls it as a hardware event hook. Is that correct?

I just looked through the code and cannot see any reason why the hook itself would be treated differently. So maybe something fails before the hooks are called. The function dock will tell you the order of execution for the on part. Is that part of the program ended early perhaps when run by the hardware hook?

Nope, i did not disable logging. My config.ini file is just

[rotate]
default_rotation = flip

[sound]
unmute = false

[network]
disable_wifi = false

[screen]
brightness = 100
relative_position = left-of

You get me right, when I invoke thinkpad-dock on manually everything works, but not via udev. Thinkpad scripts don't output anything except thinkpad-dock: Event caught: on, when called with by udev. And it logs nothing at all, when called manually. I really can't think why it works like this, I've already looked at the code, but haven't find any obvious reason so far.
The only thing to add to previous post, I mentioned that sudo is used in the main script, so I've removed it from my hook, and it works the same.

This is the log of manually called thinkpad-dock off/on if you would like to look:

Dec 22 21:20:14 monte-X230 postdock-hook: LC_PAPER=uk_UA.UTF-8
Dec 22 21:20:14 monte-X230 postdock-hook: XDG_VTNR=7
Dec 22 21:20:14 monte-X230 postdock-hook: XDG_SESSION_ID=c9
Dec 22 21:20:14 monte-X230 postdock-hook: LC_ADDRESS=uk_UA.UTF-8
Dec 22 21:20:14 monte-X230 postdock-hook: CLUTTER_IM_MODULE=xim
Dec 22 21:20:14 monte-X230 postdock-hook: LC_MONETARY=uk_UA.UTF-8
Dec 22 21:20:14 monte-X230 postdock-hook: SELINUX_INIT=YES
Dec 22 21:20:14 monte-X230 postdock-hook: XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/monte
Dec 22 21:20:14 monte-X230 postdock-hook: SESSION=xubuntu
Dec 22 21:20:14 monte-X230 postdock-hook: GLADE_PIXMAP_PATH=:
Dec 22 21:20:14 monte-X230 postdock-hook: GPG_AGENT_INFO=/run/user/1000/keyring-flBhfo/gpg:0:1
Dec 22 21:20:14 monte-X230 postdock-hook: SHELL=/bin/bash
Dec 22 21:20:14 monte-X230 postdock-hook: XDG_MENU_PREFIX=xfce-
Dec 22 21:20:14 monte-X230 postdock-hook: TERM=xterm
Dec 22 21:20:14 monte-X230 postdock-hook: LC_NUMERIC=uk_UA.UTF-8
Dec 22 21:20:14 monte-X230 postdock-hook: GNOME_KEYRING_CONTROL=/run/user/1000/keyring-flBhfo
Dec 22 21:20:14 monte-X230 postdock-hook: UPSTART_SESSION=unix:abstract=/com/ubuntu/upstart-session/1000/15623
Dec 22 21:20:14 monte-X230 postdock-hook: GTK_MODULES=overlay-scrollbar:unity-gtk-module
Dec 22 21:20:14 monte-X230 postdock-hook: USER=monte
Dec 22 21:20:14 monte-X230 postdock-hook: LC_TELEPHONE=uk_UA.UTF-8
Dec 22 21:20:14 monte-X230 postdock-hook: LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:
Dec 22 21:20:14 monte-X230 postdock-hook: *.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:
Dec 22 21:20:14 monte-X230 postdock-hook: GLADE_MODULE_PATH=:
Dec 22 21:20:14 monte-X230 postdock-hook: XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session3
Dec 22 21:20:14 monte-X230 postdock-hook: XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
Dec 22 21:20:14 monte-X230 postdock-hook: SSH_AUTH_SOCK=/run/user/1000/keyring-flBhfo/ssh
Dec 22 21:20:14 monte-X230 postdock-hook: SESSION_MANAGER=local/monte-X230:@/tmp/.ICE-unix/15798,unix/monte-X230:/tmp/.ICE-unix/15798
Dec 22 21:20:14 monte-X230 postdock-hook: DEFAULTS_PATH=/usr/share/gconf/xubuntu.default.path
Dec 22 21:20:14 monte-X230 postdock-hook: XDG_CONFIG_DIRS=/etc/xdg/xdg-xubuntu:/usr/share/upstart/xdg:/etc/xdg:/etc/xdg
Dec 22 21:20:14 monte-X230 postdock-hook: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
Dec 22 21:20:14 monte-X230 postdock-hook: DESKTOP_SESSION=xubuntu
Dec 22 21:20:14 monte-X230 postdock-hook: _=/usr/bin/env
Dec 22 21:20:14 monte-X230 postdock-hook: QT_QPA_PLATFORMTHEME=appmenu-qt5
Dec 22 21:20:14 monte-X230 postdock-hook: QT_IM_MODULE=ibus
Dec 22 21:20:14 monte-X230 postdock-hook: LC_IDENTIFICATION=uk_UA.UTF-8
Dec 22 21:20:14 monte-X230 postdock-hook: JOB=dbus
Dec 22 21:20:14 monte-X230 postdock-hook: PWD=/home/monte
Dec 22 21:20:14 monte-X230 postdock-hook: XMODIFIERS=@im=ibus
Dec 22 21:20:14 monte-X230 postdock-hook: LANG=en_US.UTF-8
Dec 22 21:20:14 monte-X230 postdock-hook: GNOME_KEYRING_PID=15621
Dec 22 21:20:14 monte-X230 postdock-hook: MANDATORY_PATH=/usr/share/gconf/xubuntu.mandatory.path
Dec 22 21:20:14 monte-X230 postdock-hook: GDM_LANG=en_US
Dec 22 21:20:14 monte-X230 postdock-hook: LC_MEASUREMENT=uk_UA.UTF-8
Dec 22 21:20:14 monte-X230 postdock-hook: IM_CONFIG_PHASE=1
Dec 22 21:20:14 monte-X230 postdock-hook: UBUNTU_MENUPROXY=1
Dec 22 21:20:14 monte-X230 postdock-hook: GDMSESSION=xubuntu
Dec 22 21:20:14 monte-X230 postdock-hook: SESSIONTYPE=
Dec 22 21:20:14 monte-X230 postdock-hook: XDG_SEAT=seat0
Dec 22 21:20:14 monte-X230 postdock-hook: HOME=/home/monte
Dec 22 21:20:14 monte-X230 postdock-hook: SHLVL=3
Dec 22 21:20:14 monte-X230 postdock-hook: LANGUAGE=en_US
Dec 22 21:20:14 monte-X230 postdock-hook: UPSTART_INSTANCE=
Dec 22 21:20:14 monte-X230 postdock-hook: LOGNAME=monte
Dec 22 21:20:14 monte-X230 postdock-hook: UPSTART_EVENTS=started xsession
Dec 22 21:20:14 monte-X230 postdock-hook: QT4_IM_MODULE=xim
Dec 22 21:20:14 monte-X230 postdock-hook: XDG_DATA_DIRS=/usr/share/xubuntu:/usr/share/xfce4:/usr/local/share/:/usr/share/:/usr/share
Dec 22 21:20:14 monte-X230 postdock-hook: DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-u0OchiTsps
Dec 22 21:20:14 monte-X230 postdock-hook: LESSOPEN=| /usr/bin/lesspipe %s
Dec 22 21:20:14 monte-X230 postdock-hook: UPSTART_JOB=startxfce4
Dec 22 21:20:14 monte-X230 postdock-hook: INSTANCE=
Dec 22 21:20:14 monte-X230 postdock-hook: TEXTDOMAIN=im-config
Dec 22 21:20:14 monte-X230 postdock-hook: DISPLAY=:0.0
Dec 22 21:20:14 monte-X230 postdock-hook: XDG_RUNTIME_DIR=/run/user/1000
Dec 22 21:20:14 monte-X230 postdock-hook: GLADE_CATALOG_PATH=:
Dec 22 21:20:14 monte-X230 postdock-hook: GTK_IM_MODULE=ibus
Dec 22 21:20:14 monte-X230 postdock-hook: XDG_CURRENT_DESKTOP=XFCE
Dec 22 21:20:14 monte-X230 postdock-hook: LC_TIME=uk_UA.UTF-8
Dec 22 21:20:14 monte-X230 postdock-hook: LESSCLOSE=/usr/bin/lesspipe %s %s
Dec 22 21:20:14 monte-X230 postdock-hook: TEXTDOMAINDIR=/usr/share/locale/
Dec 22 21:20:14 monte-X230 postdock-hook: XAUTHORITY=/home/monte/.Xauthority
Dec 22 21:20:14 monte-X230 postdock-hook: LC_NAME=uk_UA.UTF-8
Dec 22 21:20:18 monte-X230 wpa_supplicant[1655]: wlan0: CTRL-EVENT-SCAN-STARTED 
Dec 22 21:20:22 monte-X230 NetworkManager[1000]: <info> (eth0): disconnecting for new activation request.
Dec 22 21:20:22 monte-X230 NetworkManager[1000]: <info> (eth0): device state change: activated -> disconnected (reason 'none') [100 30 0]
Dec 22 21:20:22 monte-X230 NetworkManager[1000]: <info> (eth0): deactivating device (reason 'none') [0]
Dec 22 21:20:22 monte-X230 NetworkManager[1000]: <info> (eth0): canceled DHCP transaction, DHCP client pid 29561
Dec 22 21:20:22 monte-X230 NetworkManager[1000]: <info> Policy set 'monte_wlan_ddwrt' (wlan0) as default for IPv4 routing and DNS.
Dec 22 21:20:22 monte-X230 avahi-daemon[1039]: Withdrawing address record for 192.168.0.101 on eth0.
Dec 22 21:20:22 monte-X230 avahi-daemon[1039]: Leaving mDNS multicast group on interface eth0.IPv4 with address 192.168.0.101.
Dec 22 21:20:22 monte-X230 avahi-daemon[1039]: Interface eth0.IPv4 no longer relevant for mDNS.
Dec 22 21:20:22 monte-X230 NetworkManager[1000]: <info> Writing DNS information to /sbin/resolvconf
Dec 22 19:24:48 monte-X230 dnsmasq[2226]: using nameserver 192.168.0.1#53
Dec 22 21:20:22 monte-X230 dnsmasq[2226]: setting upstream servers from DBus
Dec 22 21:20:22 monte-X230 dnsmasq[2226]: using nameserver 192.168.0.1#53
Dec 22 21:20:22 monte-X230 NetworkManager[1000]: <info> Activation (eth0) starting connection 'Wired connection 1'
Dec 22 21:20:22 monte-X230 NetworkManager[1000]: <info> (eth0): device state change: disconnected -> prepare (reason 'none') [30 40 0]
Dec 22 21:20:22 monte-X230 dbus[832]: [system] Activating service name='org.freedesktop.nm_dispatcher' (using servicehelper)
Dec 22 21:20:22 monte-X230 NetworkManager[1000]: <info> Activation (eth0) Stage 1 of 5 (Device Prepare) scheduled...
Dec 22 21:20:22 monte-X230 NetworkManager[1000]: <info> Activation (eth0) Stage 1 of 5 (Device Prepare) started...
Dec 22 21:20:22 monte-X230 NetworkManager[1000]: <info> Activation (eth0) Stage 2 of 5 (Device Configure) scheduled...
Dec 22 21:20:22 monte-X230 NetworkManager[1000]: <info> Activation (eth0) Stage 1 of 5 (Device Prepare) complete.
Dec 22 21:20:22 monte-X230 NetworkManager[1000]: <info> Activation (eth0) Stage 2 of 5 (Device Configure) starting...
Dec 22 21:20:22 monte-X230 NetworkManager[1000]: <info> (eth0): device state change: prepare -> config (reason 'none') [40 50 0]
Dec 22 21:20:22 monte-X230 NetworkManager[1000]: <info> Activation (eth0) Stage 2 of 5 (Device Configure) successful.
Dec 22 21:20:22 monte-X230 NetworkManager[1000]: <info> Activation (eth0) Stage 3 of 5 (IP Configure Start) scheduled.
Dec 22 21:20:22 monte-X230 NetworkManager[1000]: <info> Activation (eth0) Stage 2 of 5 (Device Configure) complete.
Dec 22 21:20:22 monte-X230 NetworkManager[1000]: <info> Activation (eth0) Stage 3 of 5 (IP Configure Start) started...
Dec 22 21:20:22 monte-X230 NetworkManager[1000]: <info> (eth0): device state change: config -> ip-config (reason 'none') [50 70 0]
Dec 22 21:20:22 monte-X230 NetworkManager[1000]: <info> Activation (eth0) Beginning DHCPv4 transaction (timeout in 45 seconds)
Dec 22 21:20:22 monte-X230 NetworkManager[1000]: <info> dhclient started with pid 3749
Dec 22 21:20:22 monte-X230 NetworkManager[1000]: <info> Activation (eth0) Beginning IP6 addrconf.
Dec 22 21:20:22 monte-X230 avahi-daemon[1039]: Withdrawing address record for fe80::3e97:eff:fe1c:bc0 on eth0.
Dec 22 21:20:22 monte-X230 avahi-daemon[1039]: Leaving mDNS multicast group on interface eth0.IPv6 with address fe80::3e97:eff:fe1c:bc0.
Dec 22 21:20:22 monte-X230 avahi-daemon[1039]: Interface eth0.IPv6 no longer relevant for mDNS.
Dec 22 21:20:22 monte-X230 NetworkManager[1000]: <info> Activation (eth0) Stage 3 of 5 (IP Configure Start) complete.
Dec 22 21:20:22 monte-X230 dbus[832]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Dec 22 21:20:22 monte-X230 dhclient: Internet Systems Consortium DHCP Client 4.2.4
Dec 22 21:20:22 monte-X230 dhclient: Copyright 2004-2012 Internet Systems Consortium.
Dec 22 21:20:22 monte-X230 dhclient: All rights reserved.
Dec 22 21:20:22 monte-X230 dhclient: For info, please visit https://www.isc.org/software/dhcp/
Dec 22 21:20:22 monte-X230 dhclient: 
Dec 22 21:20:22 monte-X230 NetworkManager[1000]: <info> (eth0): DHCPv4 state changed nbi -> preinit
Dec 22 21:20:22 monte-X230 dhclient: Listening on LPF/eth0/3c:97:0e:1c:0b:c0
Dec 22 21:20:22 monte-X230 dhclient: Sending on   LPF/eth0/3c:97:0e:1c:0b:c0
Dec 22 21:20:22 monte-X230 dhclient: Sending on   Socket/fallback
Dec 22 21:20:22 monte-X230 dhclient: DHCPREQUEST of 192.168.0.101 on eth0 to 255.255.255.255 port 67 (xid=0x12fb2030)
Dec 22 21:20:22 monte-X230 dhclient: DHCPACK of 192.168.0.101 from 192.168.0.1
Dec 22 21:20:22 monte-X230 dhclient: bound to 192.168.0.101 -- renewal in 2147483648 seconds.
Dec 22 21:20:22 monte-X230 NetworkManager[1000]: <info> (eth0): DHCPv4 state changed preinit -> reboot
Dec 22 21:20:22 monte-X230 NetworkManager[1000]: <info>   address 192.168.0.101
Dec 22 21:20:22 monte-X230 NetworkManager[1000]: <info>   prefix 24 (255.255.255.0)
Dec 22 21:20:22 monte-X230 NetworkManager[1000]: <info>   gateway 192.168.0.1
Dec 22 21:20:22 monte-X230 NetworkManager[1000]: <info>   hostname 'monte-x230-eth'
Dec 22 21:20:22 monte-X230 NetworkManager[1000]: <info>   nameserver '192.168.0.1'
Dec 22 21:20:22 monte-X230 NetworkManager[1000]: <info> Activation (eth0) Stage 5 of 5 (IPv4 Configure Commit) scheduled...
Dec 22 21:20:22 monte-X230 NetworkManager[1000]: <info> Activation (eth0) Stage 5 of 5 (IPv4 Commit) started...
Dec 22 21:20:22 monte-X230 avahi-daemon[1039]: Joining mDNS multicast group on interface eth0.IPv4 with address 192.168.0.101.
Dec 22 21:20:22 monte-X230 avahi-daemon[1039]: New relevant interface eth0.IPv4 for mDNS.
Dec 22 21:20:22 monte-X230 avahi-daemon[1039]: Registering new address record for 192.168.0.101 on eth0.IPv4.
Dec 22 21:20:23 monte-X230 NetworkManager[1000]: <info> (eth0): device state change: ip-config -> secondaries (reason 'none') [70 90 0]
Dec 22 21:20:23 monte-X230 NetworkManager[1000]: <info> Activation (eth0) Stage 5 of 5 (IPv4 Commit) complete.
Dec 22 21:20:23 monte-X230 NetworkManager[1000]: <info> (eth0): device state change: secondaries -> activated (reason 'none') [90 100 0]
Dec 22 21:20:23 monte-X230 NetworkManager[1000]: <info> Policy set 'Wired connection 1' (eth0) as default for IPv4 routing and DNS.
Dec 22 21:20:23 monte-X230 NetworkManager[1000]: <info> Writing DNS information to /sbin/resolvconf
Dec 22 21:20:23 monte-X230 dnsmasq[2226]: setting upstream servers from DBus
Dec 22 21:20:23 monte-X230 dnsmasq[2226]: using nameserver 192.168.0.1#53
Dec 22 21:20:23 monte-X230 NetworkManager[1000]: <info> Activation (eth0) successful, device activated.
Dec 22 21:20:23 monte-X230 ntpd[29788]: ntpd exiting on signal 15
Dec 22 21:20:24 monte-X230 avahi-daemon[1039]: Joining mDNS multicast group on interface eth0.IPv6 with address fe80::3e97:eff:fe1c:bc0.
Dec 22 21:20:24 monte-X230 avahi-daemon[1039]: New relevant interface eth0.IPv6 for mDNS.
Dec 22 21:20:24 monte-X230 avahi-daemon[1039]: Registering new address record for fe80::3e97:eff:fe1c:bc0 on eth0.*.
Dec 22 21:20:25 monte-X230 postdock-hook: LC_PAPER=uk_UA.UTF-8
Dec 22 21:20:25 monte-X230 postdock-hook: XDG_VTNR=7
Dec 22 21:20:25 monte-X230 postdock-hook: XDG_SESSION_ID=c9
Dec 22 21:20:25 monte-X230 postdock-hook: LC_ADDRESS=uk_UA.UTF-8
Dec 22 21:20:25 monte-X230 postdock-hook: CLUTTER_IM_MODULE=xim
Dec 22 21:20:25 monte-X230 postdock-hook: LC_MONETARY=uk_UA.UTF-8
Dec 22 21:20:25 monte-X230 postdock-hook: SELINUX_INIT=YES
Dec 22 21:20:25 monte-X230 postdock-hook: XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/monte
Dec 22 21:20:25 monte-X230 postdock-hook: SESSION=xubuntu
Dec 22 21:20:25 monte-X230 postdock-hook: GLADE_PIXMAP_PATH=:
Dec 22 21:20:25 monte-X230 postdock-hook: GPG_AGENT_INFO=/run/user/1000/keyring-flBhfo/gpg:0:1
Dec 22 21:20:25 monte-X230 postdock-hook: SHELL=/bin/bash
Dec 22 21:20:25 monte-X230 postdock-hook: XDG_MENU_PREFIX=xfce-
Dec 22 21:20:25 monte-X230 postdock-hook: TERM=xterm
Dec 22 21:20:25 monte-X230 postdock-hook: LC_NUMERIC=uk_UA.UTF-8
Dec 22 21:20:25 monte-X230 postdock-hook: GNOME_KEYRING_CONTROL=/run/user/1000/keyring-flBhfo
Dec 22 21:20:25 monte-X230 postdock-hook: UPSTART_SESSION=unix:abstract=/com/ubuntu/upstart-session/1000/15623
Dec 22 21:20:25 monte-X230 postdock-hook: GTK_MODULES=overlay-scrollbar:unity-gtk-module
Dec 22 21:20:25 monte-X230 postdock-hook: USER=monte
Dec 22 21:20:25 monte-X230 postdock-hook: LC_TELEPHONE=uk_UA.UTF-8
Dec 22 21:20:25 monte-X230 postdock-hook: LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:
Dec 22 21:20:25 monte-X230 postdock-hook: *.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:
Dec 22 21:20:25 monte-X230 postdock-hook: GLADE_MODULE_PATH=:
Dec 22 21:20:25 monte-X230 postdock-hook: XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session3
Dec 22 21:20:25 monte-X230 postdock-hook: XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
Dec 22 21:20:25 monte-X230 postdock-hook: SSH_AUTH_SOCK=/run/user/1000/keyring-flBhfo/ssh
Dec 22 21:20:25 monte-X230 postdock-hook: SESSION_MANAGER=local/monte-X230:@/tmp/.ICE-unix/15798,unix/monte-X230:/tmp/.ICE-unix/15798
Dec 22 21:20:25 monte-X230 postdock-hook: DEFAULTS_PATH=/usr/share/gconf/xubuntu.default.path
Dec 22 21:20:25 monte-X230 postdock-hook: XDG_CONFIG_DIRS=/etc/xdg/xdg-xubuntu:/usr/share/upstart/xdg:/etc/xdg:/etc/xdg
Dec 22 21:20:25 monte-X230 postdock-hook: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
Dec 22 21:20:25 monte-X230 postdock-hook: DESKTOP_SESSION=xubuntu
Dec 22 21:20:25 monte-X230 postdock-hook: _=/usr/bin/env
Dec 22 21:20:25 monte-X230 postdock-hook: QT_QPA_PLATFORMTHEME=appmenu-qt5
Dec 22 21:20:25 monte-X230 postdock-hook: QT_IM_MODULE=ibus
Dec 22 21:20:25 monte-X230 postdock-hook: LC_IDENTIFICATION=uk_UA.UTF-8
Dec 22 21:20:25 monte-X230 postdock-hook: JOB=dbus
Dec 22 21:20:25 monte-X230 postdock-hook: PWD=/home/monte
Dec 22 21:20:25 monte-X230 postdock-hook: XMODIFIERS=@im=ibus
Dec 22 21:20:25 monte-X230 postdock-hook: LANG=en_US.UTF-8
Dec 22 21:20:25 monte-X230 postdock-hook: GNOME_KEYRING_PID=15621
Dec 22 21:20:25 monte-X230 postdock-hook: MANDATORY_PATH=/usr/share/gconf/xubuntu.mandatory.path
Dec 22 21:20:25 monte-X230 postdock-hook: GDM_LANG=en_US
Dec 22 21:20:25 monte-X230 postdock-hook: LC_MEASUREMENT=uk_UA.UTF-8
Dec 22 21:20:25 monte-X230 postdock-hook: IM_CONFIG_PHASE=1
Dec 22 21:20:25 monte-X230 postdock-hook: UBUNTU_MENUPROXY=1
Dec 22 21:20:25 monte-X230 postdock-hook: GDMSESSION=xubuntu
Dec 22 21:20:25 monte-X230 postdock-hook: SESSIONTYPE=
Dec 22 21:20:25 monte-X230 postdock-hook: XDG_SEAT=seat0
Dec 22 21:20:25 monte-X230 postdock-hook: HOME=/home/monte
Dec 22 21:20:25 monte-X230 postdock-hook: SHLVL=3
Dec 22 21:20:25 monte-X230 postdock-hook: LANGUAGE=en_US
Dec 22 21:20:25 monte-X230 postdock-hook: UPSTART_INSTANCE=
Dec 22 21:20:25 monte-X230 postdock-hook: LOGNAME=monte
Dec 22 21:20:25 monte-X230 postdock-hook: UPSTART_EVENTS=started xsession
Dec 22 21:20:25 monte-X230 postdock-hook: QT4_IM_MODULE=xim
Dec 22 21:20:25 monte-X230 postdock-hook: XDG_DATA_DIRS=/usr/share/xubuntu:/usr/share/xfce4:/usr/local/share/:/usr/share/:/usr/share
Dec 22 21:20:25 monte-X230 postdock-hook: DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-u0OchiTsps
Dec 22 21:20:25 monte-X230 postdock-hook: LESSOPEN=| /usr/bin/lesspipe %s
Dec 22 21:20:25 monte-X230 postdock-hook: UPSTART_JOB=startxfce4
Dec 22 21:20:25 monte-X230 postdock-hook: INSTANCE=
Dec 22 21:20:25 monte-X230 postdock-hook: TEXTDOMAIN=im-config
Dec 22 21:20:25 monte-X230 postdock-hook: DISPLAY=:0.0
Dec 22 21:20:25 monte-X230 postdock-hook: XDG_RUNTIME_DIR=/run/user/1000
Dec 22 21:20:25 monte-X230 postdock-hook: GLADE_CATALOG_PATH=:
Dec 22 21:20:25 monte-X230 postdock-hook: GTK_IM_MODULE=ibus
Dec 22 21:20:25 monte-X230 postdock-hook: XDG_CURRENT_DESKTOP=XFCE
Dec 22 21:20:25 monte-X230 postdock-hook: LC_TIME=uk_UA.UTF-8
Dec 22 21:20:25 monte-X230 postdock-hook: LESSCLOSE=/usr/bin/lesspipe %s %s
Dec 22 21:20:25 monte-X230 postdock-hook: TEXTDOMAINDIR=/usr/share/locale/
Dec 22 21:20:25 monte-X230 postdock-hook: XAUTHORITY=/home/monte/.Xauthority
Dec 22 21:20:25 monte-X230 postdock-hook: LC_NAME=uk_UA.UTF-8
Dec 22 21:20:33 monte-X230 ntpdate[3845]: adjust time server 62.149.0.30 offset -0.003577 sec
Dec 22 21:20:33 monte-X230 ntpd[3954]: ntpd 4.2.6p5@1.2349-o Wed Oct  9 19:08:06 UTC 2013 (1)

To be honest, I do not see what is wrong with it. Maybe the parameter is not passed correctly to the hook? I just put this into a postdock hook on my machine:

#!/bin/bash
logger -t thinkpad-scripts-my-hooks "'$#': '$0' '$1' '$2'"

It seems like on and off are the actual parameters to the script. Do you have any hunch on this maybe?

Do you have any update on this or did you just give up?

Not directly an update but for me it the same behaviour. Discovered with a T440