Man With Dog

Tue, 27 Feb 2024

The Day My MacBook Died!

Gee, the Apple Silicon MacBooks are spiffy! Well, except when they aren’t. This is a tale of such woe.

TL;DR - Laptops should have removable/replaceable storage drives; Apple MacBooks don’t. Either avoid Apple laptops or devise your own external storage system and daily backup plan.

I am a programmer; well, a system’s analyst actually but nobody pays for that anymore. And I love technology. I particularly enjoy working on Apple Computers because are so graphically rich.

It has been my longstanding opinion that I consider Apple Computers to be the best designed and engineered personal computer systems available. You want the false-economy of cheap, go elsewhere. I have been using and programming Mac computers since the days of Mac OS 7.

Sadly, I no longer hold so strongly to that opinion. I could recount many hardware fiascos Apple has delivered (butterfly keyboard is just recent one); but I won’t. My current daily driver is a sleek, fast MacBook Air with Apple Silicon. It far outperforms my last favorite MacBook: a quad-core 2012 15” MacBook Pro Retina. That was replaced by a little beastie MacBook Air with a 2GHz Core i7 & 16 GB RAM. Then I got this MacBook Air M1 with 16GB RAM and 512GB storage (henceforth, M1 MBA). Almost everything about it seemed like an enormous step forward: the CPU, the screen, the system on a chip, the fast memory subsystem, and the fast system bus. All this except for one thing I didn’t pay enough attention to: the storage system is soldered to the logic board. I truly enjoy sitting down to work with it.

…Until this incident.

I don’t mind that memory is soldered on; memory is temporary. But electronic components inevitably fail. Sometimes sooner, sometimes later. I/O subsystems are particularly vulnerable to dirty, noisy power. Even storage systems fail. These two things—overall logic & i/o subsystems, and storage subsystems—should always be separable. The best way to improve the overall performance of a system is to improve access to the slowest part, the storage subsystem. Apple did this at the cost of recoverability and long-term reliability of my data.

I now believe Apple has made a huge faux pas_ in tying the logic board & subsystems together with the storage subsystem. This is no longer just a belief; this is now my experience.

Why this?

I have two reasons for posting this story.

  • The first is to relay to the Apple Technician the symptoms of what is wrong and what I have already tried to recover from it. In a word: no joy. My hope is that Apple provides some magic tools to their technicians for this kind of incident.

  • The second reason is for my publisher who might think I’m giving him the my dog peed on my homework excuse. It certainly sounds like it: “I missed my promised deadline because my computer died.” I’m not trying to dodge a deadline. This really happened when I was in the middle of my work on Chapter 5. Once I publish this, I’m get back to work using a different computer, recovering as much as I can.

Prologue

Original, working configuration My original working configuration comprised my M1 MBA on an aluminum stand with a 12.9” iPad Pro 4 connect also on an aluminum stand connected via USB-C as a 2nd monitor.

Once you have experienced work with a 2nd monitor, it’s very difficult to work without a 2nd monitor. For casual stuff, 1 monitor is just fine.

All functioning USB-C cables. Apple MBA power supply.

The incident

On Sunday afternoon, I had been working normally editing chapter 5 of the book I’m contracted to write in exactly the configuration shown. As is my custom, whenever I stop, I upload the most recent edits to their server, which I did. We then went out for a couple of hours. The laptop was put in sleep mode but other left as-is. Upon returning, I found that the system would not wake up from sleep and was totally unresponsive to inputs (keyboard and trackpad).

Day 0: Sunday evening

As panic began to enter my consciousness, I tried powering off (hold power button for about 15 seconds) and powering back on. Nothing. Blank screen. No cursor. It appeared dead.

Well, not exactly nothing. After I calmed down a bit, having recycled power several times, I realized that I was getting the startup bong.

At this point, I started doing some research. I attempted to go into Recovery Mode but nothing appears on the screen. The system still appeared dead. After about an hour of this I was rather exhausted from the trauma, so I powered it off, disconnected the iPad and decided to sleep on it.

