refind and SmartSleep

Diego Raso
2013-10-24
2013-11-22
  • Diego Raso

    Diego Raso - 2013-10-24

    Hi,
    I have a macbook pro 4,1 and I installed refind with command ./install.sh, so work fine, but i'm using a program called SmartSleep that allow my mac to go in hibernate mode, but when i try to start up the system after hibernate, it normal boots (restart to refind menu).
    Before using refind, i had refit e with it hibrnation mode work properly
    Can anyone help me?
    Sorry for my english.
    Thank you for you attention.

     
  • Roderick W. Smith

    This is a known problem. Unfortunately, I've been unable to reproduce it on my one Mac (a very old 32-bit Mac Mini). Short of my getting my hands on a computer that has this problem, the only hope for resolution is for somebody who does have the problem to go through the rEFInd versions to discover which version first exhibited this problem. For instance, try 0.2.0; if it's clean, try 0.3.0; if it works, try 0.4.0; if it doesn't work, try the various 0.3.x versions; and so on. Once the first rEFInd version that has the problem is known, I can look over the changes and, with any luck, discover which one introduced this problem. Because I haven't been able to reproduce the problem, I obviously can't do this myself.

     
  • Simon Picard

    Simon Picard - 2013-11-09

    Hi,

    I'm encountering the same problem and I'm willing to go through revisions test. If I just backup my working setup and rebless it when I need to, download various versions, run the install.sh and change the sample conf into a real conf file, is it enough? Maybe some things have changed during development, basically my question is: should I be careful about anything or is it supposed to work out of the box?

    Anyway, thanks for refind, as many users I have a need for a linux dual boot and been using it for a bit of a time now.

     
  • Simon Picard

    Simon Picard - 2013-11-10

    Update: has refind ever been confirmed to provide OS X hibernation support at all? Just tried a few versions starting with 0.2.0 and the exact same things as with 0.7.4 happens. After some more research, it would seem that refit had the same issue, which was addressed by using a utility called refit blesser (see here: http://refit.sourceforge.net/doc/c4s4_safesleep.html) which would simply deactivate refit at boot time and reactivate it at shutdown time (hence not at hibernation time, leading to a "normal" boot sequence).

    In addition to this utility being regarded as possibly causing disk corruption (which could be solved by making a pair of scripts that would do the same thing without using bless --info, probably trivial), I'm not satisfied with this solution which only offers a partial support... I'd like to have refind support hibernation, but I understand it's not a matter of settings but rather refind not being able to do this right now. Since I don't have enough programming skills to fix it myself, I'm willing to help in any tests or whatnots required to help if you ever decide do address this issue, so feel free to contact me. In case you need to know, I have a MacBookPro8,1 running OS X 10.6 and Ubuntu 13.04, and am pretty comfortable with cli.

    Also, the various messages I could find on this subject seem to not provide an accurate account of what's exactly happening. They mostly describe it as "not working". Upon pressing the on/off switch, the indicator LED lights up and I can hear some whirring sound, like something starting spinning, which can be heard at any boot and if I'm not mistaken on every MacBook I've used. The screen stays black, though. Nothing happens for a few seconds, after which the same whirring sound comes up, quickly followed by the mac "dong", upon which the screen lights up and refind shows up.

    This makes me think that there is a first boot, which doesn't work as intended, followed by a reboot after which everything goes according to a normal boot. I would think that hibernating OS X activates a flag of some sort, whether on the disk or somewhere in the firmware, but anyway it's the firmware that reads it and tries to boot accordingly, probably by passing arguments to the boot manager, which in turn passes some arguments when calling the boot loader. I would guess refined doesn't get those, or doesn't interpret them correctly, causing it to hang and restart the computer. The hibernate flag would have been overridden by now, allowing a regular startup.

    I don't know what can be done here, I don't even know if Apple is following the standards for hibernating since it seems weird to do it on a computer level -- I used to have a hackintosh on which hibernation was system dependent, meaning you could hibernate OS X, use Ubuntu, then come back to OS X's previous state, maybe there was a trick to change the way hibernating was working. It may be a problem for refind to not follow standards in order to match Apple's idiosyncrasy (if that's what's happening here). I may also be have come up with a wrong interpretation. Anyway, like I said, I'm all yours if you need some tests done, be it some debug version of refind or whatever, or if you need more infos about my setup or anything!

     
  • Roderick W. Smith

    Thanks for the tests. The reports I'd seen were incomplete regarding rEFIt and this feature; I'd simply heard that it worked OK with rEFIt, so I assumed that I'd inadvertently broken something in rEFInd. (I suppose that's true in a sense, because I was scared off of adopting rEFItBlesser because of the problem reports you note.)

    In any event, I do have one long-shot idea of something you can try, if you're willing to create a small HFS+ test partition (or if you've got an existing HFS+ data partition you could use): Follow the procedure here for installing a boot loader:

    http://mjg59.dreamwidth.org/7468.html

    Install rEFInd as /System/Library/CoreServices/boot.efi on your dedicated (or other currently-unbootable HFS+) partition, following that procedure.

    My hypothesis is that the firmware is seeing a boot loader filename that it doesn't recognize as the default and so is performing a full startup rather than resuming from suspend. If this is what's happening, then installing rEFInd (or any other boot manager) using the procedure outlined in MJG's blog might work around the problem.

    If this works, I can document it in the rEFInd documentation. Fixing the installation script to set this up automatically might be impractical, though, since this solution would require repartitioning on many computers.

    If this procedure doesn't work, then I suppose you could always use rEFItBlesser with rEFInd (which would have to be renamed to refit.efi). That would run the risks associated with rEFItBlesser, though.

    BTW, I've just released rEFInd 0.7.5, so you might want to use it with any further tests you care to run.

     
  • Simon Picard

    Simon Picard - 2013-11-11

    I will try this setup and report "as soon as possible", although I have no idea when that is since my charger just died. Do you know if it'd work from a USB drive? I'm a bit reluctant to further partition my disk since the apple GUI interface gives me a warning about my disk --seeming-- to be partitioned for bootcamp, which is apple's terminology, so I don't know exactly what it means and I'd have to do some research. Anyway I'll see if it works from an external drive when I try...

     
  • Roderick W. Smith

    It might work from a USB drive, but I can't make any promises of that.

    The "Boot Camp partitioning" probably refers to a hybrid MBR. If you're booting Linux in EFI mode and you're not booting Windows, you can convert the hybrid MBR to a standard protective MBR by using the n option on gdisk's expert's menu or by making a small change to the disk with parted or GParted.

     
  • Simon Picard

    Simon Picard - 2013-11-19

    Got a new charger yesterday, did some tests. So far I only tried booting from a USB, I didn't realize this "boot camp partitioning" referred to a hybrid MBR so I'm a bit relieved, but it's been a long time since I messed with it and I want to do some research before touching to my disks partitioning in a way I don't fully understand.

    So, about the USB tests: it did show improvement, although some parts were kind of weird, so I'll wait until I can make tests from a partition on my internal hard drive to "pass judgement".

    The improvement was that, after hibernating, instead of going through the previously described behavior, it booted directly to OS X, completely skipping the rEFInd bootloader, and as far as I can tell resuming from hibernation was achieved perfectly. I would have expected rEFInd to show up and allow me to boot either OS X (resuming from hibernation) or Linux since that was the behavior I had on my previous laptop, but that was a hackintosh so I'm really not sure if it was compliant with booting standards. Anyway, this behavior is ok for me since it doesn't rely on some "cheap trick", aka rEFItBlesser (or a similar solution). It seems actually safer not to allow to boot another system while another one is hibernating since data consistency can't be guaranteed (although in my case Linux can't write on my HFS+ partition), so maybe it is the standard boot procedure. Anyway, if this can be achieved by using a small dedicated partition on my hard drive, I find it satisfactory.

    On the weird side, when booting on my USB-based rEFInd, my OS X system didn't show up, although I renamed the /efi folder and reblessed the standard boot.efi . I have no idea why it didn't show up. My previous rEFInd setup did show up if reinstalled though, so I may have made some mistakes with the reblessing of OS X's boot.efi, or rEFInd auto detection of settings might be having a hard time, or, or, or... Whatever the reason, I take it it should be possible to have a working setup by installing rEFInd on an internal partition other than OS X's. If so, and if the behavior described in the previous paragraph can be maintained in this setup, it looks to me like a good solution to this problem.

    One quick question though: do you have any idea if installing this on the EFI partition could cause problems? If it didn't, it would allow one to avoid creating another partition... I'll try looking into that if I have time. Anyway, I think if it causes problem it would be easy to fix since OS X could still be booted using the ALT key. I don't have anymore time now but that's probably the next thing I'll try. Thanks for your advices anyway, and thanks again for rEFInd :)

     
  • Roderick W. Smith

    Simon, you might want to check the following thread:

    https://sourceforge.net/p/refind/discussion/general/thread/8bd60a7b/

    User n808 has run a number of tests, which seem promising but the issues are not completely resolved. Some of the remaining problems may be related to setup details, and as I'm not in a position to experiment (never having run into the problem myself), I can't really comment.

     
  • Simon Picard

    Simon Picard - 2013-11-22

    Thanks, I just came in to check and don't have time now but I'll try to have a look at this!

     

Log in to post a comment.