Package: hibernate
Version: 1.99-1.1
Severity: important
Tags: patch
Hi all.
XFindServer is reading /var/log/wtmp to find X sessions. But it is
common practice not to have this wtmp file. e.g. to decrease write
access to the root file system. And it is common practice to have a
tmpfs mounted on /var/run, where utmp resides.
/var/run/utmp seems to be perfectly suited for finding xusers and their
$DISPLAYs. the attached patch replaces 'last' by 'w'. w reads the utmp
file.
As far a I understand, XFindServer is meant to find only one xsession.
this doesn't seem to be easily fixed, but with the patch a log message is
triggered in case multiple displays are in use. (see hibernate.log below)
I hope the patch is useful and doesn't break too much.
regards
felix
PS: unfortunately this leaves open #370787, since w also has an 8
character limit (although utmp contains the complete names).
-- Package-specific info:
--- configuration
==> /etc/hibernate/common.conf <==
Verbosity 10
LogFile /var/log/hibernate.log
LogVerbosity 10
Distribution debian
SaveClock restore-only
LockXtrLock yes
UnloadBlacklistedModules yes
LoadModules auto
SwitchToTextMode yes
==> /etc/hibernate/disk.conf <==
TryMethod ususpend-disk.conf
TryMethod sysfs-disk.conf
==> /etc/hibernate/hibernate.conf <==
TryMethod suspend2.conf
TryMethod disk.conf
TryMethod ram.conf
==> /etc/hibernate/ram.conf <==
TryMethod ususpend-ram.conf
TryMethod sysfs-ram.conf
==> /etc/hibernate/suspend2.conf <==
UseSuspend2 yes
Reboot no
EnableEscape yes
DefaultConsoleLevel 1
Compressor lzf
Encryptor none
FullSpeedCPU yes
Include common.conf
==> /etc/hibernate/sysfs-disk.conf <==
UseSysfsPowerState disk
Include common.conf
==> /etc/hibernate/sysfs-ram.conf <==
UseSysfsPowerState mem
Include common.conf
==> /etc/hibernate/ususpend-both.conf <==
USuspendMethod both
Include common.conf
==> /etc/hibernate/ususpend-disk.conf <==
USuspendMethod disk
Include common.conf
==> /etc/hibernate/ususpend-ram.conf <==
USuspendMethod ram
Include common.conf
--- /sys/power
==> /sys/power/disk <==
[platform] test testproc shutdown reboot
==> /sys/power/image_size <==
524288000
==> /sys/power/resume <==
0:0
==> /sys/power/state <==
mem disk
--- s2ram -n
Machine unknown
This machine can be identified by:
sys_vendor = ""
sys_product = ""
sys_version = ""
bios_version = ""
--- log
Starting suspend at Sun Mar 7 21:56:59 CET 2010
hibernate: [01] Executing CheckLastResume ...
hibernate: [01] Executing CheckRunlevel ...
hibernate: [01] Executing LockFileGet ...
hibernate: [01] Executing NewKernelFileCheck ...
hibernate: [10] Executing EnsureSysfsPowerStateCapable ...
hibernate: [11] Executing XHacksSuspendHook1 ...
hibernate: [59] Executing RemountXFSBootRO ...
hibernate: [89] Executing SaveKernelModprobe ...
Saved /proc/sys/kernel/modprobe is /sbin/modprobe
hibernate: [91] Executing ModulesUnloadBlacklist ...
Unloading blacklisted modules listed /etc/hibernate/blacklisted-modules
Module version for ipw2100 is
Module version for ipw2200 is
Module version for snd_bt_sco is
Module version for ndiswrapper is
hibernate: [91] Executing ModulesUnloadBlacklist ...
Unloading blacklisted modules listed /etc/hibernate/blacklisted-modules
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 7 to 15
hibernate: [98] Executing CheckRunlevel ...
hibernate: [99] Executing DoSysfsPowerStateSuspend ...
hibernate: Activating sysfs power state disk ...
hibernate: [91] Executing LockXtrlock ...
hibernate skipping :0.0,felix in favour of :1.0,felix (stupid?)
Trying xtrlock
Locking felix's xtrlock on display :1.0 using authority file
/home/felix/.Xauthority
hibernate: [90] Executing ModulesLoad ...
hibernate: [89] Executing RestoreKernelModprobe ...
hibernate: [85] Executing XHacksResumeHook2 ...
xhacks: changing console back to 7
hibernate: [70] Executing ClockRestore ...
hibernate: [70] Executing ClockRestore ...
hibernate: [59] Executing RemountXFSBootRW ...
hibernate: [11] Executing XHacksResumeHook1 ...
hibernate: [01] Executing NoteLastResume ...
hibernate: [01] Executing LockFilePut ...
Resumed at Sun Mar 7 21:57:09 CET 2010
-- System Information:
Debian Release: 5.0.4
APT prefers stable
APT policy: (990, 'stable'), (500, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.6.30-7-owl (SMP w/2 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages hibernate depends on:
ii console-tools 1:0.2.3dbs-65.1 Linux console and font utilities
Versions of packages hibernate recommends:
ii dash 0.5.5.1-2 POSIX-compliant shell
ii hdparm 8.9-3 tune hard disk parameters for high
ii uswsusp 0.8-1.2 tools to use userspace software su
ii vbetool 1.0-3 run real-mode video BIOS code to a
Versions of packages hibernate suggests:
pn 915resolution <none> (no description available)
pn xscreensaver | kscreensaver | <none> (no description available)
-- no debconf information
189,190d188
< [ -z "$DISPLAY" ] && DISPLAY=:0
< export DISPLAY
203,210c201,205
< local xuser xauth xpid
< for display in $(seq 0 8); do
< xuser=$(last ":$display" | grep 'still logged in' | awk '{print $1}')
|| true
< if [ -n "$xuser" ]; then
< xhome=$(getent passwd "$xuser" | cut -d: -f 6)
< if [ -n "$xhome" ]; then
< xauth=$xhome/.Xauthority
< fi
---
> local xuser xauth xpid xline
> for line in $( w -h | awk '{ print $3","$1 }' | grep ^: |sort | uniq ); do
> if [ -n "$xline" ]; then
> vecho 1 "$EXE skipping $xline in favour of $line (stupid?)"
> # TODO: multiple X sessions
212,217c207,213
< if [ -z "$xhome" ] || [ -z "$xauth" ]; then
< xauth=
< xuser=
< xhome=
< else
< break
---
>
> xline=$line
> xuser=$( echo $line | cut -d, -f2 )
> xdisplay=$( echo $line | cut -d, -f1 )
> xhome=$(getent passwd "$xuser" | cut -d: -f 6)
> if [ -n "$xhome" ]; then
> xauth=$xhome/.Xauthority
219a216,218
> export DISPLAY=$xdisplay
>
>