In the meantime, I verified that I still have AppleCare coverage on it. With that knowledge I made an appointment at the nearest Apple Technical Service Center; it’s about an hour away. I also wanted a day or two to see if I could recover my data before possibly losing everything (250GB+ of pdfs, videos, source code, etc.) on it.

Knowing that the M1 MBA had no way of (1) removing storage subsystem, and (2) I didn’t know of any way to access the storage subsystem, my sleep was fairly fitful. I awoke several times wondering how am I going to recover all of that data.

Okay, I admit it: foolish me, I don’t have a recent backup. I do have an old partial backup of my documents folder but that was more than several months ago.

Lesson 1: Don’t panic. Stop. Assess. Do some research. Even walk away for a bit. Do not return to the situation until you are calm.

Lesson 2: have a backup strategy and follow it… regularly. Even daily if your work is important. You likely won’t get fanatical about it until you actually lose a day or two of work.\

Day 2: Monday (all day)

I woke up with a good deal of hope. So this day—all day—I spent going through various possible scenarios and workarounds.

The monitor on the laptop was dead, as was the keyboard and trackpad. A workaround was in order. The first hurdle to overcome was how to get a 2nd monitor attached and appear as the main monitor.

It's dead, Jim

With a second monitor attached via Apple’s Media dongle, I could tell when the logon screen came up because the wallpaper appeared on the 2nd monitor. I could then close the lid of the laptop; the 2nd monitor then became the primary monitor. Yay!

Wait! 2nd monitor works

Oh snap, macOS is so effing secure that you cannot use attached accessories to log on until after you’ve logged on to unlock those acessories. What genius at Apple thought of that one?

I also tried various methods to activate BlueTooth from logon screen but nothing worked here either. No USB keyboard or mouse, no BlueTooth keyboard or mouse. The hardware must have recognized the internal keyboard and trackpad but couldn’t do anything with them.

By this point, I was accustomed to shutting down the OS (hold power for about 15 seconds) and then entering Recovery Mode (hit power button and hold for at least 25 seconds). When the monitor status light went active, I knew that the Recovery boot process was complete and could then close the lid to access Recovery Mode options.

Catch-22

It is interesting to note that USB keyboard and mouse worked but the USB flash drive with a bootable installer was not recognized. Musta’ been that same genius at work again.

I had found this Apple Support document describing thoroughly Recovery Mode for Apple Silicon MacBooks. The document seemed fairly complete and rather straightforward. So I began working through this document methodically (I had been thrashing about a bit the night before).

The first step was to try to reboot into Safe Mode from Recovery Mode. This appeared to work but returned to the logon screen and we’re back in our Catch-22 situation: can’t use accessories until we log on, can’t log on until we can use accessories. There must be some way to circumvent this but I have not found it. Send that genius to jail, do not pass go, do not collect $200… <aarrgghh>

I had no Time Machine backup so that was not an option.

Oh, wait! There’s a disk sharing option. Yay! On Intel Macs, that was the Target Disk mode. So we configure our M1 MBA for disk sharing

Shared disk mode?

Then we introduce the 2012 Intel MacBook Air by hooking up the necessary USB-C cable (through the Apple Media dongle). Then we open Finder and check out our network.

Enter 2nd MBA (2019 Intel)

So far, so good.

No sharing joy

But… nothing. Either this feature doesn’t work or else by USB-C subsystem is hosed in some particular way. Why am I so snarky about a feature not working? Because I made a bootable installer drive for Ventura and tried it on my Intel MBA. It failed because it could not find my Wi-Fi network.

I then tried to reinstall macOS Ventura in Recovery Mode with the hope that some driver or kext had been corrupted. Okay, but the installer needs an internet connection. If I was careful, or so the instructions stated, I might not have to completely wipe my storage. But, once again, no joy. You can’t recover your OS without a network connection. The Recovery Mode installer either does not have the necessary network drivers loaded or my networking subsystem is also hosed.

Can't reinstall, no network

