Thank you for OSMC and thank you a second time for building and sharing the AppleTV1 image!
I’ve installed the 2016.02-3-HDD image on the HDD and it all works fine so far, until I try to power down. Pressing the Play/Pause button on the remote does not power it down or put it into standby. Running any shutdown commands over SSH causes it to crash each time and hang for ever with the disk spinning.
This is what I have tried on the CLI, each time with the same result:
sudo /sbin/shutdown -h now
sudo systemctl poweroff
I am not sure if this is due to an ACPI bug, but this is what journalctl reveals:
Mar 28 15:09:29 osmc_appletv kernel: ACPI: Interpreter enabled
Mar 28 15:09:29 osmc_appletv kernel: ACPI Exception: AE_NOT_FOUND, While evaluating Sleep State [_S1_] (20150619/hwxface-580)
Mar 28 15:09:29 osmc_appletv kernel: ACPI Exception: AE_NOT_FOUND, While evaluating Sleep State [_S2_] (20150619/hwxface-580)
Mar 28 15:09:29 osmc_appletv kernel: ACPI Exception: AE_NOT_FOUND, While evaluating Sleep State [_S3_] (20150619/hwxface-580)
Mar 28 15:09:29 osmc_appletv kernel: ACPI Exception: AE_NOT_FOUND, While evaluating Sleep State [_S5_] (20150619/hwxface-580)
Mar 28 15:09:29 osmc_appletv kernel: ACPI: (supports S0)
Is there a way to shut down gracefully without pulling the plug each time?
PS. I forgot to clarify: I am currently running the AppleTV1 as a headless server and therefore I do not have access to the GUI. However, when I used the GUI earlier on with a monitor attached it still crashed in the same way.
Shut down via power icon in Kodi
AppleTV doesn’t implement ACPI support
Thanks Sam, I forgot to say that I am currently using the box as a headless server. When I tried initially to use the Power menu with a monitor attached, it still crashed.
The above journal messages are not indicative of a crash. If that’s all you see, your system is safe to shut down
The above journal messages are from the booting stage. I haven’t found any logs from the shutdown stage, but I may not be looking at the right place. Where/what should I look for?
Same result with ‘/sbin/poweroff’, the SSH connection is dropped and then the box just hangs without shutting down.
The device doesn’t implement ACPI, it cannot be ‘shut down’. The closest you will get is an unmounted filesystem.
Thanks Sam, this means that I’ll end up pulling the plug each time. What worries me is that the plug is arcing when I try to plug it back in!
I guess this doesn’t apply only to my AppleTV Intel MoBo’s BIOS, but I don’t know if Apple changed the BIOS firmware during their 1st gen production run. Would it be possible to add a kernel parameter in CONFIG_CMDLINE like e.g.:
to see if it helps? Happy to test it when an OSMC image becomes available.
Do you mean the end which plugs in to the AppleTV? Mine does this too. Not to worry about it.
You can add that to com.apple.Boot.plist. It would be good if you could report back if that helps you.
I must be doing something wrong … :-/
Error writing /boot/com.apple.Boot.plist: Read-only file system
$ ls -la /boot/com.apple.Boot.plist -rw-r--r-- 1 root root 588 Mar 27 20:14 /boot/com.apple.Boot.plist
Isn’t ‘sudo nano’ all I need to do to be able to edit this file? I tried ‘sudo mount -o remount,rw /dev/sda1 /boot’ which would not take. Then I also tried editing /etc/fstab, removed defaults and added rw, to no avail. It seems that the mount option is hardcoded?
OK, I removed the fstab entry, rebooted, unmounted /dev/sda1, then mounted with -o force,rw and it worked.
However, the shutdown -P now, still fails.
I need you to explain what ‘fails’.
I’m not sure the kernel won’t spin down the disk after shutting down, if that’s what you are going by.
I can’t tell if the disk parks its heads and stops spinning. The fan is definitely spinning and power remains on. What I mean by “it fails” is that the AppleTV does not power down completely. My understanding is that if ACPI can’t shutdown the PC it would pass on the control to the BIOS via APM and then BIOS should do its thing and power down the MoBo.
I connected a monitor and all I get is a rather blurred out of sync message:
[ OK ] Reached target Graphical interface.
Starting update UTMP about System Runlevel Changes …
[ OK ] Started update UTMP about System Runlevel Changes.
rpcbind: rpcbind terminating on signal: Restart with “rpcbind -w”
[ 101:756850] reboot: System halted
Now, there is no problem rebooting, but it always ends up like this with a blurred and flickering monitor when I try to shut it down. Trying to place it in standby using the GUI elicits no response from it.
PS. I haven’t looked at the kernel config yet. Are there any instructions/guide for rolling our own kernels?
If you see System halted, then we are shutting down the device.
The fan still running is by design and this is a hardware limitation. We don’t have enough control in the kernel to turn off the HDMI completely, as that’s managed by the bootloader.
I added ‘apm power_off=1’ in /etc/modules-load.d/modules.conf, but I got this in the logs:
systemd-modules-load: Failed to find module ‘apm power_off=1’
which I guess is to be expected, because ‘# CONFIG_APM is not set’ in the kernel. Does the OSMC installation contain the necessary headers and toolchain to build a new kernel? If not what is missing?
Thanks again for your help!
The device doesn’t implement ACPI / Advanced Power Management properly, so you won’t have luck.
You can build a kernel by cloning the OSMC repository and running cd package/kernel-osmc && make atv
Yes, I know that ACPI does not work with the AppleTV BIOS and all the S states are not recognised - the logs show this. However, my theory is that ACPI will pass the call to APM, which will pass the calls back to BIOS and it will then work as it does under OSX.
Here’s some Debian related suggestions to achieve this:
The current OSMC kernel does not have apm enabled, so I will either have to try roll my own, or wait for the next update/upgrade if it’s not too much trouble to include apm in your next kernel revision.
I would only include APM if we have some evidence that this works. A kernel is quite easy to build – I’d appreciate it if you could give this a go yourself. Let me know if you need any pointers
I took another look at this problem. The BIOS reports that it only supports ACPI and not APM:
$ sudo dmidecode -t0 |grep -E 'APM|ACPI' ACPI is supported
In addition ACPI seems to load first (built in) and it won’t allow APM to take over:
$ sudo modprobe -v apm power_off=1 insmod /lib/modules/4.2.3/kernel/arch/x86/kernel/apm.ko power_off=1 modprobe: ERROR: could not insert 'apm': No such device
Finally, I changed as many ACPI drivers as the kernel config would allow into modules (some can only be built in) and then set ‘noacpi acpi=off apm power_off=1’ in the kernel parameters and rebooted. Unfortunately AppleTV won’t boot I get an orange light flashing continuously. I can’t access the device over the network to see what the boot process fails at, but we can make a wild guess!
In conclusion, I think that this little beauty’s power management won’t play nicely with ACPI since all but one S states are disabled/buggy and APM won’t load.
I better revert now to your original kernel and configuration.
Thanks once more for your hard work with OSMC!
I’ve reinstalled and reconfigured OSMC just as I need it to be (inc. NAS storage and access to a Topfield PVR).
Given the lack of an On/Off button or similar functionality with its remote control, I guess I will have to leave the AppleTV running 24-7. Other than electricity consumption which I assume is not much, would this be a concern? Are there any problems with over-heating, or component failures? I noticed that smartmontools is not installed/running on OSMC. How do you run yours? 24-7 or intermittently?