Bug#913200: laptop-mode-tools: major performance issues on battery with kernels >=4.18.9 and intel ahci

2018-11-07 Thread Tomas Ebenlendr
Package: laptop-mode-tools
Version: 1.72-2
Severity: important
Tags: patch


Laptop-mode-tools puts SATA drives in DEVSLP on battery. Waking drives
then takes several seconds, rendering all disk-using applications (web browser, 
Vim editor, ...)
unresponsive for few seconds every often.

Reason is that recent kernels (linux-image-4.18.0-2, i.e. kernels 4.18.9 and 
4.19)
sets AHCI devices in DEVSLP mode when link_management_power_policy is
set to 'min_power'. These kernels have 'med_power_with_dipm' setting
which is near 'min_power' but without DEVSLP. This setting is introduced
in kernel 4.15.

I replaced line
 BATT_SATA_POLICY=min_power
with line
 BATT_SATA_POLICY=med_power_with_dipm
in
 /etc/laptop-mode/conf.d/intel-sata-powermgmt.conf

and now everything works again. I suggest setting default to
med_power_with_dipm as there will be only few users with kernel older
than 4.15 especially when buster will become stable. Second option is
to autodect support for 'min_power' based on kernel release (uname -r).


-- System Information:
Debian Release: buster/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable'), (1, 
'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.18.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=cs_CZ.UTF-8 (charmap=UTF-8), LANGUAGE=C (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages laptop-mode-tools depends on:
ii  lsb-base9.20170808
ii  psmisc  23.2-1
ii  util-linux  2.32.1-0.1

Versions of packages laptop-mode-tools recommends:
ii  ethtool 1:4.16-1
ii  hdparm  9.58+ds-1
ii  net-tools   1.60+git20180626.aebd88e-1
ii  python3-pyqt5   5.11.3+dfsg-1+b1
ii  rfkill  2.32.1-0.1
ii  sdparm  1.10-1
ii  udev239-11
ii  wireless-tools  30~pre9-13

Versions of packages laptop-mode-tools suggests:
ii  acpid  1:2.0.28-1+b1

-- Configuration Files:
/etc/laptop-mode/conf.d/intel-sata-powermgmt.conf changed [not included]
/etc/laptop-mode/laptop-mode.conf changed [not included]

-- no debconf information



Bug#913018: linux-image-4.18.0-2-amd64: Chromium repeatedly freezes for few seconds on battery power after upgrade to 4.18.0-2

2018-11-05 Thread Tomas Ebenlendr
Package: src:linux
Version: 4.18.10-2+b1
Severity: normal

Chromium repeatedly freezes for few seconds on battery power. The
problem does not occur with 4.18.0-1 package (version 4.18.8-1). The
problem can be turned off by disabling laptop_mode:

echo 0 > /proc/sys/vm/laptop_mode.

I tried several other options (disabling power saving of intel_pstate
and i915, setting cpufreq governor to performance) without success.
Even with laptop_mode turned off, performance seems to be worse when cpu
dynamically switches frequencies due to load. Note that there may be
other affected programs, although terminal emulator (terminology) seems
to be not affected.

-- Package-specific info:
** Version:
Linux version 4.18.0-2-amd64 (debian-ker...@lists.debian.org) (gcc version 
7.3.0 (Debian 7.3.0-30)) #1 SMP Debian 4.18.10-2 (2018-11-02)

** Command line:
BOOT_IMAGE=/boot/vmlinuz-4.18.0-2-amd64 
root=UUID=90592ae4-7522-4eee-8488-ccc1a673a0e0 ro i915.enable_rc6=0 
vsyscall=emulate quiet

** Not tainted

