MrChromebox / firmware

Issue tracker for firmware issues
78 stars 16 forks source link

Power on AC for Acer C710 (Boot after power outage) #62

Closed ShapeShifter499 closed 6 years ago

ShapeShifter499 commented 7 years ago

I was recently reading https://plus.google.com/104852207441570817808/posts/HTi8t4jf1MW and I was wondering if something similar could be done for the Acer C710 Coreboot. Can Wake-on-Lan be enabled? Or power on AC?

I want to use my Chromebook as a NAS server with Arch Linux and Nextcloud. The issue is finding a way to power the device back on when power is lost. I was looking at Wake-on-Lan but I couldn't even get it working in Sleep/Hibernate mode.

ReddestDream commented 7 years ago

AFAIK, I do not think the C710 hardware supports WOL or power on AC w/o the power button . . .

ShapeShifter499 commented 7 years ago

@ReddestDream ethtool from Arch Linux repositories seems to think it's a feature, but it doesn't work. I think it's a BIOS issue but I have little idea how to change that.

[root@kumo ~]# ethtool enp2s0f0
Settings for enp2s0f0:
    Supported ports: [ TP ]
    Supported link modes:   10baseT/Half 10baseT/Full 
                            100baseT/Half 100baseT/Full 
                            1000baseT/Half 1000baseT/Full 
    Supported pause frame use: No
    Supports auto-negotiation: Yes
    Advertised link modes:  10baseT/Half 10baseT/Full 
                            100baseT/Half 100baseT/Full 
                            1000baseT/Half 1000baseT/Full 
    Advertised pause frame use: Symmetric
    Advertised auto-negotiation: Yes
    Link partner advertised link modes:  10baseT/Half 10baseT/Full 
                                         100baseT/Half 100baseT/Full 
                                         1000baseT/Full 
    Link partner advertised pause frame use: Symmetric Receive-only
    Link partner advertised auto-negotiation: Yes
    Speed: 1000Mb/s
    Duplex: Full
    Port: Twisted Pair
    PHYAD: 1
    Transceiver: internal
    Auto-negotiation: on
    MDI-X: on
    Supports Wake-on: g
    Wake-on: g
    Current message level: 0x000000ff (255)
                   drv probe link timer ifdown ifup rx_err tx_err
    Link detected: yes
[root@kumo ~]# ethtool enp2s0f0 | grep Wake-on
    Supports Wake-on: g
    Wake-on: g
[root@kumo ~]# 

Oops posted the wrong log from a IRC chat earlier, correct ethtool output is above now.

ReddestDream commented 7 years ago

Sure. You can send that packet.

But, the wifi card/ethernet and the firmware have to work together to support that packet and actually make WOL work.

What I mean is, I think the wifi card the C710 comes with stock (AR9462) can support it and the ethernet too, but I'm not sure the firmware does, which will result in reports that it works without it actually working.

ReddestDream commented 7 years ago

So, I've looked into the code.

Few points:

  1. There is no magic switch to just turn WOL on in the firmware for the C710. For some devices, there's an option. Here, there is not. :/

  2. WOL is partly dependent on the Embedded Controller. For Chromebooks prior to Link, there was not a standardized Embedded Controller and their capabilities varied. The C710 is prior to Link, so it's possible the Embedded Controller simply doesn't support WOL.

  3. Waking on AC is also controlled by the Embedded Controller. Again, prior to Link, this is a per device custom job if it's possible at all.

Most Chromeboxes don't have Embedded Controllers. They don't have all the sophisticated power management needs of a laptop, so it's easier to have things like WOL work . . .

ShapeShifter499 commented 7 years ago

@ReddestDream I was trying the 'wol' package from Arch Linux and 'etherwake' from OpenWrt/Lede. I couldn't get either to kick start the Chromebook from both full power off and Sleep/Hibernate. 'etherwake' mentions something about a 'password' for some ethernet devices, do I need that in this case? Is it possible this card looks for something non-standard on the network?

ReddestDream commented 7 years ago

