Monday, August 19, 2013

VMware virtual machine do not start after hard shutdown

If you get error while trying to start vmware virtual machine "This virtual machine appears to be in use", than it probably that you didn't properly shutdown vm.






This might left a .lck file and vmware assume vm is in running state, find a .lck file where you store the vmware images and delete it after which vm should start fine.


Tuesday, July 23, 2013

Copying public ssh key to the remote server

After we create ssh keys pair with 'ssh-keygen' command, the next step is to copy the public key to remote server and append in ~/.ssh/authorized_keys file.

Traditional method
$ scp ~/.ssh/id_dsa.pub username@my.server.org:

Login to remote server
$ mkdir .ssh --mode 700
$ cat ~/id_dsa.pub >> ~/.ssh/authorized_keys
$ chmod 600 .ssh/authorized_keys

Fast and simple Method using ssh-copy-id

ssh-copy-id is a script that uses ssh to log into a remote machine and append the indicated identity file to that machine's ~/.ssh/authorized_keys file creating the file, and directory, if necessary.

$ssh-copy-id username@my-server.org

If your public key filename is anything other than id_rsa.pub you will get error stating "/usr/bin/ssh-copy-id: ERROR: No identities found". In this case you must provide the location and filename of  the public key

$ssh-copy-id -i ~/.ssh/id_dsa.pub username@my-server.org

If remote server is listening on non-defaut port for ssh then,
$ssh-copy-id -i ~/.ssh/id_dsa.pub -p 5555 username@my-server.org

Sunday, July 21, 2013

Installing debuginfo packages in RHEL and Fedora

Many diagnostic and debugging utilities, including crash, SystemTap, oprofile, and gdb, require the "debuginfo" version of a package to be fully functional. For example, to analyze a kernel vmcore using crash, the kernel-debuginfo package must be installed. To analyze a program core file using gdb, the debuginfo package corresponding to the program that created the core file must first be installed.

debuginfo-install

debuginfo-install is used to install the debuginfo version of packages and their dependencies, based on the name of the non-debug package.

Examples

To install all the packages for debugging the kernel:

1) # debuginfo-install kernel

--> Running transaction check
---> Package kernel-debuginfo.x86_64 0:3.6.11-4.fc16 will be installed
--> Processing Dependency: kernel-debuginfo-common-x86_64 = 3.6.11-4.fc16 for package: kernel-debuginfo-3.6.11-4.fc16.x86_64
---> Package yum-plugin-auto-update-debug-info.noarch 0:1.1.31-2.fc16 will be installed
--> Running transaction check
---> Package kernel-debuginfo-common-x86_64.x86_64 0:3.6.11-4.fc16 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================================================
 Package                                        Arch                Version                    Repository                      Size
====================================================================================================================================
Installing:
 kernel-debuginfo                               x86_64              3.6.11-4.fc16              updates-debuginfo              284 M
 yum-plugin-auto-update-debug-info              noarch              1.1.31-2.fc16              fedora                          18 k
Installing for dependencies:
 kernel-debuginfo-common-x86_64                 x86_64              3.6.11-4.fc16              updates-debuginfo               41 M

Transaction Summary
====================================================================================================================================
Install  2 Packages (+1 Dependent package)

Total download size: 325 M
Installed size: 1.9 G
Is this ok [y/N]:

2) To install the package for debugging the SSHD
# debuginfo-install openssh-server

Sunday, July 7, 2013

Changing runlevel aka targets in Fedora using systemd

On my Fedora the old and handy /etc/inittab file now only has his

cat /etc/inittab
# inittab is no longer used when using systemd.
#
# ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# Ctrl-Alt-Delete is handled by /etc/systemd/system/ctrl-alt-del.target
#
# systemd uses 'targets' instead of runlevels. By default, there are two main targets:
#
# multi-user.target: analogous to runlevel 3
# graphical.target: analogous to runlevel 5
#
# To set a default target, run:
#
# ln -sf /lib/systemd/system/.target /etc/systemd/system/default.target
#


What does it mean? it mean now if you want to boot the box into text or gui you have to do the following ....

Booting system in text only/multi-user mode execute the command
# ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target

Booting system in Graphical/multi-user mode execute the command
 # ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target

 

Changing hostname in Fedora > 18

Bofore we use to change the hostname in Fedora by editing /etc/sysconfig/network file, however Fedora 18, 19 have now using hostnamectl command. Hostname is now in /etc/hostname file and not in /etc/sysconfig/network

Current status of the system

[root@slacker ~]# hostnamectl status
Static hostname: slacker
Icon name: computer-vm
Chassis: vm
Machine ID: 9388a5eb453d59f4fd98567b37061720
Boot ID: 0c3a942a81ae44daa748c545aed51c2a
Virtualization: vmware
Operating System: Fedora 19 (Schrödinger’s Cat)
CPE OS Name: cpe:/o:fedoraproject:fedora:19
Kernel: Linux 3.9.9-301.fc19.i686
 Architecture: i686


To change hostname
# hostnamectl set-hostname fedoravm

[root@slacker ~]# hostnamectl status
Static hostname: fedoravm
Icon name: computer-vm
Chassis: vm
Machine ID: 9388a5eb453d59f4fd98567b37061720
Boot ID: 0c3a942a81ae44daa748c545aed51c2a
Virtualization: vmware
Operating System: Fedora 19 (Schrödinger’s Cat)
CPE OS Name: cpe:/o:fedoraproject:fedora:19
Kernel: Linux 3.9.9-301.fc19.i686
Architecture: i686



Sunday, March 31, 2013

Fedora Upgrade Using FedUp

Fedora 18 is out from quite sometime, which include new upgrade system called FedUp. The utility is available only for Fedora 17 and later. So user running Fedora >= 17 can use it to upgrade there systems.

FedUp is the recommended  method to upgrade Fedora.

Recently I upgraded my Fedora 17 system using FedUp the process went smooth using the below steps

1) Install FedUp
    sudo yum --enablerepo=updates-testing install fedup

2) Start the upgrade by downloading the packages
    sudo fedup-cli --network 18 --debuglog fedupdebug.log

This will download the fedora 18 packages using network (again Fedora folks recommend to download the packages instead of using the local ISO or disks

3) Reboot the system after FedUp finished downloading packages without error. On reboot select "System Upgrade"  from the grub menu.

This wil start installing the packages, once the upgrade process has completed, the system will reboot and you will be greeted with Fedora 18 option in the grub menu.

4) Cleaning up post upgrade (There are a collection of post-upgrade things to do. Some of which are fixed by doing a distro sync by running the blow command)
    yum distribution-synchronization --disablepresto

Quite simple heh? give it a try to upgrade your system running Fedora >= 17.