** Kernel log:
[3.326732] ACPI: Video Device [GFX0] (multi-head: yes  rom: no  post: no)
[3.326945] input: Video Bus as 
/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/LNXVIDEO:00/input/input20
[3.337184] fbcon: inteldrmfb (fb0) is primary device
[3.346789] pstore: Registered efi as persistent store backend
[3.366045] random: crng init done
[3.366046] random: 7 urandom warning(s) missed due to ratelimiting
[3.391075] Intel(R) Wireless WiFi driver for Linux
[3.391076] Copyright(c) 2003- 2015 Intel Corporation
[3.391422] iwlwifi :03:00.0: enabling device ( -> 0002)
[3.415290] iwlwifi :03:00.0: firmware: direct-loading firmware 
iwlwifi-8000C-36.ucode
[3.416205] iwlwifi :03:00.0: loaded firmware version 36.e91976c0.0 
op_mode iwlmvm
[3.418173] Adding 8268796k swap on /dev/sdb3.  Priority:-2 extents:1 
across:8268796k SSFS
[3.450062] iwlwifi :03:00.0: Detected Intel(R) Dual Band Wireless AC 
8260, REV=0x208
[3.458793] intel_rapl: Found RAPL domain package
[3.458795] intel_rapl: Found RAPL domain core
[3.458796] intel_rapl: Found RAPL domain uncore
[3.458797] intel_rapl: Found RAPL domain dram
[3.41] EXT4-fs (sdb4): mounted filesystem with ordered data mode. Opts: 
(null)
[3.528218] iwlwifi :03:00.0: base HW address: f4:8c:50:03:e8:00
[3.560461] audit: type=1400 audit(1541463980.036:2): apparmor="STATUS" 
operation="profile_load" profile="unconfined" name="/usr/bin/man" pid=507 
comm="apparmor_parser"
[3.560464] audit: type=1400 audit(1541463980.036:3): apparmor="STATUS" 
operation="profile_load" profile="unconfined" name="man_filter" pid=507 
comm="apparmor_parser"
[3.560466] audit: type=1400 audit(1541463980.036:4): apparmor="STATUS" 
operation="profile_load" profile="unconfined" name="man_groff" pid=507 
comm="apparmor_parser"
[3.565652] audit: type=1400 audit(1541463980.040:5): apparmor="STATUS" 
operation="profile_load" profile="unconfined" name="libreoffice-xpdfimport" 
pid=510 comm="apparmor_parser"
[3.572781] audit: type=1400 audit(1541463980.048:6): apparmor="STATUS" 
operation="profile_load" profile="unconfined" name="libreoffice-senddoc" 
pid=506 comm="apparmor_parser"
[3.573307] audit: type=1400 audit(1541463980.048:7): apparmor="STATUS" 
operation="profile_load" profile="unconfined" name="/usr/sbin/tcpdump" pid=511 
comm="apparmor_parser"
[3.578147] audit: type=1400 audit(1541463980.052:8): apparmor="STATUS" 
operation="profile_load" profile="unconfined" name="virt-aa-helper" pid=508 
comm="apparmor_parser"
[3.580884] audit: type=1400 audit(1541463980.056:9): apparmor="STATUS" 
operation="profile_load" profile="unconfined" name="/usr/sbin/libvirtd" pid=512 
comm="apparmor_parser"
[3.580886] audit: type=1400 audit(1541463980.056:10): apparmor="STATUS" 
operation="profile_load" profile="unconfined" 
name="/usr/sbin/libvirtd//qemu_bridge_helper" pid=512 comm="apparmor_parser"
[3.607578] ieee80211 phy0: Selected rate control algorithm 'iwl-mvm-rs'
[3.607837] thermal thermal_zone4: failed to read out thermal zone (-61)
[3.682702] iwlwifi :03:00.0 wlp3s0: renamed from wlan0
[3.775180] ipmi message handler version 39.2
[3.776967] ipmi device interface
[3.786099] IPMI System Interface driver.
[3.786168] ipmi_si: Unable to find any System Interface(s)
[3.905422] Bluetooth: Core ver 2.22
[3.905433] NET: Registered protocol family 31
[3.905433] Bluetooth: HCI device and connection manager initialized
[3.905436] Bluetooth: HCI socket layer initialized
[3.905438] Bluetooth: L2CAP socket layer initialized
[3.905442] Bluetooth: SCO socket layer initialized
[4.728427] snd_hda_intel :00:1f.3: bound :00:02.0 (ops 
i915_audio_component_bind_ops [i915])
[4.728428] Console: switching to colour frame buffer device 240x67
[4.748688] i915 :00:02.0: fb0: inteldrmfb frame buffer device
[4.756539] snd_hda_codec_conexant 

