Tuesday, December 11, 2012

Nvidia Optimus under Ubuntu 12.04 using Nvidia Experimental 310 Drivers

Nvidia Optimus under Ubuntu 12.04 using Nvidia Experimental 310 Drivers


Build System - Alienware M11xR2


Please be sure to double check my spelling. Yet again this was a rushed set of instructions copied from my notes.  Let me know if you have any problems.

This install method is not standard.  It is merely taking a minimal install to a point that the Native Steam Client will run.

Big picture mode reports "X Error of failed request: GLXUnsupportedPrivateRequest"
Looking into that.

Backwards cursor once Steam starts.  This is a default cursor issue handle that later. 

UPDATE:  TF2 is reporting that OpenGL is at version 1.4.0.  Common issue but the work arounds seem to fail from this install.  I'm going to reload the system and dual boot a Standard Desktop and a Minimal Install.  See if I can track down the missing component.  ldd isn't very helpful for tracking it down.  :-(

After being accepted into the Steam Linux Client Testing I figured it would be a good time to see how much I could push the BumbleBee project.  After much reading on LaunchPad about various bugs and errors, I set out to find a workable solution for running the Nvidia Experimental 310 inside BumbleBee.  This is the solution that worked for me from a mini.iso (netboot) Ubuntu 12.04 install.  I planed to do this from a debootstrap but I had no time to do so.  An install from mini.iso with no packages other than the base is basically/kinda what you get from debootstrap.

ISOs

Ubuntu 12.04 64bit netboot: 
Ubuntu 12.04 32bit netboot (with PAE):
Ubuntu 12.04 32bit netboot (without PAE):

(PAE stands for Physical Address Extension.  This allows software addressing of memory increasing the the CAP from 3.2 GiB  upto 64 GiB if your mother board supports the physical capacity.  Generally your BIOS will reserve 800 MiB for Hardware Addressing leaving you short of the 4 GiB max that most 32bit boards support.  The majority of my 32bit boards only allow 3.2 GiB usable, my Dell Dual Xenon board is the only exception.)

USB Boot

I used the 64bit install CD.  I have no CD-ROM drive so I copied this to a USB Drive in a Linux Install.  I recommend using UNetbootin for this as it runs under Windows, Linux, Mac, and Other Unix Platforms.
Debian/Ubuntu: aptitude install unetbootin syslinux extlinux mbr
Fedora Based: yum install unetbootin syslinux syslinux-extlinux

Install


I selected an Expert Install, but you should be able to install from a NON-expert command line install with no issues.  The options I chose are as follows, if you want to copy my answers.
  • Kernel: Linux Generic
  • Drivers: Generic (All) 
  • No Root Login
  • Encrypted LVM Storage Volumes
    • This causes a blank screen at time on boot due to some package I installed, or /etc/default/ that I changed.  I have not tracked it down yet.  If you type in your password for the storage crypto and press enter it will boot normally.
  • (Targeted should work fine, but I wanted to keep this close to standard for this test)
  • Non-free Repository: Yes
  • (For the Broadcom WiFi)
  • Universe Repository: Yes
  • Multiverse Repository: No
  • (Default install includes this, but I hardly ever use packages from it)
  • Backport Repository: Yes
  • Security Updates: Yes
  • Partner Archive: No
  • Extras Archive: No
  • Install Security Updates: Automatically
  • Selected No Additional Packages

Setup

After the install completes the system will reboot.  Now we can make some system configuration changes to keep our system minimal.
vim.tiny /etc/default/console-setup
  • VERBOSE_OUTPUT="yes"
  • ACTIVE_CONSOLES="/dev/tty[1-3]"
    • Just and old-school habit of mine
  • Personal Preference (I like Large Text)
    • FONTFACE="Terminus"
    • FONTSIZE="32x16"
vim.tiny /etc/default/grub
  • GRUB_HIDDEN_TIMEOUT_QUIET=false
    • I like to see the Grub Menu.
  • I like to see the kernel boot, so we remove the automatic options for silent boot.
    • GRUB_CMDLINE_LINUX_DEFAULT=""
    • GRUB_CMDLINE_LINUX=""
vim.tiny /etc/apt/apt.conf.d/00aptitude
  • Control the Packages Installed and Removed.
    • Aptitude::Install-Recommends "false";
  • Aptitude::Install-Suggests "false";
    • Aptitude::Keep-Recommends "false";
    • Aptitude::Keep-Suggests "false";
    • APT::Install-Recommends "false";
    • APT::Install-Suggests "false";
    • APT::Keep-Recommends "false";
    • APT::Keep-Suggests "false";
  • I do this to fine tune the package needed for an install.  Old-school security build habit.
vim.tiny /boot/grub/grub.cfg
  • In line: "linux   /vmlinuz-#.#.#-#-generic root=/dev/... ro splash quiet $vt_handoff"
  • Remove "splash quite" to see the kernel boot.

IPv6 - Optional

I have been involved with converting systems to IPv6.  In that process I have seen many holes and gotchas.  For my home network I prefer to just turn IPv6 off.  Google has spent 5 years trying to perfect IPv6 with Vendors and is still doing so.  You can read that in a Google publication, but I have misplaced the link.

vim.tiny /etc/default/ufw
  • IPV6=no
Typically I uninstall ufw and just use regular iptables.

vim.tiny /etc/sysctl.conf
  • Add to Bottom
    • # Turn off IPv6
    • net.ipv6.conf.all.disable_ipv6 = 1
    • net.ipv6.conf.default.disable_ipv6 = 1
    • net.ipv6.conf.lo.disable_ipv6 = 1
To apply new Settings run this command as root:  
sysctl -p

Begin Install

My preference is Aptitude but Apt can be used as well.  To get a base X System for BumbleBee testing I installed the following:
  • xserver-xorg xfce4-terminal xfonts-100dpi xfonts-scalable libgl1-mesa-dri xfont-base xauth xinit
    • You can choose your favorite terminal
  • openbox menu ttf-dejavu obconf openbox-themes hicolor-icon-theme
    • I prefer OpenBox as a window manager.
  • fonts-liberation fonts-droid ttf-freefonts ttf-ubuntu-font-family fonts-opensymbol xfonts-mathml ttf-lyx font-stix
    • Some additional fonts that help visibility.
Once install completed I tested this from my USER account (not root) by running:
startx
If you get the OpenBox desktop (right click for Menu Options), you can exit and install some additional packages as root.
  • firefox 
  • jockey-common jockey-kde qt4-qtconfig pulseaudio alsa-utils gstreamer0.10-pulseaudio enchant
    • I use Jockey to manage my Broadcom Drivers.  It has a command line interface, but many prefer a gui.  So I added jockey-kde for the gui.  And now I like the gui, LOL
    • I prefer Qt over GTK, feel free to use jockey-gtk if that is your preference.
  • python-software-properties
    • This installs the command: add-apt-repository
  • mesa-utils
    • For glxgears testing
Run the commands:
  • aptitude update
  • aptitude upgrade
    • (If any are available install them, it is unlikely there are any if this is a fresh install)
  • shutdown -r now
  • Once reboot completes continue below.

BumbleBee Install

As root run the following commands and installs.
  • add-apt-repository ppa:ubuntu-x-swat/x-update
  • aptitude update
  • aptitude upgrade
  • add-apt-repository ppa:bumblebee/stable
  • aptitude update
  • aptitude install bumblebee bumblebee-nvidia nvidia-settings virtualgl-libs virtualgl

Run the command
shutdown -r now
Once reboot completes we can test Sable BumbleBee as a USER.
  • startx
  • Right Click Desktop, Select Terminal emulator
  • glxgears
    • This runs on the Intel Graphics Card.  
    • Once you see the statistics you can close the Gears window.
  • optirun glxgears
    • This runs on the Nvidia Card (For the M11xR2 this is the GT335).
    • Once you see the statistics you can close the Gears window.
You should see an increase in framerate if BumbleBee is functioning properly.

Nvidia Experimental Driver 310

Doing the following, I was able to get the Nvidia Experimental Driver 310 functioning in Ubuntu 12.04 on the 11th of December 2012.
I started from a reboot, and as root I performed the following commands.
  • aptitude install linux-source linux-headers-generic nvidia-experimental-310 nvidia-settings-experimental-310
  • vim.tiny /etc/bumblebee/bumblebee.conf
    • Driver=nvidia
    • KernelDriver=nvidia-experimental-310
    • LibraryPath=
      • Change "-current" to "-experimental-310"
    • XorgModulePath=
      • Change "-current" to "-experimental-310"
  • Just because I wanted to see it build with no errors I ran to following.
    • dpkg-reconfigure nvidia-experimental-310
As root restart the system.  After the system reboots and you login as the USER account test the following.
  • startx
  • Right Click Desktop, Select Terminal emulator
  • glxgears
    • Once you see the statistics you can close the Gears window.
  • optirun glxgears
    • Once you see the statistics you can close the Gears window.
If there are no errors you are now running Nvidia Experimental 310 under BumbleBee.
Have Fun and good luck.

Steam

Download the Steam.deb package from the link in your official e-mail.
As root:
  • dkpg --force-depends --install steam.deb
  • aptitude update
  • aptitude
  • IGNORE the Error Message in Red.
  • /steam
    • / brings up the search dialog.
  • Highlight steam:i386, Press Enter
    • If your Ubuntu install was 32bit you will not need the ":i386" in the following commands.
  • With steam:i386 highlighted press Shift and =
    • The + key says add package and all dependencies.
  • Press g, Press g
  • After install press q and Exit Aptitude.
  • aptitude gnutils-bin tcpd libsound2-plugins:i386 librsvg2-common:i386 libtxc-dxtn-s2tc0:i386 libsasl2-modules:i386 libgpm2:i386 gpm librsvg2bin librsvg2bin:i386 rng-tools
    • Not sure which are absolute needs.  But this should help with headsets, encryption and image display.  
  • shutdown -r now
As the account that will be running Steam do the following in a Terminal.
  • export LD_LIBRARY_PATH=/usr/lib32:/usr/lib/i386-linux-gnu/mesa:$LD_LIBRARY_PATH/usr/bin/steam:
  • optirun steam
After uppdates apply you should beable to run Steam via optirun.  I get Intel driver errors when trying to run with Intel Graphics.

I am downloading TF2, we will see how it plays.

Closing

Thank you: 
  • BumbleBee Wiki
  • Superunamused @ askubuntu - for highlighting the dependancy issues.
  • webupd8.org for the BumbleBee config explination.

Thursday, September 13, 2012

Create an Ultima Online Classic Client Patch Archive

Note:  This will be a quick and messy post, I may return later to clean it up.
Patching methods changed in 7.0.24.  This works on all versions up to 7.0.24.

Begin:

If you have ever played Ultima Online or you have played one of many Player Run servers, you know that patching can be a pain at times. Many years ago (I started with Ultima Online: Renaissance, and quit sometime around Age of Shadows / Samurai Empire) updating over 56K was a multiple day run. Back then I found a way to keep the installer from purging the patch files. I would back them up so I could manually feed them to the patch application anytime I re-installed Ultima Online. I'll detail the process for doing so here.

If your like me (only play EA servers when they give away a free month), you probably have an old client laying around. Mine is 7.0.10.3, and it has quite a few patches (about a Gig) before it is to the main stream version. We can capture the patch files from a fresh install using the following method:

Requirements:

  1. Download: http://technet.microsoft.com/en-us/sysinternals/bb842062.
    We are going to create some settings that can only be altered by the system account. PsExec.exe will give us this ability.
  2. An Administrator Account.
  3. A full installer for an Ultima Online Version.

Install Ultima Online Classic Client:

Use the installer you have on hand.  I use 7.0.10.3.
Once it has finished installing, do not run or update the client.  
If it starts automatically stop it.


Create "patch" folder:

In the Ultima Online Classic Install Directory you need to create the patch folder manually.  The default install Location is: 
"C:\Program Files (x86)\Electronic Arts\Ultima Online Classic\"
Once created we will have to alter the Permissions.


Apply Settings:

Right Click "patch" and select Properties

Click Advanced and then Click Change Permissions

Remove the Check on "Include Inheritable Permissions" and Apply.  Chose "Add" to copy permissions.
Check the Option to "Replace all Child Object Permissions"



"Edit" the "TrustedInstaller" Permission to "Deny" the following. Click "Ok".

Set the following for "Administrators" (Group) and "Creator/Owner".  It is important to leave "change Permissions" and "Take ownership" unchecked.  If you explicitly "Deny" them then the process to regain control becomes much more involved.
Click on the "Owner" tab.
Click "Other Users or Groups".  Type "System" and Click "Check Name".  Click "Ok".

Set the new Owner to the "patch" folder to the new "System" Entry.
Click "Apply" and "Ok" on all the windows. So that the settings all take effect.  When asked about "Setting Permissions" and "Account Controls" for all the Sub/Child files/folders, Click "OK", "Yes", Any Agree Option.


Run Update:

In vercfg.cfg change compassion.owo.com 8888 to patch.uo.eamythic.com 8888
You will now be able to run the Updater.  All patches are downloaded and applied, but the failure to delete the patch will not cause the updater to error.  Once you are up to 7.0.24, or your target.  Cancel the download, or let 7.0.24 run until it says update complete.  Copy all the files in "patch" to a location that you can archive them.


Regain Control:

  1. Open cmd "As Administrator"
  2. PsExec.exe -i -s cmd.exe 
  3. Default directory shown:
    cd "C:\Program Files (x86)\Electronic Arts\Ultima Online Classic\"
  4. cacls ./patch /e /c /g [An_Administrator_Account]:f
  5. cacls ./patch/*.* /c /g [An_Administrator_Account]:f
    As the Administrator account you will now have full control over the directory.  I also recommend an uninstall if you ran all the way to 7.0.24.


    To use Patches:

    1. Install the client.
    2. In vercfg.cfg change compassion.owo.com 8888 to patch.uo.eamythic.com 8888
    3. Create"patch" folder.
    4. Steps 4 - 5 are only to apply Specific Versions.
    5. Copy only the patches you wish to apply.
    6. In the settings for the patch folder remove both "Create Files / Write Data" and "Create Folders / Append Data" permissions (Don't deny them) for the "patch" folder.  Do this for all Accounts.  Do not remove the attribute entries, this will make it harder to regain control of the directory.
    7. Continue Below For all Installs.
    8. Start Ultima Online Classic, it will apply all patches in the patch directory without downloading those patches.
    9. If you performed step 5 and 6 - You see a denied write message when the installer attempts to download the next patch.  This will end the patch Cycle.

    Notes:

    Once you install Patch 7.0.24 you will be upgraded to the New Client and New Map Files.  The installer for this version forward only installs the latest version. 

    If you are patching up from version 7.024 and earlier: The client will not run after the 7.0.24 update until the latest version is installed.

    If you use UOAM or UOCartographer You should copy out all the Pre-7.0.24 map files so that they can build their maps.  Other wise they will not build the map resources and you map will be all black.

      Thursday, June 28, 2012

      Update: Removing those darn .DS_Store and .AppleDouble directories from shared network storage

      Seems at 0200 in the morning I was not accurate in my description.  I apologize.


      This one is a short one. 


      I searched long and hard for this one and found a partial fix.  The environment variables of old (Leopard and Tiger) do not work to stop the creation of these files. I found out the hard way. :-)


      .DS_Store

      Here is the command to stop the creation of .DS_Store Directories that pollute your network storage resources. For For Mac OS X Lion you need to use:
      defaults write com.apple.desktopservices DSDontWriteNetworkStores true
      Now you must Logoff or Restart.


      .AppleDouble

      To stop the creation of .AppleDouble folders you need to edit your AFP service configuration.  There is usually a "No AppleDouble" or "Enable AppleDouble" configuration setting that needs to be set true (For the NO option) or set to false (For the Enable Option).


      Note: In FreeNAS 8.0.4 it seems that the .AppleDouble directories are created anyway regardless of setting.  But at least they seem to be empty and can be removed (rm -r /path/).




      The Who, What, and When

      The .AppleDouble Directories are used by Mac OS X to store Extended Attributes (exattr) for files residing on filesystems that are not formatted HFS+.  They are most commonly seen when moving a flash drive from your Mac to your Windows Machine.


      The .DS_Store Directories store Finder Information.  Such as in "Get File Information" you can access a "Comments" field.  If you provide information on the file i the comment it is stored and Finder Information.  If this directory is missing on remote storage, other Mac users would not be able to see the comment you created.


      Why get rid of them?

      On network storage you can have the same share presented over AFP (Apple Filing Protocol) and CIFS (Common Internet File System).  Windows users that connect over CIFS can see the extra Apple directories.  The files often copy the name of the original file and prefix it with "._".  Windows users can mistakenly access these files and think their data is corrupt.


      Hope this helps, :-)


      This is the day the Lord has made. We will rejoice and be glad in it.
        --Psalm 118:24, NLT

      Saturday, June 9, 2012

      Interesting Mac OS X Configuration Tips

      Why


      Yes you can google and find many more results like the following:
      MacLife.com -8 Finder Terminal Hacks
      Mac OS X Tips - Terminal Commands For Hidden Settings
      But these are the ones I use almost all the time when working on Mac Systems.  So I thought I would compile them here as there are only a few.



      Tips


      Show all files in Finder

      The following allows you to show all files in a directory from the GUI.  I am a full on Terminal Fan, but some times it's just faster to do it the easy way.
      Show All Files
      sudo defaults write com.apple.Finder AppleShowAllFiles YES
      Hide Hidden Files
      defaults write com.apple.Finder AppleShowAllFiles NO

      Add Quit to Finder

      Trust me on this one, one day you will need to quit the Finder.
      Can Quit Finder
      sudo defaults write com.apple.finder QuitMenuItem 1
      Can Not Quit Finder
      sudo defaults write com.apple.finder QuitMenuItem 0
      Restart the finder by using Option+Right Click (Or Two Finger on Touch Pad Click) on the Finder Icon. Click Relaunch.

      Show full path in Finder title bar

      It makes moving from the Finder GUI to the Terminal so much easier.
      Path in Finder Title
      defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES
      Remove Path from Finder Title
      defaults write com.apple.finder _FXShowPosixPathInTitle -bool NO
      Restart the finder by using Option+Right Click (Or Two Finger on Touch Pad Click) on the Finder Icon. Click Relaunch.

      Verbose Boot

      This one give you more of a Linux Style Kernel boot so you can see the steps that OS X's Kernel is taking.
      You can hold Command+V during boot. 

      Or
      Set your kernel to always boot Verbosely by doing the following in a terminal.
      sudo nvram boot-args="-v"

      You can also
      sudo nano /Library/Preferences/SystemConfiguration/com.apple.Boot.plist
      Now add -v between <string> and </string>.
      Save Changes.

      Mac OS X Safe Mode

      Hold the Shift key while booting.  I have messed up kernel flags so bad in the past that Single User mode (Hold Command+S during boot) would not even boot.  This mode would using default kernel settings.

      Mac OS X Startup Manager

      Hold the Option key (fitting no?) during boot to load the Startup Manager.  This will allow you to chose a Startup Disk, Flash Drive, Firewire Drive or CD to boot from.  Handy if you forgot to use the Startup Disk utility before rebooting.



      “Pride leads to disgrace, but with humility comes wisdom.”
      Proverbs 11:2

      Friday, June 8, 2012

      Aptana Studio 3 and AFP (Apple Shares)

      (The JavaVM -Dosgi.locking=none trick, from Eclipse)


      Problem:


      I installed Aptana Studio 3 on my MacBook.  I use Aptana because I am partial to the slimed down Eclipse environment it offers.  Majority of my code and scripts are Python, Java, and XHTML so it makes sense not to use the entire Eclipse suite.  However I came across the strangest error when I pointed Aptana's workspace to my AFP share on my NAS.



      Many failed attempts to diagnose why Aptana saw the share as "read-only" had occurred when looking in the logs.  So, I went Geek on it.  I tried using the command line argument -data [path] when launching Aptana.  This forces Aptana to use the value provided (replace [path] with your intended path) as the workspace directory.  

      With a Mac this is not as simple as running Aptana.app -data [path].  In very high level terms I will explain why.  The [name].app items in your Applications folder are actually Directories.  These hold all the vital contents and resources required to launch you Mac Application.  When you click (launch or execute) the directory, it will proceed to launch [name].app/Contents/MacOS/[name]
      In the case of Aptana we can list the directory like so:
      ls /Applications/Aptana\ Studio\ 3/AptanaStudio3.app/Contents/MacOS/
      -rwxr-xr-x  1  70368 May 30 02:13 AptanaStudio3
      -rw-r--r--  1  458 May 30 02:13 AptanaStudio3.ini

      So now we can test the argument in a terminal window. 
      /Applications/Aptana\ Studio\ 3/AptanaStudio3.app/Contents/MacOS/AptanaStudio3 -data [path]

      It is more than likely that your AFP share still will not work, you will probably see one of two errors.
      1. The folder "[path]" is read-only.
      2. Locking is not possible in the directory "[path]". A common reason is that the Runtime Environment does not support file locking for that location. Please choose a different location , or disable file locking passing "-Dosgi.locking=none" as a VM argument.

      This all means that Aptana's underlying JavaVM can't perform a file lock on the target AFP share.  To disable file locking you need to add two parameters to your command.
       -vmargs
       -Dosgi.locking=none