OSX 10.8 Not Booting on Retina Display

I went on a vacation for a week with my brand new retina display I just paid a little over 3500 for. I ran into a snag not 2 days into the trip. The machine would no longer boot into OSX. After several google searches. All turned useless. I spent several hours searching one last time and came across a interesting article that suggested moving the fsck asside. So here are the results that I hope will save other techies days of searching.

Symptoms:

  • Booting hangs at the apple logo
  • Repairing the Disk fails (fsck -fy, restarts several times and does not succeed)
    Error: Disk Utility can’t repair this disk…disk, and restore your backed-up files.
    Disk Utility Error
  • Re-install is impossible (this is because the Macintosh HD is read only)

Configuration:

Problem:

I did not want to re-format. This was simply not an option. I just built the machine less than a week before the problem. It’s impossible thats its a hardware file. So I figure it may have been related to a recent update OS X 10.8.3 update. However, I can not be 100% that was the cause. All I know everything went for a turn for the worse

Solution:

So this is a multipart solution. Each one took me several hours to test. I should note here I am highly experienced with OSX/Linux machines. So non of this is out of my territory. I was sure I was not “hurting” my hardware/software.

WARNING:  I WILL NOT BE RESPONSIBLE FOR LOST DATA FOR ANY REASON. USE THIS GUIDE AT YOUR OWN RISK OR FOR REFERENCE!!!

  1. Boot into single user mode, if you are using refit press F2 at the startup menu when you are on any the the “apple” icons, otherwise press Apple+S on startup. 
  2. Now we need to stop fsck from running at startup because it keeps shutting down your machine when it fails to fix the errors.
    To do this. I simply moved aside “fsck”.
    WARNING: You must be very careful. Type exactly as you see it below!!!

    • mv /sbin/fsck /sbin/fsck.back
      cp /usr/bin/true /sbin/fsck

    • (OPTIONAL STEP before rebooting)
      • You may want to try just:

        nvram boot-args=”-v”

        -x means safe mode, -v will print out a tone of crap, remember safe mode does not load the graphics drivers so it will be much slower.

      • nvram boot-args=”-x -v”

        be sure to disable the -x before you do the install step below

      • Once you completed you “should” be able to reboot so long as a “real” hardware failure did not happen.
  3. If you are able to boot into OS X you can continue to the next step, otherwise you probably have a hard drive / ssd failure at this point. For a brand new machine this is extremely unlikely. So you should “go no further” and bring your machine into Apple Support. If you able to run in single user mode. I would suggest backing up your data onto another drive before doing so. Most likely apple will wipe the drive when fixing your machine.
  4. Download 10.8 once you boot into OSX, you can do this by logging into the App Store (I have already purchased 10.8 for several other machines; however, I believe that if you say “buy” for 10.8 and you have 10.8 already installed you will not be changed, please someone post to confirm this to be true if you try this)
  5. (OPTIONAL STEP) If you took the optional step above, run this command in the Terminal.app (located in your /Applications/Utilities/ folder) before installing OS X:

    sudo nvram boot-args=”-v”

  6. Now, you should be able to run the setup, once you do OS X will automatically reboot
  7. Once booted, DO NOT continue the install, simply goto disk utility from the menu
    disk utility menu

    disk utility menu

    DO NOT PRESS ERASE AT ANYTIME!!!

    Disk Utility Repair

    Repair disk after you boot into the “installer” for osx. Be sure to run step 1 and 2 in the image before closing.

  8. Once that is complete, exit disk utility
  9. Now run the installer… Note, I had to reboot a few times for the installer to detect the Machintosh HD again.
  10. If all is done correctly, you should just boot into OSX normally again
  11. Verify everything is working and your files still exist.
  12. Now, open a terminal and disable the boot args:

    sudo nvram boot-args=””

    This will turn off safe mode and the verbose flag. If you took the optional step to run in safe mode.

  13. NOTE: You should not need to reset fsck if you did that step above. This is because the re-install should overwrite the “fake” file you put in its place. However, do confirm fsck is still working.
    • Open a terminal

      fsck ?

      fsck usage: fsck [-fdnypq] [-l number]

References:


Getting Sphinx to work with Maya modules

Lets say you want to have your API look pretty. However, your API interfaces with another program such as Maya. The problem here is that maya comes with its own python interpreter. With a little bit of hacking you can get it working.

Required before you begin:

  • Maya 2011 or higher (I have not tested 2010 or below, but you will need at minimum mayapy working)
  • Sphinx 2.x.x or higher (again, ive only tested with the build 2.0.6)

Step-By-Step

% mkdir docs
% cd docs
% sphinx-quickstart
# follow instructions, mostly just letting it create the default stuff (smash the return key until its complete)
# edit the conf.py that was created, and insert your python source path after your import modules:
sys.path.insert(0, os.path.abspath(‘..’))
# you need to turn on extensions in the conf.py as well:
extensions=['sphinx.ext.autodoc']
# so now you should be able to auto-generate the rcs files
% sphinx-apidoc -F -o ‘install_dir’ ‘source_dir’
# python script used to build the docs

  • Take special note of the #!/usr/bin/env mayapy, the mayapy is the trick here. If you are windows it might be: #!/C:/maya2013/bin/mayapy (or where ever the mayapy is located. The file should be setting right next to maya.exe)

build_sphinx_mayadoc.py:

#!/usr/bin/env mayapy
 import maya.standalone
 maya.standalone.initialize(name='python')
 import sphinx
 import sys
 import os
 if __name__ == '__main__':
 argv = sys.argv[1:]
 cwd = os.getcwd()
 argv.insert(0, sphinx.__file__)
 sphinx.main(argv)

# I also updated my Makefile to point to this script ‘build_sphinx_mayadoc.py’ instead of ‘sphinx’. This allows me now to do “make install” and all my Maya related modules won’t complain that they do not exist.

References

Full instructions are a bit vague:
http://sphinx-doc.org/tutorial.html
http://sphinx-doc.org/ext/autodoc.html


Keep Alive your Plex Media Server (PMS)

Let’s say you want to have a script run every 1 min to check to see if plex media server is running. If its not, re-launch it and send me an email when it does so. If its still running; don’t bother to inform me.

Sounds simple. And for the non-unix savvy people this might be a little hard to digest. You need 3 things:

  1. You need the script to check the Plex Media Server is running or not
  2. You need to install the script as a cronjob
  3. You need to have postfix setup so when the job fails it can send you an email

The Plex Media Script (plexchecker.py):


#!/usr/bin/python
__doc__ = """
Plex Media Server Startup if closed cronjob
"""
#
import os
import sys

import subprocess

PIPE = subprocess.PIPE

def start_plex():
    return os.system('open -a "Plex Media Server" &')

if __name__ == '__main__':
    # [] around P ignores self matching
    cmd = "ps aux |grep '/[P]lex Media Server' | awk '{print $2}' | head -1"

    pid = subprocess.Popen(cmd,shell=True, stdout=PIPE, stderr=PIPE).communicate()[0]
    pid = pid.strip()
    if pid == "":
        print cmd
        print "pid='%s'" % pid
        print "no process found, starting plex media server"
        sys.exit(start_plex())
        print "done."

    sys.exit(0)

I saved the script in my user accounts “bin” directory. Open a terminal (located in /Applications/Utilities/Terminal.app).
% mkdir ~/bin
* anytime you see “%” that means shell command.
And save the script in your ~/bin/ directory. You may use any text editor you wish. I personally use gvim but its a little hard for new users to use. Something better like BBEdit or Eclipse is recommended for new programmers.

Setup Your POSTFIX email:
Why do you need this step? Well, this is only needed if you want to recieve an email anytime your cronjob fails or succeeds. If you don’t care, you can skip down to the cronjob section.
The next part is setting up postfix. Note that everything here uses “gmail” but you can use any provider you want. I only recommend gmail since  you can setup a generic account that you send your alerts too. We need to create a text file for postfix first:
% sudo touch /etc/postfix/sasl_passwd
% sudo vi /etc/postfix/sasl_passwd

(type i – for insert mode), and put the following in the file:
smtp.gmail.com:587 user_account@gmail.com:password_for_your_email
– replace user_account, with your gmail account
– replace password_for_your_email with your gmail password
(type :wq, the : means vi is looking for a command, w means write, q means quite, so :wq does it all at once)
% sudo postmap -q smpt.gmail.com:587 /etc/postfix/sasl_passwd
This installs the username and password into the postfix db file so its encrypted

Now that you have the password setup. We need to configure the server:
% sudo vi /etc/postfix/main.cf
Scroll to the bottom of the file and add:

relayhost=smtp.gmail.com:587
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = smtpd
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_type = cyrus
smtp_sasl_auth_enable = yes
# Enable Transport Layer Security (TLS), i.e. SSL.
smtp_use_tls=yes
smtp_tls_security_level=encrypt
tls_random_source=dev:/dev/urandom

( type :wq when done, remember the shift semi-colin is a command in vi)

Ok, now to start the server and test it:
% sudo postfix start
After, type:
% date | mail -s testing.a user_account@gmail.com
You should get an email after a few minutes; check your spam folder since gmail is probably thinking this is spam. You may have to re-read / re-do this a few times if you are new to linux. Even me (a pro) it took a few times before I got it working. Typo’s all over the place.

Check the internal mail server:
% mailq
Check the postfix for your logged in account
% mail

As always, use “man” to get the manual for these commands (e.g. man mail) for help.

Setup your Cronjob:
Phew, lots of info. Ok, so we have postfix started, we have our file we need for our cronjob. Now to setup the cron.
% crontab -e

# min(0-59) hour(0-23)  day(1-31)   month(1-12) day (0-6)
# *         *           *           *           *       # script to run
MAILTO=user_account@gmail.com
*/1 *   *   *   *   /Users/mac_account/bin/plexchecker.py 

Notice user_account@gmail, this tells the cron to send the email if something fails to this account. The /User/mac_account/ folder is your home folder. On linux it would be /home/user_account/ for example. To keep things simple you probally should have your mac_account on your machine be the same as you gmail account.

When done inserting the code above for crontab, type :wq, notice that crontab used vi, this is why its a good idea to know a little vi.

So, to summarize what will happen here. The cronjob will run every 1 minute, if the plex server is not running, nothing is printed by the “plexchecker.py” script. If “ANY” text is printed via the script to standard output (e.g. print statement in python) or any errors are found (e.g. standard error) the cron will send you an email to the account specified in “MAILTO”.

Lastly, please let me know if this works for you. It took a few hours for me to get this up and running. I will modify/update the page if you find errors or I am missing a step.


Plexapp and ripping DVD’s

Well, if this was not any easier I don’t know what is.

Here is my setup:
– Mac Mini
-Plex and Plex Media server
-6TB attached FW800 drive (raid 5 setup: click here for more info)

Now, after doing some configuring (see my earlier post here)

  1. Install VideoRip plugin forum link
  2. Install HandBrakeCLI version 0.9.4 download here (NOT 0.9.5 the latest)
  3. make sure to change the version in the path to 0.9.4:

    download
  4. after finished downloading copy HandBrakeCLI file into the /Applications/ folder
  5. Download VLC and install that in your /Applications/ folder
  6. You may need to restart your plexapp
  7. Once everything is installed make sure to set the following:
    • From the main plex menu, look for “Applications”
    • Then look for VideoRip
    • Open the app and you should see settings
    • Set the Movie path and the TV Path
      Settings

      Preferences for VideoRip

Phew, lots of steps for the novice. Now that you have the all complete. It should be as simple as selecting “Rip Movie” from the main menu of “VideoRip”.

I should also note, when burning the “Waiting for server…” message will stay up the entire time. When its complete “if you have eject when complete” enabled the DVD will eject. My screen cap has it off since I was debugging. But by default it should be on.

I should note that for more up-to-date info you should check the forums on plexapp.com, here is the full link:
http://forums.plexapp.com/index.php/topic/19456-new-plug-in-videorip/

I hope you enjoyed this post, and if you are new to plex check out my earlier posts for configuring you mac mini (or what every device you are setting up).


iPad 2 vs Me!

iPad 2

I am not the person who would say this lightly. Those who know me; I am very practical and don’t buy things unless I will use them. When the first iPad came out I was resistant to purchase for two reasons. One was price the other was it sound like a woman product (no offense).

That said, I have been completely turned 180. The device is invaluable now. Aside from the gaming and fast dual-core processing. The device is far more useful than I expected. So far here is my list of must-have-apps :