Bug#864356: network-manager: Support for certificate hashes when writing 802.1x configuration.

2017-06-07 Thread Tomas Ebenlendr
Package: network-manager
Version: 1.6.2-3
Severity: normal
Tags: patch upstream

Some 802.1x networks (wifi or wired) use self-signed certificates.
Wpa-supplicant has support for this, by checking sha256 sum of the
certificate instead of verifying certificate against some CA
certificate, by supplying 'hash://...' url instead of path into
'ca-cert' configuration option.

The keyfile plugin of networkmanager responsible for reading
/etc/NetworkManager/system-connections/* thinks, that ca-cert
is local path and adds /etc/NetworkManager/... before the hash.
Solution is simple: just pass the hash url from the keyfile to
wpa-supplicant as-is, as it is done for absolute paths.

(It would be nice, to have also graphical configuration for this, but
that would be a feature request to another package.)

Sha256 sum of the certificate is logged already when no certificate
check is done: Jun  7 14:51:57 chewbacca wpa_supplicant[841]: wlp3s0:
CTRL-EVENT-EAP-PEER-CERT depth=0 subject='/CN=WMSvc-ELVIRA'
hash=c640682caa9cd14bf60640f92ff59c844df363dfce800fca3416b9cb222a4cdb
Then I can use the hash in the keyfile, and wpa-supplicant forbids to
send my username/pasword to any server that provides different
certificate.

Example configuration from 
/etc/NetworkManager/system-connections/my_safer_8021x follows:

...
[802-1x]
ca-cert=hash://server/sha256/c640682caa9cd14bf60640f92ff59c844df363dfce800fca3416b9cb222a4cdb
eap=peap;
identity=my_user_name
password=my_password
phase2-auth=mschapv2
...

Patch allowing 'hash://' url in ca-cert follows:

diff --git a/libnm-core/nm-keyfile-reader.c b/libnm-core/nm-keyfile-reader.c
index 8adf67dd..c071264d 100644
--- a/libnm-core/nm-keyfile-reader.c
+++ b/libnm-core/nm-keyfile-reader.c
@@ -893,7 +893,7 @@ get_cert_path (const char *base_dir, const guint8 
*cert_path, gsize cert_path_le
base = path = g_malloc0 (cert_path_len + 1);
memcpy (path, cert_path, cert_path_len);
 
+   if (path[0] == '/')
-   if ((path[0] == '/') || (strncmp(path, "hash://",7)==0))
return path;
 
p = strrchr (path, '/');


-- System Information:
Debian Release: 9.0
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.9.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=cs_CZ.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages network-manager depends on:
ii  adduser3.115
ii  dbus   1.10.16-1
ii  init-system-helpers1.47
ii  libaudit1  1:2.6.7-2
ii  libbluetooth3  5.43-2
ii  libc6  2.24-9
ii  libglib2.0-0   2.50.3-1
ii  libgnutls303.5.8-3
ii  libgudev-1.0-0 230-3
ii  libjansson42.9-1
ii  libmm-glib01.6.4-1
ii  libndp01.6-1+b1
ii  libnewt0.520.52.19-1+b1
ii  libnl-3-2003.2.27-2
ii  libnm0 1.6.2-2
ii  libpam-systemd 233-5
ii  libpolkit-agent-1-00.105-18
ii  libpolkit-gobject-1-0  0.105-18
ii  libreadline7   7.0-2
ii  libselinux12.6-3+b1
ii  libsoup2.4-1   2.56.0-2
ii  libsystemd0233-5
ii  libteamdctl0   1.26-1+b1
ii  libuuid1   2.29.2-1
ii  lsb-base   9.20161125
ii  policykit-10.105-18
ii  udev   233-8
ii  wpasupplicant  2:2.4-1

Versions of packages network-manager recommends:
ii  crda 3.18-1
ii  dnsmasq-base 2.76-5+b1
ii  iptables 1.6.0+snapshot20161117-5
ii  iputils-arping   3:20161105-1
ii  isc-dhcp-client  4.3.5-3
ii  modemmanager 1.6.4-1
ii  ppp  2.4.7-1+4

Versions of packages network-manager suggests:
pn  libteam-utils  

-- Configuration Files:
/etc/NetworkManager/NetworkManager.conf changed [not included]

-- no debconf information



pgpq3WfgEO6OH.pgp
Description: OpenPGP digital signature


Bug#813226: tzdata config script ignores /etc/timezone on non-interactive configuration

2017-02-24 Thread Tomas Ebenlendr
On Mon, 1 Feb 2016 08:43:32 +0100
Aurelien Jarno  wrote:

> ...
> I don't think it is a bug. The correct way to configure the timezone has
> always been to change /etc/localtime symlink, ie in your case by doing
> "ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime". This is what
> desktop environments do when changing the timezone and it is what
> systemd expects.

But after dpkg-reconfigure tzdata, content of this symlink was written
into /etc/timezone and the symlink was turned into real file.
Subsequent runs of dpkg-reconfigure have seen /etc/localtime real file,
thus behaving as if /etc/timezone is the source of authority here,
and /etc/localtime symlink is some obsure state which needs to be
transformed into /etc/timezone authority and /etc/localtime real file,
driven by /etc/timezone.

New package completely changes source of authority to /etc/localtime,
as tzdata.postinst script makes /etc/localtime into symlink, and
subsequent run of tzdata.config rewrites contents of /etc/timezone
based on the value of the symlink.

This change in behaviour should be documented, at least somewhere
in /usr/share/doc/tzdata/...

P.S.: Ansible (or other orchestration tool), usually checks file not
only by its contents, but also by its type. Thus there must be now two
paths (old tzdata and new tzdata) when checking /etc/localtime.
Checking /etc/timezone is not sufficient after the change. I spent 4
hours by debugging our ansible environment because of poor
documentation of this change and poor documentation of relation
between /etc/timezone and /etc/localtime in older versions of tzdata.

> Changing /etc/timezone worked in some cases before as we use to store
> /etc/localtime as a copy of the file instead of a symlink when possible,
> in order to allow the timezone to be correct without a /usr partition.
> This is not needed anymore given /usr is now mount from the initramfs
> when needed.
> 
> Aurelien
> 



-- 
 Tomáš 'ebík' Ebenlendr
 Economia a.s.
 PF 2017.15021197996


-- 
*Úspěch, charisma a inspirace v jednom magazínu. *
*Čtěte o nejúspěšnějších ženách Česka.*

*Objednejte si exkluzivní magazín Hospodářských novin Top ženy Česka 2016 
.*


pgpt1e99w1Zx2.pgp
Description: OpenPGP digital signature


Bug#807134: laptop-mode-tools: battery level polling kills udevd

2015-12-05 Thread Tomas Ebenlendr
Package: laptop-mode-tools
Version: 1.68-3
Severity: normal
Tags: patch upstream

Laptop_mode spawns lm-polling-daemon within the same process group as itself
when AC is plugged out. Laptop_mode is launched in process group of
systemd-udevd on my system. When AC is plugged in later, laptop_mode
kills all processes in group where lm-polling-daemon is found, i.e.,
it kills udevd and itself as well.

I use battery level polling to trigger custom actions when battery is
low, but not yet critical.

The solution proposed in patch is to spawn lm-polling-daemon in its own
process group, using /usr/bin/setsid wrapper from util-linux package.


--- /usr/sbin/laptop_mode   2015-09-03 13:10:48.0 +0200
+++ modified/laptop_mode2015-12-05 21:41:16.873037703 +0100
@@ -1148,7 +1148,7 @@
log "VERBOSE" "On battery and there was no 
polling daemon yet, starting the polling daemon."
 
# If there is no polling daemon, we start one.
-   
/usr/share/laptop-mode-tools/module-helpers/lm-polling-daemon < /dev/null > 
/dev/null 2> /dev/null &
+   setsid 
/usr/share/laptop-mode-tools/module-helpers/lm-polling-daemon < /dev/null > 
/dev/null 2> /dev/null &
fi
else
log "VERBOSE" "Lock acquisition on descriptor 7 failed 
with pid $$";

-- System Information:
Debian Release: stretch/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable'), (500, 
'oldstable'), (1, 'experimental')
Architecture: i386 (x86_64)
Foreign Architectures: amd64

Kernel: Linux 4.3.0-trunk-amd64 (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=cs_CZ.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Init: sysvinit (via /sbin/init)

Versions of packages laptop-mode-tools depends on:
ii  init-system-helpers  1.24
ii  lsb-base 9.20150917
ii  psmisc   22.21-2.1
ii  util-linux   2.27.1-1

Versions of packages laptop-mode-tools recommends:
ii  ethtool 1:4.2-1
ii  hdparm  9.43-2
ii  net-tools   1.60+git20150829.73cef8a-1
ii  python-qt4  4.11.4+dfsg-1+b2
ii  sdparm  1.08-1
ii  udev228-2
ii  wireless-tools  30~pre9-8

Versions of packages laptop-mode-tools suggests:
ii  acpid  1:2.0.25-1
ii  apmd   3.2.2-15

-- Configuration Files:
/etc/laptop-mode/conf.d/auto-hibernate.conf changed:
DEBUG=0
ENABLE_AUTO_HIBERNATION=1
HIBERNATE_COMMAND=/usr/sbin/hibernate-disk
AUTO_HIBERNATION_BATTERY_CHARGE_PERCENT=3
AUTO_HIBERNATION_ON_CRITICAL_BATTERY_LEVEL=0

/etc/laptop-mode/conf.d/battery-level-polling.conf changed:
DEBUG=0
CONTROL_BATTERY_LEVEL_POLLING=1
BLACKLIST_IN_FLOCK=1

/etc/laptop-mode/conf.d/cpufreq.conf changed:
DEBUG=0
CONTROL_CPU_FREQUENCY=0
BATT_CPU_MAXFREQ=fastest
BATT_CPU_MINFREQ=slowest
BATT_CPU_GOVERNOR=ondemand
BATT_CPU_IGNORE_NICE_LOAD=1
LM_AC_CPU_MAXFREQ=fastest
LM_AC_CPU_MINFREQ=slowest
LM_AC_CPU_GOVERNOR=ondemand
LM_AC_CPU_IGNORE_NICE_LOAD=1
NOLM_AC_CPU_MAXFREQ=fastest
NOLM_AC_CPU_MINFREQ=slowest
NOLM_AC_CPU_GOVERNOR=ondemand
NOLM_AC_CPU_IGNORE_NICE_LOAD=0
CONTROL_CPU_THROTTLING=0
BATT_CPU_THROTTLING=medium
LM_AC_CPU_THROTTLING=medium
NOLM_AC_CPU_THROTTLING=minimum

/etc/laptop-mode/conf.d/dpms-standby.conf changed:
DEBUG=0
CONTROL_DPMS_STANDBY=1
BATT_DPMS_STANDBY=300
LM_AC_DPMS_STANDBY=1200
NOLM_AC_DPMS_STANDBY=1200

/etc/laptop-mode/conf.d/ethernet.conf changed:
DEBUG=0
CONTROL_ETHERNET=0
BATT_THROTTLE_ETHERNET=0
LM_AC_THROTTLE_ETHERNET=0
NOLM_AC_THROTTLE_ETHERNET=0
THROTTLE_SPEED="slowest"
DISABLE_WAKEUP_ON_LAN=1
ETHERNET_DEVICES="eth0"
DISABLE_ETHERNET_ON_BATTERY=0

/etc/laptop-mode/conf.d/usb-autosuspend.conf changed:
DEBUG=0
CONTROL_USB_AUTOSUSPEND=0
AUTOSUSPEND_USE_WHITELIST=1
AUTOSUSPEND_USBID_BLACKLIST=""
AUTOSUSPEND_USBTYPE_BLACKLIST=""
AUTOSUSPEND_USBID_WHITELIST=""
AUTOSUSPEND_USBTYPE_WHITELIST=""
BATT_SUSPEND_USB=0
LM_AC_SUSPEND_USB=0
NOLM_AC_SUSPEND_USB=0
AUTOSUSPEND_TIMEOUT=2

/etc/laptop-mode/laptop-mode.conf changed:
ENABLE_LAPTOP_MODE_TOOLS=1
VERBOSE_OUTPUT=1
LOG_TO_SYSLOG=1
DEBUG=0
ENABLE_LAPTOP_MODE_ON_BATTERY=1
ENABLE_LAPTOP_MODE_ON_AC=0
ENABLE_LAPTOP_MODE_WHEN_LID_CLOSED=0
ENABLE_AUTO_MODULES=1
MINIMUM_BATTERY_CHARGE_PERCENT=3
DISABLE_LAPTOP_MODE_ON_CRITICAL_BATTERY_LEVEL=1
DISABLE_BATTERY_ALARM_CHECK=0
HD="/dev/disk/by-id/ata-ST320LT007-9ZV142_W0Q66HJ9"
PARTITIONS="auto /dev/mapper/* /dev/dm-*"
ASSUME_SCSI_IS_SATA=1
LM_BATT_MAX_LOST_WORK_SECONDS=600
LM_AC_MAX_LOST_WORK_SECONDS=360
CONTROL_READAHEAD=1
LM_READAHEAD=3072
NOLM_READAHEAD=128
CONTROL_NOATIME=0
USE_RELATIME=1
CONTROL_HD_IDLE_TIMEOUT=1
LM_AC_HD_IDLE_TIMEOUT_SECONDS=20
LM_BATT_HD_IDLE_TIMEOUT_SECONDS=20
NOLM_HD_IDLE_TIMEOUT_SECONDS=7200
CONTROL_HD_POWERMGMT="auto"
BATT_HD_POWERMGMT=1
LM_AC_HD_POWERMGMT=254
NOLM_AC_HD_POWERMGMT=254
CONTROL_HD_WRITECACHE=0
NOLM_AC_HD_WRITECACHE=1
NOLM_BATT_HD_WRITECACHE=0
LM_HD_WRITECACHE=0
CONTROL_MOUNT_OPTIONS=1
LM_DIRTY_RATIO=60

Bug#688937: hibernate: FindXServer fails if X started from console by startx and no usual wm/de is used

2012-09-27 Thread Tomas Ebenlendr
Package: hibernate
Version: 2.0+15+g88d54a8-1
Severity: normal
Tags: patch

If X are started from console by 'startx' (i.e., no entry in wtmp) and
no usual window manager or desktop environment is used, then $XUSER is
set to 'root'.

The only process found by 'pidof' in setting described above is 'X'.
Unfortunately this program is 'suid root' (because of access to hw).
Thus I propose to read 'real user' instead of 'effective user':

--- a/hibernate.sh  2012-09-27 08:14:29.0 +0200
+++ b/hibernate.sh  2012-09-27 08:33:24.253498281 +0200
@@ -224,7 +224,7 @@ FindXServer() {
 
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}'`
+   xuser=`/bin/ps -o ruser= $xpid`
[ -z $xauth ]  [ -n $xhome ]  [ -f $xhome/.Xauthority ]  
xauth=$xhome/.Xauthority
 
[ -z $xauth ]  continue


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#461225: hibernate: add option to resume network interfaces with their current logical settings

2008-01-17 Thread Tomas Ebenlendr
Package: hibernate
Version: 1.97-1
Severity: wishlist
Tags: patch

Imagine following situation: I will do
 $ ifup eth0=home
then I will hibernate my laptop. Network scriptlet from hibernate
package does:
 ifdown eth0
 ifup eth0
 (i.e. ifup eth0=eth0).
Now I suppose I have more than one configuration in /etc/network/interfaces
 * if I have there 'map' section, then ifup eth0 is probably ok as
   the mapping script guesses what logical configuration use with given
   interface.
 * if I have no 'map' section, then I surely want to bring the device up
   in state it was brought down. To achieve this, I added UpNoRemap option
   to the network scriptlet. I use /etc/network/run/ifstate to get
   actual configuration of given interface.

Here is my patch---
--- /usr/share/hibernate/scriptlets.d/network   2007-10-22 15:06:52.0 
+0200
+++ /etc/hibernate/scriptlets.d/network 2008-01-17 14:31:40.0 +0100
@@ -4,6 +4,7 @@
 AddConfigHandler NetworkConfigOptions
 AddConfigHelp DownInterfaces auto|ifname [...] The names of network 
interfaces to bring down before suspending. If the parameter \auto\ is given, 
all interfaces which are not lo are brought down.
 AddConfigHelp UpInterfaces auto|ifname [...] The names of network 
interfaces to bring up after suspending. If the parameter \auto\ is given, 
the interfaces stopped before suspending will be started in reverse order.
+AddConfigHelp UpNoRemap boolean Save mapping to logical interface for 
'UpInterfaces auto'. (Works only if 'Distribution debian' is set.
 
 NetworkStop() {
 # If the script stops networking altogether, there's not much we can do.
@@ -73,6 +74,13 @@
upinterfaces)
NETWORK_UPIFS=$NETWORK_UPIFS $* 
;;
+   upnoremap)
+   if BoolIsOn $opt $1; then
+   NETWORK_NOREMAP=true
+   else
+   NETWORK_NOREMAP=false
+   fi
+   ;;
*)
return 1
 esac
@@ -114,10 +122,16 @@
--startas /sbin/ifup --name hibernate_ifup_$1 -- $*
}
network_ifdown() {
+   if [ xtrue != x$NETWORK_NOREMAP ]; then
+   _IFACE=$1
+   else
+   _IFACE=`egrep ^$1 /etc/network/run/ifstate`
+   if [ -z $_IFACE ]; then _IFACE=$1; fi
+   fi
 STDERR=$(/sbin/ifdown $1 21 1/dev/null) || return $?
 case $STDERR in
 /sbin/ifdown: interface $1 not configured) :;;
-*) echo $1;;
+*) echo $_IFACE;;
 esac
 }
;;
End of patch---

-- Package-specific info:
--- configuration
== /etc/hibernate/common.conf ==
Verbosity 0
LogFile /var/log/hibernate.log
LogVerbosity 3
Distribution debian
SaveClock restore-only
UnloadModules video
UnloadBlacklistedModules yes
LoadModules auto
DownInterfaces eth0
UpInterfaces auto
UpNoRemap yes
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 ==
427031674
== /sys/power/resume ==
8:5
== /sys/power/state ==
mem disk

--- log
Starting suspend at Thu Jan 17 14:29:01 CET 2008
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: [59] Executing RemountXFSBootRO ... 
hibernate: [60] Executing NetworkStop ... 
Bringing down interface eth0
hibernate: [89] Executing SaveKernelModprobe ... 
Saved /proc/sys/kernel/modprobe is /sbin/modprobe
hibernate: [90] Executing ModulesUnload ... 
Unloading module video... Removing modules with rmmod.

hibernate: [91] Executing ModulesUnloadBlacklist ... 
Unloading blacklisted modules listed /etc/hibernate/blacklisted-modules
Module version for ipw2100 is 66050
Module version for ipw2200 is 66050
Module version for snd_bt_sco is 
Module version for ndiswrapper is 78592
hibernate: [95] Executing XHacksSuspendHook2 ... 
xhacks: