{"id":9267,"date":"2022-03-15T20:12:30","date_gmt":"2022-03-15T20:12:30","guid":{"rendered":"http:\/\/putridparrot.com\/blog\/?p=9267"},"modified":"2022-03-15T20:12:30","modified_gmt":"2022-03-15T20:12:30","slug":"stopping-my-ubuntu-server-from-hibernating","status":"publish","type":"post","link":"https:\/\/putridparrot.com\/blog\/stopping-my-ubuntu-server-from-hibernating\/","title":{"rendered":"Stopping my Ubuntu server from hibernating"},"content":{"rendered":"<p>I&#8217;m not sure what&#8217;s happened, but after a recent upgrade to my Ubuntu server &#8211; when I tried to connect to the server (which I use as both a dev server and NAS), I couldn&#8217;t log into via ssh but when I attached a monitor and keyboard to the server I was able to use it and the ssh started working. However after a period of inactivity the server seemingly went offline, pressing the power switch briefly bought it back online. So some how it had gone sleep\/hibernate mode &#8211; not very useful thing for a server.<\/p>\n<p>Here&#8217;s some steps I went through to eventually get this working again&#8230;<\/p>\n<p><strong>Check the logs<\/strong><\/p>\n<p>Checking the logs is always a useful first step, so let&#8217;s take a look at the <em>syslog<\/em><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nnano \/var\/log\/syslog\r\n<\/pre>\n<p>or use<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\ntail -f \/var\/log\/syslog\r\n<\/pre>\n<p>I spotted log entries saying the machine was going to sleep.<\/p>\n<p><strong>Checking and then disabling sleep mode<\/strong><\/p>\n<p>Now use <em>systemctl<\/em> to confirm the status of the <em>sleep.target<\/em>, i.e. is it enabled<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nsudo systemctl status sleep.target\r\n<\/pre>\n<p>To disable sleep, we probably want to disable all options that hibernate\/sleep so we can disable the lot using <\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nsudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target\r\n<\/pre>\n<p>If for some reason you wish to re-enable these, just run<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nsudo systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target\r\n<\/pre>\n<p>I&#8217;m still none the wiser as to how hibernate got enabled &#8211; but at least I&#8217;ve learned how to check and disable it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m not sure what&#8217;s happened, but after a recent upgrade to my Ubuntu server &#8211; when I tried to connect to the server (which I use as both a dev server and NAS), I couldn&#8217;t log into via ssh but when I attached a monitor and keyboard to the server I was able to use [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[312],"tags":[],"class_list":["post-9267","post","type-post","status-publish","format-standard","hentry","category-ubuntu-2"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/9267","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/comments?post=9267"}],"version-history":[{"count":3,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/9267\/revisions"}],"predecessor-version":[{"id":9276,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/9267\/revisions\/9276"}],"wp:attachment":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/media?parent=9267"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/categories?post=9267"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/tags?post=9267"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}