Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 199806 - sys-power/hibernate-script-1.97-r2 - Searching for running X11 fails from GDM, wrong use of bash build-in "command" to run "xauth"
Summary: sys-power/hibernate-script-1.97-r2 - Searching for running X11 fails from GDM...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Alon Bar-Lev (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-20 17:56 UTC by Daniel Schömer
Modified: 2007-11-25 16:20 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Fix use of "command -v xauth" to "command xauth" (a.patch,478 bytes, patch)
2007-11-20 17:57 UTC, Daniel Schömer
Details | Diff
Exchange arguments on function get_env_var_of_process (b.patch,623 bytes, patch)
2007-11-24 09:46 UTC, Daniel Schömer
Details | Diff
Output of hibernate --verbosity=4 after appling b.patch (hibernate-ok.log,101.80 KB, text/plain)
2007-11-24 09:47 UTC, Daniel Schömer
Details
Output of hibernate --verbosity=4 (hibernate-not-ok.log,14.14 KB, text/plain)
2007-11-24 10:47 UTC, Daniel Schömer
Details
Output of "hibernate --verbosity=4" with PauseAudio disabled (hibernate-not-ok_no-pause-audio.log,20.51 KB, text/plain)
2007-11-24 19:28 UTC, Daniel Schömer
Details
Output of "hibernate --verbosity=4" without any X and service related options, except LockGnomeScreenSaver yes (hibernate-ok_no-x_except-lock-gnome-screensaver.log,79.96 KB, text/plain)
2007-11-24 21:03 UTC, Daniel Schömer
Details
Hibernate config for attachment 136921 (common.conf,3.97 KB, text/plain)
2007-11-24 21:04 UTC, Daniel Schömer
Details
Output of "hibernate --verbosity=4" without any X and service related options, except LockGnomeScreenSaver yes and XStatus gnome (hibernate-not-ok_no-x_except-lock-gnome-screensaver-and-xstatus.log,21.25 KB, text/plain)
2007-11-24 21:31 UTC, Daniel Schömer
Details
Hibernate config for attachment 136924 (common.conf,3.97 KB, text/plain)
2007-11-24 21:32 UTC, Daniel Schömer
Details
Working hibernate configuration (common.conf,3.97 KB, text/plain)
2007-11-24 22:53 UTC, Daniel Schömer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Schömer 2007-11-20 17:56:45 UTC
Hibernation aborts, if I'm logged out and GDM is waiting for someone to login. The output of "hibernate -v3" indicates to me an authentication error against X11.

In shell-function FindXServer() at line 179 of /usr/sbin/hibernate I found

  xhost=`command -v xhost 2>/dev/null`

This only prints the path of the xhost executable and return 0. It does not acutally run xhost (see COMMAND(1P) and bash documentation). After removing the '-v', function FindXServer() finds my X server and hibernation works even from GDM.

Reproducible: Always

Steps to Reproduce:
(I assume a working sys-power/suspend s2disk system)
1. Install sys-power/hibernate-script-1.97-r2, gnome-base/gdm, gnome-extra/zenity
2. Run GDM without loggin in
3. Configure hibernate to "LockGnomeScreenSaver yes" and "XStatus gnome"
4. Run "hibernate -v3" from console

Actual Results:  
hibernate: Trying method in suspend2.conf...
hibernate: Trying method in disk.conf...
hibernate: Trying method in ususpend-disk.conf...
hibernate: Including configuration from common.conf
Using '/etc/init.d' as init.d directory.
/usr/sbin/hibernate: line 810: /proc/XAUTHORITY/environ: No such file or directory
/usr/sbin/hibernate: line 810: /proc/HOME/environ: No such file or directory
hibernate: [01] Executing CheckLastResume ...
hibernate: [01] Executing CheckRunlevel ...
hibernate: [01] Executing LockFileGet ...
hibernate: [01] Executing NewKernelFileCheck ...
hibernate: [05] Executing XStatusSuspendBegin ...
hibernate: [10] Executing EnsureUSuspendCapable ...
hibernate: [11] Executing XHacksSuspendHook1 ...
hibernate: [15] Executing PauseAudio ...
Xlib: connection to ":0.0" refused by server
Xlib: Invalid MIT-MAGIC-COOKIE-1 key

(zenity:18638): Gtk-WARNING **: cannot open display: :0
hibernate: Suspend aborted by user.
/usr/share/hibernate/scriptlets.d/xstatus: line 101: echo: write error: Broken pipe
hibernate: [15] Executing XStatusProgress ...
hibernate: [11] Executing XHacksResumeHook1 ...
hibernate: [05] Executing XStatusProgressKill ...
hibernate: [01] Executing XStatusReportErrors ...
hibernate: [01] Executing NoteLastResume ...
hibernate: [01] Executing LockFilePut ...


Expected Results:  
hibernate: Trying method in suspend2.conf...
hibernate: Trying method in disk.conf...
hibernate: Trying method in ususpend-disk.conf...
hibernate: Including configuration from common.conf
Using '/etc/init.d' as init.d directory.
hibernate: Could not find xhost program. Disabling X scriptlets.
hibernate: [01] Executing CheckLastResume ...
hibernate: [01] Executing CheckRunlevel ...
hibernate: [01] Executing LockFileGet ...
hibernate: [01] Executing NewKernelFileCheck ...
hibernate: [10] Executing EnsureUSuspendCapable ...
hibernate: [11] Executing XHacksSuspendHook1 ...
hibernate: [15] Executing PauseAudio ...
hibernate: [30] Executing ServicesStop ...
Executing /etc/init.d/lircd stop
 [32;01m*[0m Service lircd stopping
 [32;01m*[0m Service irexec-user stopping
 [32;01m*[0m Service irexec-user stopped
 [32;01m*[0m Service lircd stopped
Executing /etc/init.d/fcron stop
 [32;01m*[0m Service fcron stopping
 [32;01m*[0m Service fcron stopped
Executing /etc/init.d/nscd stop
 [32;01m*[0m Service nscd stopping
 [32;01m*[0m Service nscd stopped
hibernate: [59] Executing RemountXFSBootRO ...
hibernate: [89] Executing SaveKernelModprobe ...
Saved /proc/sys/kernel/modprobe is /sbin/modprobe
hibernate: [91] Executing LockGnomeScreensaver ...
Locking daniel's gnome-screensaver on display :0 using authority file /home/daniel/.Xauthority
hibernate: [91] Executing ModulesUnloadBlacklist ...
Unloading blacklisted modules listed /etc/hibernate/blacklisted-modules
Unloading blacklisted module lirc_serial (and dependencies)
Unloading lirc_serial ...
Removing modules with rmmod.
Unloading blacklisted module lirc_dev (and dependencies)
Unloading lirc_dev ...
Module version for ipw2100 is
Module version for ipw2200 is
Module version for snd_bt_sco is
Module version for ndiswrapper is
hibernate: [95] Executing XHacksSuspendHook2 ...
xhacks: changing console from 1 to 15
hibernate: [98] Executing CheckRunlevel ...
hibernate: [99] Executing DoUSuspend ...
hibernate: Running /usr/sbin/s2disk ...
hibernate: [91] Executing GentooModulesAutoload ...
Loading modules listed /etc/modules.autoload.d/kernel-2.6
Loading fscher
Loading usbnek4k
hibernate: [90] Executing ModulesLoad ...
Loading module lirc_serial (from auto)...
Loading module lirc_dev (from auto)...
hibernate: [89] Executing RestoreKernelModprobe ...
hibernate: [85] Executing XHacksResumeHook2 ...
xhacks: changing console back to 1
hibernate: [70] Executing ClockRestore ...
hibernate: [59] Executing RemountXFSBootRW ...
hibernate: [30] Executing UnlockGnomeScreensaver ...
Unlocking daniel's gnome-screensaver on display :0 using authority file /home/daniel/.Xauthority
hibernate: [30] Executing ServicesStart ...
Executing /etc/init.d/nscd start
 [32;01m*[0m Service nscd starting
 [32;01m*[0m Service nscd started
Executing /etc/init.d/fcron start
 [32;01m*[0m Service fcron starting
 [32;01m*[0m Service fcron started
Executing /etc/init.d/irexec-user start
 [32;01m*[0m Service irexec-user starting
 [32;01m*[0m Service lircd starting
 [32;01m*[0m Service lircd started
 [32;01m*[0m Service irexec-user started
hibernate: [20] Executing MiscLaunchAuxFunc1 ...
Executing /bin/sh /etc/conf.d/local.start...
hibernate: [11] Executing XHacksResumeHook1 ...
hibernate: [01] Executing NoteLastResume ...
hibernate: [01] Executing LockFilePut ...
Comment 1 Daniel Schömer 2007-11-20 17:57:34 UTC
Created attachment 136510 [details, diff]
Fix use of "command -v xauth" to "command xauth"
Comment 2 Alon Bar-Lev (RETIRED) gentoo-dev 2007-11-24 07:17:58 UTC
You just disabled all X behavior.
hibernate: Could not find xhost program. Disabling X scriptlets.

Please attach the output of hibernate with --verbosity=4
Comment 3 Daniel Schömer 2007-11-24 09:42:48 UTC
from tty1 while nobody logged into X

# sudo hibernate --verbosity=4
hibernate: Trying method in suspend2.conf...
hibernate: Trying method in disk.conf...
hibernate: Trying method in ususpend-disk.conf...
hibernate: Including configuration from common.conf
Using '/etc/init.d' as init.d directory.
/usr/sbin/hibernate: line 810: /proc/XAUTHORITY/environ: No such file or directory
/usr/sbin/hibernate: line 810: /proc/HOME/environ: No such file or directory
+ tee -a -i /var/log/hibernate.log
++ date
+ echo 'Starting suspend at Sat' Nov 24 10:32:53 CET 2007
+ EXIT_CODE=0
+ '[' 'tee -a -i /var/log/hibernate.log' = cat ']'
+ '[' -n 1 ']'
+ DoWork
+ tee -a -i /var/log/hibernate.log
+ trap ctrlc_handler INT HUP
+ local ret
+ local CHAIN_UP_TO
+ local bit
+ CHAIN_UP_TO=0
++ SortSuspendBits
++ sort -n
++ /bin/echo -ne '98XStatusProgressKill\n95XStatusProgress\n90XStatusProgress\n80XStatusProgress\n70XStatusProgress\n60XStatusProgress\n50XStatusProgress\n40XStatusProgress\n30XStatusProgress\n20XStatusProgress\n05XStatusSuspendBegin\n95XHacksSuspendHook2\n11XHacksSuspendHook1\n30ServicesStop\n15PauseAudio\n91ModulesUnloadBlacklist\n91LockGnomeScreensaver\n99DoUSuspend\n10EnsureUSuspendCapable\n59RemountXFSBootRO\n01NewKernelFileCheck\n89SaveKernelModprobe\n98CheckRunlevel\n01CheckRunlevel\n01CheckLastResume\n01LockFileGet\n'
+ for bit in '`SortSuspendBits`'
+ local new_CHAIN_UP_TO
++ awk 'BEGIN{print substr("01CheckLastResume", 1, 2)}'
+ new_CHAIN_UP_TO=01
+ '[' -n 01 ']'
+ CHAIN_UP_TO=01
+ bit=CheckLastResume
+ vecho 1 'hibernate: [01] Executing CheckLastResume ... '
+ local v
+ v=1
+ shift
+ '[' x = x1 ']'
+ '[' 1 -le 4 ']'
+ echo hibernate: '[01]' Executing CheckLastResume ...
+ '[' -n '' ']'
+ CheckLastResume
+ '[' -f /var/run/hibernate-last-resume ']'
+ local last_resume now
+ read last_resume
hibernate: [01] Executing CheckLastResume ...
++ date +%s
+ now=1195896773
+ '[' 1195896773 -gt 1195896756 ']'
+ rm -f /var/run/hibernate-last-resume
+ return 0
+ ret=0
+ '[' 0 -ge 2 ']'
+ '[' 0 -gt 0 ']'
+ '[' -n '' ']'
+ for bit in '`SortSuspendBits`'
+ local new_CHAIN_UP_TO
++ awk 'BEGIN{print substr("01CheckRunlevel", 1, 2)}'
+ new_CHAIN_UP_TO=01
+ '[' -n 01 ']'
+ CHAIN_UP_TO=01
+ bit=CheckRunlevel
+ vecho 1 'hibernate: [01] Executing CheckRunlevel ... '
+ local v
+ v=1
+ shift
+ '[' x = x1 ']'
+ '[' 1 -le 4 ']'
+ echo hibernate: '[01]' Executing CheckRunlevel ...
+ '[' -n '' ']'
+ CheckRunlevel
+ '[' -z '' ']'
hibernate: [01] Executing CheckRunlevel ...
++ /sbin/runlevel
++ awk '{print $2}'
+ RUNLEVEL=3
+ case "${RUNLEVEL}" in
+ return 0
+ ret=0
+ '[' 0 -ge 2 ']'
+ '[' 0 -gt 0 ']'
+ '[' -n '' ']'
+ for bit in '`SortSuspendBits`'
+ local new_CHAIN_UP_TO
++ awk 'BEGIN{print substr("01LockFileGet", 1, 2)}'
+ new_CHAIN_UP_TO=01
+ '[' -n 01 ']'
+ CHAIN_UP_TO=01
+ bit=LockFileGet
+ vecho 1 'hibernate: [01] Executing LockFileGet ... '
+ local v
+ v=1
+ shift
+ '[' x = x1 ']'
+ '[' 1 -le 4 ']'
+ echo hibernate: '[01]' Executing LockFileGet ...
+ '[' -n '' ']'
+ LockFileGet
+ local other_pid
+ '[' -f /var/run/hibernate-script.pid ']'
+ echo 24570
+ LOCKFILE_IN_USE=1
+ return 0
+ ret=0
+ '[' 0 -ge 2 ']'
+ '[' 0 -gt 0 ']'
+ '[' -n '' ']'
+ for bit in '`SortSuspendBits`'
+ local new_CHAIN_UP_TO
hibernate: [01] Executing LockFileGet ...
++ awk 'BEGIN{print substr("01NewKernelFileCheck", 1, 2)}'
+ new_CHAIN_UP_TO=01
+ '[' -n 01 ']'
+ CHAIN_UP_TO=01
+ bit=NewKernelFileCheck
+ vecho 1 'hibernate: [01] Executing NewKernelFileCheck ... '
+ local v
+ v=1
+ shift
+ '[' x = x1 ']'
+ '[' 1 -le 4 ']'
+ echo hibernate: '[01]' Executing NewKernelFileCheck ...
+ '[' -n '' ']'
+ NewKernelFileCheck
+ '[' -f /var/run/suspend2-new-kernel ']'
+ return 0
+ ret=0
+ '[' 0 -ge 2 ']'
+ '[' 0 -gt 0 ']'
+ '[' -n '' ']'
+ for bit in '`SortSuspendBits`'
+ local new_CHAIN_UP_TO
hibernate: [01] Executing NewKernelFileCheck ...
++ awk 'BEGIN{print substr("05XStatusSuspendBegin", 1, 2)}'
+ new_CHAIN_UP_TO=05
+ '[' -n 05 ']'
+ CHAIN_UP_TO=05
+ bit=XStatusSuspendBegin
+ vecho 1 'hibernate: [05] Executing XStatusSuspendBegin ... '
+ local v
+ v=1
+ shift
+ '[' x = x1 ']'
+ '[' 1 -le 4 ']'
+ echo hibernate: '[05]' Executing XStatusSuspendBegin ...
+ '[' -n '' ']'
+ XStatusSuspendBegin
+ '[' -z gnome ']'
+ XSTATUS_PROGRESS=10
+ XStatusProgressStart_gnome 'Preparing to suspend...'
+ trap XStatusProgressPIPEhandler_gnome PIPE
++ /bin/sh -c 'echo $PPID'
hibernate: [05] Executing XStatusSuspendBegin ...
+ pid_to_kill=24751
+ '[' -n '' ']'
+ eval 'exec 8> >(XStatusProgressStart_gnomeZenityHelper "Preparing to suspend...")'
++ exec
+ echo 10
+ ZENITY_OPEN=1
+ return 0
+ ret=0
+ '[' 0 -ge 2 ']'
+ '[' 0 -gt 0 ']'
+ '[' -n '' ']'
+ for bit in '`SortSuspendBits`'
+ local new_CHAIN_UP_TO
++ awk 'BEGIN{print substr("10EnsureUSuspendCapable", 1, 2)}'
+++ XStatusProgressStart_gnomeZenityHelper 'Preparing to suspend...'
+++ trap zenity_hup_handler HUP
+++ zenity --progress --auto-close --title=Hibernate '--text=Preparing to suspend...'
+ new_CHAIN_UP_TO=10
+ '[' -n 10 ']'
+ CHAIN_UP_TO=10
+ bit=EnsureUSuspendCapable
+ vecho 1 'hibernate: [10] Executing EnsureUSuspendCapable ... '
+ local v
+ v=1
+ shift
+ '[' x = x1 ']'
+ '[' 1 -le 4 ']'
+ echo hibernate: '[10]' Executing EnsureUSuspendCapable ...
hibernate: [10] Executing EnsureUSuspendCapable ...
+ '[' -n '' ']'
+ EnsureUSuspendCapable
++ command -v s2disk
+ USUSPEND_PROG_PATH=/usr/sbin/s2disk
+ '[' s2disk = s2ram ']'
+ test -f /sys/power/state
+ test -c /dev/snapshot
+ return 0
+ ret=0
+ '[' 0 -ge 2 ']'
+ '[' 0 -gt 0 ']'
+ '[' -n '' ']'
+ for bit in '`SortSuspendBits`'
+ local new_CHAIN_UP_TO
++ awk 'BEGIN{print substr("11XHacksSuspendHook1", 1, 2)}'
+ new_CHAIN_UP_TO=11
+ '[' -n 11 ']'
+ CHAIN_UP_TO=11
+ bit=XHacksSuspendHook1
+ vecho 1 'hibernate: [11] Executing XHacksSuspendHook1 ... '
+ local v
+ v=1
+ shift
+ '[' x = x1 ']'
+ '[' 1 -le 4 ']'
+ echo hibernate: '[11]' Executing XHacksSuspendHook1 ...
hibernate: [11] Executing XHacksSuspendHook1 ...
+ '[' -n '' ']'
+ XHacksSuspendHook1
+ '[' x = x1 ']'
+ '[' x = x1 ']'
+ '[' -n '' ']'
+ return 0
+ ret=0
+ '[' 0 -ge 2 ']'
+ '[' 0 -gt 0 ']'
+ '[' -n '' ']'
+ for bit in '`SortSuspendBits`'
+ local new_CHAIN_UP_TO
++ awk 'BEGIN{print substr("15PauseAudio", 1, 2)}'
+ new_CHAIN_UP_TO=15
+ '[' -n 15 ']'
+ CHAIN_UP_TO=15
+ bit=PauseAudio
+ vecho 1 'hibernate: [15] Executing PauseAudio ... '
+ local v
+ v=1
+ shift
+ '[' x = x1 ']'
+ '[' 1 -le 4 ']'
+ echo hibernate: '[15]' Executing PauseAudio ...
hibernate: [15] Executing PauseAudio ...
+ '[' -n '' ']'
+ PauseAudio
+ local auuser
++ ps aux
++ grep -w '[q]uodlibet'
++ awk '{print $1}'
++ sort
++ uniq
Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified


(zenity:24769): Gtk-WARNING **: cannot open display: :0
+++ kill -INT 24751
+++ exit 0
++ ctrlc_handler
++ SUSPEND_ABORT=1
++ ps aux
++ grep -w '[x]mms'
++ awk '{print $1}'
++ uniq
++ sort
++ ps aux
++ grep -w '[b]eep-media-player'
++ awk '{print $1}'
++ sort
++ uniq
++ ps aux
++ grep -w '[a]marok'
++ awk '{print $1}'
++ sort
++ uniq
+ return 0
+ ret=0
+ '[' 0 -ge 2 ']'
+ '[' 0 -gt 0 ']'
+ '[' -n 1 ']'
+ vecho 0 'hibernate: Suspend aborted by user.'
+ local v
+ v=0
+ shift
+ '[' x = x1 ']'
+ '[' 0 -le 4 ']'
+ echo hibernate: Suspend aborted by user.
hibernate: Suspend aborted by user.
+ EXIT_CODE=3
+ break
++ SortResumeBits
++ /bin/echo -ne '01XStatusReportErrors\n05XStatusProgressKill\n15XStatusProgress\n20XStatusProgress\n30XStatusProgress\n40XStatusProgress\n50XStatusProgress\n60XStatusProgress\n70XStatusProgress\n80XStatusProgress\n90XStatusProgress\n95XStatusResumeBegin\n85XHacksResumeHook2\n11XHacksResumeHook1\n30ServicesStart\n91GentooModulesAutoload\n90ModulesLoad\n20MiscLaunchAuxFunc1\n30UnlockGnomeScreensaver\n70ClockRestore\n59RemountXFSBootRW\n89RestoreKernelModprobe\n01NoteLastResume\n01LockFilePut\n'
++ sort -rn
+ for bit in '`SortResumeBits`'
++ awk 'BEGIN{print substr("95XStatusResumeBegin", 1, 2)}'
+ THIS_POS=95
+ '[' -z 95 ']'
+ bit=XStatusResumeBegin
+ '[' 95 -gt 15 ']'
+ continue
+ for bit in '`SortResumeBits`'
++ awk 'BEGIN{print substr("91GentooModulesAutoload", 1, 2)}'
+ THIS_POS=91
+ '[' -z 91 ']'
+ bit=GentooModulesAutoload
+ '[' 91 -gt 15 ']'
+ continue
+ for bit in '`SortResumeBits`'
++ awk 'BEGIN{print substr("90XStatusProgress", 1, 2)}'
+ THIS_POS=90
+ '[' -z 90 ']'
+ bit=XStatusProgress
+ '[' 90 -gt 15 ']'
+ continue
+ for bit in '`SortResumeBits`'
++ awk 'BEGIN{print substr("90ModulesLoad", 1, 2)}'
+ THIS_POS=90
+ '[' -z 90 ']'
+ bit=ModulesLoad
+ '[' 90 -gt 15 ']'
+ continue
+ for bit in '`SortResumeBits`'
++ awk 'BEGIN{print substr("89RestoreKernelModprobe", 1, 2)}'
+ THIS_POS=89
+ '[' -z 89 ']'
+ bit=RestoreKernelModprobe
+ '[' 89 -gt 15 ']'
+ continue
+ for bit in '`SortResumeBits`'
++ awk 'BEGIN{print substr("85XHacksResumeHook2", 1, 2)}'
+ THIS_POS=85
+ '[' -z 85 ']'
+ bit=XHacksResumeHook2
+ '[' 85 -gt 15 ']'
+ continue
+ for bit in '`SortResumeBits`'
++ awk 'BEGIN{print substr("80XStatusProgress", 1, 2)}'
+ THIS_POS=80
+ '[' -z 80 ']'
+ bit=XStatusProgress
+ '[' 80 -gt 15 ']'
+ continue
+ for bit in '`SortResumeBits`'
++ awk 'BEGIN{print substr("70XStatusProgress", 1, 2)}'
+ THIS_POS=70
+ '[' -z 70 ']'
+ bit=XStatusProgress
+ '[' 70 -gt 15 ']'
+ continue
+ for bit in '`SortResumeBits`'
++ awk 'BEGIN{print substr("70ClockRestore", 1, 2)}'
+ THIS_POS=70
+ '[' -z 70 ']'
+ bit=ClockRestore
+ '[' 70 -gt 15 ']'
+ continue
+ for bit in '`SortResumeBits`'
++ awk 'BEGIN{print substr("60XStatusProgress", 1, 2)}'
+ THIS_POS=60
+ '[' -z 60 ']'
+ bit=XStatusProgress
+ '[' 60 -gt 15 ']'
+ continue
+ for bit in '`SortResumeBits`'
++ awk 'BEGIN{print substr("59RemountXFSBootRW", 1, 2)}'
+ THIS_POS=59
+ '[' -z 59 ']'
+ bit=RemountXFSBootRW
+ '[' 59 -gt 15 ']'
+ continue
+ for bit in '`SortResumeBits`'
++ awk 'BEGIN{print substr("50XStatusProgress", 1, 2)}'
+ THIS_POS=50
+ '[' -z 50 ']'
+ bit=XStatusProgress
+ '[' 50 -gt 15 ']'
+ continue
+ for bit in '`SortResumeBits`'
++ awk 'BEGIN{print substr("40XStatusProgress", 1, 2)}'
+ THIS_POS=40
+ '[' -z 40 ']'
+ bit=XStatusProgress
+ '[' 40 -gt 15 ']'
+ continue
+ for bit in '`SortResumeBits`'
++ awk 'BEGIN{print substr("30XStatusProgress", 1, 2)}'
+ THIS_POS=30
+ '[' -z 30 ']'
+ bit=XStatusProgress
+ '[' 30 -gt 15 ']'
+ continue
+ for bit in '`SortResumeBits`'
++ awk 'BEGIN{print substr("30UnlockGnomeScreensaver", 1, 2)}'
+ THIS_POS=30
+ '[' -z 30 ']'
+ bit=UnlockGnomeScreensaver
+ '[' 30 -gt 15 ']'
+ continue
+ for bit in '`SortResumeBits`'
++ awk 'BEGIN{print substr("30ServicesStart", 1, 2)}'
+ THIS_POS=30
+ '[' -z 30 ']'
+ bit=ServicesStart
+ '[' 30 -gt 15 ']'
+ continue
+ for bit in '`SortResumeBits`'
++ awk 'BEGIN{print substr("20XStatusProgress", 1, 2)}'
+ THIS_POS=20
+ '[' -z 20 ']'
+ bit=XStatusProgress
+ '[' 20 -gt 15 ']'
+ continue
+ for bit in '`SortResumeBits`'
++ awk 'BEGIN{print substr("20MiscLaunchAuxFunc1", 1, 2)}'
+ THIS_POS=20
+ '[' -z 20 ']'
+ bit=MiscLaunchAuxFunc1
+ '[' 20 -gt 15 ']'
+ continue
+ for bit in '`SortResumeBits`'
++ awk 'BEGIN{print substr("15XStatusProgress", 1, 2)}'
+ THIS_POS=15
+ '[' -z 15 ']'
+ bit=XStatusProgress
+ '[' 15 -gt 15 ']'
+ vecho 1 'hibernate: [15] Executing XStatusProgress ... '
+ local v
+ v=1
+ shift
+ '[' x = x1 ']'
+ '[' 1 -le 4 ']'
+ echo hibernate: '[15]' Executing XStatusProgress ...
hibernate: [15] Executing XStatusProgress ...
+ '[' -n '' ']'
+ XStatusProgress
+ '[' -z gnome ']'
+ XSTATUS_PROGRESS=20
+ XStatusProgressUpdate_gnome
+ '[' -n 1 ']'
+ echo 20
/usr/share/hibernate/scriptlets.d/xstatus: line 101: echo: write error: Broken pipe
++ XStatusProgressPIPEhandler_gnome
++ ZENITY_OPEN=
++ XStatusProgressKill_gnome
++ '[' -n '' ']'
++ exec
++ '[' -p '' ']'
++ '[' -n '' ']'
++ ZENITY_OPEN=
+ '[' x20 = x100 ']'
+ return 0
+ for bit in '`SortResumeBits`'
++ awk 'BEGIN{print substr("11XHacksResumeHook1", 1, 2)}'
+ THIS_POS=11
+ '[' -z 11 ']'
+ bit=XHacksResumeHook1
+ '[' 11 -gt 15 ']'
+ vecho 1 'hibernate: [11] Executing XHacksResumeHook1 ... '
+ local v
+ v=1
+ shift
+ '[' x = x1 ']'
+ '[' 1 -le 4 ']'
+ echo hibernate: '[11]' Executing XHacksResumeHook1 ...
hibernate: [11] Executing XHacksResumeHook1 ...
+ '[' -n '' ']'
+ XHacksResumeHook1
+ '[' -n '' ']'
+ return 0
+ for bit in '`SortResumeBits`'
++ awk 'BEGIN{print substr("05XStatusProgressKill", 1, 2)}'
+ THIS_POS=05
+ '[' -z 05 ']'
+ bit=XStatusProgressKill
+ '[' 05 -gt 15 ']'
+ vecho 1 'hibernate: [05] Executing XStatusProgressKill ... '
+ local v
+ v=1
+ shift
+ '[' x = x1 ']'
+ '[' 1 -le 4 ']'
+ echo hibernate: '[05]' Executing XStatusProgressKill ...
hibernate: [05] Executing XStatusProgressKill ...
+ '[' -n '' ']'
+ XStatusProgressKill
+ '[' -z gnome ']'
+ XSTATUS_PROGRESS=30
+ XStatusProgressKill_gnome
+ '[' -n '' ']'
+ exec
+ '[' -p '' ']'
+ '[' -n '' ']'
+ ZENITY_OPEN=
+ return 0
+ for bit in '`SortResumeBits`'
++ awk 'BEGIN{print substr("01XStatusReportErrors", 1, 2)}'
+ THIS_POS=01
+ '[' -z 01 ']'
+ bit=XStatusReportErrors
+ '[' 01 -gt 15 ']'
+ vecho 1 'hibernate: [01] Executing XStatusReportErrors ... '
+ local v
+ v=1
+ shift
+ '[' x = x1 ']'
+ '[' 1 -le 4 ']'
+ echo hibernate: '[01]' Executing XStatusReportErrors ...
hibernate: [01] Executing XStatusReportErrors ...
+ '[' -n '' ']'
+ XStatusReportErrors
+ '[' -z gnome ']'
+ '[' -z '' ']'
+ return 0
+ for bit in '`SortResumeBits`'
++ awk 'BEGIN{print substr("01NoteLastResume", 1, 2)}'
+ THIS_POS=01
+ '[' -z 01 ']'
+ bit=NoteLastResume
+ '[' 01 -gt 15 ']'
+ vecho 1 'hibernate: [01] Executing NoteLastResume ... '
+ local v
+ v=1
+ shift
+ '[' x = x1 ']'
+ '[' 1 -le 4 ']'
+ echo hibernate: '[01]' Executing NoteLastResume ...
hibernate: [01] Executing NoteLastResume ...
+ '[' -n '' ']'
+ NoteLastResume
+ '[' -f /var/run/hibernate-last-resume ']'
+ date +%s
+ return 0
+ for bit in '`SortResumeBits`'
++ awk 'BEGIN{print substr("01LockFilePut", 1, 2)}'
+ THIS_POS=01
+ '[' -z 01 ']'
+ bit=LockFilePut
+ '[' 01 -gt 15 ']'
+ vecho 1 'hibernate: [01] Executing LockFilePut ... '
+ local v
+ v=1
+ shift
+ '[' x = x1 ']'
+ '[' 1 -le 4 ']'
+ echo hibernate: '[01]' Executing LockFilePut ...
hibernate: [01] Executing LockFilePut ...
+ '[' -n '' ']'
+ LockFilePut
+ '[' -z 1 ']'
+ local lockfile_pid
+ read lockfile_pid
+ IsANumber 24570
+ case "$1" in
+ return 0
+ '[' 24570 -eq 24570 ']'
+ rm -f /var/run/hibernate-script.pid
+ return 0
+ return 3
+ eval 'EXIT_CODE=${PIPESTATUS[0]}'
++ EXIT_CODE=3
+ PluginTermination
+ local i
+ for i in '$TERMINATION_HANDLERS'
+ Swsusp2Termination
+ return 0
+ return 0
+ tee -a -i /var/log/hibernate.log
++ date
+ echo 'Resumed at Sat' Nov 24 10:32:53 CET 2007
+ exit 3
Comment 4 Daniel Schömer 2007-11-24 09:44:46 UTC
I got the meaning of "command -v xhost" totally wrong. Sorry for that. After a second look on these lines in the output

  /usr/sbin/hibernate: line 810: /proc/XAUTHORITY/environ: No such file or directory
  /usr/sbin/hibernate: line 810: /proc/HOME/environ: No such file or directory

I found a maybe-bug in calling function "get_env_var_of_process". In it's definition, $1 is the pid, $2 the variable name.

After appling the following patch, everything seems fine the following patch, everything seems fine and I get a progress bar in GDM.

--- /usr/sbin/hibernate.orig	2007-09-30 15:54:58.000000000 +0200
+++ /usr/sbin/hibernate	2007-11-24 10:28:19.000000000 +0100
@@ -222,8 +206,8 @@
 	    # Ensure the process still exists, and we aren't hallucinating.
 	    [ -d "/proc/$xpid/" ] || continue
 
-	    xauth="`get_env_var_of_process XAUTHORITY $xpid`"
-	    xhome="`get_env_var_of_process HOME $xpid`"
+	    xauth="`get_env_var_of_process $xpid XAUTHORITY`"
+	    xhome="`get_env_var_of_process $xpid HOME`"
 	    xuser=`/bin/ls -ld /proc/$xpid/ | awk '{print $3}'`
 	    [ -z $xauth ] && [ -n $xhome ] && [ -f $xhome/.Xauthority ] && xauth=$xhome/.Xauthority


(from tty1 while nobody logged into X)
# sudo hibernate --verbosity=4
(output to large, appending as file "hibernate-ok.log")
Comment 5 Daniel Schömer 2007-11-24 09:46:42 UTC
Created attachment 136868 [details, diff]
Exchange arguments on function get_env_var_of_process
Comment 6 Daniel Schömer 2007-11-24 09:47:14 UTC
Created attachment 136870 [details]
Output of hibernate --verbosity=4 after appling b.patch
Comment 7 Daniel Schömer 2007-11-24 09:49:59 UTC
Should we change the summary to "sys-power/hibernate-script-1.97-r2 - Searching for running X11 fails from GDM, wrong call to function get_env_var_of_process in /usr/sbin/hibernate"?
Comment 8 Alon Bar-Lev (RETIRED) gentoo-dev 2007-11-24 10:27:46 UTC
Please *ATTACH* the failed result.
Thanks.
Comment 9 Daniel Schömer 2007-11-24 10:47:44 UTC
Created attachment 136872 [details]
Output of hibernate --verbosity=4
Comment 10 Alon Bar-Lev (RETIRED) gentoo-dev 2007-11-24 19:05:14 UTC
Do you have PauseAudio in your configuration?
If you do, can you please try to disable it?
Comment 11 Daniel Schömer 2007-11-24 19:28:39 UTC
Created attachment 136908 [details]
Output of "hibernate --verbosity=4" with PauseAudio disabled

I had "PauseAudio yes" in configuration. After disabling it, hibernate still aborts if nobody is logged into an X session (no matter if hibernate is called from console or the GDM Greeter). Appling "b.patch" still solves the problem for me.
Comment 12 Alon Bar-Lev (RETIRED) gentoo-dev 2007-11-24 20:09:11 UTC
Why do you aborted suspend?
Does it hang?
+ vecho 0 'hibernate: Suspend aborted by user.'
+ local v
+ v=0
+ shift
+ '[' x = x1 ']'
+ '[' 0 -le 4 ']'
+ echo hibernate: Suspend aborted by user.
hibernate: Suspend aborted by user.
+ EXIT_CODE=3
+ break
Comment 13 Daniel Schömer 2007-11-24 20:28:33 UTC
I never aborted suspend myself! It aborts just by itself.
Comment 14 Alon Bar-Lev (RETIRED) gentoo-dev 2007-11-24 20:29:58 UTC
Strange!
Can you please disable all options related to X and services, leave just:
LockGnomeScreenSaver yes
Comment 15 Daniel Schömer 2007-11-24 21:03:23 UTC
Created attachment 136921 [details]
Output of "hibernate --verbosity=4" without any X and service related options, except LockGnomeScreenSaver yes

Without any X or service related options, except LockGnomeScreenSaver yes, hibernation works for me. (from GDM Greeter; never had problems from within X session)
Comment 16 Daniel Schömer 2007-11-24 21:04:20 UTC
Created attachment 136922 [details]
Hibernate config for attachment 136921 [details]
Comment 17 Alon Bar-Lev (RETIRED) gentoo-dev 2007-11-24 21:08:39 UTC
Great!
Now start to enable each individual feature so we can start solving these one by one.

Thanks!
Comment 18 Daniel Schömer 2007-11-24 21:31:16 UTC
Created attachment 136924 [details]
Output of "hibernate --verbosity=4" without any X and service related options, except LockGnomeScreenSaver yes and XStatus gnome

Only enabled "XStatus gnome" option. As I expected, hibernate does not work now.

Again, after applying "b.patch", hibernate works. Pleas take a look at the calls and definition of get_env_var_of_process(). The parameter order either on call or in the definition needs to be exchanged (but not both :-).

/usr/sbin/hibernate: line 810: /proc/XAUTHORITY/environ: No such file or directory
/usr/sbin/hibernate: line 810: /proc/HOME/environ: No such file or directory

# grep -n -C3 get_env_var_of_process /usr/sbin/hibernate
206-        # Ensure the process still exists, and we aren't hallucinating.
207-        [ -d "/proc/$xpid/" ] || continue
208-
209:        xauth="`get_env_var_of_process XAUTHORITY $xpid`"
210:        xhome="`get_env_var_of_process HOME $xpid`"
211-        xuser=`/bin/ls -ld /proc/$xpid/ | awk '{print $3}'`
212-        [ -z $xauth ] && [ -n $xhome ] && [ -f $xhome/.Xauthority ] && xauth=$xhome/.Xauthority
213-
--
804-
805-# Gets the value of the environment variable in the environment space of the
806-# processes identified by its PID.
807:get_env_var_of_process()
808-{
809-    local pid="$1" envvar="$2"
810-    tr '\0' '\n' </proc/$pid/environ | sed -ne "s/^$envvar=//p"
Comment 19 Daniel Schömer 2007-11-24 21:32:08 UTC
Created attachment 136926 [details]
Hibernate config for attachment 136924 [details]
Comment 20 Alon Bar-Lev (RETIRED) gentoo-dev 2007-11-24 21:52:09 UTC
Oh...
Thanks for the reference.

I think:
-xauth="`get_env_var_of_process XAUTHORITY $xpid`"
-xhome="`get_env_var_of_process HOME $xpid`"
+xauth="`get_env_var_of_process $xpid XAUTHORITY`"
+xhome="`get_env_var_of_process $xpid HOME`"

Can you see if this solve this issue?
Comment 21 Daniel Schömer 2007-11-24 21:58:26 UTC
Yes, this change solves this issue for me. (already in 136868, but the linenumbers there might be wrong, since I compared to the original hibernate.sh from hibernate-script-1.97.tar.gz)

Thanks for your help.
Comment 22 Daniel Schömer 2007-11-24 21:59:23 UTC
Sorry, I should have written "already in attachment 136868 [details, diff]".
Comment 23 Alon Bar-Lev (RETIRED) gentoo-dev 2007-11-24 22:06:08 UTC
Oh.
I did not read your comment properly.
Does it work with the sound too?
Comment 24 Daniel Schömer 2007-11-24 22:53:25 UTC
Created attachment 136938 [details]
Working hibernate configuration

Yes, it works, even with "PauseAudio yes" in config. Here's my curret working common.conf.
Comment 25 Alon Bar-Lev (RETIRED) gentoo-dev 2007-11-25 06:07:37 UTC
Thanks!!!
Comment 26 Daniel Schömer 2007-11-25 16:20:15 UTC
With sys-power/hibernate-script-1.97-r3, to problem is gone. Thank you!