電源管理で休止状態を有効にしますか?

電源管理で休止状態を有効にしますか?

私は最新バージョンのLinux Mintがインストールされているノートブックを持っています。スワップパーティションを設定しましたが、pm-hibernate正常に動作します(起動時にシャットダウンと復元)。ただし、電源管理設定で「バッテリーが非常に不足している場合」を休止状態にすることはオプションではありません。 オプションのない写真 Python Configurator()を見て、/usr/share/cinnamon/cinnamon-settings/modules/cs_power.py休止状態が可能かどうかを確認するコードがあるようです。

def get_available_options(up_client):
    can_suspend = False
    can_hibernate = False
    can_hybrid_sleep = False

    # Try logind first
    try:
        connection = Gio.bus_get_sync(Gio.BusType.SYSTEM, None)
        proxy = Gio.DBusProxy.new_sync(
            connection,
            Gio.DBusProxyFlags.NONE,
            None,
            "org.freedesktop.login1",
            "/org/freedesktop/login1",
            "org.freedesktop.login1.Manager",
            None)

        can_suspend = proxy.CanSuspend() == "yes"
        can_hibernate = proxy.CanHibernate() == "yes"
        can_hybrid_sleep = proxy.CanHybridSleep() == "yes"
    except:
        pass

    # Next try ConsoleKit
    try:
        connection = Gio.bus_get_sync(Gio.BusType.SYSTEM, None)
        proxy = Gio.DBusProxy.new_sync(
            connection,
            Gio.DBusProxyFlags.NONE,
            None,
            "org.freedesktop.ConsoleKit",
            "/org/freedesktop/ConsoleKit/Manager",
            "org.freedesktop.ConsoleKit.Manager",
            None)

        can_suspend = can_suspend or (proxy.CanSuspend() == "yes")
        can_hibernate = can_hibernate or (proxy.CanHybridSleep() == "yes")
        can_hybrid_sleep = can_hybrid_sleep or (proxy.CanHybridSleep() == "yes")
    except:
        pass

    def remove(options, item):
        for option in options:
            if option[0] == item:
                options.remove(option)
                break

    lid_options = [
        ("suspend", _("Suspend")),
        ("shutdown", _("Shutdown immediately")),
        ("hibernate", _("Hibernate")),
        ("blank", _("Lock Screen")),
        ("nothing", _("Do nothing"))
    ]

    button_power_options = [
        ("blank", _("Lock Screen")),
        ("suspend", _("Suspend")),
        ("shutdown", _("Shutdown immediately")),
        ("hibernate", _("Hibernate")),
        ("interactive", _("Ask")),
        ("nothing", _("Do nothing"))
    ]

    critical_options = [
        ("shutdown", _("Shutdown immediately")),
        ("hibernate", _("Hibernate")),
        ("nothing", _("Do nothing"))
    ]

    if not can_suspend:
        for options in lid_options, button_power_options, critical_options:
            remove(options, "suspend")

    if not can_hibernate:
        for options in lid_options, button_power_options, critical_options:
            remove(options, "hibernate")

    return lid_options, button_power_options, critical_options, can_suspend, can_hybrid_sleep

can_hibernateこのコードの後に​​設定すると、Trueオプションが表示されますが機能しません。バッテリーが不足しているときにスリープモードを設定する方法は?

ベストアンサー1

私はLinux Mint 19.3 Cinnamon設定で休止状態を有効にするタスクを処理しました。

A)私は最初にこのチュートリアルに従いました。https://www.reddit.com/r/linuxmint/comments/93ta9u/enable_hibernation_in_linux_mint_19_tara/

注:SWAPパーティションが十分に大きいことを確認してください。

1.) 「/etc/polkit-1/localauthority/50-local.d」に「com.ubuntu.enable-hibernate.pkla」というファイルを作成します。

sudo touch /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla

2.)お気に入りのエディタ(root権限を含む)を使用してこのファイルを開き、次の行を貼り付けて保存します。

[Re-enable hibernate by default]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes

[Re-enable hibernate by default in logind]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate
ResultActive=yes

3.) "/etc/default/grub" ファイルで次の行を編集し、次のようにします。

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=swap_partition_uuid"

swap_partition_uuid- このUUIDは/etc/fstabファイルにありますので、その文字列をスワップパーティションの実際のUUIDに置き換えてください。

4.) 次のコマンドを実行して grub 構成を更新します。

sudo update-grub

  • コマンドを使用して休止状態をsystemctl hibernate有効にします。

  • ただし、休止状態ボタンは終了ウィンドウに表示されず、電源管理設定にも休止状態オプションは表示されません(注意してください)。

B)その後、/var/lib/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pklaこのチュートリアルで説明されているようにファイルを作成しました。http://linuxg.net/how-to-enable-hibernation-and-add-the-hibernate-button-to-the-shutdown-menu-on-ubuntu-14-04-trusty-tahr/

より明確に説明するために、引用の一部を編集しました。

1.) 「/var/lib/polkit-1/localauthority/50-local.d」に「com.ubuntu.enable-hibernate.pkla」というファイルを作成します。

sudo touch /var/lib/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla

2.)お気に入りのエディタ(root権限を含む)を使用してこのファイルを開き、次の行を貼り付けて保存します。

[Re-enable hibernate by default in upower]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes

[Re-enable hibernate by default in logind]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate
ResultActive=yes
  • 今私の設定でスリープボタンとオプションを使用することができます!

お役に立てば幸いです。

おすすめ記事