Christians Tagebuch: mac

The latest posts in full-text for feed readers.


MacOS: Resizing partition fails

To make space for a Linux installation, I tried to shrink the native MacOS partition that occupied the whole hard disk with the disk utility on macOS Monterey 12.7.6, both in normal and in recovery mode. It always failed:

The failing Disk Utility

APFS-Datenstrukturen verkleinern
Fehlercode beim Ändern der Größe des APFS-Containers: 49187
Bei der Größenänderung der Strukturen des APFS-Containers ist ein Problem aufgetreten. : (-69606)

Aktion fehlgeschlagen ...

As usual with MacOS: The UI looks sleek, but once you try to do something more sophisticated than viewing an image, you'll stumble over unfixable errors.

There were no official documents describing this problem, and the Apple forums were full of "helpful" people repeating the question and then telling the user to reboot.

Solution: umount

A ticket for the Asahi Linux installer had the solution:

  • Boot into recovery and open a terminal
  • diskutil unmountdisk /dev/disk3
  • fsck_apfs /dev/disk3 (and hit y in response to the various prompts)

Published on 2024-08-23 in


Screen time passcode reset without Apple ID

I've got a Macbook Pro running MacOS 12.7.4 Monterey with two local accounts: user and admin, both without an Apple ID.

The user account has a "screen time" passcode set that I forgot:

10 failed login attempts

The official instructions say:

  • Click Change Passcode, then click Forgot Passcode.
  • Enter the Apple ID and password you used to set up the Screen Time passcode.

The window does not have a "forgot passcode" button, and I suspect this is because the account does not have an Apple ID.


After searching for hours for a solution, I spent 50 internet points to get an answer but nobody could help.

The only options left are:

  1. Delete the user account and create a new one.
    Lose all settings like wallpaper, keychain and dock preferences.

  2. Install Linux that allows me to reset such things in config files.

For me this one of the shady things Apple does to nudge people into their pay-per-month online system, just as they do with the system preferences advertisements.

Published on 2024-05-03 in , ,


Docker MacOS: No space left

One of my colleagues uses Docker Desktop on MacOS. One day, it reported that all of the 200GiB of reserved space were full.

The docker daemon did not think so:

$ docker system df
TYPE            TOTAL     ACTIVE    SIZE      RECLAIMABLE
Images          68        18        36GB      26.9GB (74%)
Containers      20        20        111.7MB   0B (0%)
Local Volumes   56        12        7.947GB   4.992GB (62%)
Build Cache     365       0         0B        0B

This are no 200 GiB.

On Linux we can simply inspect /var/lib/docker, but Docker on MacOS is running inside a virtual machine (VM). We got access to that VM with the help of justincormack/nsenter1:

$ docker run -it --rm --privileged --pid=host justincormack/nsenter1

# cd /var/lib/docker/
# du -h -d 1
44.5G ./overlay2
95.6M ./image
7.7G ./volumes
114.4G ./containers
336.0K ./network
166.7G ./var/lib/docker

So containers is very full although docker said it should contain only 111 MiB :)

# cd /var/lib/docker/containers/
# du -h -d 1
56.0K ./e239e861c2a9097f79d3c0c0f98fce7b20ab899674ea7772356d0355d9f688f4
44.0K ./962a1795b5440e9b9900a4743d86f9c18452675a43c379a88aaac2b16b5bd275
[...]
114G  ./2f9867b08a714fcfd83b85d5cf7f883be05394970e7e0058747b399f06bd269d
[...]

# cd /var/lib/docker/containers/2f9867b08a714fcfd83b85d5cf7f883be05394970e7e0058747b399f06bd269d
# ls -lah
total 114G
[...]
-rw-r-----    1 root     root      114.3G Oct 11 07:01 2f9867b08a714fcfd83b85d5cf7f883be05394970e7e0058747b399f06bd269d-json.log
[...]

And there we have it: A log file of 114 GiB.

But which container is that?

$ docker inspect 2f9867b08a714fcfd83b85d5cf7f883be05394970e7e0058747b399f06bd269d | jq '.[].Config.Image'
"gitlab-docker.company.com/customer/customer-wordpress-docker/mysql:latest"

This particular MySQL container seems to be very badly configured.

Published on 2023-10-11 in ,


Macbook Air 2011: Sound of death

