Kernel Panic on older Macbooks – A permanent cure

It took some time I know, since I last managed to resurrect the old Macbook 2013 from a completely unusable state 3 years ago. It was an antedote to speeding fan, to a completely paniced kernel service (that goes up to more than 200% usage for the minimal amount of applications).

The kernel panic happened essentially due to the system detecting a sensor signal that suggests there is overheating in the CPU. In order to prevent this, and protect the machine from overheating, it tries to throttle the CPU power for as much as possible till the sensor returns to normal. It does this, apparently via two ways, first of which is an IOcontrol module, which the last fix takes care of. Upon the fix, my CPU usage for light uses (e.g. browsing news website on chrome) consumed only 50-70% of CPU power, and the Mac was useable as a note-taking device. But that was not quite enough. The Macbook, despite being old, was a lot more power than that (It has three cores each in theory capable of being clocked to 2.9GHz). As it turns out, the core CPU was still being throttled physically via hardware limitation – the voltage supply to the CPU is capped at around 0.7241 volts, and as a result, CPU clock-speed capped at 0.8GHz (less than a third of the maximum capacity – and that explains almost 50% CPU usage for merely opening a page in chrome!)

I came upon this tool that could detect the core frequency, and upon some searches (and browsing through the Q&A sections), another tool being used by people with powerful Macs to clock-down their fast CPUs in order to gain better battery performance has surfaced as the ideal tool to get the CPU back to its normal working speed. Here is a quick walk through of how:

We need a tool called Voltageshift. You might be tempted to build the tool from source just to err on the safe side. Been there, did not succeed. It seems that the support for older versions of XCode was no longer good enough for that build. I chose to download the built version supplied by the author instead.

in order to use the tool, it needs to be uplifted in list of kext files, using the command similar to below. Replacing the directory to VoltageShift to wherever the downloaded/build kext file is saved

sudo chown -R root:wheel ./VoltageShift.kext

It is easy to run the following code to verify the installation:

./voltageshift.info

This should provide a summary of the CPU core, which could look something like this:

------------------------------------------------------
   VoltageShift Info Tool
------------------------------------------------------
CPU voltage offset: 0mv
GPU voltage offset: 0mv
CPU Cache voltage offset: 0mv
System Agency offset: 0mv
Analogy I/O: 0mv
Digital I/O: 0mv
CPU BaseFreq: 2400, CPU MaxFreq(1/2/4): 2900/2900/2900 (mhz)OC_Locked  PL1: 100W PL2: 125W 
CPU Freq: 0.8ghz, Voltage: 0.7241v, Power:pkg 9.40w /core 2.06w,Temp: 43 c

Use the following piece of code to force CPU voltage back to normal (disclaimer: use this at own risk, it will definitely void warranty; you shouldn’t do it if you are not sure)

./voltageshift write 0x1FC 0x04005e

In my case, this usually forces the CPU to go back to CPU Freq of 2.4 GHz if something demanding is already running. Notice the immediate speeding up of CPU back to how it used to be (which seemed likea long distant memory).

One thing to note, from my own experience, and from feedback in the forum, the override seems to be discarded each time Macbook wakes up from a sleep cycle. So it needs to be applied again. It is minimal hassle considering the speed boost that I get back. I also made a shell script to quickly run it each time the Macbook sleeps. Although not fully automated, it is definitely is an acceptable solution for the end-result.

读书

2023年从某些方面感觉到了自己的变化。一则托实体中文书和微信读书的福重新找到了阅读的状态。间歇着去读中文和英文的小说,反而让阅读的感受更加舒缓,没有那么急功近利的感觉了。毕竟中文阅读还是在使用母语,更自然些。另一方面而言,阅读中文更容易一目十行而忽略掉细节性的内容,所以更多是读一些简单的放松的作品(例如伊坂幸太郎这样信息量较低的小说),或者一些优美的经典作品。

时间近凌晨一点便不展开细说。最近读完了詹姆斯·乔伊斯的《都柏林人》。之前只是耳闻他以《尤利西斯》的晦涩难懂而闻名,没想到这本书极度细腻深沉。难想象这是一位年轻人的处女座。其中最后一篇给人印象深刻,尤其是结尾,无论是中文还是英文,都是我所读过作品里最震撼人心之一。甚至媲美《了不起的盖茨比》里那句著名的

