<SOLVED>Wakeon lan works only afther shutting down with X-win NOT with console shutdown command

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
bla_bla_is_2bla

<SOLVED>Wakeon lan works only afther shutting down with X-win NOT with console shutdown command

Post by bla_bla_is_2bla »

Hello all,
A year ago I did build a small backup server. I do not want this server to run all day so I tried to use wake up lan. The backup program I use on the PC which needs to access the server is lucky backup, I like this program because it is small and it accepts command line commands. You can use command line commands before the backup starts and when the backup is done.

This works fine, when I do wakeonlan macaddress the server boots up. When the backup is done I can do: "ssh username@ipaddress sudo shutdown -P now" this makes the server shutdown. But when I try the wakeonlan command after the shutdown command the server will not boot. I did also try to shut down the server with the shutdown button in X-windows, when I use this method, wakeup-lan works. The server uses linux mint 17 Mate.

Can anyone please tell me how to fix this problem?
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.
User avatar
Pierre
Level 21
Level 21
Posts: 13192
Joined: Fri Sep 05, 2008 5:33 am
Location: Perth, AU.

Re: Wakeon lan works only afther shutting down with X-win NOT with console shutdown command

Post by Pierre »

that command - "ssh username@ipaddress sudo shutdown -P now" - shut's the machine down.
ie: to use another command , that will place the machine into a sleep, rather than a shutdown.

that doesn't have to be in 'Hibernation' either, - rather just into a 'sleep' mode,
& yeah - -that will also consume a bit of power, whilst 'asleep'.
Image
Please edit your original post title to include [SOLVED] - when your problem is solved!
and DO LOOK at those Unanswered Topics - - you may be able to answer some!.
bla_bla_is_2bla

Re: Wakeon lan works only afther shutting down with X-win NOT with console shutdown command

Post by bla_bla_is_2bla »

Pierre wrote: Wed Jun 13, 2018 9:03 am that command - "ssh username@ipaddress sudo shutdown -P now" - shut's the machine down.
ie: to use another command , that will place the machine into a sleep, rather than a shutdown.

that doesn't have to be in 'Hibernation' either, - rather just into a 'sleep' mode,
& yeah - -that will also consume a bit of power, whilst 'asleep'.
Hello Pierre, than you for your reply. Sleep might be a nice workaround. Still I wonder though why clicking shutdown in the X-windows works and the shutdown command in the console does not work. Is there a way to check what the shutdown command in X-windows does and just copy it to the console?
User avatar
Pierre
Level 21
Level 21
Posts: 13192
Joined: Fri Sep 05, 2008 5:33 am
Location: Perth, AU.

Re: Wakeon lan works only afther shutting down with X-win NOT with console shutdown command

Post by Pierre »

To shutdown the system:

Code: Select all

sudo shutdown -h now 
To restart:

Code: Select all

sudo reboot
& one more command for restart:

Code: Select all

sudo shutdown -r now
Another way as one of the user mentioned.

For shutdown:

Code: Select all

sudo halt
or:

Code: Select all

sudo init 0 
For restart:

Code: Select all

sudo init 6
You can get more info on the shutdown command by using one of the following:

shutdown --help
man shutdown
Image
Please edit your original post title to include [SOLVED] - when your problem is solved!
and DO LOOK at those Unanswered Topics - - you may be able to answer some!.
User avatar
Pierre
Level 21
Level 21
Posts: 13192
Joined: Fri Sep 05, 2008 5:33 am
Location: Perth, AU.

Re: Wakeon lan works only afther shutting down with X-win NOT with console shutdown command

Post by Pierre »

another way, would be:
The command for sleep or suspend, is pm-suspend. pm-suspend is included in the pm-utils package,
- on Debian, Ubuntu, Linux Mint, Pinguy, Knoppix and other Debian based distros.

Suspend Linux Box: sudo pm-suspend

To send your computer to hibernation, use pm-hibernate.

Hibernate Linux Box: sudo pm-hibernate

You can also hybrid suspend your computer, with pm-suspend-hybrid.

The hybrid command saves the hard disk session and keeps the system on, allowing a the computer to fast resume.

