Home‎ > ‎Tom's Ideas And Notes‎ > ‎

Fresh Install Ubuntu 12.10 (recovering from HDD failure)

posted Oct 22, 2012, 8:16 PM by Tom Gutwin   [ updated Nov 23, 2012, 6:11 PM ]
Yet again, I have a failed hard-drive.  That's 4 in the last 6 months.  All of them Seagates of various ages under 5 years.
I have backups, so its no big deal, just a bother.
ubuntu name and logo

This is my log of moving to U12.10 from my previous U12.04 desktop.
My machine is:
  • processor: Intel® Core™ i7 CPU 920 @ 2.67GHz × 8
  • memory: 16GB
  • HD:a new 1GB WD Black Caviar Black SATA3 (WD1002FAEX)
  • Video is a GeForce 9600 GT based nVidia card from Asus

Without thinking enough, I installed a 32bit version on this workstation. I have it on a USB key and everything went without issue.
I created a swap partition and put everything else on a partition taking up the rest of the drive (/).

Oooops - I wanted the 64bit OS, so I had to go back and grab a new iso, burn a DVD and reinstall.

After it is installed here is what I did.

  1. sudo apt-get install synaptic
  2. untar'd my archived home, opt, etc directories that each hold my existing data.
  3. copy my apt repos so I can re-install my favourite software
    • sudo cp etc/apt-get/repos.d/* /etc/apt-get/repos.d/.
  4. open settings/software-sources and updated my mirror and personalized my choices
  5. sudo apt-get install  nvidia-current-updates nvidia-settings-updates sensors-applet
    • the *-updates packages are straight from nvidia
    • Problems show up later from this... see my fix below
    • be warned.. put a desktop icon/shortcut to a terminal app and nautilus app
  6. sudo apt-get install gnome-tweak-tool vlc vorbis-tools soundconverter sound-juicer transmageddon speex vorbisgain gnome-system-tools
  7. Re-place my user .bashrc files
    • selectively copy old .bashrc contents into new one
  8. Re-Install Virtualbox
    • sudo sh -c 'echo "deb http://download.virtualbox.org/virtualbox/debian  quantal" >> /etc/apt/sources.list'
    • sudo apt-get update && sudo apt-get install virtualbox-4.2 dkms
    • Did NOT re-place my VirtualBox VMs and .VirtualBox Settings
    • install Extension Pack from https://www.virtualbox.org/wiki/Downloads
    • Then just added new VBs pointing to existing VBoxFiles
  9. I re-booted here to see how things are shaping up.
    • Oooops, video problems due to the installation of nVideo drivers from 5 above
    • desktop showed up with a low resolution and without unity (no menu, no panel or toolbar)
    • The fix took a number of steps - here are the things I had to do 
      1. C-A-F2 to bring up a terminal
      2. set the default boot up to runlevel 3 (text with network) or 1 (single user)
        • edit /etc/default/grub
        • change the line GRUB_CMDLINE_LINUX_DEFAULT="text"
        • ****run sudo update-grub to regenerate grub files
        • NOTE: you can also set this option at the GRUB2 bootmanager menu, but it is a one time setting
      3. reboot
      4. unintstall nVidia packages 
        • sudo apt-get remove nvidia-current-updates nvidia-settings*
        • sudo rm /etc/X11/xorg.conf
      5. linux-headers are required to build the drivers for nVidia
        •  sudo apt-get install linux-headers-generic
      6. downloaded the latest driver from nVidia and install it (http://www.nvidia.com/object/linux-display-amd64-304.60-driver.html)
        • it is going to want to disable nouveau from running with:
          • let the nvidia installer create the /etc/modprobe.d/nvidia-installer-disable-nouveau.conf file
      7. reboot then re-run the nvidia installer
        • let it run the nvidia-settings to crate a new xorg.conf
      8. set the default boot back up to runlevel 6 (full Graphical desktop)
        • edit /etc/default/grub
        • change the line GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
        • ****run sudo update-grub to regenerate grub files
      9. reboot
      10.  but still no unity... I saw that glx was not loading, so I had to add the module to the xorg.conf
        • add the following to the xorg.org
          • Section "Module"
               # glx and glcore implement opengl
               Load "glx" 
               Load "dri"
            EndSection 
      11. reboot and up came unity with full nVidia support
  10. Okay on with the setup... 
    • move many of my key setting dirs back in place:
    • move my application dirs back in place
      • opt
      • /home/share
    • re-linked 
      • bin
      • dev
    • re-installed mythtv-frontend
      • sudu apt-get install mythtv-frontend
    • Tested the apps
    • copy init.d startup files, and restart services (I also installed boot-up manager package 'bum' to do this)
    • jetty
    • derby
  11. copied my /etc/fstab cifs  network dirs back in place
    • cifs package had to get installed
      • sudu apt-get install cifs-utils
    • re-create /mnt sub-dirs
    • mounted mythtv, droboshare
  12. re-install openssh to get my sshd running
  13. re-installed samba packages
    • shared my rootDir
    • started smbd

  14. Setup my desktop
    • some nautilus-scripts for image convention, adding desktop apps
    • re-created some application desktop files
    • added things to unity dash
    • added gnome panel
    • added some panel applets
  15. Symbolic links to Music and pictures on my media server / MythTV dvr
    • sudo ln -s /mnt/mythtv/media1 /media1
    • sudo ln -s /mnt/mythtv/media2 /media2
    • ln -s /media1/snd/ogg /home/tgutwin/Music/ogg
    • ln -s /media1/pictures /home/tgutwin/Pictures/mythtvPictures
    • ln -s /media2/pictures /home/tgutwin/Pictures/mythtvPictures
    • cd ~;rm Videos;ln -s ../share/Videos
    • cd ~/Videos;ln -s /media1/recordings/showNames
    • cd ~/Videos;ln -s /media2/videos mythtvVideos
    • cd ~/Videos;ln -s /media2/videos/HD
    U12.10 screenshot

  16. Added the Java Plugin to Firefox -> see http://www.ubuntututorials.com/install-oracle-java-jdk-7-ubuntu-12-04
    • REMEMBER to go into firefox:tools:extensions:plugins and enable the java plugin once its installed
  17. Getting my WorkoutTracker web-app running was a bit finicky. For some reason the startup scripts did not run with the same permissions.
    • /etc/init.d/jetty worked fine, it was derby that gave me some issues
    • added a new apache derby system user
    • updated the init.d startup script to include this 'derby' user
    • added an option to the netStart commandline to allow connections from any IP address (default is to accept from 'localhost') and for some reason my web app helper code wasn't allowed to connect any more even though it was connecting from the same machine.
      • /etc/init.d/derby

        #!/bin/bash
        #
        # Startup script for Derby
        ### BEGIN INIT INFO
        # Provides:          derby
        # Required-Start:    $remote_fs $syslog
        # Required-Stop:     $remote_fs $syslog
        # Default-Start:     91 2 3 4 5
        # Default-Stop:      20 0 1 6
        # Short-Description: Start Apache Derby DB at boot time.
        # Description:       Provides a small simple java based DB.
        ### END INIT INFO#
        # chk con fig: 345 94 16
        # description: Derby startup script
        # to enable on bootup on redhat "chkconfig --level 35 derby on"
        # to enable on bootup on debian "update-rc.d derby defaults" or the
        # slightly longer (but better run levels) "update-rc.d derby start 91 2 3 4 5  . stop 20 0 1 6 ."

        # see http://blog.rimuhosting.com/2009/09/30/one-java-init-script/

        HOMEDIR=/opt/db-derby
        DERBY_USER=derby
        APPNAME=Derby

        # see http://www.vogella.com/articles/ApacheDerby/article.html  for startUp Options
        RUNCOMMAND="bin/startNetworkServer  -h 0.0.0.0"
        STOCOMMAND=bin/stopNetworkServer
        LOGFILE=/var/log/derby.log


        DERBY_HOME=$HOMEDIR
        export DERBY_HOME


        GREPSTRING='derbyclient.jar'

        if ! grep -qai "$DERBY_USER" /etc/passwd; then
            echo "$DERBY_USER is not a user.  Please create a user account first" >&2
            exit 1
        fi

        setpslist() {
            #if [ ! -z "$GREPSTRING" ]; then
                pslist=`ps a --width=1000 --User "$DERBY_USER" -o  pid,user,command   | grep "$GREPSTRING" | grep -v PID| grep -v grep | awk '{printf $1 " "}'`
            #else
            #    pslist=`ps a --width=1000 --User "$DERBY_USER" -o  pid,user,command  | grep "$GREPSTRING" | grep -v PID | awk '{printf $1 " "}'`
            #fi
        }


        start() {
            setpslist
            if [ ! -z "$pslist" ]; then
                echo "$APPNAME already running, can't start it" >&2
                return 1
            fi
            echo -n "Starting $APPNAME: "
            if [ ! -e "$LOGFILE" -a ! -e "`dirname \"$LOGFILE\"`" ]; then
                mkdir -p `dirname "$LOGFILE"`
            fi
            if [ -e "$LOGFILE" ]; then
                mv "$LOGFILE" "$LOGFILE".old
            fi
            touch $LOGFILE
            chown $DERBY_USER $LOGFILE
            chmod guo+w $LOGFILE

            chown -R $DERBY_USER $HOMEDIR
            #echo echo exec su - -p --shell=/bin/sh $DERBY_USER -c "cd $HOMEDIR; $RUNCOMMAND >\"$LOGFILE\"" 2>&1

            exec su - -p --shell=/bin/sh $DERBY_USER -c "cd $HOMEDIR; $RUNCOMMAND >\"$LOGFILE\"" 2>&1 &

        }


        killprocesses() {
            setpslist
            if [ -z "$pslist" ]; then
                echo "$APPNAME not running, no need to kill it"
                return 0
            fi
            kill -9 $pslist
            echo "Killed $APPNAME"
            return 0
        }

        stop() {
            setpslist
            if [ -z "$pslist" ]; then
                echo "$APPNAME not running, no need to stop it"
                return 0
            fi
            echo -n $"Shutting down $APPNAME: "

            suoutput=`su - --shell=/bin/bash -p $DERBY_USER -c "$STOPCOMMAND"`

            kill -SIGTERM $pslist


        }

        status() {
            setpslist
            if [ ! -z "$pslist" ]; then
                echo -n "$APPNAME ( PIDs $pslist ) is running."

            else
                echo "$APPNAME is stopped"

            fi
        }

        case "$1" in
            start)
                start
                ;;
             stop)
                stop
                ;;
             restart)
                stop
                sleep 3
                start
                ;;
             kill)
                killprocesses
                ;;
             killstart)
                killprocesses
                start
                ;;
             status)
                status
                ;;
             *)
                echo "Usage: $0 {start|stop|restart|status|kill|killstart}"
             exit 1
        esac
        exit $?


    • I also had to update directory owners on the db-derby and derbyDB directories. If the derbyDB dir was not owned by the 'derby' user that started derby, it would open the DB as Read Only. :(
      • sudo chown -R derby:tgutwin /opt/derbyDB
      • sudo chown -R derby:tgutwin /opt/db-derby
      • sudo chmod -R g+rwx /opt/derbyDB
      • sudo chmod -R g+rwx /opt/db-derby
    • It now starts and accepts connections...

      WorkoutTracker Frontpage Screenshot
  18. Install Google Earth from the google.com/earth deb package (as opposed to the package in the Ubuntu repo.
    • Oooops, It starts but the there is a blank screen, black with no earth.  I open it from the command line and see some OpenGL problems:
      • tgutwin@warp4:/opt/google/earth/free$ sudo LIBGL_DEBUG=verbose /opt/google/earth/free/googleearth
        libGL: screen 0 does not appear to be DRI2 capable
        libGL: OpenDriver: trying /usr/lib/i386-linux-gnu/dri/tls/swrast_dri.so
        libGL: OpenDriver: trying /usr/lib/i386-linux-gnu/dri/swrast_dri.so
        libGL error: failed to load driver: swrast

      • Seeing the refernce to i386-linux-gnu, I think it might be something with the fact I installed the 64Bit deb .
      • I removed it and installed the 32 bit version.  Same error.
    • Still unresolved... moving on
    • Fixed... see item 23 below
  19. Restart by Subversion code repository
    • the svnroot already is present in my /opt dir
    • I already had packages subversion and subversion-tools installed
    • I had to move my /etc/subversion files back over-top of the default install files
    • run sudo bum to add svnserve to the system startup  and start it up.
      • note: ubuntu uses upstart. Othger than 'bum' you can use a few different tools to get things into the service startup
        • Jobs-Admin
        • sysv-rc-conf
        • rcconf
  20. Get my web based subversion viewer started AstroVersion.

    • astroVersion screenshot
    • Oooops, my /etc/hosts file was not re-updated with all my helper aliases I use.
      • Copy my old /etc/hosts hosts and host aliases back in place to get my svn alias back
  21. Android SDK
    • I started following the tutorial at http://developer.android.com/training/basics/firstapp/index.html which I already had previously working with a myFirstApp.
    • when I get to calling:   android avd
      • Error message saying it could not find stdc++.so.6
    • It needs the ia32 package
      • sudu apt-get install ia32
    • Success. virtual device can now be created
    • When I try to start the emulator...
      • libGL: screen 0 does not appear to be DRI2 capable
      • libGL error: failed to load driver: swrast
      • same as my Google Earth error 
    • I suspect it has something to do with the 2 versions of libstdc++.so.6 or dri
      • one in  /usr/lib/i386-linux-gnu
      • one in  /usr/lib/x86_64-linux-gnu
      • sudo ln -s /usr/lib/i386-linux-gnu/dri /usr/lib/dri
  22. I needed to clear this openGL issue up so I can get Google Earth and Android emulator running
    • re-boot to runlevel3 by adding 'text' to the grub vmlinuz commandline
    • login and re-install the nVidia driver
      • sudo apt-get remove nvidia-setting*
      • sudo cp /etc/X11/xorg.conf /etc/X11/xorg.withglxdri.conf
      • sudo ~tgutwin/Downloads/NVIDIA-Linux-x86_64-304.60.run
        • accept everything except re-writing the xorg.conf
      • /sbin/init 6
    • This time boot as normal into gui login screen
    • /opt/google/earth/free/googleearth now runs!!
    • so does my Android emulator!!
Comments