The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 4,152 other subscribers

Archive for the ‘Mac’ Category

Way easier to fix on Intel MacBook machines than I thought: macos kernel_task high cpu dual screen

Posted by jpluimers on 2023/03/13

The links found via [Wayback/Archive] macos kernel_task high cpu dual screen – Google Search were daunting.

In the end, the issue ways way easier to fix than I thought: open up your Intel MacBook (you need pentalobe screwdrivers for that), then with some compressed air, clean the dust (especially from the fans).

This post saved my day [Wayback/Archive] kernel_task takes up 500% of my CPU when plugging in external monitor – MacBook Pro 15″ Retina Display Mid 2015 – iFixit

Things I haven’t tried yet:

  • Cleaning out more free space from HDD
  • Using plain HDMI cable into the HDMI cable port
  • Taking MBP apart and cleaning any potential dust


Block Image

I faced the very same issue that you guys are facing and based on input from another forum decided to get my 2016 MPB fans cleaned out.

This made an immediate impact where when I connected my external display to the MBP.pre-cleaning, it would overheat causing the fans to spin at 6000 rpm or thereabout and the kernel_task would eat up 500%-900% of the CPU rending the system unusable.

This simple cleanup of the fans has allowed me to connect the monitor with no kernel panic anymore and even though the fans run around 5000 rpm now the CPU and GPU are running around 10 degrees cooler now.

The same picture is in [Wayback/Archive] macos – MacBook Pro high CPU with external monitors – Ask Different.

An even dirtier MacBook was at [Wayback/Archive] External Display – High CPU Usage – MacBo… – Apple Community.

Links that were interesting but unhelpful:

–jeroen

Read the rest of this entry »

Posted in Apple, Mac, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, Power User | Leave a Comment »

Getting your public IP address from the command-line when http and https are blocked: use DNS

Posted by jpluimers on 2022/12/28

Years ago, I wrote Getting your public IP address from the command-line. All methods were http based, so were very easy to execute using cURL.

But then in autumn 2021, Chris Bensen wrote this cool little blog-post [Wayback/Archive] Chris Bensen: How do I find my router’s public IP Address from the command line?:

dig -4 TXT +short o-o.myaddr.l.google.com @ns1.google.com

At first sight, I thought it was uncool, as the command was quite long and there was no explanation of the dig command trick.

But then, knowing that dig is a DNS client, it occurred to me: this perfectly works when http and https are disabled by your firewall, but the DNS protocol works and gives the correct result:

# dig -4 TXT +short o-o.myaddr.l.google.com @ns1.google.com
"80.100.143.119"

This added the below commands and aliases to my tool chest for *nix based environments like Linux and MacOS (not sure yet about Windows yet :), but that still doesn’t explain why it worked. So I did some digging…

IPv4

  • command:
    dig -4 TXT +short o-o.myaddr.l.google.com @ns1.google.com
  • command removing outer double quotes:
    dig -4 TXT +short o-o.myaddr.l.google.com @ns1.google.com | xargs
  • alias:
    alias "whatismyipv4_dns=dig -4 TXT +short o-o.myaddr.l.google.com @ns1.google.com | xargs"

IPv6

  • command:
    dig -6 TXT +short o-o.myaddr.l.google.com @ns1.google.com
  • command removing outer double quotes:
    dig -6 TXT +short o-o.myaddr.l.google.com @ns1.google.com | xargs
  • alias:
    alias "whatismyipv6_dns=dig -6 TXT +short o-o.myaddr.l.google.com @ns1.google.com | xargs"

How it works

Let’s stick to dig and IPv4 as that not having IPv6 (regrettably still) is the most common situation today:

# dig -4 TXT +short o-o.myaddr.l.google.com @ns1.google.com
"80.100.143.119"

What it does is request the DNS TXT record of o-o.myaddr.l.google.com from the Google DNS server ns1.google.com and returns the WAN IPv4 address used in the DNS request, which is for instance explained in [Wayback/Archive] What is the mechanics behind “dig TXT o-o.myaddr.l.google.com @ns1.google.com” : linuxadmin.

Since these are TXT records, dig will automatically double quote them, which xargs can remove (see below how and why):

# dig -4 TXT +short o-o.myaddr.l.google.com @ns1.google.com | xargs
80.100.143.119

The DNS query will fail when requesting the Google Public DNS servers 8.8.8.8 or 8.8.4.4:

