Jump to content
3205 posts in this topic

Recommended Posts

Please try 1.3 @Sherlock @Slice @gujiangjiang @tluck @cjfly

attachicon.gif80.save_nvram_plist.local.zip

 

syscl

 

finally it's good working now. brightness load and nvram value load too.

 

Last login: Wed Jan  4 16:06:13 on console

Supreme-MBP:~ supreme$ sudo cat /Library/Logs/CloverEFI/rc.shutdown.log 

Password:

v1.3 © 2017 syscl/lighting/Yating Zhou

Found EFI disk0s1

Target path: /Volumes/EFI01

EmuVariable is present

dump nvram

>> End Script: /private/etc/rc.shutdown.d/80.save_nvram_plist.local

 

Supreme-MBP:~ supreme$ 

 

 

i recommend that remove nvram file in all drive before use syscl's script.

  • Like 1

As there might be multiple instances of nvram.plist created in different disks / partitions / paths, this is another good reason for scripts not hiding these files.

Yes. Desktop users has many drive. And if unhidden nvram file, we can see nvram easily.

 

My case is laptop. Laptop has one drive. I just suggest it. Maybe Slice decide this hidden or not, now in rc script, unhidden nvram file.

 

Thank you

 

나의 LG-F410S 의 Tapatalk에서 보냄

Please try 1.3 @Sherlock @Slice @gujiangjiang @tluck @cjfly

attachicon.gif80.save_nvram_plist.local.zip

 

syscl

I can confirm that this script also works for my system (Which has had problems with all other scripts), and propose that it is added to Clover.

 

Just one question Syscl: What is the reason you are saving the nvram.plist in both "/" and EFI partition?

 

EDIT: nvram.plist is only saved to EFI partition if I run: 

sudo kextload /System/Library/Extensions/msdosfs.kext

before shutting down.

 

We probably need to load that kext on boot?

I can confirm that this script also works for my system (Which has had problems with all other scripts), and propose that it is added to Clover.

 

Just one question Syscl: What is the reason you are saving the nvram.plist in both "/" and EFI partition?

 

EDIT: nvram.plist is only saved to EFI partition if I run: 

sudo kextload /System/Library/Extensions/msdosfs.kext

before shutting down.

 

We probably need to load that kext on boot?

You also need to use my version of 20.mount.ESP.local and place it to /etc/rc.boot.d

 

syscl

Yeah I just created my own simple version:

$cat 40.load_msdos_kext.local

#!/bin/bash
kextload /System/Library/Extensions/msdosfs.kext

 

Will not be reliable. The macOS/OS X kernel employs "lazy unload" of kexts... After some period, given that the kext does not *need* to be in memory (no file systems mounted that need it), it will be unloaded.

 

Yeah I just created my own simple version:

$cat 40.load_msdos_kext.local

#!/bin/bash
kextload /System/Library/Extensions/msdosfs.kext

Now the problem is msdosfs.kext will sometimes unload by macOS, for example sleep or simply put your display into sleep but play music...

 

syscl

Will not be reliable. The macOS/OS X kernel employs "lazy unload" of kexts... After some period, given that the kext does not *need* to be in memory (no file systems mounted that need it), it will be unloaded.

@RehabMan, is there a way to keep msdosfs persist in memory?

 

Or do we need to create a virtual Fat32/exfat device(invisible) to ensure msdosfs is in memory?

 

syscl

Now the problem is msdosfs.kext will sometimes unload by macOS, for example sleep or simply put your display into sleep but play music...

 

syscl

 

RehabMan, is there a way to keep msdosfs persist in memory?

 

Or do we need to create a virtual Fat32/exfat device(invisible) to ensure msdosfs is in memory?

 

syscl

Keeping EFI mounted would probably do the trick...

Or mount EFI earlier during the shutdown process (logout hook?)

Or maybe a kext with IOResources match that has a dependency on msdosfs.

Keeping EFI mounted would probably do the trick...

Or mount EFI earlier during the shutdown process (logout hook?)

Or maybe a kext with IOResources match that has a dependency on msdosfs.

Great, especially the logout hook or kext to match msdosfs...

 

About logout hook: if we shutdown, should logout hook be called earlier than shutdown process? Because, during shutdown process, we can do very limited operations, many services are closed at this stage.

 

Thank you again,

syscl

Great, especially the logout hook or kext to match msdosfs...

 

About logout hook: if we shutdown, should logout hook be called earlier than shutdown process? Because, during shutdown process, we can do very limited operations, many services are closed at this stage.

 

Thank you again,

syscl

I would think logout hook would be earlier. As to whether it is "early enough", you'll find out when you try it...

Looks like it is (very quick test):

sudo defaults write com.apple.loginwindow LogoutHook /etc/rc.boot.d/40.load_msdos_kext.local