- PopSci+
– Angry Birds HD (highly addictive)
– GoodReader
– Netflix
– MarketDash (for stock watchers)
– AppShopper
– OpenTable (great for finding restraints)
– Amazon.com
– NPR (National Public Radio)
– Plex (been talking much about this in other posts)

I am sure my list will grow…

Let me talk a little about why GoodReader is worth it. First off, everything iBook does not support GoodReader seems to. I have about 10 PDF’s now stored in GoodReader and I love how simply and easy it is to get to my PDF files. In addition GoodReader supports several cloud services including dot me accounts (and of course I have one). The primary reason I like this reader is I can crop my PDFs to just focus on the areas I want. And its persistent throughout the entire PDF. I will soon be adding all my PDF’s here.

Plex app is amazing since it connects to my PMS (Plex Media Server) at home when I am at work. This is great for the type of desk job I have. I put something on in the background and work all day with a full media center at my disposal. Plex also supports pictures and music. Though the music still needs work streaming from your server.

iPad 2 is nothing less than my laptop replacement. Pretty much everything I used to do on my laptop. I am now doing on the iPad. For example, email, browsing the web, and checking stock prices are much of my morning tasks. I do this all on the iPad as soon as I wake. No bulky laptop to bring around. As we grow into the iPad world I foresee laptops a thing of the past. I personally think the laptop I am typing this post on will be my last laptop ever. The iPad is slowly gaining its footing. Its a matter of time and adjustment and we all will have a iPad or iPad clone.

For the non-believers of the iPad. You can touch it in the store, you can play with it at your friends house. But you have no idea how much you use it till you actually buy it. It is totally worth every penny and more. Its nothing less than a huge time saver and space saver. For the business folks this tool is an absolute must. Taking notes is a breeze and keynote is amazing on the iPad. I am 100 percent on-board with iPad now. And just a year ago I though it was a useless piece of middle-ware hardware.


Port fowarding on your AirPort Extreme

Apple is really good at making things simple. AirPort Extreme is no exception. I will be showing items in the Apple Time Capsule. For the price, the Time Capsule is $299 where the AirPort Extreme is $179. For what you are getting both are very acceptable.

Let me start by saying I have had my TimeCapsule since about 2008. It has had no problems and has been a backup device for my two laptops since I got the TimeCapsule. I would personally recommend the AirPort Extreme since the network backup is nice to have but you can go a much cheaper route by getting a larger network storage device.

In anycase, you are here to learn how to port forward. I am using the “AirPort Utility” found on any mac in the /Applications/Utilities/ Folder:
1) Manual Setup:

2)

Port Fowarding

Click the "+" icon

3) Next assign the port for connecting from the outside world (e.g. Public UDP/TCP Ports)

Assign Port Number

For security reasons, you should pick a number above 40000. This is so port scanners can not detect what service might be running on your IP Address. This is important to prevent hackers from getting into your network or using the item you are port fowarding.

I will be port-forwarding plexapp (see my technology section for more posts on plex app)

Name your port

Name your port and click Done

Now that you have your port fowarding. You are able to access that port externally. One way to test this is get your external ip address (you can use the script I posted a little while back or use google: external ip address). You should be able to setup your PlexApp device (iPad/iPhone) by adding a custom server, entering your external ip address and port number. If you did everything correctly you should be able to connect no problem.

If you can not connect. Make sure you have no hardware/software firewalls preventing your connection. The computer you setup the port fowarding for needs to also be able to talk to the AirPort Extreme. Sometimes you need to “allow” the port access so your Airport can foward the port outside. If you are using Little Snitch it will ask you the first time you try to connect to the port (internal or external).

As always, be conserned about security. Plex app for example you can enable security which forces a username/password for anyone who trys to connect to that port.

You can also apply the same concepts to port fowarding a VNC connection. Of course you need to use a different external port for each device you want to access outside of your home. I recommend only port forwarding what is absolutely necessary. Less is more in the case. You don’t want 20 ports all exposed to the outside world.


What is Plex?

Plex is a client/sever tool for accessing your media and much more. let me explain:

The true power behind plexapp is its ability to transcode media on the fly. Or another way of putting it is convert your AVI/MOV files to stream to any of your iPad or iPhone devices or other computers that have plexapp installed. I think with a few more versions of this app and it will be optimized to even faster than what it already is.

