Search This Blog

Thursday, July 18, 2013

VMware Fusion - Permissions on Shared Folders on Ubuntu

VMware Fusion provides a nice functionality of sharing folder from host (Mac OSX) to guest (Ubuntu). But then, it seems they are more focused on windows guests, because they screwup on file permissions of shared folders.

"ls -al /mnt/hgfs" will show 501 dialout as user and group, which is sure to cause permission issues on linux guest.

Update: Found a more persistent alternative
1. sudo vim /etc/vmware-tools/services.sh
2. Search for 'vmhgfs_mnt="/mnt/hgfs"'. After this line add: 'vmuser=${VMWARE_MNT_USER:-root}'
3. Then search for 'vmware_exec_selinux "mount -t vmhgfs .host:/ $vmhgfs_mnt"' and replace it with following section:
   uid=`id --user $vmuser`
   gid=`id --group $vmuser`
   vmware_exec_selinux "mount -t vmhgfs .host:/ $vmhgfs_mnt -o uid=$uid,gid=$gid"
4. sudo vim /etc/init/vmware-tools.conf
Before the "pre-start" and "post-stop" lines add:
env VMWARE_MNT_USER=[The guest user you want]
5. sudo reboot

NOTE: This will have to be redone when you update/ reinstall vmware-tools

To fix this:
ssh to your ubuntu.
run command "id". Make note of uid and gid.
"sudo vim /etc/mtab"
look for line ".host:/ /mnt/hgfs vmhgfs rw,ttl=1 0 0"
Duplicate the line and change it to ".host:/ /mnt/hgfs vmhgfs rw,ttl=1,uid=1000,gid=1000 0 0"
"sudo umount /mnt/hgfs"
"sudo mount /mnt/hgfs"

Now do a "ls -al /mnt/hgfs" to verify if correct username and group are shown.

Ideally, vmware fusion should be making this as transparent as possible. But then again, they don't care because they still don't have a real competition. Once, we do some real competitors, maybe then might start worrying about such minor but key items.

Currently, I spend more time trying to get it working than actually working on a VM. I am desperately looking for a better alternative.

This seems like a pretty neat fix. On the sharing screen, VMWare could add a simple textbox for user name and next time vmware tools are installed, use this value while generating the vmware-tools.conf file.

Not sure when VMWare will take note of such minor issues.

Tuesday, May 07, 2013

error in setup.cfg: command 'nosetests' has no such option 'with_pylons'