Reboot

sudo kextunload com.apple.filesystems.msdosfs

To make sure the msdos kext is not loaded.

 

Reboot and nvram.plist in EFI partition was updated.

 

So LogoutHook should be early enough to allow us to load stuff.

 

I used this page for the logoutHook command.

  • Like 2

Looks like it is (very quick test):

sudo defaults write com.apple.loginwindow LogoutHook /etc/rc.boot.d/40.load_msdos_kext.local

Reboot

sudo kextunload com.apple.filesystems.msdosfs

To make sure the msdos kext is not loaded.

 

Reboot and nvram.plist in EFI partition was updated.

 

So LogoutHook should be early enough to allow us to load stuff.

 

I used this page for the logoutHook command.

@cnrd, 

Do you remove any other script that will load the msdosfs.kext?

 

To make sure nvram.plist being refreshed, could you please test the following as well?

sudo kextunload msdosfs

Then reboot?

 

If this work, our script will be pretty nice to ensure nvram.plist will be dumped to EFI always 

What I tried with logoutHook:

- call diskutil, call ls none of them work

- Then, I kextunload msdosfs.kext and logoutHook 80.save_nvram_plist.local, after reboot there's no even a single file being created...

Last login: Wed Jan  4 12:38:26 on console
syscls-MacBook:~ syscl$ sudo cat /Library/Logs/CloverEFI/rc.shutdown.log 
Password:
-------------------------------
DATE: 2017-01-04 TIME: 12:37:16
-------------------------------
syscls-MacBook:~ syscl$ 

There must be some restriction during the logoutHook stage to mute all information to log to file.

 

But the funny thing is my script seem to work by using the LogoutHook as well...

Here's what I do:

- Removed /etc/rc.boot.d/20.mount.ESP.local

- Rename /etc/rc.shutdown.d/80.save_nvram_plist.local to /etc/rc.shutdown.d/80.save_nvram_plist.local.syscl

- Remove rc.shutdown.log

- Reboot

- msdosfs.kext is not loaded by kextstat |grep msdos

- logoutHook /etc/rc.shutdown.d/80.save_nvram_plist.local.syscl

- check msdosfs is not loaded again

- change brightness to minimal 

- reboot

- Minimal brightness, nvram.plist created successfully in EFI/, no nvram.plist in /

- change brightness to maximum

- Remove rc.shudown.log

- Reboot

- Maximum brightness, nvram in EFI/ being refreshed, no nvram.plist in /

 

A short conclusion by using logoutHook:

- we no more need to use touched 20.mount.ESP.local to force load msdosfs.kext

- if this method is proved to be stable, then we won't see nvram.plist in root anymore :thumbsup_anim:

- drawback of this way, we can't see any log, it's hard to solve problem if there has

- logoutHook method credit @cnrd and @RehabMan

- For detail information credit @Sherlock, very thanks for the test log 

- Prevent write to EFI without Clover credit @tluck

 

 

Thank you,

syscl

  • Like 1

@cnrd,

Do you remove any other script that will load the msdosfs.kext?

 

To make sure nvram.plist being refreshed, could you please test the following as well?

sudo kextunload msdosfs
Then reboot?

 

If this work, our script will be pretty nice to ensure nvram.plist will be dumped to EFI always

What I tried with logoutHook:

- call diskutil, call ls none of them work

- Then, I kextunload msdosfs.kext and logoutHook 80.save_nvram_plist.local, after reboot there's no even a single file being created...

Last login: Wed Jan  4 12:38:26 on console
syscls-MacBook:~ syscl$ sudo cat /Library/Logs/CloverEFI/rc.shutdown.log 
Password:
-------------------------------
DATE: 2017-01-04 TIME: 12:37:16
-------------------------------
syscls-MacBook:~ syscl$ 
There must be some restriction during the logoutHook stage to mute all information to log to file.

 

But the funny thing is my script seem to work by using the LogoutHook as well...

Here's what I do:

- Removed /etc/rc.boot.d/20.mount.ESP.local

- Rename /etc/rc.shutdown.d/80.save_nvram_plist.local to /etc/rc.shutdown.d/80.save_nvram_plist.local.syscl

- Remove rc.shutdown.log

- Reboot

- msdosfs.kext is not loaded by kextstat |grep msdos

- logoutHook /etc/rc.shutdown.d/80.save_nvram_plist.local.syscl

- check msdosfs is not loaded again

- change brightness to minimal

- reboot

- Minimal brightness, nvram.plist created successfully in EFI/, no nvram.plist in /

- change brightness to maximum

- Remove rc.shudown.log

- Reboot

- Maximum brightness, nvram in EFI/ being refreshed, no nvram.plist in /

 