I bought a Macbook Air 13" in 2011 (Model A1369) and used it as Linux laptop until 2018. Then the upper letter row on the keyboard would take up to 5 minutes to be usable after opening the lid. Since my password contains at least one of the letters in that row, the laptop became unusable for me and I replaced it with a Purism Librem 13.

When Corona struck my older child got it for school work, and it got used until mid of 2022.

One day it showed strange colors on the screen and turned off. When turning it back on, the screen stays black and three consecutive sounds play every 5 seconds:

Apple says that "the memory in your Mac didn't pass an integrity check", which basically means the RAM is broken. Others had the same problem and they found a (now available) support document that said "3 beeps = no good banks".

But because the RAM is soldered onto the logic board I can't simply replace it.

Published on 2022-11-07 in ,


MacOSX answers pings while sleeping

We got an old 2015 Macbook Pro (A1398) and I let Munin check if it is connected to the Wi-Fi network. When looking at the graphs I saw it was responding to ping packets even though it was sleeping!

A setting in the preferences application is responsible for this:

System Preferences > Energy Saver > Power Adapter > Wake for Wi-Fi network access

(German: Systemeinstellungen > Energie sparen > Netzteil > Ruhezustand bei WLAN-Netzwerkzugriff beenden )

Screenshot of energy saver preferences

When it is enabled and the Macbook is attached to the power cord, it will respond to pings in the network.

When the setting is disabled, it stops responding to pings 16-40s after closing the lid.

Published on 2022-09-19 in ,


MacOS X: "iCloud verwenden"-Werbung abschalten

Ein Familienmitglied nutzt einen Mac Mini, und auf dem zeigte die Programmleiste am unteren Bildschirm über dem Symbol der Systemeinstellungen seit neuestem immer ein rotes Benachrichtigungsicon mit einer "2" an. Zwei dringende Dinge, die behoben werden müssen.

Öffnet man die Systemeinstellungen, so ist bei "Apple ID" und bei "Softwareupdate" ein rotes Benachrichtigungssymbol zu sehen. Weiterhin wird unter dem Namen noch "iCloud verwenden .. Details" angezeigt:

MacOS X Systemeinstellungen: Übersicht

Bei "AppleID" ist dann ein gelbes Warn-Icon, daß man doch iCloud benutzen soll. Es gibt keinen "normalen" Weg, diese Warnung abzuschalten:

MacOS X Systemeinstellungen: Apple ID

Andere Leute im deutschsprachigen Raum stört diese unnötige und nicht abschaltbare Werbung auch, hatten aber keine Lösung.

Im englischsprachigem Raum ab es im Apple-Forum eine Lösung: Ein Terminal aufmachen und folgenden Befehl ausführen:

$ defaults delete com.apple.systempreferences AttentionPrefBundleIDs

Wer möchte, kann sich den Eintellungswert vorher auch ausgeben lassen:

$ defaults read com.apple.systempreferences AttentionPrefBundleIDs

In unserem Fall war die iCloud-Benachrichtung nach dem Reboot weg. Leider tauchte die OSX-Update-Benachrichtigung automatisch nach 30 Sekunden wieder auf :/

So möchte ich als zahlender Kunde nicht behandelt werden.

Published on 2020-11-15 in ,


Tuxbook: Glowing Tux sticker for the Macbook Air

I'm using a Macbook Air because of the nice hardware and run Ubuntu Linux on it since OSX isn't really usable for me.

Being a Linux guy, I wanted to get rid of the glowing apple on the front for quite some time now. There was of course a catch: The apple should be replaced with something nice that integrates the glow in a cool way.

The first stickers I found were on Etsy, search word here is macbook decal. Unfortunately, most of the badges keep the apple logo and only some integrate it at least partly, but nothing was nice enough for me.

After a while I found macstix.net which exclusively have labels that cover the apple and let other symbols glow instead - see their gallery. I contacted them, sending a SVG file along how I imagined the sticker could be. Unfortunately they had to decline but told me the address of their competitor: iDiffer.

The iDiffer guys answered quickly, measured, tested and finally made the sticker for me. It costed 19€ in total, and today it arrived:

Macbook with Tux sticker Tux sticker detail

Update 2013-08: Separate sticker page

iDiffer has a separate page for the tux sticker now, and it costs 8€.