And so we beat on, boats against the current, borne back ceaselessly into the past.

《死者》这篇文章是《都柏林人》的最后一篇,一般被称为是詹姆斯·乔伊斯在尤利西斯以前集大成的一篇短篇小说。它经常被引用的结尾是这样的

雪落在阴晦的中部平原的每一片土地上,落在没有树木的山丘上,轻轻地落在艾伦沼地上,再往西,轻轻地落进山农河面汹涌澎湃的黑浪之中。他也落在山丘上孤零零的教堂墓地的每一个角落,迈克尔·福瑞就埋葬在那里。它飘落下来,厚厚的堆积在歪斜的十字架和墓碑上,堆积在小门一根根栅栏的尖顶上,堆积在光秃秃的荆棘丛上。他听着雪花隐隐约约地飘落,慢慢地睡着了,雪花穿过宇宙轻轻地落下,就像他们的结局似的,落到所有生者和死者身上。

Yes, the newspapers were right: snow was general all over Ireland. It was falling softly upon the Bog of Allen and, further westwards, softly falling into the dark mutinous Shannon waves. It was falling too upon every part of the lonely churchyard where Michael Furey lay buried. It lay thickly drifted on the crooked crosses and headstones, on the spears of the little gate, on the barren thorns. His soul swooned slowly as he heard the snow falling faintly through the universe and faintly falling, like the descent of their last end, upon all the living and the dead.

这段文字里有种宏大的投射到每一个人身上的力量。只是不声不响轻轻飘落的雪花一视同仁地覆盖这个世界的所有物事,沉重得让人感到窒息。

Mac OS Big Sur Kernel Panic solution

Users updating to Big Sur against their better judgement will find themselves unable to modify system configurations after the update. Post read-only protection in Catalina, Apple has added additional write-protection to system files, that they cannot be modified.

Some additional steps now need to be followed to disable a particular system extension:

  1. Disable FileVault – this can take a long time particularly if the MacOS system is undergoing Kernel panic. My experience also shows that if your old Mac is being slower than usual, turning off FileVault helps tremendously with speed.
  2. Boot into Recovery mode (cmd + R), and run
    csrutil authenticated-root disable
  3. A restart is required for the change to take effect. Next step is to mount a local drive and make a snapshot of system settings (to be modified and used for system); if doing this in Recovery mode, then no need for sudo
  4. Run
    mount -uw /Volumes/Macintosh\ HD
  5. navigate to directory under /Volumnes/Macintosh \HD/Systems/Library/Extensions/ (note in my case, direct cd to /Systems/Library/Extensions/ shows that the directory remains read-only, so full directory is needed)
  6. Modify the Extension as usually do (see my previous article)
  7. Bless the settings by taking a snapshot (MacOS will use the snapshot as boot settings), by running:
    bless –folder /Volumes/Macintosh\ HD/System/Library/CoreServices –bootefi –create-snapshot
  8. Reboot the system

MacBook Pro 高Kernel CPU占用解决办法 (含iOS Catalina)

MacBook Pro when suffering from water damage (spilled coffee, for example), usually displays two symptoms:

  1. High CPU consumption by system process “Kernel” – usually in the ball park of 200-300%
  2. Consistent top fan speed

The first, in particular, renders a MacBook unusable, as almost all computational power is consumed by the Kernel. The Kernel process was designed to prevent high resource consumption by individual applications – but the gut feeling shows that this is yet another built-in feature to force users to bring a nevertheless perfectly usable back to the so-called genius bar to be fixed for a price, or better yet, replaced with a new unit altogether.

While the conscientiousness of corporate Apple is open for discussion, there are in fact ways to informally prevent such behaviour and restore the machine to a use-able state. Many blog posts (e.g. the most concise one I’ve read can be found here) Here is how:

First, the machine needs to be rebooted into Recovery Mode, by restarting while holding down cmd + R before the loading screen (white apple) shows. In this view, launch the Terminal and run the following command to disable System Integrity Protection (SIP), which is a built in feature of the iOS to prevent undesirable modification of system files:

csrutil disable

Then the machine can be rebooted, either into full operating system or into the Single User mode (which is faster, and quieter) by holding down cmd + S.

