Wednesday, July 22, 2015

Failed to create domain from - qemu error


 I run out of space on /var/lib/libvirt/images , so need to change the path where qcow2 image is stored(/home)?.

Tried creating vm from new location but faced the following error.

[root@gant qemu]# virsh create fedora21_3.xml
error: Failed to create domain from fedora21_3.xml
error: Cannot access storage file '/home/test/qemu_images/fedora21_3.qcow2' (as uid:107, gid:107): Permission denied


 Fix is we need to change the permission of whole directory path.

[root@gant qemu]# chmod 777 /home/test/

[root@gant qemu]# chmod 777 /home/test/qemu_images/

[root@gant qemu]# chmod 777 /home/test/qemu_images/fedora21_3.qcow2

[root@gant qemu]# virsh create fedora21_3.xml
Domain fedora21_3 created from fedora21_3.xml

[root@gant qemu]#

This is for a  development machine , so not recommended for anything else.

Tuesday, July 21, 2015

Hardlinks - usecase


Hard link points to the same data on the storage device.
--
It has same inode.

You can check using:
ls -li  filename*
--

--
To check number of hardlinks present for a file:
ls -l filename
  Here, check third column count.
--

--
No hard link for directory / special device. only for regular files.

Also, files should be on the same file system(remember inode)

(with soft links, it is possible to create for directories/special files as well)
(with soft links, across file system possible)

• A hard link points a name to data on a (storage)device
• A soft link points a name to another name, that points to data on a (storage) device.

while using softlink for directory, your PWD will be softlink.
--

How hardlinks can be used?

Please refer reference mentioned below for complete details.
 ============================================
This is how many modern file system backup programs work.

On day 1 you make an rsync copy of your entire file system:

backup@backup_server> DAY1=`date +%Y%m%d%H%M%S`
backup@backup_server> rsync -av -e ssh earl@192.168.1.20:/home/earl/ /var/backups/$DAY1/


On day 2 you make a hard link copy of the backup, then a fresh rsync:

backup@backup_server> DAY2=`date +%Y%m%d%H%M%S`
backup@backup_server> cp -al /var/backups/$DAY1 /var/backups/$DAY2
backup@backup_server> rsync -av -e ssh --delete earl@192.168.1.20:/home/earl/ /var/backups/$DAY2/


“cp -al” makes a hard link copy of the entire /home/earl/ directory structure from the previous day, then rsync runs against the copy of the tree.

If a file remains unchanged then rsync does nothing — the file remains a hard link. However, if the file’s contents changed, then rsync will create a new copy of the file in the target directory. If a file was deleted from /home/earl then rsync deletes the hard link from that day’s copy.

In this way, the $DAY1 directory has a snapshot of the /home/earl tree as it existed on day 1, and the $DAY2 directory has a snapshot of the /home/earl tree as it existed on day 2, but only the files that changed take up additional disk space. If you need to find a file as it existed at some point in time you can look at that day’s tree. If you need to restore yesterday’s backup you can rsync the tree from yesterday, but you don’t have to store a copy of all of the data from each day, you only use additional disk space for files that changed or were added.
============================================

Ref:
http://earlruby.org/2013/05/creating-differential-backups-with-hard-links-and-rsync/

Sunday, July 19, 2015

python script check for erros


want to check python script for errors without running?

flake8  src/main.py

ofcourse you need to install flake8 first :)

secure connection failed error in firefox

secure connection failed error in firefox

check:
https://support.mozilla.org/en-US/questions/1028755


install acroread adobe pdf reader on fedora


cd /tmp

## English version ##
wget http://ardownload.adobe.com/pub/adobe/reader/unix/9.x/9.5.5/enu/AdbeRdr9.5.5-1_i486linux_enu.rpm


## Fedora 22 ##
## English version ##
dnf install AdbeRdr9.5.5-1_i486linux_enu.rpm

## Install other needed packages on Fedora ##
dnf install nspluginwrapper.i686 libcanberra-gtk2.i686 adwaita-gtk2-theme.i686 PackageKit-gtk3-module.i686