Published on 2012-04-23 in , ,


Linux on Macbook: Black screen on boot

Now it happened the second time: After a Ubuntu Linux system crash I had to reboot my Macbook Air and, instead of seeing GRUB, a black screen with a lonely blinking cursor illuminated my face. The mac did not boot Ubuntu anymore - rEFIt still worked, but loading grub completely failed.

I tried booting with the official boot loader (holding alt/option during boot) and selecting the (wrongly labeled) "windows" installation there, re-installing rEFIt, re-blessing the linux boot partition and re-setting the boot partition bootable in MBR - nothing helped. The cursor flashed and flashed for minutes, not doing anything.

In the end, I had to reinstall GRUB to make my linux partition bootable again.

Rescue boot

The beginning of the procedure was the same as the installation process:

  1. Use UNetbootin to put the Ubuntu 64bit Mac CD ISO onto an USB stick
  2. On OSX, copy that onto the 4th partition (my linux boot partition that somehow got damaged):

    $ sudo dd if=/dev/disk2s1 of=/dev/disk1s4 bs=1m
  3. Reboot from that partition into live cd mode

Now when that's done, GRUB needs to be re-installed. We need to chroot into the old system to do that, but before we have to make the partition writable. Since we booted from it, we cannot change it by default, but since we have enough RAM it's easy:

$ sudo bash
$ cp -r /cdrom /cdrom2
$ umount -lfr /cdrom
$ rmdir /cdrom
$ mv /cdrom2 /cdrom

Now chroot into the old system:

$ sudo bash
$ mount /dev/sda5 /mnt
$ mount -o bind /proc /mnt/proc
$ mount -o bind /dev /mnt/dev
$ mount -o bind /dev/pts /mnt/dev/pts
$ mount -o bind /sys /mnt/sys
$ chroot /mnt /bin/bash

And finally reinstall GRUB:

$ sudo grub-install --force /dev/sda4

Shutdown the live cd and boot your mac. It will start the old Linux system now without problems.

Published on 2012-07-29 in , ,


Installing Ubuntu on a Macbook Air

I bought a Macbook Air 4,2 (= mid 2011) last week. Despite that my last laptop was a Macbook, I really wanted to buy no Mac again since setup is always a hassle. Unfortunately, no other notebook vendor has similar hardware for the same or lower price.

So the first thing after I got the Macbook Air and trying out the multi touch gestures in OSX was to install Ubuntu and move the profile from my old laptop on it so I could continue working. Unfortunately, it was not easy. Installing really sucked - the apple engineers and programmers did their best to make it as hard as possible to get Linux running on it.

Booting a Linux installer from a USB stick

The Macbook Air has no CD/DVD drive (since those optical media are dead for me anyway), so I wanted to use a "live usb stick" with the Ubuntu installer on it. UNetbootin is a tool that takes any Linux installation CD/DVD .iso file and puts it on a USB stick that is bootable by almost all PCs. As that always worked, I used it to put the Ubuntu 11.04 live install CD iso on a USB stick.

After installing rEFIt, the stick was detected and I wanted to boot. Guess what - it does not work. Others have the same experience : Booting from USB sticks does not work on a Macbook Air. You'll learn to hate the following errors:

Missing operating system
no bootable devices

Booting the installer CD

I managed to get the Ubuntu installation CD working by putting it on a separate partition after preparing it a bit.

Partition layout for Macbook Air with 256 GB SSD
OSX device name Linux device name Type Size Description
Original partitions
disk0s0 /dev/sda1 fat32 200 MiB EFI boot partition
disk0s1 /dev/sda2 hfs+ All the disk / 60 GiB after resizing Mac OSX
disk0s2 /dev/sda3 ??? 620 MiB Hidden Mac OSX rescue partition.
Additional partitions
disk0s3 /dev/sda4 fat32 1 GiB Ubuntu installer / boot
disk0s4 /dev/sda5 ext4 50 GiB Linux root /
disk0s5 /dev/sda6 swap 4 GiB Swap
disk0s6 /dev/sda7 ext4 10 GiB /tmp
disk0s7 /dev/sda6 ext4 110 GiB Home folders /home

With the OSX disk utility, you can resize the OSX partition and prepare the new ones, all as "fat32".