I don't think so. I think this is simply a case where, while the networking hardware (the ethernet and wifi themselves) would support WOL, the firmware doesn't have the code for it, likely because the Embedded Controller doesn't support it and doesn't get or at least doesn't respond to the WOL packet at all.

ShapeShifter499 commented 7 years ago

@ReddestDream what about powering on AC detection?

ReddestDream commented 7 years ago

That's also Embedded Controller territory. I'm not sure how to change it or if it is possible on pre-Link devices since it was not standardized.

ShapeShifter499 commented 7 years ago

@ReddestDream I'm sorry, what is "Link"? I never heard of that term in this context before, some sort of standardization?

ReddestDream commented 7 years ago

Link is the Chromebook Pixel 1. It was the first Chromebook to use the GoogleEC embedded controller with standardized EC firmware. We are able to change/update the GoogleEC's firmware, so for devices after Link, we have a lot more control over low-level behavior, things like sleep/wake and power on behavior, keyboard key mapping, fan speeds, thermal thresholds, etc.

ShapeShifter499 commented 7 years ago

Oh how cool.

So do you have any other ideas about booting after a power outage?

ReddestDream commented 7 years ago

More info on Embedded Controllers:

https://en.wikipedia.org/wiki/Embedded_controller

So do you have any other ideas about booting after a power outage?

I'm not sure. From my experience with C710 boards, they require a power button press to turn on and there is no obvious way of shorting that. The power button is part of the mainboard itself. :/

ShapeShifter499 commented 7 years ago

@ReddestDream I guess I'll just have to setup some scripts to safely stop anything writing data and power down drives connected via USB in the event of a power loss on AC. If AC power is restored before critical battery level then restart services (i.e. Nextcloud). I wish there was a better solution, this is the only spare device I have besides my main Laptop where I put so much RAM into, 12Gb total.

Thank you for the help and information. I'll leave this open in case anyone with the same Chromebook has a similar issue OR in case someone actually knows a workaround.

ReddestDream commented 7 years ago

So, I've done more review and talked to MrChromebox.

I have an idea that /might/ get wake-on-lan/wake-on-lan-over-wifi to work.

I'll have to try to implement something in the firmware. And then have you test it with your config if I can get some progress here.

But I will need you to be on the latest UEFI firmware (04/09). This fix will only be in the UEFI firmware if I make it.

If you are on a Legacy SeaBIOS firmware and you upgrade to UEFI, you will lose your ability to boot any BIOS-style Linux installations you may have. If re-installing is too much of a pain given the complexity of your config, then it's not going to be worth me trying to implement this idea I've had since you are the only person who's requested it.

Does this make sense? Let me know. Thx.

ShapeShifter499 commented 7 years ago

@ReddestDream Before I saw your latest post I just went and updated to the latest firmware I could get from MrChromebox just to make sure I had the latest fixes and whatnot. I spent some time and after reading through the Arch Linux Wiki I was able to convert my current install into a UEFI install.

I have three partitions, boot, root, and swap. I had to reformat the old boot partition to a fat partition that had the EFI boot flag. I have "boot" mounted to /esp and then I have '/esp/EFI/arch' bind mounted to '/boot' in the file system. According to the Wiki it's the best way to allow pacman to continue installing kernel upgrades as normal while allowing EFI to boot a grub install from that partition.

TL;DR I have everything booting in UEFI after only having to reinstall the boot stuff. For anyone reading the particular setup I have above only works because Arch Linux enables support in their kernels to load from a fat partition. I ran the script from https://mrchromebox.tech/firmware-util.sh so I should be on the latest firmware there is.

ReddestDream commented 7 years ago

@ShapeShifter499 Cool. I'll take a look at enabling wake-on-lan/wake-on-lan-over-wifi in the firmware with a trick I discovered a few days ago . . .

ShapeShifter499 commented 7 years ago

@ReddestDream @MattDevo Any updates on this?

ReddestDream commented 7 years ago

Been busy. Have not had a chance to look into it. Still on my list.

ShapeShifter499 commented 7 years ago

