Archive for category howtos
VirtualBox init.d service autostart script
Posted by Alex Amiryan in Code, howtos on November 4th, 2009
I’ve just installed started using VirtualBox on my Fedora 11 x86_64 and it works just perfectly. I’ve migrated from VMWare when it figured out that it is unable to work with latest kernel version. So I need to start some virtual machines in the background with system startup. I’ve made a lot of googling and found some dirty scripts that were not meeting my criterias. I’ve decided to write my own system startup service.
You need to create file named vbox in /etc/sysconfig/ to list the virtual machine names that you want to start with system. Also when shutting down this service will save state to all running VMs. Here is the script:
/etc/init.d/vbox
#!/bin/sh
#
# chkconfig: - 91 35
# description: Starts and stops vbox autostart VMs.
### BEGIN INIT INFO
# Provides: vbox
# Required-Start: $network $named $vboxdrv
# Required-Stop: $network $named
# Default-Start:
# Default-Stop: 0 1 2 3 4 5 6
# Short-Description: Autostart some Virtual Box VMs
# Description: Autostart some Virtual Box VMs that are mentioned in /etc/sysconfig/vbox file
### END INIT INFO
. /etc/rc.d/init.d/functions
MANAGE_CMD=VBoxManage
[ -r /etc/sysconfig/vbox ] && . /etc/sysconfig/vbox
prog=$"Virtual Box Machines"
start()
{
echo -n $"Starting $prog: "
RETVAL=0
for vbox_name in ${VBOX_AUTOSTART}
do
SERVS=1
echo -n "${vbox_name} "
daemon $MANAGE_CMD startvm "${vbox_name}" -type vrdp >/dev/null 2>&1
RETVAL=$?
[ "$RETVAL" -eq 0 ] || break
done
if [ -z "$SERVS" ]; then
echo -n "no virtual machines configured "
failure
RETVAL=6
else
if [ "$RETVAL" -eq 0 ]; then
success $"vbox startup"
touch /var/lock/subsys/vbox
else
failure $"vbox start"
fi
fi
echo
return "$RETVAL"
}
stop()
{
echo -n $"Shutting down $prog: "
for vbox_name in ${VBOX_AUTOSTART}
do
echo -n "${vbox_name} "
runuser root -c "$MANAGE_CMD -q controlvm "${vbox_name}" savestate" >/dev/null 2>&1
done
RETVAL=$?
[ "$RETVAL" -eq 0 ] && success $"vbox shutdown" || \
failure $"vbox shutdown"
echo
[ "$RETVAL" -eq 0 ] && rm -f /var/lock/subsys/vbox
return "$RETVAL"
}
status()
{
for vbox_name in ${VBOX_AUTOSTART}
do
echo -n "${vbox_name} "
$MANAGE_CMD showvminfo "${vbox_name}"|grep "^State:\s*.*$"
done
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|force-reload)
stop
start
;;
status)
status
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2
exit 3
;;
esac
:
And here is configuration file:
/etc/sysconfig/vbox
# Virtual box machines to autostart # Example to start 2 machines # VBOX_AUTOSTART = "MachineName1 MachineName2" # VBOX_AUTOSTART=""
Thats it. If you have any questions do not hesitate to contact me.
SOLVED: Adobe AIR installation problem on Fedora 10 x86_64
Posted by Alex Amiryan in howtos on May 25th, 2009
Adobe AIR installation fails on Fedora 10 x86_64 without any explanations. It just says:
An error occurred while installing Adobe AIR. Installation may not be allowed by your administrator. Please contact your administrator.
The reason is some missing i386 packages. You just have to run following command:
yum install gtk2-devel.i386 nss.i386 libxml2-devel.i386 libxslt.i386 gnome-keyring.i386 rpm-devel.i386
You may already have some these packages. Don’t worry about that, yum will skip them. After yum finishes, retry installation of AIR, it should work now.
Howto delete all .svn folders from SVN working directory
Posted by Alex Amiryan in Code, howtos on April 23rd, 2009
To delete all .svn folders from SVN working directory for releasing folder from SVN just do this simple steps.
Create new file in /usr/local/bin with name svnrm with following content
#!/bin/sh find . -name .svn -print0 | xargs -0 rm -rf
Save it. From now on you can execute svnrm command in your working directory and it will delete all .svn folders at once.
Have fun!
Bugfix: Howto turn off gpg-agent usage in Enigmail in Thunderbird
Posted by Alex Amiryan in Code, howtos on April 22nd, 2009
There is some bug in Enigmail v0.95.7 for Thunderbird. If you untick the checkbox “Use gpg-agent for passphrases” in Advanced tab of Advanced settings menu, Thunderbird in anyway will try to use gpg-agent if GPG_AGENT_INFO environment variable is set. The reason is some little bug in Enigmail source code. To fix it, first close Thunderbird, then just open .thunderbird folder in your home directory, search for enigmail.js file. It have to be in extensions folder in one of the random name folders. When you have found the enigmail.js file open it with your favorite text editor and find line number 1368. It have to be this:
useAgent= (this.gpgAgentInfo.envStr.length>0 || this.prefBranch.getBoolPref("useGpgAgent"));
Change the || sign to &&. After change this line have to look like this:
useAgent= (this.gpgAgentInfo.envStr.length>0 && this.prefBranch.getBoolPref("useGpgAgent"));
Save file. Now open Thunderbird and enjoy.
Howto recursively add unversioned files into SVN repository
Posted by Alex Amiryan in Code, howtos on April 22nd, 2009
Because svn add command does not support recursive addition of unversioned files you can use this little script to do it.
Create new file in /usr/local/bin with name svnadd with following content
#!/bin/sh
svn status | perl -ne 's/^\?\s+(\S.+)$/\1/g;chomp;system("svn add \"$_\"");'
Save it. From now on you can execute svnadd command in your working directory.
Howto run Gajim with root privileges
Posted by Alex Amiryan in howtos on April 16th, 2009
Gajim 0.12.1 says that he can’t run with root privileges. This is new feature that appeared in Fedora 10. In earlier versions it was normaly running under root. Anyway let’s turn off this feature in case that you need to run Gajim under root.
Open /usr/bin/gajim with your favorite text editor, find 24th line and just comment out this part of code:
if test $(id -u) -eq 0; then echo "You must not launch Gajim as root, it is INSECURE" exit 1 fi
After commenting it should look like
#if test $(id -u) -eq 0; then # echo "You must not launch Gajim as root, it is INSECURE" # exit 1 #fi
Save file. Thats it.
Happy chatting
SOLVED: Linux software RAID 5 too slow
Posted by Alex Amiryan in howtos on April 10th, 2009
In this article I am going to tell about my experience with Linux software RAID.
So I had a ASUS P6T motherboard which has Intel ICH10R raid controller, 3x 1 Tb SATA 2 HDDs and Intel Core i7 920 processor. So I wanted to install Fedora 10 on that machine.
After configuring RAID 5 in the BIOS I booted the Fedora 10 installation DVD to start the installation. BUT! Suddenly I saw that Anaconda see 3 separate hard drives instead of 1 RAID device. After some googleing I figured out that my motherboard don’t have real RAID controller. Instead it is fakeraid controller. It is just software raid which software is located in BIOS. So I decided to use linux software raid, because it is definitely better than the from ASUS.
So installed Fedora 10 with linux software RAID 5 with LUKS encryption. After installation machine started to work very slowly. I thought it so because of the encryption, but after some googleing I understood that the encryption can’t slow down the machine that way. The thing was when you newly create RAID 5 array it needs to build the 3rd hard drive and it take a lot of time. It took from me approximately 4 hours to finish that operation on 1 Tb hard drives. You can check the rebuild status at any time invoking one of the following commands:
# cat /proc/mdstat
or
# mdadm --detail /dev/md0
After rebuild was over and after some tunings (see tuning parameters below) I had ~90 Mb/s write and ~200 Mb/s read.
My tuning parameters was:
echo 32768 > /sys/block/md0/md/stripe_cache_size
blockdev --setra 65536 /dev/md0
VMWare Workstation 6.5 segfault on Fedora 10 x86_64
Posted by Alex Amiryan in howtos on March 22nd, 2009
VMWare Workdstation 6.5 is causing segmentation fault on Fedora 10 x86_64 when trying to execute it. The message is:
/usr/lib/vmware/bin/launcher.sh: line 231: 13748 Segmentation fault "$binary" "$@"
To solve the problem you need to do this:
# mv /usr/lib/vmware/modules/binary /usr/lib/vmware/modules/binary.old # vmware-modconfig --console --install-all
After build is over start VMWare, it should work now.
Taken from http://www.jerrypau.ca/?p=63GDM root login in Fedora 10
Posted by Alex Amiryan in howtos on March 16th, 2009
To enable logging in with root user on fedora 10 system simply edit file /etc/pam.d/gdm and comment out line:
auth required pam_succeed_if.so user != root quiet
Thats it
Fedora 10 mouse pointer problem
Posted by Alex Amiryan in howtos on March 13th, 2009
I’ve just discovered that when intalling Fedora 10 on some computer causes this problem. Problem start from instalation: there is no pointer for mouse in Anaconda and further in the system. It is a little bit dificult but install system with keaboard only, then when system installed and running do the following steps to fix this issue:
# yum install system-config-display
Open system-config-display and just press “OK” button. It will generate xorg.conf file in /etc/X11.
Then open /etc/X11/xorg.conf and in section “Device” add following two lines
Option "HWCursor" "off" Option "SWcursor" "True"
Save file and restart your X server. It have to work now.



