Ambos lados da revisão anteriorRevisão anteriorPróxima revisão | Revisão anterior |
public:hibernar-mint-19 [2019/06/08 13:19] – kawabata | public:hibernar-mint-19 [2025/06/05 19:47] (atual) – edição externa 127.0.0.1 |
---|
[[https://forums.linuxmint.com/viewtopic.php?t=284100|https://forums.linuxmint.com/viewtopic.php?t=284100]] | [[https://forums.linuxmint.com/viewtopic.php?t=284100|https://forums.linuxmint.com/viewtopic.php?t=284100]] |
| |
* sudo swapoff -a | <code bash> |
* SIZE=10 // como regra use o tamanho da RAM + 2GB. Se for 8GB use SIZE=10 | sudo swapoff -a |
* | </code> |
'' sudo dd if=/dev/zero of=/swapfile bs=1M count=$(($SIZE * 1024)) sudo chmod 0600 /swapfile sudo mkswap /swapfile sudo sed -i '/swap/{s/^/#/}' /etc/fstab sudo tee -a /etc/fstab<<<__GESHI_QUOT__ /swapfile none swap sw 0 0__GESHI_QUOT__'' | |
| |
''''RESUME_PARAMS=__GESHI_QUOT__resume=UUID=$(findmnt / -o UUID -n) resume_offset=$(sudo filefrag -v /swapfile|awk 'NR==4{gsub(/\./,__GESHI_QUOT____GESHI_QUOT__);print $4;}') __GESHI_QUOT__'' </file> <code>''if grep resume /etc/default/grub>/dev/null; then echo -e __GESHI_QUOT__ \nERROR: Hibernation already configured. Remove the existing configuration from /etc/default/grub and add these parameters instead:\n$RESUME_PARAMS__GESHI_QUOT__;else sudo sed -i __GESHI_QUOT__s/GRUB_CMDLINE_LINUX_DEFAULT=\__GESHI_QUOT__ /GRUB_CMDLINE_LINUX_DEFAULT=\__GESHI_QUOT__ $RESUME_PARAMS/__GESHI_QUOT__ /etc/default/grub;fi''''''''sudo update-grub'' sudo tee /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla <<'EOB' [Enable hibernate] Identity=unix-user:* Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions ResultActive=yes EOB '' REBOOT ''''busctl call org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager CanHibernate'''' tem de retornar YES Já deve estar no menu a opção hibernar ou '' systemctl hibernate '' // | |
| |
//// | ''SIZE=10'' -- como regra use o tamanho da RAM + 2GB. Se for 8GB use SIZE=10 |
| |
// | |
| |
| <code bash> |
| sudo dd if=/dev/zero of=/swapfile bs=1M count=$(($SIZE * 1024)) |
| sudo chmod 0600 /swapfile |
| sudo mkswap /swapfile sudo sed -i '/swap/{s/^/#/}' /etc/fstab |
| sudo tee -a /etc/fstab<<<"/swapfile none swap sw 0 0" |
| </code> |
| |
| <code bash> |
| RESUME_PARAMS="resume=UUID=$(findmnt / -o UUID -n) resume_offset=$(sudo filefrag -v /swapfile|awk 'NR==4{gsub(/\./,"");print $4;}') " |
| </code> |
| |
| <code bash> |
| if grep resume /etc/default/grub>/dev/null; then echo -e "\nERROR: Hibernation already configured. Remove the existing configuration from /etc/default/grub and add these parameters instead:\n$RESUME_PARAMS";else sudo sed -i "s/GRUB_CMDLINE_LINUX_DEFAULT=\"/GRUB_CMDLINE_LINUX_DEFAULT=\"$RESUME_PARAMS/" /etc/default/grub;fi |
| </code> |
| |
| <code bash> |
| sudo update-grub |
| </code> |
| |
| <code bash> |
| sudo tee /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla <<'EOB' |
| [Enable hibernate] |
| Identity=unix-user:* |
| Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions |
| ResultActive=yes |
| EOB |
| </code> |
| |
| Reboot. |
| Ao reiniciar o botão dehibernar já deve estar disponível. |
| |
| Teste para saber se está ok |
| |
| <code bash> |
| busctl call org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager CanHibernate |
| </code> |
| |
| tem de retornar "yes" |
| |
| ou para hibernar em linha de comando |
| |
| <code bash> |
| systemctl hibernate |
| </code> |