@ReddestDream I'm not trying to rush anything, I'm just wondering were you are on this.

ReddestDream commented 7 years ago

I have not had time yet. But it is on my list to work on.

I can't guarantee anything, and I will let you know if/when I'm able to come up with something.

ShapeShifter499 commented 7 years ago

@ReddestDream Updates?

ReddestDream commented 7 years ago

Wish I had updates. Sorry. I'll work on it after my finals. :/

darkknight1812 commented 7 years ago

@ReddestDream Any news/updates?

ReddestDream commented 7 years ago

Not planned for the next update, but I will take a look for the next one.

darkknight1812 commented 7 years ago

Thank you.

ShapeShifter499 commented 7 years ago

@ReddestDream any progress yet?

ReddestDream commented 7 years ago

So, I have taken a look at it, and it seems it's more complex than I initially thought . . .

WoL on Linux is not something I really understand . . . I mean, I've never used WoL much generally.

We are still a ways from the next firmware release.

Maybe I'll be able to get something for you to test before then . . .

If you are still waiting on this to make your C710 a NAS server for your setup, I really do recommend you find something else to serve your need. The C710 is already fairly old hardware, and I can make no guarantees at all. Like, if this is fun project, fine. But don't hang setup decisions on this working.

ShapeShifter499 commented 6 years ago

I've been running this as a hobby file server right now and I've set up everything for a graceful shutdown. The power on when away is the only big issue for me with this set up.

@ReddestDream any updates?

ReddestDream commented 6 years ago

I might have a chance over the holidays . . .

darkknight1812 commented 6 years ago

Thank you.

ShapeShifter499 commented 6 years ago

I still would like to see this feature and would happily reuse my Acer Chromebook C710 as a server but right now I'm planning on converting my C710 back into a standard laptop. I have since switched to using a Raspberry Pi 3B+ for all of my server needs including a Nextcloud, Syncthing, and Wallabag install. I was originally worried about the RAM requirements but it seems to handle all of my personal stuff just dandy.

ShapeShifter499 commented 6 years ago

I'll leave this issue open for anyone else who wants or needs this feature.

ShapeShifter499 commented 6 years ago

@ReddestDream @MattDevo I'm going to close this issue in a week if there is absolutely no possibility of getting something working here.

darkknight1812 commented 6 years ago

I did find a work around for this in Windows. I have been using an usb ethernet adapter that supports WoL. You have to mess with the power settings for the usb ports in device manager to get it to work. I mainly use the laptop for Kodi and Xbox Game Streaming and this work around works most of the time (if the os updates/restarts, having the lid closed sometimes causes the laptop to shutdown instead).

ShapeShifter499 commented 6 years ago

@darkknight1812 this won't work for my use case I don't think. I will be running Linux on this laptop for some server programs. The problem is not being able to remotely turn on the laptop after power outage.

If the laptop powers off completely but then mains power is restored I have no way to remotely power on the laptop. With the original factory firmware the laptop would turn on when AC was plugged in if it was fully powered off. If I remember correctly @MattDevo on IRC said that was a bug and actually not a feature.

MrChromebox commented 6 years ago

@ShapeShifter499 are you sure there's a difference between the stock firmware and mine? Power-on behavior is handled by the EC, which unlike newer devices, isn't made by Google / open source. I don't handle anything differently w/r/t EC init or power settings.

Given your use case, a Chromebox would be a much better fit, as those can be configured to turn on automatically any time AC power is applied

ShapeShifter499 commented 6 years ago

@MattDevo I could have sworn I talked with you or someone on IRC @ freenode on the #coreboot channel. With stock firmware on the Acer C710, the laptop would power itself on automatically if it was off when a AC cable was plugged in. After installing the modified firmware it no longer does this.

ShapeShifter499 commented 6 years ago

@MattDevo @ReddestDream @darkknight1812 I'm going to close this and chalk it up to the "Mandela effect" for why I thought it was the AC being plugged causing the laptop to turn itself on. I just flashed my C710 back to stock everything to test and it seems like it might have been the magnet that was making it appear as if it turned itself on.