Talk:Elogind

From Gentoo Wiki
Jump to: navigation, search
Note
This is a talk page. Please add newer comments below older ones, and sign your comments using four tildes (~~~~). When adding a new section (at the bottom of the page), please mark it as "open for discussion" by using {{talk|open}} so it will show up in the list of open discussions.

Suggestion about Suspend to hibernate with elogind

Talk status
This discussion is still ongoing.

When laptop is suspended to ram, it uses very little power, so when the battery runes out user is forced to fully boot up the machine.

There are two ways to prevent this situation: Hibernate with hybrid-sleep, or use loginctl suspend command with the real-time wake timer hook to allow system to wake up and perform hibernate to disk with loginctl hibernate.

Solution is similar to Sabayon's wiki https://wiki.sabayon.org/index.php?title=Auto_hibernate_after_suspend, but it fully uses loginctl command so sys-power/pm-utils becomes obsolete.

First You have to create folder /lib/elogind/system-sleep/ for sleep hooks, and/or /lib/elogind/system-shutdown/ for shutdown hooks.

Then, in /lib/elogind/system-sleep/ place script:

#!/bin/bash
# Script name: /lib/elogind/system-sleep/autohibernate.sh
# Purpose: Auto hibernates after a period of sleep
# Edit the "autohibernate" variable below to set the number of seconds to sleep.

curtime=$(date +%s)

# 60 Minutes should be fine
autohibernate=3600

echo "$curtime $1" >>/tmp/autohibernate.log


if [ "$1" = "pre" ]
then
        if [ "$2" = "suspend" ]
        then
                # Suspending.  Record current time, and set a wake up timer.
                echo "$curtime" >/var/run/rtchibernate.lock
                rtcwake -m no -s $autohibernate
        fi
fi

if [ "$1" = "post" ]
then

        if [ "$2" = "suspend" ]
        then
                # Coming out of sleep
                sustime=$(cat /var/run/rtchibernate.lock)
                rm /var/run/rtchibernate.lock

                # Did we wake up due to the rtc timer above?
                if [ $(($curtime - $sustime)) -ge $autohibernate ]
                then
                        # Then hibernate
                        /bin/loginctl hibernate
                else
                        # Otherwise cancel the rtc timer and wake up normally.
                        rtcwake -m no -s 1
                fi
        fi
fi

You need to add executable permission with: chmod +x /lib/elogind/system-sleep/autohibernate.sh and reboot machine. — The preceding unsigned comment was added by PrSo (talkcontribs) 18th October, 2017

Kernel configuration needs updating

Talk status
This discussion is done as of 2018-01-22.

I can't find "[*] Simplified Mandatory Access Control Kernel Support" on my kernel 4.13.5 configuration.

Maybe it could be worth also specifying the actual CONFIG_* -variables too? Then tell to enable them using provided script (inside scripts -directory inside the kernel source directory). After applying the changes then users would need to run "make oldconfig". --Zucca (talk) 17:58, 24 October 2017 (UTC)

Sure. Can you update the article? The kernel configuration option is CONFIG_SECURITY_SMACK. Cateee is a wonderful site. Kind regards, --Maffblaster (talk) 19:03, 26 October 2017 (UTC)
Likely addressed by this edit: "Enable different security models" (CONFIG_SECURITY) must be enabled to make the option visible. The contents of the {{KernelBox}} template are correct at least for the 4.14-series, so marking as done. — GuillermoDH (talk) 18:53, 8 December 2018 (UTC)