What!? Apple, you are killing me, because your marketers bleat, “It just works.” … Uh, no, it doesn’t.

  • Aside: I used to work with Microsoft Windows since before Windows 95. Greasy kid stuff. Then I worked at Microsoft in the Windows Server group. I saw from the inside why Windows is the cheesy way it is. When Microsoft did their enormous layoff in 2015, I think Apple hired way too many of those people thinking they were getting skilled workers. This entire process has felt like working with Microsoft Windows 95 again. <yuk>

Finally, before throwing in the towel and waiting to see what the Apple Tech team could do, I decided to verify that my file system was still good.

File system appears OK

Using Terminal in Recovery Mode and fsck -n (no changes), it appears that the storage subsystem is just fine. Now if I could only get to it. Rather, get it all off that system.

Day 3: Tuesday

I resolved this day to do a clean setup of everything—disconnect all accessories, power off each computer—and perform each step I tried yesterday one last time.

I also decided to take pictures and write this blog entry so as to provide evidence of what I’d done and what I’m seeing.

At this point, nothing worked. The system is not recoverable. The storage system is intact but inaccessible. There is nothing else to do but see what the Apple Technician can do tomorrow.

Day 4: A trip to the Apple Technician

This has not occurred. I will provide an update after this incident has been resolved one way or the other.

Epilogue

This incident has left a very bad taste in my mouth, as it were.

Yes, I know computers fail. Yes, I know that a backup strategy is essential. Yes, I know that actually following a backup plan is critical.

Still, this MacBook Air is not even 3 years old. I did not expect it to fail so relatively soon (for Apple computers) and in such an unrecoverable manner.

I am at the point where FreeBSD and/or Linux is looking better and better and where all the gizmos, gadgets and blinky-lights of Apple products, especially w.r.t. macOS, have lost their allure. This is akin to Bill Burr’s experience of losing his religion—gradually, the way curlers let go of the stone.

I am not so certain that I will ever buy another Apple computer again. At least not until the storage system is reliably recoverable/replaceable.

Now I have to get back to work on my book…

posted at: 14:30 | path: /Computering | permanent link to this entry

Thu, 31 Aug 2023

From C to … where next?

C is still a great language. Here we examine some viable successors.

TL;DR: Rust, Zig, and ObjFW.

The C programming language was the 3rd programming language I’ve learned—-and that was over 4 decades ago. The first two languages I have essentially forgotten and will never use again: BASIC and Pascal. To be honest, after learning C in university I actually forgot it since I was steeped in a quite different language for my day job for nearly a decade.

As luck would have it, I not only relearned C but also learned C++. I mostly learned C++; I learned just enough to get done whatever was needed; it is a beastly language.

In fact like most programmers, I largely used C++ as a better C. Then C got better.

After more than another decade and I no longer needed to write programs in C++, I very happily jettisoned it. I will not re-acquire it, no matter how many gyrations the C++ committee puts it through. With each gyration they attempt to make it a more something language—-more streamlined, more expressive, more I don’t know what. They do improve some things but then introduce other kludges features—-just too much syntactical strychnine. There is now so much baggage that C++ is beginning to approach COBOL or Ada. COBOL evolved where you could do nearly anything and everything with it… in thousands of lines of stultifying code. Ada was designed to be absolutely everything for every possible usage and therefore could do nothing well or fast. Yet, we keep hearing the incessant bleats, “C is too hard! Pointers! Waaa!”

Then I learned Objective-C. It is C with a few simple syntax additions. Suddenly you have objects and methods. It was influenced directly by Smalltalk where the focus is upon messages, and not all of that other OOP gobbledygook in other OOP languages. The Smalltalk environment has great limitions. Objective-C has a different set of limitations; one is you will only find a viable programming environment for it on macOS. Forget about iOS and the other inhabitants of Apple’s walled garden; they want you to use Swift and only Swift. Swift was billed as a systems programming language but nearly 10 years later very little of any core OS is written with it. Oh, and they just introduced macros in Swift. <sigh>

Aside: The C preprocessor is the one facility of C that I truly despise.