Here is where the trick needs to be adapted to Catalina: in this latest version of the iOS, Apple has introduced yet another layer of protection for the system files – they are stored in a read-only section of the drive, which prevents the removal of the undesirable system file that causes the blown-out Kernel issue.

In the Single-User view (effectively terminal only view), or in the full OS view with a terminal launched, run the following command to enable read/write mode for system files:

 sudo mount -uw /

Followed by the following command which removes the package extension file IOPlatformFamilyPlugin.kext that causes high Kernel CPU usage

rm -rf /System/Library/Extension/IOPlatformFamilyPlugin.kext

This in turn followed by a restart, or if in Single User mode then

 shutdown -r now 

Do remember to boot into Recovery Mode using method mentioned above, and rearm the SIP protection by running the following in Terminal

csrutil disable

In the case of some users, the fan would go back to normal – but if not, as in my case, an app Macs Fan Control can be used to slow the fan down according to the actual machine. There are many websites that lists regular temperature of a working MacBook Pro for various models. These can be used as a reference for setting temperature dependent fan speed of the machine.

日记

太久不写东西的话人从表达能力到对身边事情感受的敏锐程度都出现了明显的退化。内心里对很多事情都变得比较麻木,对外在而言则是那种一度如影随形的不自在感在某个时刻开始消失了。

这是一个漫长的融入世界的过程,曾经以为十分深刻但并不持久的想法在和粗糙而并没有太多人情味的环境里,也慢慢消失了。与其说人在成长的过程中不断向身边的世界妥协,倒不如说我的个体逐渐在消失,而那些一度构成我的部分,和我之所以成为我的理由开始和周遭的一切自如的融合在一起,边界变得模糊不清,那些色彩在短暂的美丽旋转图案后,最终变成均匀、温和、黯淡以及停滞不再流动的灰色。

这个世界一点也不好。

慢慢的在回头看的时候视线变得越来越长,但是始终总是落在那几个柔软的地方:那些没能实现的、那些如果重来是否会不一样的、那些未曾经历而留下永远遗憾的。而现在的昨天的朝夕的硬邦邦的现实像是枷锁和沉重的负担。不知道西绪福斯在重复与巨石和山峰的战斗时,是不是会会想起曾经征服死亡。

何方

伦敦的冬天总是湿漉漉的,日和夜都沉甸甸,夜来得早,天好像总也亮不起来。橱窗里的灯总也不关,古旧建筑的砖同钢筋水泥同样冰冷,地上被冲刷的那么干净,连衣服上溅起的积水也留不下它的印子。高楼群里热岛效应圈出一块块低气压的和无处不在一场回旋大风的碎片,从所有的东南西北一起吹过来,凉透灵魂。(同样是高纬度城市,对向北五十英里剑桥却并没有这样的记忆。)

不知是第一百多少个这样的周末被推送了李志的《热河》,看到评论里提到《湖心亭看雪》,读到“客此”,涌上来的感受让人一时不知道如何是好。不知道是落寞也好、乡愁也罢,确实是很久没有这么强烈地感受到活着。

更新

一直只是保持这个网站在线,并没有写新的内容–直到上个月没有及时续费域名导致.tk这个网址直接被别人拿走,才意识到其实自己或许还是需要这个网页的,从中二的角度来说也是某种secret identity之类的吧。

总而言之,终于把这个域名拿回来了。

Cloudflare服务升级

最近Cloudflare给免费用户也提供了SSL服务,换而言之,往后cenci.tk应该也可以通过https的加密连接来访问。虽然迄今为止网站上并没有进行任何的eCommerce之类的活动,不过能够不需要太多麻烦就能获得更高的安全性,也是不错的。

另外最近网站访问掉线频繁,不知道是不是服务器方的原因,已经联系过,但未有答复。整个博客从搭建到现在一切服务都是免费的,所以也不好抱怨太多了。

可以预期在SSL升级的过程里,通过https的访问会有一些问题,具体的情况会再update一次。

历练

不敢说时间带来了什么,至少在这个时刻突然意识到,《北京一夜》这样的歌,还是得听陈升的版本。

墨水的语言
沉默得像
闪烁的倒影
在笔尖流淌出
浑浊的眼泪
像被刺穿的心脏
空空荡荡
但没有回音

2014-10-30 00.29.20