# dig -4 TXT +short o-o.myaddr.l.google.com @8.8.8.8
"2a00:1450:4013:c1a::103"
"edns0-client-subnet 80.101.239.0/24"

Or, with quotes removed (the -L 1 ensures that xargs performs the quote-pair removal action on each line):

# dig -4 TXT +short o-o.myaddr.l.google.com @8.8.8.8 | xargs -L 1
2a00:1450:4013:c1a::103
edns0-client-subnet 80.101.239.0/24

This request is both slower than requesting the ns1.google.com server and wrong.

The reason is that only ns1.google.com understands the special o-o.myaddr.l.google.com hostname which instructs it to return the IP address of the requesting dig DNS client.

That 8.8.8.8 returns a different IP address and an additional edns0-client-subnet with less accurate information is explained in an answer to [Wayback/Archive] linux – Getting the WAN IP: difference between HTTP and DNS – Stack Overflow by [Wayback/Archive] argaz referring to this cool post: [Wayback/Archive] Which CDNs support edns-client-subnet? – CDN Planet.

Not just ns1.google.com: any DNS server serving the google.com domain

Since o-o.myaddr.l.google.com is part of the google.com domain, the above works for any DNS server serving the google.com domain (more on that domain: [Wayback/Archive] General DNS overview  |  Google Cloud).

Getting the list of DNS servers is similar to getting the list of MX servers which I explained in Getting the IP addresses of gmail MX servers, replacing MX record type (main exchange) with the NS record type (name server) and the gmail.com domain with the google.com domain:

# dig @8.8.8.8 +short NS google.com
ns3.google.com.
ns1.google.com.
ns2.google.com.
ns4.google.com.

The ns1.google.com DNS server is a special one of the NS servers: it is the start of authority server, which you can query using the SOA record type that also gives slightly more details for this server:

# dig @8.8.8.8 +short SOA google.com
ns1.google.com. dns-admin.google.com. 410477869 900 900 1800 60

The difference between using NS and SOA records with dig are explained in the [Wayback] dns – How do I find the authoritative name-server for a domain name? – Stack Overflow answer by [Wayback/Archive] bortzmeyer who also explains how to help figuring out SOA and NS discrepancies (note to self: check out the check_soa tool originally by Michael Fuhr (I could not find recent content of him, so he might have passed away) of which source code is now at [Wayback/Archive] Net-DNS/check_soa at master · NLnetLabs/Net-DNS).

So this works splendid as well using ns4.google.com on my test system:

# dig -4 TXT +short o-o.myaddr.l.google.com @ns4.google.com | xargs
80.100.143.119

The xargs removes outer quotes removal trick

[Wayback/Archive] string – Shell script – remove first and last quote (“) from a variable – Stack Overflow (thanks quite anonymous [Wayback/Archive] user1587520):

> echo '"quoted"' | xargs
quoted

xargs uses echo as the default command if no command is provided and strips quotes from the input.

More on https versus DNS requests

Some notes are in [Wayback/Archive] How to get public IP address from Linux shell, but note the telnet trick now fails as myip.gelma.net is gone (latest live version was archived in the Wayback Machine in august 2019).

Via

–jeroen

Posted in *nix, *nix-tools, Apple, bash, bash, Batch-Files, Communications Development, Development, DNS, Internet protocol suite, Linux, Mac, Mac OS X / OS X / MacOS, Power User, Scripting, Software Development, TCP | Leave a Comment »

The only practical way of running x86 VMs on Apple M1 seems to be QEMU based UTM

Posted by jpluimers on 2022/07/01

Few articles exist on running x86 VMs on Apple M1 architecture.

This is the best I found, and clearly states that QEMU based UTM is the way to go, but notably lacks 3D support: [Wayback/Archive.is] Apple Silicon M1: How to run x86 and ARM Virtual Machines on it? | by Dmitry Yarygin | Mar, 2021 | Medium

Without VMs, but running Windows x86_64 code is already possible using Windows 10 for ARM via Parallels: [Wayback] Windows 10 on M1 Macs: What you can do (virtualization, sorta) and can’t (Boot Camp) | Macworld.

VMware Fusion is not going to support x86_64 virtualisation anytime soon as per [Wayback/Archive.is] Fusion on Apple Silicon: Progress Update – VMware Fusion Blog – VMware Blogs

What about x86 emulation?