Back to C

Well, mostly. FreeBSD, OpenBSD, Linux (on just about every device), Raspberry Pi, and even Arduino still require C skills. So these things are keeping C alive after 50 (!) years.

The thing I like the most about the C Standards Committee is that for each version they follow a charter. The charter has evolved—-grown, not changed—-from the original to meet current needs. You can read the charter for C23 (née c2x). Note that at the time of this writing, most compilers currently only recognize the -std=c2x option and do not yet recognize -std=c23 even though many features of C23 are supported in current versions.

This charter thing is significant because it means C will continue to operate as C and not some new, improved, now with fizzle-gig gyration of C. There are myriad examples of languages that have gone off this cliff; consider the whole ongoing Python 2.x versus 3.x debacle.

C-Next

If you accept the proposition that C++ has failed as the next iteration of C, and I deeply believe it has, what are current the reasonable options?

I will simply state without going into details that I have a strong bias against Apple’s Swift and Microsoft’s C#. Both of these are vendor-driven technologies from vendors who have a proven track record of abandoning developers for the next new shiny thing. And beyond their walled gardens, they promise broader platform scope, but how long has this ever lasted from both of these companies. It’s just not in their charters.

I have come upon three different language trends that I believe are reasonable successors to C. Note: I think JavaScript is viable on the web but not elsewhere, and so we will leave it aside for now.

Let’s consider each of these.

Rust

Rust has been around since 2015. It is not C. It is not necessarily easy to learn.

Yet, in that time, it has garnered a lot of favor from developers as can be seen in the Tiobe Index and Stack Overflow Annual Survey.

Additionally, it is now officially supported in the Linux 6.1 kernel. That is a rather notable vote of confidence for this language. Furthermore, Rust is not only supported as an extension to an OS (Linux) it is also used to write new, experimental OSes. There’s also a tutorial to build a simple one. There are lots of similar systems projects when you start looking for them.

The Rust community is vibrant. It provides a great deal of resources for learning Rust and support for creating apps in Rust.

Zig

In a recent chat with Mark Dalyrmple of CocoaHeads fame and author of Advanced Mac OS X Programming, among other works, he mentioned Zig as a C-like evolution of C. He’s always good for that kind of thing, as in, “Hey, lookee at that thingee over there…”

The syntax looks simple and clean. It has objects. It already runs a bunch of places.

Okay, that’s enough to get me interested.

ObjFW

The main problem with Objective-C today is that it only, or largely only, runs on Apple platforms. Then, this article surfaced via OSNews. ObjFW promises to give new life to Objective-C on more than just Apple platforms.

I am rather excited by this development because I really like Objective-C. I wrote a desktop clock application with it and very much enjoyed the experience. That was about the time Swift was announced.

Sadly, I’ve let that app languish. But now with ObjFW I can see a way to not only escape from the clutches of Apple but also port this app to other non-Apple platforms. Writing/porting my Objective-C app to Linux/Wayland is now a real possibility. I don’t know when that will happen but it is back on my list.

Conclusion

Will these languages replace C? I think not.

Or, at least, not anytime soon. The market is fickle. Programmers are even more fickle. What is the new, shiny today may no longer hold any interest tomorrow. To be clear, these languages will have to get well beyond the new, shiny phase to displace C. That day is coming… but nobody knows when that will be; that day seems to be too far off over the horizon.

C grew out of a practical need for a portable systems programming language. It was originally intended to be used by and for experienced systems programmers. It has grown to be used in many other areas: scientific computing, application development, and the web. However, C still requires a level of awareness and skill to create feature-rich and robust programs. Even with that, C has become a model for many other languages: C++, C#, JavaScript, Objective-C, and now Rust and Zig.

I do think these languages will provide vibrant and stable development environments for picking up where C is weak or falls down. I am looking forward to deeply learning each of these languages to see if, in fact, they will fullfil their promise as the next iteration of C.

Mobile, Alabama
August, 2023

posted at: 12:01 | path: /Computering | permanent link to this entry

powered by blosxom