Hybrid Suspend Linux Box: sudo pm-suspend-hybrid

All, the pm-* tools (pm-suspend, pm-hybernate, pm-suspend-hybrid) are included in the pm-utils package.
but, I'm not sure if the PM-command is pre-installed, or not.
EDIT: yes - it does seem to be already installed.
Image
Please edit your original post title to include [SOLVED] - when your problem is solved!
and DO LOOK at those Unanswered Topics - - you may be able to answer some!.
bla_bla_is_2bla

Re: Wakeon lan works only afther shutting down with X-win NOT with console shutdown command

Post by bla_bla_is_2bla »

Hello Piere,
Think I did find somethings:

The -H halts the system then I see the mint symbol and nothing works anymore then I need a hard reset, pushing the button on the server.

ssh xxxx@xxxxxxx sudo shutdown -h now

seems to work. But only when I do log in in the X-windows like type the pasword in the x-windows on the server keyboard. Then I can shutdown the server from a other machine with the command above. Then I can use the wake on lan command from a other machine to boot the server. again. does this give the right information to fix the problem?

thanks for the help
bla_bla_is_2bla

Re: Wakeon lan works only afther shutting down with X-win NOT with console shutdown command

Post by bla_bla_is_2bla »

I tried the following:

(1)boot the server
(2)login to x-windows on the server, using the keyboard connected to the server
(3)log user out of x-windows on the server, using the mouse connected to the server
(3)"ssh user@ip-address sudo shutdown -h now" from the NON server machine, the server shuts down
(4)"wakeonlan mac address" from the NON server machine, this makes the server boot

If I do not do step (2) and (3) the server will not boot when I do (4)
This makes me think it is not the shutdown command which is causing the problem but it is some configuration which takes place when I log into X-windows. I hope this information helps and some-one can tell me what to do. Thank you all for the help.
User avatar
all41
Level 19
Level 19
Posts: 9498
Joined: Tue Dec 31, 2013 9:12 am
Location: Computer, Car, Cage

Re: Wakeon lan works only afther shutting down with X-win NOT with console shutdown command

Post by all41 »

I use a utility from the repositories powerwake

then pass:
powerwake <mac address>
in the terminal or via script
Everything in life was difficult before it became easy.
bla_bla_is_2bla

Re: Wakeon lan works only afther shutting down with X-win NOT with console shutdown command

Post by bla_bla_is_2bla »

I also did the following:
"sudo ethtool eth0" via ssh on the server before I did log into x-windos I got this:

Settings for eth0:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: No
Supports auto-negotiation: Yes
Advertised link modes: Not reported
Advertised pause frame use: No
Advertised auto-negotiation: Yes
Speed: 100Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
MDI-X: Unknown
Supports Wake-on: pg
Wake-on: d
Current message level: 0x0000003f (63)
drv probe link timer ifdown ifup
Link detected: yes

"sudo ethtool eth0" via ssh on the server logged in x-windows I got this:

Settings for eth0:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: No
Supports auto-negotiation: Yes
Advertised link modes: Not reported
Advertised pause frame use: No
Advertised auto-negotiation: Yes
Speed: 100Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
MDI-X: Unknown
Supports Wake-on: pg
Wake-on: g
Current message level: 0x0000003f (63)
drv probe link timer ifdown ifup
Link detected: yes

So then I tried to do "sudo ethtool -s eth0 wol g" before logging into x-windows and then the wak-on lan did work again. Now I need to find a way to enable the "g" option before the x-windos loging. Any suggestions are welcome.
bla_bla_is_2bla

Re: Wakeon lan works only afther shutting down with X-win NOT with console shutdown command

Post by bla_bla_is_2bla »

I did ask someone on irc and he told me to put the following script:


#!/bin/sh
set -e

if [ "$IFACE" = lo ]; then
exit 0
fi

if [ "$MODE" != start ]; then
exit 0
fi

/sbin/ethtool -s $IFACE wol g


into a file in the following directory:
/etc/network/if-up.d/

and make it chmod +x

when I did this the wake-on was g and not d before logging into X-windows and the server can now do wake-on-lan after a shutdown! It seems to work! Thanks for the help all!
Locked

Return to “Networking”