Wednesday, June 24, 2015

Yosemite: dump calendar server database

I always knew it.

One day that server is gonna crash and that calendar database will be gone.

As it is it happened the day I was going to write my export script.

I was lucky enough to have some backup.
But it's not gonna get me again. So I started writing my daily dump script.

It's not done quite yet.

But the main step is done.
I found out how to successfully dump the calendar database.

The command to do so is:

sudo -u _calendar /Applications/Server.app/Contents/ServerRoot/usr/bin/pg_dumpall -h /var/run/caldavd/PostgresSocket/ -f /Users/Shared/calendar_$(date +%Y%m%d).pgdump

Monday, March 23, 2015

Logic Pro X Additional Content download

We want to deploy Logic Pro X in one of our computer labs.

As Logic wants to download huge amounts of additional content when installed and our users are not admins on the lab machines, we have to deploy the additional content as well.

These are the steps I figured out to install the additional content packages via our software deployment.

Same thing as written for GarageBand applies to Logic as well

Here's the link to the plist containing all the information for the additional content packages of Logic Pro X 10.1.1:

http://audiocontentdownload.apple.com/lp10_ms3_content_2015/logicpro1010.plist

To get the information needed, enter this command:

defaults read ~/Downloads/logicpro1010 | grep DownloadName

You will then end up with a list of the packages.

Some updated content is added via App Store.

So maybe there is a better way to do this.