link:http://www.if-not-true-then-false.com/2010/install-adobe-acrobat-pdf-reader-on-fedora-centos-red-hat-rhel/


PS:
Also, we need to add this line(below) in /usr/bin/acroread:
ldconfig /opt/Adobe/Reader9/Reader/intellinux/lib





 Then, you can launch acroread like :
sudo acroread &

This may be a recommended option, please use with caution.

fpaste utility to get your info to pastebin



To get entire info about your (fedora) system:
run this:
fpaste --sysinfo

$ fpaste --help
Usage: fpaste [OPTION]... [FILE]...
  send text file(s), stdin, or clipboard to the http://paste.fedoraproject.org/ pastebin and return the URL.

Examples:
  fpaste file1.txt file2.txt
  dmesg | fpaste
  (prog1; prog2; prog3) | fpaste
  fpaste --sysinfo -d "my laptop" --confirm
  fpaste -n codemonkey -d "problem with foo" -l python foo.py






USB printer connected to fedora 22

Configuring local printer in fedora
----------------------------------

/etc/cups/client.conf
ServerName  localhost
 ----------------------------------


In order to see the local printers (while using system-config-printer) , the above line (ServerName  localhost) needs to be added.




restart cups like: service cups restart

Please note you may need to comment your office(OR NETWORK) printer server in this configuration. I am still figuring out how to make both to work.

BUT, with this above option you should be able to configure your local printer.

PS: Somehow test printing from the properties dialog box is NOT working. BUT I am able to print from pdf/ text documents. (File-> Print) like that.


Tuesday, July 7, 2015

webcam in fedora

want to use your webcam, install cheese
sudo yum install cheese

and invoke like
cheese

Friday, July 3, 2015

Adding printer Fedora



Want to add your local printer:

use  this interface:
http://localhost:631

PS: I have tough time to add printer using default GUI.

In /etc/cups/cupsd.conf

check whether following entry present
# Restrict access to the admin pages...

Order allow,deny
Allow localhost
 
 
 
Then, add printer.
 
 
Select default and you are done.  
 

vim-jedi plugin - autocomplete python


 sudo yum install vim-jedi.noarch -y


Logger. (CONTROL + SPACE)
for autocomplete.
Selecting the function shows the function help.


// To load the module info
:Pyimport os

Apart from that, jedi-vim supports the following commands
  • Completion
  • Goto assignments g (typical goto function)
  • Goto definitions d (follow identifier as far as possible, includes imports and statements)
  • Show Documentation/Pydoc K (shows a popup with assignments)
  • Renaming r
  • Usages n (shows all the usages of a name)
  • Open module, e.g. :Pyimport os (opens the os module)
Leader means / here.
C - control space

Permission denied (publickey) - git access denied - ssh key issue





==========================================================
$ git pull
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
==========================================================
$ ssh-add ~/.ssh/id_rsa ^C

==========================================================
$ssh-keygen
==========================================================
$cat ~/.ssh/id_rsa.pub

// copy the contents to whichever repository/
==========================================================

Now, try git pull it should work.

Wednesday, July 1, 2015

Upgrade Fedora 21 to Fedora 22

Fedora 21 to Fedora 22 Upgrade howto:

# Boot Fedora 21 first :)

# update the system
yum update


# Run this command to bring in all fedora 22 rpms ( takes lots of time - may be you want to run this overnight)
fedup --network 22

# Now , you may have faced some issues related to some packages which are all displayed at last, just
take those logs in text file. This helps just in case you face any issue in the future.

# Now, reboot the system , Select upgrade in grub menu.

# After installing packages, system will boot as fc22. :)


Post Fedora 22 update:

# update all packages in fc22
sudo dnf update

# If you want to have maximize, minimize buttons install this.

dnf install gnome-tweak-tool.noarch
Open gnome-tweak-tool  -> Windows -> ON Maximize, minimize buttons.

# You may want to explore more gnome-tweak-tool depending upon your needs.


Ref:
http://www.linuxveda.com/2015/05/28/things-installing-fedora-22/