SSH - Computer-server accessible on sleep mode

Questions about Wi-Fi and other network devices, file sharing, firewalls, connection sharing etc
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
chrisdasp

SSH - Computer-server accessible on sleep mode

Post by chrisdasp »

Hi everybody ! :)

I just learnt how to use SSH and well, turns out my main computer is now a "server". I'd like to use it as a hard drive for personal datas, since my new computer has few hard memory.
But the thing is that I would like to let him accessible through SSH while I put him to sleep, or hibernate (pm-suspend), in order to avoid use of electricity too much.

Is it something doable? Letting the Internet connection open while it sleeps? Then I can access to it fro, anywhere with my other laptop.

I heard about Mosh, configured it, but it seems is more about keeping the connection with the computer we use after a sleep period, and not to put the computer server in sleep mode and keep the connection.


Thank you very much in advance for your answers,
Chris
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
redlined

Re: SSH - Computer server hibernate

Post by redlined »

hi chrisdasp!

I'm new to Linux and don't know any workarounds or other options, however as I understand it sleep, suspend and hibernate mode the computer will be non-responsive, basically session is saved for a quick(er than start/logon) resumes and computer goes into power saving mode.

Couple options I can think of for saving or minimizing power use of your SSH server is to have it remotely managed (via SSH client from remote PC) and remove keyboard, mouse and monitor which won't be needed. As well running a barebones distro (terminal/no DE) or perhaps a "lighter" Mint DE than Cinnamon, like XFCE would help.

For even more power savings on the SSH server you might look into WakeOnLAN (aka magic packet) which is designed to wake up a remote computer from shut down state (or sleep/hibernate?) if the server ethernet card and mobo support it. This search result should help you get that working: https://www.startpage.com/do/search?cmd ... linux+mint

I do not know if there will be other issues (like password/credntials requirements to address) but this should help get you started!

edit: add LM WOL tutorial link https://community.linuxmint.com/tutorial/view/1062
chrisdasp

Re: SSH - Computer server hibernate

Post by chrisdasp »

redlined wrote: Sat Nov 10, 2018 6:31 pm hi chrisdasp!
[...]
edit: add LM WOL tutorial link https://community.linuxmint.com/tutorial/view/1062
Hi redlined!

Thanks for your answer, I gotta have to check this WoL process to see if it does work with my situation. Since it is a laptop (Asus ROG pretty fat) it isn't gonna be possible to take off keyboard or screen.

If anyone has other tips to share I'll appreciate, and when the WoL is gonna be tested on my machine I'll let a note here for the people looking forward to do the same!

Regards,
Chris
redlined

Re: SSH - Computer server hibernate

Post by redlined »

hi Chris!

Thank you for checking back in and mention of plan to return and update if this works or you find another option. Perhaps others from forum, more experienced and even running SSH server on their networks, will add their thoughts as well and give advice on better options. I'm keeping an eye on this thread since this is similar to a desire I have for my home network 8)
chrisdasp

Re: SSH - Computer server hibernate

Post by chrisdasp »

Hi

I tried to use this Wake On Lan thing on my computer-server but actually it cannot work, looks like my internet card and the actual system shut down and does not let anything awake.
Anyway, it could be used only on the LAN network...

I'd like to use this computer on sleep mode as a "server" accessible from an other network, for exemple at University. The use is to store datas and have an HDD, nothing else (at least for now)
Is it something really doable? I searched a lot on the web but could not find an answer to this situation!


Thanks in advance,
Chris
redlined

Re: SSH - Computer-server accessible on sleep mode

Post by redlined »

hi Chris,

Let's get some more info and see if we can troubleshoot this further (this will also help other Linux knowledgable folks determine what is going on)

please copy and paste inxi -Fxz into terminal then copy those results and paste back into reply here (pasting results into a code box is the general norm when doing this, see the </> icon to set this option)
chrisdasp

Re: SSH - Computer-server accessible on sleep mode

Post by chrisdasp »

Here is the inxi-Fxz of my main computer where the SSH is configured.

