Monday, August 6, 2012

Failed to read NTFS $Bitmap: Input/output error

  • ERROR:
    Error mounting /dev/sdb2 at /run/media/user/Study: Command-line `mount -t "ntfs" -o "uhelper=udisks2,nodev,nosuid,uid=1000,gid=1000,dmask=0077,fmask=0177" "/dev/sdb2" "/run/media/user/Study"' exited with non-zero exit status 13: ntfs_attr_pread_i: ntfs_pread failed: Input/output error
    Failed to read NTFS $Bitmap: Input/output error
    NTFS is either inconsistent, or there is a hardware fault, or it's a
    SoftRAID/FakeRAID hardware. In the first case run chkdsk /f on Windows
    then reboot into Windows twice. The usage of the /f parameter is very
    important! If the device is a SoftRAID/FakeRAID then first activate
    it and mount a different device under the /dev/mapper/ directory, (e.g.
    /dev/mapper/nvidia_eahaabcc1). Please see the 'dmraid' documentation
    for more details.

    This is due to fragmentation problem of the NTFS partition
    • Windows - Run command prompt in Administrative mode
      run following command:

      chkdsk /r f:
      (help - command manual )

      (if partition is "F")
    • Linux (fedora/ubuntu) - install "ntfsprogs" package
      Run following command:
      $ ntfsck /dev/sda1    #If your partition is /dev/sda11


Friday, July 27, 2012

samba share - ctags: Warning: cannot open source file "directory" : Value too large for defined data type

  1. Reason: Samba share mounted from windows in linux (fedora) may be read-only check in windows by going to properties of folder.
  2. Solution: if its marked as read-only, un-check box.
  3. fstab: add following lines at end of your /etc/fstab file
 //server/share_name    /path/to/mount/point  cifs rw,uid=1000,gid=1000,credentials=/home/user_home/smbcredential_file,dir_mode=0755,file_mode=0755  0  0  
  1. details: add your credentials to smbcredentials_file:

Wednesday, July 25, 2012

openGL : Fedora 17 : undefined reference to symbol 'cos@@GLIBC_2.0'

  1. ERROR:

    gcc wave.o -o wave -I/usr/include -L/usr/lib -lglut -lGL -lGLU -lX11 -m32
    /usr/bin/ld: wave.o: undefined reference to symbol 'cos@@GLIBC_2.0'
    /usr/bin/ld: note: 'cos@@GLIBC_2.0' is defined in DSO /lib/ so try adding it to the linker command line
    /lib/ could not read symbols: Invalid operation
    collect2: error: ld returned 1 exit status
  2. Solution:
    Add '-lm' flag while compiling.

    gcc wave.o -o wave -I/usr/include -L/usr/lib -lglut -lGL -lm  -lGLU -lX11 -m32

Tuesday, July 24, 2012

Sharing using SAMBA on fedora 17

  1. Install SAMBA in fedora 17:
    • $ sudo yum install system-config-samba samba-client samba-common samba system-config-samba system-config-users
  2. Set SElinux permissions:
    • $ sudo yum install policycoreutils-gui
    • in gnome go to Administration > SELinux Management and check (set) the following booleans
      • Allow qemu to share any file/directory read/write
      • Allow samba to share users home diectory 
      • Allow samba to export ntfs/fusersfs volumes
  3. Configure Firewall :
    • check the samba box in System > Administration > Firewall
  4. Configure SAMBA:
    1. Adding users:
      •  Go to System > Administration > Samba > Preferences > Samba Users > Add User
      •  Then to edit the Samba share that was created earlier, click on the share then > File > Properties > Access > Give access to users or choose to give access to everybody.
    2. Sharing user's HOME directory:Here is configuration file /etc/samba/smb.conf
      (NOTE: make changes in above file look as bellow and do not change other options, leave other settings as it is)

      ########## PART of smb.conf file #############
      #=======Global Settings=======
      workgroup = WORKGROUP
      server string = YOURSERVER
      netbios name = YOURSERVER
      interfaces = eth0
      # ----------------------- Standalone Server Options -------------------
      security = user
      #------------------------ Name Resolution -------------------------------
      wins support = yes
      #========= Share Definitions ===========
          comment = Home Directories
      ;   browseable = yes
          writable = yes
          valid users = %S

          path = /path/to/your_share
          read only = no
          browseable = no
          valid users = username
    5.  Accessing share:
    • Access users HOME sharing:

      In windows go to Run> \\YOURSERVER\samba_username

      Enter your username and password of samba user.
    • Auto mount as Network drive:
      Right-click on computer>Map network drive

      choose Drive from drop down (e.g. L:)

      At Folder enter \\YOURSERVER\samba_username to access home directory share or enter \\YOURSERVER\your_share to access shared directory.

Monday, July 23, 2012

Installing openGL on Fedora 17

Steps to install openGL on fedora 17:
 $sudo yum install freeglut-devel build-essential  
Compiling sample program:
  1. Get sample programs from SAMPLE  PROGRAMMS
  2. Makefile:
 LDFLAGS=-lglut -lGL -lGLU -lX11 -lm  
 SOURCES=wave.c teapot.c logo.c  
 %.o: %.c $(DEPS)   
  $(CC) -c -o $@ $< $(INCLUDES) $(LIBS) $(LDFLAGS)  
 wave: $(OBJS)  
  $(CC) $@.o -o $@ $(INCLUDES) $(LIBS) $(LDFLAGS)  
 teapot: $(OBJS)  
  $(CC) $@.o -o $@ $(INCLUDES) $(LIBS) $(LDFLAGS)  
 logo: $(OBJS)  
  $(CC) $@.o -o $@ $(INCLUDES) $(LIBS) $(LDFLAGS)  
 .PHONY: clean  
  rm -f $(OBJS) $(TARGETS)  
E.g. Compiling  wave.c
 $make wave  
Running program:
E.g. To run wave.c program

Tuesday, April 24, 2012

Grep excluding .svn directories

  1. Temporary/one-time  solution:
grep -Rin "what r u looking for" *|grep -v "\.svn/*"
     2. Permanent solution (for Ubuntu/Linux) - add following line to ~/.bashrc
export GREP_OPTIONS="--exclude=*\.svn*"

Monday, April 16, 2012

Linux Kernel Cross-compilation for ARM based systems

Here is the link for small presentation regarding cross-compilation of Linux kernel for arm based systems. Presentation also includes guide for how to edit existing Linux drivers to adapt to your application.

link : Linux Kernel Compilation-ARM

Sunday, April 8, 2012

Download Youtube Videos on Linux (Behind Proxy)

  • Install youtube-dl
    • Ubuntu: sudo apt-get install youtube-dl
    • Fedora: sudo yum -y install youtube-dl
  •  Open terminal and export http_proxy
    • export http_proxy=
              ( escape spacial characters in password by '\')
  • Download videos
    • youtube-dl  --all-formats url-of-video