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

Connection sharing, Firewall, Samba..etc
Forum rules
Before you post please read how to get help
Post Reply
bla_bla_is_2bla
Level 1
Level 1
Posts: 8
Joined: Wed Jun 13, 2018 8:33 am

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

Post by bla_bla_is_2bla » Wed Jun 13, 2018 8:56 am

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 bla_bla_is_2bla on Wed Jun 13, 2018 4:34 pm, edited 1 time in total.

User avatar
Pierre
Level 17
Level 17
Posts: 7697
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 » 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'.
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
Level 1
Level 1
Posts: 8
Joined: Wed Jun 13, 2018 8:33 am

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

Post by bla_bla_is_2bla » Wed Jun 13, 2018 9:17 am

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 17
Level 17
Posts: 7697
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 » Wed Jun 13, 2018 9:24 am

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 17
Level 17
Posts: 7697
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 » Wed Jun 13, 2018 9:32 am

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
Level 1
Level 1
Posts: 8
Joined: Wed Jun 13, 2018 8:33 am

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

Post by bla_bla_is_2bla » Wed Jun 13, 2018 10:43 am

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
Level 1
Level 1
Posts: 8
Joined: Wed Jun 13, 2018 8:33 am

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

Post by bla_bla_is_2bla » Wed Jun 13, 2018 3:00 pm

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 13
Level 13
Posts: 4987
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 » Wed Jun 13, 2018 3:36 pm

I use a utility from the repositories powerwake

then pass:
powerwake <mac address>
in the terminal or via script
Proud to be a supporter and monthly contributor to Mint.

bla_bla_is_2bla
Level 1
Level 1
Posts: 8
Joined: Wed Jun 13, 2018 8:33 am

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

Post by bla_bla_is_2bla » Wed Jun 13, 2018 3:57 pm

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
Level 1
Level 1
Posts: 8
Joined: Wed Jun 13, 2018 8:33 am

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

Post by bla_bla_is_2bla » Wed Jun 13, 2018 4:21 pm

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!

Post Reply

Return to “Other networking topics”