Let's try it this way.

    1. Activate the AppStore debug mode#   
      • Quit the AppStore.app if it is running
      • open the terminal and enter "defaults write com.apple.appstore ShowDebugMenu -bool true"
      • Start AppStore.app and open the Menu 'Debug > Show Download Folder…"
    2. Download Logic Pro X
    3. Start Logic Pro X - it will ask to download additional content
    4. Allow Logic to download the content, but, when asked for your admin credentials, click 'Cancel'. Do NOT install anything at this point.
    5. Quit Logic Pro X
    6. Navigate to the ausic apps download folder, You can find it in the same folder as the 'iTunes Download Folder'. It will look something like this '/private/var/folders/nc/t8zc00xs2nx1vmcjyxryf11w0000gn/C/com.apple.MusicApps' where the part in the middle seems to be a randomly generated string. 
    7. In the folder 'com.apple.MusicApps' you should now see a folder named 'audiocontentdownload.apple.com' and inside that another called 'audiocontentdownload.apple.com'. Here we find what we need: the 'ProAudioCoreContent10.pkg'.
    8. Place a copy of  'ProAudioCoreContent10.pkg' somewhere else from where you can install it later.
    9. Start Logic Pro X. It will no ask you for the credential to install the package, we already downloaded.
    10. Now we come to the additional content.
    11. Select menu 'Logic Pro X > Download Additional Content'
    12. Select any of the additional content packages you want to deploy
    13. Click 'Install'
    14. Wait for the download to complete
    15. When prompted for the admin password, do NOT enter it. Click 'Cancel' instead
    16. Quit Logic Pro X
    17. Inside the directory of the folder containing the download there should now be a folder named 'com.apple.MusicApps >  com.apple.MusicApps > audiocontentdownload.apple.com > lp10_ms3_content_2015' and some more in 'lp10_ms3_content_2013'.
    18. In these folders you will now find the packages needed to deploy the additional content. 
    19. Copy these packages to a safe place.
    20. Deploy them as needed
    21. When you start Logic Pro X with the packages installed, you will see that all the additional content is already installed.

    Thursday, January 22, 2015

    OS X 10.9 Mavericks and Keychain

    We had massive problems with OS X 10.9 Mavericks and Keychains.

    Theses problems mainly occurred to users with network home directories.
    It affected some massively while others had not problems at all.
    Even on the same Mac.

    In our case this caused mail and calendar to be unusable to those affected.

    Updating to that latest 10.9 seemed to help somewhat.

    These steps seem to cure the the problems on the other users affected:


    • Delete every folder in ~/Library/Keychains that has a name somewhat like for example 'ABF6C3A9-702E-5666-AE78-0D0D96A676BA'.
    • Delete ~/Library/Preferences/com.apple.security.cloudkeychainproxy3.keysToRegister.plist
    • Delete ~/Library/Preferences/com.apple.security_common.plist
    • Reboot
    • Open 'System Preferences > Internet Accounts'.
    • Select each account and enter the passwords as required
    From there on mail and calendars work seamlessly again.

    Thursday, December 18, 2014

    ESX & OS X Yosemite 10.10.1

    Last week I upgraded my Caching Server from OS X 10.9 Mavericks to 10.10.1 Yosemite.
    It runs on my ESX.

    I installed the latest vmware tools. Version 9354.

    The problem was, that now I could no longer log in to my server.
    It was hanging after I entered the password.
    Loginwindow got stuck.

    I could log into the server per SSH, so that was not a problem.
    When I killed the loginwindow process using

    killall loginwindow

    I could login again. Most of the times.

    Finally I got to the point at which I made the vmware tools responsible for this behavior.
    As soon as I had uninstalled them, the situation got better.

    So. What now.

    I finally had an idea. Sure I did - otherwise I wouldn't be writing this, would I.

    I knew that VMware Fusion supported Mavericks and had recently been updated.
    So my guess was, that Fusion may contain a newer version of the vmware tools.

    So I opened this image:

    /Applications/VMware Fusion.app/Contents/Library/isoimages/darwin.iso

    And installed the package that I found there.

    Now I am running vmware tools version 9504 and the problems are gone.

    BTW:
    The same thing applies to Windows 10.
    Just mount this image:


    /Applications/VMware Fusion.app/Contents/Library/isoimages/windows.iso

    Inside the Windows 10 VM and install the VMware Tools from there.



    Wednesday, March 26, 2014

    Expand OS X virtual disk in esxi

    As you all know, it is currently not possible to expand a disk (vmdk) with 'OS X' on it in esx so that you get more space.

    Well, that's not quite true. You can expand the disk. That's not the problem. You can do that using the command 'vmkfstools -x' as described here:

    VMware KB: Adding space to an ESXi/ESX host virtual disk

    The problem is that by using disk utility it is currently not possible to expand the size of the partition:

    VMware KB: Unable to extend a partition using the guest Disk Utility after extending disk of a virtual machine running Mac OS X

    So, what's the solution?

    Well, it's actually quite simple:


    1. Create a new Hard disk of the size you need.
    2. Restore the contents of the too small disk to the new disk using disk utility.
    3. Detach both disks from the virtual machine
    4. Rename the old disk by issuing the command 'vmkfstools -E OldName.vmdk OldName.off.vmdk' as shown here VMware KB: Renaming a virtual machine disk (VMDK) via the vSphere Management Assistant (vMA) or vSphere CLI (vCLI)
    5. Rename the new disk by issuing the command 'vmkfstools -E NewName.vmdk OldName.vmdk'
    6. Attach the new disk to the VM
    7. If everything is working, delete the old disk

    Tuesday, March 25, 2014

    Virtualize physical OS X Server: Best practice

    So you plan to virtualize a physical server running OS X?

    Too bad all the tool for converting a physical server into a virtual server run on Windows or Unix.

    Wenn, actually there is (quite) a simple way to do this. This method is independent of any product and can be used with any virtualization such as Parallels, VMware.

    Just follow these steps:

    On you physical server:

    1. Boot from an external volume and create a disk image of your server using 'Disk Utility'.
    2. After the disk image has been written, mount it and verify that it can be read and has all the data required on it.
    3. Select the image in the sidebar and run the menu 'Images > Scan Image for Restore'
    4. Turn off your physical server
    Intermediate steps:
    1. Copy your disk image to a server that is accessible via AFP
    2. Note down the address, path and the credentials needed to access this image via AFP.
    Inside virtualization:
    1. Create a new virtual machine for OS X.
    2. Make sure you have access to a bootable OS X media inside the virtualization. Normally this is done by using a disk image that is assigned to the virtual machine as a  CD ROM drive. If you are unsure how to create such a medium, you can use an app like DiskMaker X to create a bootable USB stick from which you can create a bootable disk image.
    3. Create a HDD in the virtual machine that is large enough.
    4. Create a network interface that has access to a network, preferably one that assigns addresses via DHCP.
    5. Start the virtual machine
    Inside the virtual machine:
    1. The VM will now boot using the disk image supplied. In this example I am using a bootable "OS X 10.9 Mavericks" but the same method works with other versions.
    2. Don't start the installation process!!! Remember: we want a virtualized copy of our physical server, not a new server
    3. From the 'Utilities' menu select 'Terminal'.
    4. Once the terminal is running make sure we have an IP address by typing 'ifconfig'. The line starting with 'inet' should now show a valid IP address.
    5. Now we need to mount our disk image. There is a little trick involved here. As we have to mount our server via command line, we need a folder to attach our mount to it. In order to do so, we need a writable directory.
    6. One directory that is writeable is the Trash. So we cd into that directory by typing the command 'cd Library/.Trashes'.
    7. We are now in the directory '/var/root/Library/.Trashes'. Check that it is writeable by creating a folder using the command 'mkdir mnt'. If you see this 'mkdir: mnt: Read-only file system' you have to find another folder that is writable. There is always one as the system itself need to write certain files.
    8. So once we have created our directory, we can mount the AFP share that host our disk image. This is done by issuing the command (by replacing 'myusername', 'myserver' and 'mysharedvolume' with you own data as noted above)  'mount_afp -i afp://myusername@myserver/mysharedvolume mnt'   
    9. You are now requested for the password of the AFP user you use to mount the volume
    10. Once the volume has been mounted, you can verify everything is working by showing the contents of the mount volume by issuing the command 'ls -l mnt'.
    11. If your disk image is visible in here, we're almost done.
    12. Quit the Terminal
    13. Open 'Utilities > Disk Utility'
    14. Select the disk image of your virtual machine and go to the 'Restore' tab.
    15. In here, drag the disk you selected on the left that is now listed as 'Source' to the 'Destination field.
    16. Now we click on the button 'Image…' next to the 'Source' field. Here we select the image we created from our physical server that is now located on our AFP share we mounted in the steps above.
    17. Once this has been done, we can click on 'Restore'.
    18. The disk image of our physical server is now being restore to our virtual server.
    19. Once this has completed, we can quit 'Disk Utility' and go to 'Startup Disk…' that can be found in the menu under the Apple logo.
    20. Here we select our newly restored disk.
    21. Select 'Shut down' from the Apple menu
    22. Go to the settings of your VM and adjust network and RAM configurations as required. Detach the image file attached to the CD ROM drive.
    23. Start the VM.
    24. Et voilĂ  ! An exact copy of your physical server is now virtualized.

    Tuesday, March 18, 2014

    Apple Remote Desktop or another administration application is currently running.

    Have you ever encountered this message:

    «Apple Remote Desktop or another administration application is currently running.»
    This message shows up when you try to observe or control a Mac that is itself running 'Remote Desktop Admin'.

    If you have access via ssh, you can try this:


    connect to the client via ssh
    enter these commands:

    defaults write /Library/Preferences/com.apple.RemoteManagement AdminConsoleAllowsRemoteControl -bool true
    sudo killall 'Remote Desktop'

    From now on, you are able to access this client even though Remote Desktop Admin is running. 

    I know you can adjust this setting in the preferences.
    But, if you are not able to adjust them, do it via ssh.