When running nosetests, if you see error in setup.cfg: command 'nosetests' has no such option 'with_pylons' or Error reading config file 'setup.cfg': no such option 'with-pylons', it could be because you have Pylons==1.0* installed. Pylons==1.0* does not register itself as a nose plugin (https://github.com/Pylons/pylons/issues/13). Use following work arounds:
  1. For "python setup.py nosetests":
    Add the following to your projects "setup.py -> entry_points" and ".egg-info/entry_points.txt"
        [nose.plugins]
        pylons = pylons.test:PylonsPlugin
    
  2. For "nosetests --version":
    sudo vim `which nosetests`
    
    Make it look something like:
    #!/usr/bin/python
    # EASY-INSTALL-ENTRY-SCRIPT: 'nose==1.3.0','console_scripts','nosetests'
    __requires__ = 'nose==1.3.0'
    import sys
    from pkg_resources import load_entry_point
    
    addplugins = []
    
    try:
        import pylons
        if pylons.__version__[0] == '1':
            from pylons.test import PylonsPlugin
            addplugins.append(PylonsPlugin())
    except ImportError:
        pass
    
    if __name__ == '__main__':
        sys.exit(
            load_entry_point('nose==1.3.0', 'console_scripts', 'nosetests')(addplugins=addplugins)
        )
    
    now you should be able to run it as nosetests --version

Friday, April 19, 2013

Working with multiple Python projects

While working with multiple Python projects, you might soon realize you need different versions of the same Py package or packages are conflicting between multiple projects.
VirtualEnv to your rescue.
But once you go through the docs, install and start using virtualenv, you might soon realize it is a little cumbersome.
  1. You need to provide the complete path where you want to save your virtualenv environment folder. virtualenv proj1 will just create the env in your current directory. If you are using a long path to store your envs, it might be a pain to put it in every-time.
  2. To activate an env, source <path-to-envs>/proj1/bin/activate
  3. To find all envs, you have to ls <path-to-envs>. But this works only if you have all yours envs in a single place.
Don't worry, VirtualEnvWrapper is here to help you.
Now you have a wrapper which provides you some shortcuts to the virtualenv commands. But it doesn't end there. VirtualEnvWrapper provides you with the an extension system.
ls $WORKON_HOME and you will find files starting with "post" and "pre". These are simple shell scripts. You can add your commands to these scripts and they will be everytime you run one of the commands.
It doesn't end there. You can also have separate extensions for each of your env. ls $WORKON_HOME/proj1/bin/ should show some similar files starting with "post" and "pre". For eg. To go to your source folder when you activate your env, just add "cd to "postactivate"
All said and done, one thing that might trouble you is figure out what packages are available in your current env?
Yolk will prove useful here. Remember, you can write extensions in wrapper. Just add pip install yolk to "$WORKON_HOME/postmkvirtualenv" and yolk will be installed on all new virtual envs created automatically. You can then activate your env and just use yolk -l to list packages available in that env.
Not much time for formatting. Will do it later.

Wednesday, April 03, 2013

Install CyanogenMod 10.1 (JellyBean Android 4.2.2) on Samsung S2 Skyrocket

Before you begin:

  • You NEED a windows machine (atleast as of now) for odin.
  • Download using Chrome/ Firefox to avoid issues with tar/ md5 downloads.
  • Read all steps before you start anything.

5 simple steps:

  1. Download CyanogenMod 10.1 and gapps, copy it on the internal external SD card
  2. Download and run odin on Windows machine
  3. Download and install TWRP using Odin
  4. Boot in recovery and install the ROM using TWRP
  5. Install gapps using TWRP

Lets get going:

  1. CyanogenMod 10.1:
    1. Go to http://get.cm/?device=skyrocket
    2. Select the type of build
      • Stable - Stable. Well tested. But will not have latest features.
      • Nightly - Nightly builds. Latest features added but unstable.
      • M snapshot (Experimental) - Similar to nightly. You could call them monthly builds. Somewhere between stable and nightly.
    3. Copy the file onto the phone using USB transfer.
  2. GApps
    1. Go to http://goo.im/gapps
    2. Download the gapps which match your CyanogenMod version.
    3. Copy the file onto the phone using USB transfer.
  3. TWRP (Similar to clockworkmod [CWM])
    1. Download TWRP from http://d-h.st/Xo2
  4. Odin
    1. Download odin from http://forum.xda-developers.com/attachment.php?attachmentid=925569&d=1330549534.
    2. Extract the zip.
    3. Run the exe.
    4. Check "auto-boot". Uncheck all other options
    5. Click on "PDA" button. Select TWRP tar file.
    6. HOLD YOUR HORSES HERE
  5. Process - Install TWRP
    1. Put the phone into download mode. (Download mode is different from recovery mode.)
    2. Connect USB cable to computer but not the phone.
    3. Shutdown and remove the battery of the phone
    4. Wait for sometime and reinsert the battery.
      • AT&T - Hold both volume buttons.
      • Rogers - Hold only volume down button.
      (Do not release the buttons until instructed to do so. Do not touch the power button.)
    5. Insert the usb cable into the phone. The phone will boot up. When you see a download mode page with a little yellow triangle at bottom, release the volume button(s).
    6. Now press the volume up button as per the instructions on the screen to continue to download mode.
    7. Odin should have recognized your phone now. You should see a green box with com port listed.
    8. Click start in Odin.
    9. When odin is finished flashing, you should see a green box with Pass written right above the com port green box.
  6. Process - Install CyanogenMod 10.1
    1. Put the phone in recovery mode:
    2. Turn off phone and unplug USB.
    3. Hold down both volume keys.
    4. Hold power button till you feel the phone vibrate. (Release only power button, not the volume keys when the phone vibrates.)
    5. When the screen goes black, release volume keys.
    6. You should now be in recovery mode.
    7. It is a good idea to backup here.
    8. Click on install button.
    9. Select the cyanogenmod zip file from internal/ external sd card and follow on screen instructions to complete the install.
    10. Click Home.
    11. Click Wipe.
    12. Click on Cache, Dalvik Cache and Factory Reset.
    13. Click on back button.
    14. Click on Reboot -> System.

Since we reset cache, the first boot could take 5-10 mins. But if it is taking longer, go to recovery mode and try other options in Wipe menu of TWRP. Then reboot.

On first boot, you might panic to see none of the Google related apps available. Not even Google Play. Thats where the gapps we downloaded come into picture.

  1. Install GApps
    1. Go to recovery mode.
    2. Click Install and select the gapps file. Complete the install.
    3. Reboot.

You should be good to go.

References

Need some more time to work on the post formatting. But instructions are pretty much covered.