We get asked regularly about running x86 VMs on M1 Macs. It makes total sense… If Apple can emulate x86 with Rosetta 2, surely VMware can do something too, right?

Well, the short answer is that there isn’t exactly much business value relative to the engineering effort that is required, at least for the time being. For now, we’re laser focused on making Arm Linux VMs on Apple silicon a delight to use.

So, to be a bit blunt, running x86 operating systems on Apple silicon is not something we are planning to deliver with this project. Installing Windows or Linux from an x86 ISO, for example, will not work.

More on UTM, which is open source:

Now hopefully someone posts a Wiki of running x86_64 Windows on Apple M1 (:

This is a small start that it can be done [Wayback/Archive.is] Has anyone tried running Delphi on Windows ARM? – Delphi IDE and APIs – Delphi-PRAXiS [en]

It works well. I’ve managed to build and run my VCL and FMX projects on Android, iOS, Windows and Mac without any problems.
Note that both Windows ARM and the way it runs Delphi are still in preview so tread carefully!
On 4/18/2021 at 8:01 PM, Der schöne Günther said:
Can you confirm it cannot only build projects but also debug them?
I can debug Windows and Android no problem. I’m having issues debugging iOS as it’s stopping in the IDE but showing the CPU rather than code views. I believe this might be a badly built component I need to re-install rather than an issue with the environment but can’t confirm either way at the moment.

An update on the debugging issues on iOS – it’s all working now. My VM just needed a restart and I can debug without problems now.

–jeroen

Posted in Apple, M1 Mac, Mac, Mac OS X / OS X / MacOS, Power User, Qemu, UTM, Virtualization, Windows, Windows 10 | Leave a Comment »

Kris on Twitter is a bit radical against shell scripts. Learn why.

Posted by jpluimers on 2022/04/13

I say to people: only use shell interactively, don’t write scripts. Never. Not one.
But Kris, they ask, why so radical?
Because of this:

is the literal English Google Translation of the German text

Ich sage den Leuten: benutzt Shell nur interaktiv, schreibt keine Scripte. Nie. Nicht eines.
Aber Kris, fragen sie, wieso so Radikal?
Deswegen:

then links to [Wayback/Archive] Jan Schaumann on Twitter: “TIL zgrep(1) is a shell script. BSD basically does “zcat | grep”, but GNU does “gzip -dc | sed”. How did I learn that? The fun way! CVE-2022-1271, arbitrary-file-write and code execution vulnerability in GNU zgrep / gzip. …”:

Read the rest of this entry »

Posted in *nix, *nix-tools, Apple, ash/dash, ash/dash development, bash, bash, BSD, Development, Mac, Mac OS X / OS X / MacOS, Power User, Scripting, Software Development | Leave a Comment »

Cleaning the cooling fans of a 15-inch Retina MacBook Pro 2015 model

Posted by jpluimers on 2022/03/14

After years of use, the cooling fans of my 15-inch Retina MacBook Pro 2015 model got quite a bit dirty, causing them to run louder and louder.

The video below the fold shows how to clean them: 11 screws, some isopropyl alcohol, (dry!) compressed, and caution for the connector-clips connecting the bottom plate.

It helps having a:

  • pentalobe P5 screwdriver
  • plastic spudger so separate the bottom plate (especially be careful with the connector-clips)
  • magnet to stick the screws to, as they are really tiny and it is easy to loose them

I got the pentalobe screwdriver with some spare screws from the German Amazon: [Archive.is] Kricson Ersatzschrauben MacBook Pro – 4 Pack Gummi: Amazon.de: Computer & Zubehör

You can get a similar one from the USA Amazon site: [Archive.is] Amazon.com: 8 Pack Rubber Case Feet + Set of 20pcs Repair Replacement Screw + 1pcs 5 Point Pentalobe Screwdriver for Unibody MacBook Pro Retina A1425 A1502 A1398 13″ 15″ Bottom Case(Retina): Computers & Accessories

Two important tips:

  • After using isopropyl alcohol, let the parts dry
  • Hold the fans when spraying compressed air (to prevent the fan-motors to create over-voltage, and to prevent the fans spinning faster than they are rated for)

The iFixit pictures for replacing the SSD help greatly to see how to remove and re-attach the back-cover, and where the various parts are inside the machines.

Note the screws differ between the 13-inch and 15-inch models!

–jeroen

Read the rest of this entry »

Posted in Apple, Mac, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, Power User | Leave a Comment »

 
%d bloggers like this: