Gregs' tech info



HTML Referance information
HTML GlossaryHTML Specification Version 2.0
HTML ColoursHTML Specification Version 3.0
HTML Crib sheetwww.w3schools.com
URL SpecHTML snippets
Htmlgoodies - Full tutorialsHtml Remix
 
Perl Referance information
Perl and CGI tutorialsPerl.org tutorials
Perl.com tutorials
 
Other information
Remote side infomationTime-Machine Backup to NAS storage
What is my IPHow to test SMTP from CLI
Bash Shellshock tests 
burnard.duckdns.orgUNIX crib sheet

OS X bad block scan using DD in terminal

You can use the dd command to copy the raw data blocks from the drive to a null device, if you use rdisk identifier this is raw data and faster.

Just check the disk number before you start with:

diskutil list

sudo dd bs=1m if=/dev/rdisk4 of=/dev/null

To view the progress press 'CTRL + T' to view the bytes transferred and time with speed.


To test for the MTU value using PING:

Windows command line:
ping 8.8.8.8 -f -l 1466

This will use the '-f' parameter to set the 'Don't fragment flag' and the '-l xxxx' will set buffer size.
So if the packet is to large you will see the warning 'Packet needs to be fragmented but DF set.'
Try reducing the value until you no longer get the warning, then remember to add 28 for the IP and ICMP headers.
Example: Ping of 1464 + Headders of 28 = MTU 1492

Mac OS X terminal:
ping -D -g 1460 -G 1500 -h 1 8.8.8.8

This will use the '-D' parameter to set the 'Don't fragment flag'.
Then we set a start packect size using '-g 1460' note remember 28 bytes of headder are added.
Then we set the end packect size using '-G 1472'
Then an increment step of 1 using '-h 1'.
This will start to scan through the packet sizes until you get the warning 'Request timeout for icmp_seq' and it should specify the MTU.


To zero all data on a drive:

diskutil zeroDisk /dev/disk(your drive number)


Windows 10 how to remove network login username and passwords:

Open command prompt in elevated administrator mode.

Enter: rundll32.exe keymgr.dll,KRShowKeyMgr


To Setup Ubuntu running in VirtualBox
To setup the virtual video card to follow the window size:
To install the VirtualBox video driver.
sudo apt-get install virtualbox-guest-dkms virtualbox-guest-utils
Note set the Virtual Box video memory to more then the default of 17MB

To show the boot progress:
edit the GRUB settings.
sudo pico /etc/default/grub
Find the line starting with GRUB_CMDLINE_LINUX_DEFAULT and remove the parameters quiet and splash.
Save the file and close the editor.
To update the running config run sudo update-grub


What is the cause of the “Computer missing a firmware partition” error?

Just like many PC problems, this particular error could result from any number of things. Your computer could be low on storage space, for instance, or a malware infection might have interfered with system settings, or perhaps a piece of the Mac’s hardware is damaged or not properly configured. To troubleshoot as many problems as possible, it is recommended to first try a Mac repair tool such as before pursuing any other solution. Outbyte MacRepair will scan your entire system to find and fix any performance-limiting issues that may exist. If the “Computer is missing a firmware partition” error persists even after cleaning your computer with a Mac repair tool, the following other solutions will be of great help to you on the matter.

Check Compatibility
To upgrade to Mac OS High Sierra or to Mojave from previous versions of OS, such as OS X Mountain Lion, your PC must meet several minimum requirements. Apple, for instance, recommends at least 2GB of memory and 14.3 GB of available storage space. However, to be on the safe side, make sure that your computer exceeds these minimum requirements by at least 20%. The following is a list of devices that are compatible with Mac OS High Sierra and Mojave:
• MacBook released 2009 or later.
• MacBook Air released late 2010 or later.
• MacBook Pro released mid-2010 or later.
• Mac mini released mid-2010 or later.
• Mac released late 2009 or later.
• Mac Pro released mid-2010 or later.
If your device is not on the list above, then trying to install the latest versions of iOS on your device will result in failure no matter what you do. You can check whether your device meets these minimum requirements by choosing About this Mac from the Apple Menu.

Update Your Drivers 
Drivers are what allows hardware devices to communicate with the operating system. When drivers are out of date or misconfigured, they can cause all sorts of problems on a computer. To make sure drivers are not responsible for the “Computer is missing a firmware partition” error, you will have to update them. To update drivers on the Mac, take the following steps:
1. Click on the Apple icon and select App Store.
2. Click UPDATE for the specific update that you want or choose UPDATE ALL to make all updates at the same time.
NB: It is important that you always keep your system up to date for security and performance reasons.

Bypass Method
The following technique that involves using the Carbon Copy Cloner and VMware Fusion software seems to work in eliminating the error under discussion. Carbon Copy Cloner is a special kind of backup app that can copy the entire operating system and files onto a bootable device, while VMware Fusion is a software hypervisor that allows Intel-based Macs to run other operating systems like Windows and Linux virtually. These software tools can be combined to overcome the “Computer is missing a firmware partition” error. The following is how it is done:
1. Install VMware Fusion on your Mac.
2. Download Mojave or High Sierra from App Store. Don’t open the app, close it.
3. Create a new VMware machine using the OS you have just downloaded.
4. Select the installation file and wait for it to be fully installed on your virtual machine.
5. Download a copy of Carbon Copy Cloner on the virtual machine.
6. Select to copy your virtual machine to a USB drive or an external SSD.
7. After it’s done cloning, you will be prompted to create a recovery partition on the USB; accept and wait for it to finish.
8. After it’s done, shut down the virtual machine and boot from your USB or external SSD.
9. To now install on your internal drive, open Carbon Copy Cloner and select USB as the source and your device as the destination.
10. You will be prompted to create a recovery partition; accept and close.
This process will install Mojave or High Sierra OS on your device and bypass the errors that you are experiencing.


Download a full ‘Install macOS’ app with softwareupdate in Catalina

The softwareupdate command has gained a new option in Catalina:

softwareupdate --fetch-full-installer
Will download the latest ‘Install macOS’ application to this Mac’s /Applications folder. This is extremely useful for many admin tasks.

The --fetch-full-installer flag has a sub-flag: --full-installer-version which allows you to download a specific version.

softwareupdate --fetch-full-installer --full-installer-version 10.14.6
During my testing in the Catalina beta version I was able to download 10.15, 10.14.6, 10.14.5, and 10.13.6.

I would assume that downloading an Installer application for a macOS version that is not supported on the hardware you are running the command on would fail.


Create an External macOS Installer Drives and Include Assets

Apple has included a tool to build a bootable external installer drive with the macOS Installer application for a while now. Apple actually has documentation for this tool.

The tool is called createinstallmedia and can be found in /Applications/Install macOS [[High ]Sierra | Mojave].app/Contents/Resources/.

When run, the tool requires a path to an external volume or partition, which will be erased and replaced with a bootable installer volume.

Note: Secure Boot Macs with the T2 chip cannot boot from external drives in the default configuration. As of this writing this affects the iMac Pro and the 2018 MacBook Pro. But it is expected that any new Macs released from now on (as in maybe at the Apple Event tomorrow?) will also have Secure Boot.
Nevertheless, having an bootable external installer is still every useful for ‘legacy’ (i.e. non-secure boot) Macs. Also, while it not a good general configuration, it can be very useful to enable external boot on machines that you frequently re-install for testing.

While the support article covers the basics, the tool gained a new feature in Mojave which is not documented in the article.

When you run the Mojave createinstallmedia tool without arguments you get the usage documentation:

$ /Applications/Install\ macOS\ Mojave.app/Contents/Resources/createinstallmedia
Usage: createinstallmedia --volume <path to volume to convert>

Arguments
--volume, A path to a volume that can be unmounted and erased to create the install media.
--nointeraction, Erase the disk pointed to by volume without prompting for confirmation.
--downloadassets, Download on-demand assets that may be required for installation.