System: Host: ChrisDasP Kernel: 4.15.0-20-generic x86_64
bits: 64 gcc: 7.3.0
Console: tty 1 Distro: Linux Mint 19 Tara
Machine: Device: laptop System: ASUSTeK product: G750JH v: 1.0 serial: N/A
Mobo: ASUSTeK model: G750JH v: 1.0 serial: N/A
BIOS: American Megatrends v: G750JH.205 date: 08/20/2013
Battery BAT0: charge: 58.7 Wh 83.5% condition: 70.3/89.2 Wh (79%)
model: ASUSTeK G750-59 status: Discharging
CPU: Quad core Intel Core i7-4700HQ (-MT-MCP-)
arch: Haswell rev.3 cache: 6144 KB
flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx) bmips: 19155
clock speeds: max: 3400 MHz 1: 1500 MHz 2: 1496 MHz 3: 1496 MHz
4: 1496 MHz 5: 1496 MHz 6: 1400 MHz 7: 1446 MHz 8: 1445 MHz
Graphics: Card: NVIDIA GK104M [GeForce GTX 780M] bus-ID: 01:00.0
Display Server: N/A
drivers: nouveau (unloaded: modesetting,fbdev,vesa)
tty size: 80x24 Advanced Data: N/A out of X
Audio: Card-1 Intel 8 Series/C220 Series High Def. Audio Controller
driver: snd_hda_intel bus-ID: 00:1b.0
Card-2 NVIDIA GK104 HDMI Audio Controller
driver: snd_hda_intel bus-ID: 01:00.1
Sound: Advanced Linux Sound Architecture v: k4.15.0-20-generic
Network: Card-1: Qualcomm Atheros AR9462 Wireless Network Adapter
driver: ath9k bus-ID: 03:00.0
IF: wlp3s0 state: up mac: <filter>
Card-2: Qualcomm Atheros QCA8171 Gigabit Ethernet
driver: alx port: d000 bus-ID: 04:00.0
IF: enp4s0 state: down mac: <filter>
Drives: HDD Total Size: 1750.4GB (1.9% used)
ID-1: /dev/sda model: HGST_HTS541010A9 size: 1000.2GB
ID-2: /dev/sdb model: WDC_WD7500BPKX size: 750.2GB
Partition: ID-1: / size: 28G used: 6.7G (26%) fs: ext4 dev: /dev/sda1
ID-2: /home size: 641G used: 20G (4%) fs: ext4 dev: /dev/sda2
ID-3: swap-1 size: 5.00GB used: 0.00GB (0%)
fs: swap dev: /dev/sda3
RAID: No RAID devices: /proc/mdstat, md_mod kernel module present
Sensors: System Temperatures: cpu: 46.0C mobo: N/A gpu: 45.0
Fan Speeds (in rpm): cpu: 2300
Info: Processes: 251 Uptime: 16 min Memory: 1168.7/15990.3MB
Init: systemd runlevel: 5 Gcc sys: 7.3.0
Client: Shell (bash 4.4.191) inxi: 2.3.56
User avatar
all41
Level 19
Level 19
Posts: 9520
Joined: Tue Dec 31, 2013 9:12 am
Location: Computer, Car, Cage

Re: SSH - Computer-server accessible on sleep mode

Post by all41 »

Have a look at powerwake package in repositories
Everything in life was difficult before it became easy.
redlined

Re: SSH - Computer-server accessible on sleep mode

Post by redlined »

hi chrisdasp!

Thank you for that, it looks like you have the server on wifi, uh, let's see WoL is supported and see if we can find a good tutorial to follow and get this done. Using that community link on setting WoL up I found I had to querry my laptop card by name, the "eth0" returns no such device errors.
if you haven't already then install ethtool sudo apt install ethtool
then let's check both your cards for WoL capability, please run the following comands in terminal and copy the results into your next reply.

sudo ethtool wlp3s0

in order to see if your ethernet adapter supports WoL it will need to be enabled (plug cat5 line in to card disconnect wifi and connect via wired in NM)
then- sudo ethtool enp4s0

if your preference is wifi and your wifi card returns positive results then you can skip the ethernet card check if not considering it an option (due to need for server to be on wifi)

