試験運用中なLinux備忘録・旧記事

はてなダイアリーで公開していた2007年5月-2015年3月の記事を保存しています。

UbuntuでTuxOnIceを用いる(Ubuntu 10.10時点・後半)

UbuntuでTuxOnIceを用いる(Ubuntu 10.10時点・前半)」の続き。見出し「pm-utilsからTuxOnIceを用いる」における続きとなる。

TuxOnIce固有の設定を行う

pm-utilsではhibernate-scriptと異なり、設定ファイルでTuxOnIceの挙動を調整することはできないため、/sys/power/tuxonice/以下のファイルへの書き込み処理を手動で記述することになる。
下は「#echo」で始まる行を好みに応じてコメント解除して用いる。
[任意]ファイル名: /etc/pm/config.d/01tuxonice

# 1を書き込むと電源を切る代わりに再起動される
#echo "1" > /sys/power/tuxonice/reboot
echo "0" > /sys/power/tuxonice/reboot

# 下に挙げたもの以外にも/sys/power/tuxonice/の下に設定可能なものはある
# 以下ドキュメントより説明を引用

# Set the cryptoapi algorithm used for compressing the image.
#echo "lzo" > /sys/power/tuxonice/compression/algorithm

# These values allow you to set an expected compression ratio, which TuxOnice
# will use in calculating whether it meets constraints on the image size. If
# this expected compression ratio is not attained, the hibernation cycle will
# abort, so it is wise to allow some spare. You can see what compression
# ratio is achieved in the logs after hibernating.
#echo "0" > /sys/power/tuxonice/compression/expected_compression

# TuxOnIce provides support for automatically waking after a user-selected
# delay, and using a different powerdown method if the lid is still closed.
# (Yes, we're assuming a laptop).  This entry lets you choose what state
# should be entered next. The values are those described under
# powerdown_method, below. It can be used to suspend to RAM after hibernating,
# then powerdown properly (say) 20 minutes. It can also be used to power down
# properly, then wake at (say) 6.30am and suspend to RAM until you're ready
# to use the machine.
#echo "-1" > /sys/power/tuxonice/post_wake_state

# The maximum size of hibernation image written to disk, measured in megabytes (1024*1024).
#echo "0" > /sys/power/tuxonice/image_size_limit

# Used to select a method by which TuxOnIce should powerdown after writing the
# image. Currently:
#
# 0: Don't use ACPI to power off.
# 3: Attempt to enter Suspend-to-ram.
# 4: Attempt to enter ACPI S4 mode.
# 5: Attempt to power down via ACPI S5 mode.
#echo "0" > /sys/power/tuxonice/powerdown_method

TuxOnIceの動作状況をグラフィカルに表示するtuxonice-useruiの/sys/power/tuxonice/user_interface/enable_escapeの設定については、UbuntuのPPAのパッケージでは/usr/lib/pm-utils/sleep.d/99tuxoniceuiというファイルで書き込まれるようになっている。

hibernate-scriptから用いる

hibernate」パッケージが提供するhibernate-scriptからTuxOnIceを用いるには/etc/hibernate/hibernate.confで「TryMethod tuxonice.conf」が一番上にある状態の設定でhibernateコマンドを実行する(以前に扱った通り)。

設定

必要/好みに応じて

を管理者権限で編集する。テストを行う際には/etc/hibernate/tuxonice.confの「Reboot no」を「Reboot yes」にすると電源を切る代わりに再起動するので便利。
設定内容についても既に扱ったことがあるため、ここでは扱わない。

関連記事:

使用したバージョン:

  • Linux 2.6.35-23.41~ppa1(PPAのバイナリ), 2.6.35-24.42~ppa1(PPAのバイナリ), 2.6.35-24.42(ソースからビルドしたもの)
  • pm-utils 1.4.1-3
  • tuxonice-userui 1.0.git20100407~ppa1~maverick1
  • hibernate-script 2.0.git20100603~ppa1~maverick1