A short conclusion by using logoutHook:

- we no more need to use touched 20.mount.ESP.local to force load msdosfs.kext

- if this method is proved to be stable, then we won't see nvram.plist in root anymore :thumbsup_anim:

- drawback of this way, we can't see any log, it's hard to solve problem if there has

- logoutHook method credit @cnrd and @RehabMan

- For detail information credit @Sherlock, very thanks for the test log

- Prevent write to EFI without Clover credit @tluck

 

 

Thank you,

syscl

Good.

I'm waiting your script for testing.

 

Thank you

 

나의 LG-F410S 의 Tapatalk에서 보냄

I would think logout hook would be earlier. As to whether it is "early enough", you'll find out when you try it...

Confirmed, logoutHook method work. But there's no log output in rc.shutdown.log now.

 

syscl

Good.

I'm waiting your script for testing.

 

Thank you

 

나의 LG-F410S 의 Tapatalk에서 보냄

Ok, I will write 1.4 for testing, give me 10 minutes

 

syscl

@cnrd, 

Do you remove any other script that will load the msdosfs.kext?

 

To make sure nvram.plist being refreshed, could you please test the following as well?

sudo kextunload msdosfs

Then reboot?

 

If this work, our script will be pretty nice to ensure nvram.plist will be dumped to EFI always 

What I tried with logoutHook:

- call diskutil, call ls none of them work

- Then, I kextunload msdosfs.kext and logoutHook 80.save_nvram_plist.local, after reboot there's no even a single file being created...

Last login: Wed Jan  4 12:38:26 on console
syscls-MacBook:~ syscl$ sudo cat /Library/Logs/CloverEFI/rc.shutdown.log 
Password:
-------------------------------
DATE: 2017-01-04 TIME: 12:37:16
-------------------------------
syscls-MacBook:~ syscl$ 

There must be some restriction during the logoutHook stage to mute all information to log to file.

 

But the funny thing is my script seem to work by using the LogoutHook as well...

Here's what I do:

- Removed /etc/rc.boot.d/20.mount.ESP.local

- Rename /etc/rc.shutdown.d/80.save_nvram_plist.local to /etc/rc.shutdown.d/80.save_nvram_plist.local.syscl

- Remove rc.shutdown.log

- Reboot

- msdosfs.kext is not loaded by kextstat |grep msdos

- logoutHook /etc/rc.shutdown.d/80.save_nvram_plist.local.syscl

- check msdosfs is not loaded again

- change brightness to minimal 

- reboot

- Minimal brightness, nvram.plist created successfully in EFI/, no nvram.plist in /

- change brightness to maximum

- Remove rc.shudown.log

- Reboot

- Maximum brightness, nvram in EFI/ being refreshed, no nvram.plist in /

 

A short conclusion by using logoutHook:

- we no more need to use touched 20.mount.ESP.local to force load msdosfs.kext

- if this method is proved to be stable, then we won't see nvram.plist in root anymore :thumbsup_anim:

- drawback of this way, we can't see any log, it's hard to solve problem if there has

- logoutHook method credit @cnrd and @RehabMan

- For detail information credit @Sherlock, very thanks for the test log 

- Prevent write to EFI without Clover credit @tluck

 

 

Thank you,

syscl

I'm not sure that we should keep the 80.save_nvram_plist.local file in rc.shutdown.d folder, as I think that folder should be reserved for scripts that are run at that time, not for a logoutHook, but I'm not really sure where we should place it then? (I'm sorry, not a reply for you directly, but more for the Clover maintainers).

 

Not sure if there is actually a folder we could use, but I'm thinking: "/etc/logoutHook"?

frankly, this logoutHook approach is not all that new. I (and others IIRC) used it about 1.5 years when El Cap came out -  the CloverDaemon and /etc/rc.shutdown scripts where failing.

a modified CloverDaemon script was run as a logoutHook. the /etc/rc.shutdown scripts can stay where they are.

anyway it was stored in /Library/Application Support/Clover - called CloverDaemon.hook

Please try v1.4, improvements:

 

- 20.mount.ESP.local will write logoutHook to system at startup

- 80.save_nvram_plist.local now will compare old nvram.plist, if the content is same, then we do not dump to it(reduce write to hard disk each time and improve shutdown time on HDD)

- now the sleep cannot dump nvram to EFI/ issue should have gone

 

@Sherlock @tluck @cnrd @cjfly @RehabMan @Dr.Hurt @Slice ...

 

Note: this time, you should ensure that msdosfs.kext hasn't been loaded when startup. To force it unload, just type

sudo kextunload /System/Library/Extensions/msdosfs.kext

syscl_nvram_save.zip

 

 

Best wishes,

syscl

  • Like 1
×
×
  • Create New...