USB stick and harddisk preparation

  1. Create a msdos partition table on your USB stick. Most sticks do not have one, but we absolutely need it. GParted makes that easy: Menu "Device", "Create partition table", "msdos".

  2. Create a 1 GiB FAT32 partition on it. Give it a nice name; rEFIt will show that later when booting.

  3. Use UNetbootin on a second computer to put the install CD .iso on that partition. I used the "64-bit Mac (AMD64) desktop install CD" from the Ubuntu 11.04 alternate iso download page , but I think the normal (non-mac) 64-bit iso should work, too.

  4. Boot into OSX, open the Terminal and run

    $ sudo dd if=/dev/disk2s1 of=/dev/disk1s4 bs=1m

    This will copy the partition from the USB stick onto the fourth partition on your Macbook's SSD.

  5. Install rEFIt if you haven't done that yet.

  6. Reboot. You will see the new partition in the rEFIt menu and can boot it. It will show the UNetbootin boot menu from where you can start the Ubuntu Live CD or the installer.

    When running Ubuntu, add nomodeset to the boot options - otherwise the screen will look garbled and you won't see anything. This is necessary in at least Ubuntu 11.04 and 11.10; the fix will hopefully be in Linux kernel 3.2 after is has only recently been implemented.

Very important: You will only able to boot from the first four partitions because rEFIt uses the BIOS emulation for Linux, which means that you have to use the MBR partition table. Syncing the GPT to MBR does not give you an extended partition, so the first 4 are usable only. Keep that in mind when playing around.

Installing Ubuntu Linux

Making the harddisk writable

The Ubuntu 11.04 installer has a problem installing Ubuntu on the same disk that the installer is run from. I don't know the reasoning behind that; the error is that the a partition of the disk is already in use (the installer partition).

To work around that problem, do not start the installer but the Live CD mode, run the following commands and then start the installer:

$ sudo cp -r /cdrom /cdrom2
$ sudo umount -lfr /cdrom
$ sudo rmdir /cdrom
$ sudo mv /cdrom2 /cdrom

The rest of the installation process is as usual without any problems.

Special drivers

The Macbook Air 4,2 (mid 2011) is not very well supported by the stock kernel and software in Ubuntu. Additional work is required.

The most easy way is to use Joshua V. Dillon's post-install script, post-install-natty.sh for 11.04 or post-install-oneiric.sh for 11.10.

The script fixes the graphic driver problems, so nomodeset is not required anymore. It also fixes bluetooth, the touchpad, the keyboard layout and backlight.

Hardware support

Support status for Ubuntu 11.10, kernel 3.0.0-12-generic #20-Ubuntu.

Hardware State Description
Display Works Full 1440x900 resolution
  VGA adapter Partially Full HD resolution of TV was not recognized, worked up to 1440x900
  HDMI adapter Works All TV resolutions were detected correctly
Wifi Works No problems in 11.10, 11.04 crashed under heavy load
Bluetooth Partially My phone does not see the Macbook, works the other way round
Keyboard Works Backlight, too - Gnome shell automatically supports hotkeys
Touchpad Works 2-finger scrolling works, too
Webcam Works No problems on 11.10. Didn't work on 11.04. Cheese allows 640x480 only, although HD should be possible according to Wikipedia.
Sound Works If you hear no sound, use alsamixer to unmute both surround speakers.
Suspend Works
SD card reader Works

Other resources

The Ubuntu Wiki has a very complete guide for the Macbook Air 4,2 now.

Broken?

In case the linux system does not boot anymore from rEFIt, have a look at my solution.

Published on 2011-10-14 in , , ,


Reading your MacBook's revision on Linux

Before upgrading the RAM in my Macbook, I had to find out which revision it was. Reboot wasn't an option since I did not want to lose my 39 days of uptime, so I had to find a linux-based solution - dmidecode:

$ sudo dmidecode --type 1
# dmidecode 2.9
SMBIOS 2.4 present.

Handle 0x0001, DMI type 1, 27 bytes
System Information
    Manufacturer: Apple Inc.
    Product Name: MacBook2,1
    Version: 1.0
    Serial Number: N0N3EDTOFE3D
    UUID: S0M3TH1N5-57RAN53-15-H3RE-70-C
    Wake-up Type: Power Switch
    SKU Number: System SKUNumber
    Family: MacBook

Published on 2011-01-14 in , ,