iMac goes to sleep because the battery has 0% left I've got an iMac 5k (Ultimo 2014) running Mojave. Every few days, it just goes to sleep while I'm using it. Looking at pmset -g log for the sleep reason, I find:
Entering Sleep state due to 'Low Power Sleep': Using AC (Charge:0%) 20 secs
Looks to me like it thinks it was a MacBook and needs to turn off to prevent losing data... What's going on here?
Output of pmset -g:
System-wide power settings:
Currently in use:
 standby              1
 Sleep On Power Button 1
 womp                 1
 halfdim              1
 hibernatefile        /var/vm/sleepimage
 powernap             1
 gpuswitch            2
 autorestart          0
 networkoversleep     0
 disksleep            10
 standbydelayhigh     86400
 sleep                60
 autopoweroffdelay    28800
 hibernatemode        0
 autopoweroff         1
 ttyskeepawake        1
 displaysleep         60 (display sleep prevented by Spotify)
 highstandbythreshold 50
 standbydelaylow      86400
I would recommend performing a re-install of macOS. This does not require that you delete your existing data and should be non-destructive. However, backups are always good to have.
Reboot into recovery mode (instructions are available on Apple's Website). Ensure that the installer shown in recovery mode is for Mojave (if not, then the system may be updated or downgraded when you do this!). Run the Install macOS option in Recovery mode and choose your existing disk.
It will install macOS on top of your disk, but leave your data in place.