Example: createinstallmedia --volume /Volumes/Untitled

This tool must be run as root.

The new argument in the Mojave is called --downloadassets. The description is a bit sparse, but from what I gather this is download additional assets, like firmware installers and bundle them with the other installer files on the installer drive instead of downloading them on-demand during installation.
This will not remove the requirement for the Mac to be connected to the internet during the installation process but it should speed up the process quite a bit.


Downgrading a Mac that shipped with Catalina to Mojave

Apple has started shipping Mac models that used to come with Mojave pre-installed with Catalina. If your organization has blockers for Catalina (incompatible software, etc.) you may want to install Mojave on these Macs. Unfortunately, this is not so easy.

Important Notice: these instructions will only work for Mac models that can boot to Mojave. Usually a Mac requires at least the version of macOS that the model shipped with when it was introduced. As of this writing, all new Macs require at least Mojave. The exceptions are the iMac Pro (High Sierra) and the MacBook Pro 16“ and the Mac Pro (2019) which both require Catalina. You cannot use these instructions to force a Mac Pro or MacBook Pro 16” to boot to Mojave. Any new Mac models that Apple introduces from now on, will also require Catalina and cannot be downgraded to Mojave.

(Not meant as a challenge. I am aware that someone might be able to hack together a Chimera Mojave with Catalina drivers. These ‘solutions’ are not supportable on scale.)

Directly downgrading from Catalina to Mojave with the startosinstall --eraseinstall command will fail. Attempts to run the Mojave installer from a Catalina Recovery (local or Internet) will also fail. The reason seems to be that the Mojave Installer application chokes on some aspect of Catalina APFS. Apple is likely not very motivated to fix this. So far, the recommendation has been to boot to Internet Recovery with the shift-command-R key combination at boot. This used to boot to a Mojave (more specfically, the system the Mac shipped with) recovery system, and then you can wipe and re-install Mojave. However, if a Mac was shipped with Catalina pre-installed, it will boot to Catalina Internet Recovery, regardless of whether the Mac can boot to Mojave or not.

We have to get creative.

External USB Installer

The solution requires a Mojave Installer USB disk. First download the latest Mojave installer. You can do so from by following this App Store link. If you are running Catalina, you can also use the new option in softwareupdate:
softwareupdate --fetch-full-installer --full-installer-version 10.14.6

Then you can use the createinstallmedia command in the Install macOS application to build an external Installer Drive on a USB drive. You probably want to add the --downloadassets option to add the current firmware to the USB drive as well.

createinstallmedia --volume /Volumes/Untitled --downloadassets

This will delete the target volume data on the USB disk.

Enable External Boot

To boot a new Mac with a T2 chip off an external drive, you need to allow external boot from the Security Utility in the Recovery partition. This utility is protected and requires the password of a local administrator user to access. When you get a new Mac “out of the box,” you cannot directly boot to Recovery to change this. Instead, you have to boot to the pre-installed Catalina, work your way through the Setup Assistant, and create a local administrator user before you can boot to Recovery to change this setting.

You also need to connect the Mac to a network with non-filtered/proxied access to Apple’s servers, either with Wifi or an ethernet adaptor. You can see which services and servers the network needs to be able to access in this kbase article. You will definitely need the servers listed under ‘Device Setup’ from that list and many of the others, depending on your deployment workflow.

This network connection is required to verify the integrity of the system on the USB Installer drive. You could also disable ‘Secure Boot’ entirely, but that is not recommended as it will, well, disable all system security verifications.

Now, reboot the Mac and hold the option key, from the list of devices to boot from, select the Mojave Installer drive. Once booted to the Mojave installation drive, start Disk Utility. In Disk Utility, erase the entire internal drive. You may have to choose ‘Show All Devices’ from the View menu to be able to select the internal drive with all sub volumes, not just the system or data volume.

Then you can quit Disk Utility and start the Mojave installation process.

After completing the installation, you want to remember to return to Recovery and re-disable external boot again. However, you need to create a new admin account on the disk before you can do that…