what we are looking for is described in that article as:
We are interested in the line that says “Supports Wake-on: g” if the end of the line is “g” that means it is support to wake up your pc if it is “d” then you will probably need to buy a new one.
for comparison my results for those two lines

Code: Select all

	Supports Wake-on: pg
	Wake-on: d
shows that my ethernet adapter supports WoL (end with a 'g') but the wake-on: d tells me it is disabled, most likely in bios as it is a function I've never considered using before. If your results return Wake-on: d then you'll need to boot into bios options and enable it there for your adapter before we can go further.
all41 wrote: Sun Nov 18, 2018 4:29 pm Have a look at powerwake package in repositories
This certainly sounds like a solution, thanks all41!

Chris, see: https://launchpad.net/powernap for a bit of info on that package. The bug reports seem very active, some of that info may prove to be very useful to help in seting up as well. see here and here for tips in these reports.

which brings up another good point, software is the next thing to consider and there are options which I cannot vouch for much less troubleshoot and the choice may be best found in linux tutorials that set it up using a particular method. The below output from a repo search:

Code: Select all

~$ apt search wake
p   etherwake                       - tool to send magic Wake-on-LAN packets    
p   golang-github-danwakefield-fnma - Update clone of kballards golang fnmatch g
p   gwakeonlan                      - wakes up your machines using Wake on LAN  
p   nvram-wakeup                    - Read/write the WakeUp time from/to the BIO
p   powerwake                       - remotely wake a napping system            
p   powerwake-common                - common library files required by powerwake
p   powerwaked                      - remotely wake a napping system - Server Da
p   wakeonlan                       - Sends 'magic packets' to wake-on-LAN enabl
you may find a quick search for wake in Synaptic (SPM) to be handy in viewing those options provided by the various packages to enable this function.
User avatar
all41
Level 19
Level 19
Posts: 9520
Joined: Tue Dec 31, 2013 9:12 am
Location: Computer, Car, Cage

Re: SSH - Computer-server accessible on sleep mode

Post by all41 »

After powerwake package is installed then you can wake a remote computer on the lan by
powerwake <mac address>
as example:
powerwake 70D396003578
no colons are needed in the mac address

To wake multiple systems example
powerwake 70D396003578 001BB41C2AA5 72F3850447FD

You can even assign a keyboard shortcut to do this
Everything in life was difficult before it became easy.
redlined

Re: SSH - Computer-server accessible on sleep mode

Post by redlined »

hi all41, that certainly sounds easy enough!

came across a couple more references, going to paste them here as browser tabs are mysteriously accumulating again :P

Wake on WLAN, Ubuntu NM docs

Wake on WLAN, kernel docs

edit to add:
lifewire article covers bios, powerwake and the challenge for WoWLAN
Wake on Wireless LAN (WoWLAN)

Most laptops do not support Wake-on-LAN for Wi-Fi, officially called Wake on Wireless LAN, or WoWLAN. The ones that do need to have BIOS support for Wake-on-LAN and need to be using Intel Centrino Process Technology or newer.

The reason most wireless network cards do not support WoL over Wi-Fi is because the magic packet is sent to the network card when it's in a low power state, and a laptop (or wireless-only desktop) that isn't authenticated with the network and is completely shut down, has no way to listen for the magic packet, and therefore won't know if one is sent over the network.

For most computers, Wake-on-LAN works over Wi-Fi only if the wireless device is the one sending the WoL request. In other words, it works if the laptop, tablet, phone, or other device is waking up a computer but not the other way around.
that low power state for wifi card is one to consider how to manage this :?

good info from a blog
- Standby Mode Only - Because wireless clients must remain connected to the BSS at all times, standby mode is the lowest power state supported. Hibernation or full power off states will not work because no power is provided to the wireless NIC to maintain network association.
comments from above blog led to here: http://wakeonlan.me/ which may prove useful in testing wake ups from outside of LAN (and help get any required port-forwarding and subsequent troubleshooting)

and step 1 on this page mentions using a wifi repeater to help get his WoWLAN working; https://hackernoon.com/wake-on-lan-thro ... 1817e2dd41

2nd edit to add: another WoL from internet side test
Locked

Return to “Networking”