{"id":80,"date":"2020-05-19T10:47:23","date_gmt":"2020-05-19T14:47:23","guid":{"rendered":"http:\/\/ericdarsey.com\/?p=80"},"modified":"2020-05-19T10:47:23","modified_gmt":"2020-05-19T14:47:23","slug":"dell-t5500-centos-7-wake-on-lan","status":"publish","type":"post","link":"https:\/\/www.ericdarsey.com\/?p=80","title":{"rendered":"Dell T5500 CentOS 7 Wake on LAN"},"content":{"rendered":"\n<p>After setting up the Server, I wanted to be able to turn it off from the command line after I was done using it, and to be able to remotely start it. This is how I imagine that a SysAdmin would work with their devices. <\/p>\n\n\n\n<p>Also, this is in my bedroom, and although it isn&#8217;t screaming loud like a rack server is, it still makes noise. I have no where else to put it, so I though that getting this functionality to work would be extremely useful<\/p>\n\n\n\n<p>Ethtool comes pre-installed on CentOS 7<br><code>ethtool [eth0] | grep Wake-on <\/code>#Where eth0 is the name of your NIC interface found from the &#8220;$ ip link&#8221; command<br>My wol settings are &#8220;g&#8221; which uses &#8220;magic packets&#8221; sent to the Network Interface Card, which then is able to send signals to the motherboard about power states.<br><code>cat \/sys\/class\/net\/[eth0]\/address <\/code>#This command outputs the mac address of designated nic interface to the console<\/p>\n\n\n\n<p>Test it! <code>$ systemctl hibernate<\/code><br>Now the ssh session will stop responding for the remote computer that was just hibernated<\/p>\n\n\n\n<p>etherwake was already on my system.<br>copy the mac address from the remote interface<br><code>$ sudo etherwake [mac address]<\/code><br>The terminal will respond &#8220;<code>Network is down<\/code>&#8220;<\/p>\n\n\n\n<p>After the computer comes up from hibernation the remote ssh session will respond again!<\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" href=\"https:\/\/www.lisenet.com\/2016\/set-up-wake-on-lan-wol-on-centos-7\/ #\" target=\"_blank\">A Linux SysAdmin Blog &#8211; (Far more advance than me)<\/a><br><a href=\"https:\/\/linux.die.net\/man\/8\/ether-wake\" target=\"_blank\" rel=\"noreferrer noopener\">Etherwake documentation page<\/a><\/p>\n\n\n\n<p>Issues!!<\/p>\n\n\n\n<p>After implementing all of the changes, the machine clearly hibernates (i.e. powers down) and after the magic packet is sent it powers up. It also responds to ping and ARP, BUT I can&#8217;t log in via ssh. The process just hangs now with no results. I tested this and it will hang overnight with no results\/output.<\/p>\n\n\n\n<p>Google search \u201cpacket_write_wait: Connection to 192.168.0.120 port 22: Broken pipe\u201d<br>Best result: <a rel=\"noreferrer noopener\" href=\"https:\/\/askubuntu.com\/questions\/127369\/how-to-prevent-write-failed-broken-pipe-on-ssh-connection\/354245#354245\" target=\"_blank\">https:\/\/askubuntu.com\/questions\/127369\/how-to-prevent-write-failed-broken-pipe-on-ssh-connection\/354245#354245<\/a><br>When changing all of these read-only files and you encounter the E212 error when using vi or nano:<br><a href=\"https:\/\/stackoverflow.com\/questions\/14948441\/vim-cant-save-file-e212\/14948510\">https:\/\/stackoverflow.com\/questions\/14948441\/vim-cant-save-file-e212\/14948510<\/a><br>command: <code>$ w !sudo tee %<\/code> then type L for load<br>To correct the broken pipe error I made changes on my SSH clients and the SSH Server config files as well.<\/p>\n\n\n\n<p>Google Searching:<br>Generic explanation of Wake on LAN for all OSes: <a rel=\"noreferrer noopener\" href=\"https:\/\/www.howtogeek.com\/70374\/how-to-geek-explains-what-is-wake-on-lan-and-how-do-i-enable-it\/\" target=\"_blank\">https:\/\/www.howtogeek.com\/70374\/how-to-geek-explains-what-is-wake-on-lan-and-how-do-i-enable-it\/<\/a><br>Search Terms: &#8220;magic packet wake on lan centos 7&#8221;, &#8220;enable wol centos 7&#8221;<br>Another site like this one trying to document fixes: <a href=\"https:\/\/frank.sauerburger.io\/2019\/09\/25\/wake-on-lan-on-centos-7.html\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/frank.sauerburger.io\/2019\/09\/25\/wake-on-lan-on-centos-7.html<\/a><br>Link to another site pointed out by Frank above: <a href=\"https:\/\/blog.yucas.mx\/2018\/02\/03\/add-systemd-service-to-start-wake-on-lan\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/blog.yucas.mx\/2018\/02\/03\/add-systemd-service-to-start-wake-on-lan\/<\/a><br>CentOS 7 specific mention of a WoL problem: <a href=\"https:\/\/forums.centos.org\/viewtopic.php?t=71861\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/forums.centos.org\/viewtopic.php?t=71861<\/a><br>Cool PDF of Redhat SysAdmin guide: <a href=\"https:\/\/access.redhat.com\/documentation\/en-us\/red_hat_enterprise_linux\/7\/pdf\/system_administrators_guide\/Red_Hat_Enterprise_Linux-7-System_Administrators_Guide-en-US.pdf\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/access.redhat.com\/documentation\/en-us\/red_hat_enterprise_linux\/7\/pdf\/system_administrators_guide\/Red_Hat_Enterprise_Linux-7-System_Administrators_Guide-en-US.pdf<\/a><\/p>\n\n\n\n<p>Alright so I rebooted the server and logged in to the GUI to make all of these changes<\/p>\n\n\n\n<p>Command history [use command &#8211;> <code>$ history | less<\/code>]<br>44 ls<br>45 cd \/etc\/<br>46 ls<br>47 cd .\/udev\/<br>48 ls<br>49 rpm -qa | grep gnome-shell-browser-plugin<br>50 yum repolist<br>51 yum-config-manager &#8211;enable<br>52 sudo yum-config-manager &#8211;enable<br>53 sudo yum-config-manager &#8211;enable rhel-7-server-optional-rpms<br>54 yum -y install gnome-shell-browser-plugin<br>55 sudo yum -y install gnome-shell-browser-plugin<br>56 sudo ethtool enp6s0<br>57 man ethtool<br>58 cat \/pro\/net\/dev<br>59 cat \/proc\/net\/dev<br>60 cd \/etc\/dev\/rules.d<br>61 ls<br>62 cd \/etc\/udev\/rules.d<br>63 vi 99-wakeonlan<br>64 sudo vi 99-wakeonlan<br>65 sudo vi \/usr\/lib\/systemd\/systemd-wakeonlan<br>66 ls<br>67 vi 5<br>68 rm 5<br>69 sudo rm 5<br>70 ls<br>71 cd \/usr\/lib\/systemd\/systemd-wakeonlan<br>72 cd \/usr\/lib\/systemd\/<br>73 ls<br>74 chmod +x \/usr\/lib\/systemd\/systems-wakeonlan<br>75 chmod +x \/usr\/lib\/systemd\/systemd-wakeonlan<br>76 sudo chmod +x \/usr\/lib\/systemd\/systemd-wakeonlan<br>77 sudo vi \/usr\/lib\/systemd\/system\/wakeonlan.service<\/p>\n\n\n\n<p>clearly some mistakes are visible (that&#8217;s why you see that rm 5 in there)<br>But I implemented the solution found in:<\/p>\n\n\n\n<p>And then the service wouldn&#8217;t start!!!<br>I found one issue by following the error message prompts. That was a typo.<br>Then I looked at one other source to follow which was exactly the same, except that I included the #\/usr\/lib\/systemd\/systemd-wakeonlan creation line in the file when it should have started with #!\/bin\/sh<\/p>\n\n\n\n<p>I need to know more about services and scripts to understand why this is an error.<\/p>\n\n\n\n<p>So I found that the service script that was written didn&#8217;t change the way that my system behaved when waking up from hibernate (Save to disk before powering down). But! When I suspend (save to RAM and keep RAM powered on) or if I completely power down the Magic packet powers the system on and I am able to access the system through ssh (or the GUI if I have a monitor plugged in).<\/p>\n\n\n\n<p>I researched system power states and found helpful information, but I will need to look up more information on both my specific hardware and how the OS interacts with it, to see why <code>$ systemctl hibernate<\/code> is not functional, but <code>$ systemctl suspend<\/code> and <code>$ systemctl poweroff<\/code> put the server into a state that I can bring it back from. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>After setting up the Server, I wanted to be able to turn it off from the command line after I was done using it, and to be able to remotely start it. This is how I imagine that a SysAdmin would work with their devices. Also, this is in my bedroom, and although it isn&#8217;t [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,4],"tags":[],"class_list":["post-80","post","type-post","status-publish","format-standard","hentry","category-project","category-troubleshooting"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.ericdarsey.com\/index.php?rest_route=\/wp\/v2\/posts\/80","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ericdarsey.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ericdarsey.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ericdarsey.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ericdarsey.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=80"}],"version-history":[{"count":0,"href":"https:\/\/www.ericdarsey.com\/index.php?rest_route=\/wp\/v2\/posts\/80\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.ericdarsey.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=80"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ericdarsey.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=80"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ericdarsey.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=80"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}