My Setup:
– Mac Mini (500GB internal drive and 1TB external drive for media)
– iPad 2 with Plex app installed (for watching movies at work while I work)
I have setup plexapp (server and client) on my Mac Mini. I have connected a 1TB FireWire 800 drive to the mac mini and store my current movies on this drive. In addition, plexapp has support for Hulu and Netflix. The list of plugins is much longer and growing daily. However, to see them on your devices that are connecting to your server you need to enable the plugins from the Media Server Application (not the Plex Media Player).

  • Plex Media Player
    For this to see your media center your internal network must have a server running. If you only have one computer then that computer is your Plex Media Server (PMS) and Client (Plex). In the case of the Mac Mini this is how I have it setup. However, the rest of my computers connect to the mac mini as clients so no need to run the PMS on the other computers.
  • Mobile Media Player (iPad, iPhone, Andriod)
  • Plex Media Server
    I connect all my other devices (other laptops, iPad, iPhones) all to the Media Server running on my Mac Mini (internal and external).

Since I started down this road; I have been able to get just about everything to work on the Mac Mini running plex media server. The only part I am focusing on next is getting Live TV working somehow or someway.

The media format I find that works the best so far is H.264. Some other formats do take a little before the video starts streaming. However, once it starts it does seem to have great quality throughout the duration. I have had it get a little choppy a few times; however I think this was the connection and not the transcoding. For the most part, everything Plex App advertises on the site works exactly as expected.apple remote

  1. Setting up plexapp is very easy. Simply go to the website download and install. Plex
  2. Once installed, I would first start by checking out the Media Server application (should launch by default)

The next part is for setting up Plex to be your default app rather than FrontRow.app when you press the “Menu” button on your mac mini remote.

  • From a Terminal (/Applications/Utilities/Terminal.app)
  • Type:
  • sudo cp /System/Library/LaunchAgents/com.apple.RemoteUI.plist /System/Library/LaunchAgents/com.apple.RemoteUI.plist.bak
  • sudo vi /System/Library/LaunchAgents/com.apple.RemoteUI.plist (or open with what command line text editor you want)
  • Replace the line that looks like this:
    <string>/System/Library/CoreServices/Front Row.app/Contents/MacOS/Front Row</string>
    with:
    <string>/Application/Plex.app/Contents/MacOs/Plex</string>
  • Type save and close your file (for vi commands google works well, the commands are tricky for first time users)

Now that you have that setup, you need to reboot the machine for the “menu” button to get activated correctly. You may need to repeat the steps a few times and make sure that path for Plex is 100% accurate. Anytime you update the file its best to reboot.You can also set plexapp to load on start and login. This is how I have it so if the machine reboots plex starts fullscreen. And once you have that XML file updated when you press the menu button plex will load automatically.

The final part that I setup was when you “press menu” on the remote inside “plexapp client” was I wanted it to restart the app.

  • From a Terminal:
  • mkdir -p “~/Libraray/Application Support/Plex/keymaps/”
  • vi “~/Libraray/Application Support/Plex/keymaps/Apple Remote.xml”
  • Put the following in the file:
    <keymap>
    <Home>
    <joystick name=”Apple Remote”>
    <button id=”6″>Plex.Quit()</button>         <!— Menu —>
    </joystick>
    </Home>
    </keymap>

Once you have done all this. You should restart plexapp once more and the “Quit” should now happen if you press the menu button at the main screen.

The last part is to setup your media server to be used external. Now, you can get a dynamic dns name (this means when your ip changes your dynamic dns company will keep it up to date). Though this is a solution, I prefer knowing my ip address and directly connecting to my computer. See the plexapp website on how to port forward your internal media center external. Before you do this, you should be 100% concerned about getting evertthing working internal before you go external. And when going external, remember you are exposing your computer to the outside world. So I would recommend turning on security features in Plex Media Server (username and password). So not just anyone can access your system.

Overall I am very impressed with Plex. The media center, my mobile application, and its simply design make for a win-win application. I just hope that it does not grow too fast and get stupid like Hulu did. Remember when we only had like 1 ad during the early days of Hulu? Now I can’t stand it. Anyways, Enough of me, what about you? I hope you enjoyed this, if its a little hard to follow please let me know and I will make corrections/updates/refinements.


Follow

Get every new post delivered to your Inbox.