Archive for category Howto

VCS: fix dg disabled. cannot open ” ” for quotactl

root@myhost1# vxdisk list
DEVICE TYPE DISK GROUP STATUS
sdbu auto:cdsdisk emc1XXX DB_PRD online dgdisabled
sdbv auto:cdsdisk emc1XXX DBarc_PRD online dgdisabled

root@myhost1# vxdg deport DB_PRD
VxVM vxdg ERROR V-5-1-584 Disk group DB_PRD: Some volumes in the disk group are in use
Read the rest of this entry »

No Comments

Cygwin telnet tips etc

Install Telnet Using Cygwin On Windows 7
telnet for Cygwin is in inetutils, install the package to gain telnet

Crontab issue:
pam_access(crond:account): access denied
crond[9985]: CRON (someuser) ERROR: failed to open PAM security session: Success
crond[9985]: CRON (someuser) ERROR: cannot set security context

* if has /etc/cron.allow – add users to this file
* /etc/security/access.conf – comment out

# All other users should be denied to get access from all sources.
#- : ALL : ALL
# -:ALL EXCEPT root:LOCAL

No Comments

Converting a virtual disk image: VDI to VMDK to a raw loopback file you can mount

By default, VirtualBox creates virtual disk images in a special format called VDI, which is unique to VirtualBox. Disk images are stored in $HOME/.VirtualBox/HardDisks.

You’ll need to convert VDI into another format if you want to run a VirtualBox VM on another virtualization platform, such as VMWare or KVM.

The VMDK virtual disk format is a good choice because even though it originated with VMWare it is supported by other virtualization platforms including VirtualBox and KVM.

VirtualBox enables the conversion using the low-level “VBoxManage clonehd” command:

VBoxManage list hdds # prints a list of disk image UUIDs
VBoxManage clonehd -o converted.vmdk format VMDK
cd ~/.VirtualBox/HardDisks/
ls -la converted.vmdk

Once you have converted to VMDK you can use qemu-img, a tool bundled with qemu (KVM’s virtualization backend) to further convert VMDK to other formats.

A particularly useful format to convert to is ‘raw’ which you can then mount as a loopback device:

apt-get install qemu
qemu-img convert -f vmdk converted.vmdk -O raw converted.raw
mount -o loop converted.raw /mnt

,

No Comments

Changing password inside a script

In an ideal world you’d never need to change the password associated with a user account without using passwd, but there are times when it is helpful to script such things.

The naive attempts to automate the use of passwd will fail, so the standard advice has always been to use a tool like expect to interactively call the passwd binary.

But there is an alternative approach which is more sensible which is to use the usermod command to change a password.

Assume you have a user account called guest upon your system and you wish to set the user’s password to openaccess you can do this by running:

# hash=$(echo openaccess | openssl passwd -1 -stdin)
# usermod –pass=”$hash” guest

If you wish you could combine that into a single line:

# usermod -p $(echo openaccess | openssl passwd -1 -stdin) guest

If a local user can see the commands you’re running in the output of “ps”, “top”, or similar then this is insecure – but if you generate the hash remotely you should probably be safe enough.

No Comments

Solaris: Boot archive error or corrupt

Boot archive error or corrupt

A few weeks ago, I got a little problem with my solaris box, namely solaris won’t boot because the boot archive was corrupt, *sigh*. Anyway the boot archive in solaris 10 was contain kernel module and configuration file was needed for solaris to startup the system.

Error:

module /platform/i86pc/boot_archive error 3 bad or corrupt data while decompressing file

Workaround:

Boot up your solaris in “solaris failsafe mode”, next solaris image will mount with writeable mode on “/a” mount point

rm -f /a/platform/i86pc/boot_archive
bootadm update-archive -R /a
reboot

,

No Comments

short scripts: convert squid timestamp

cat > /var/convert.pl
#!/usr/bin/perl -p
s/^\d+\.\d+/localtime $&/e;

Ctrl+D
. /var/convert.pl /var/squid/log/access.log |more

No Comments

how to get latest php mysql

There are many ways, you can compile by yourself, but not good in production env.

Here is option from iuscommunity.org

We are committed to providing up-to-date and regularly maintained RPM packages for the latest upstream versions of PHP, Python, MySQL and other common software specifically for Red Hat Enterprise Linux and clones.

Ref: http://iuscommunity.org/Docs/ClientUsageGuide
Try at your own risk. :)

No Comments

Patch ESXi from 4.0 to 4.1 Update 1

Target: Patch ESXi from 4.0 to 4.1 Update 1
Preparation: Install vSphere Client

1st round
# halt all the VMs from Vsphpere

# put the ESXi into “maintenance mode”, right click the host.

# backup the firmware configuration
C:\Program Files\VMware\VMware vSphere CLI\bin>vicfg-cfgbackup.pl –server beivm
srv01 -s beivmsrv01_20110320.bak
Enter username: root
Enter password:
Saving firmware configuration to beivmsrv01_20110320.bak …

Read the rest of this entry »

No Comments

Network / TCP / UDP Tuning

This is a very basic step by step description of how to improve the performance networking (TCP & UDP) on Linux 2.4+ for high-bandwidth applications. These settings are especially important for GigE links.

Quick Step
Cut and paste the following into a linux shell with root privleges:
sysctl -w net.core.rmem_max=8388608
sysctl -w net.core.wmem_max=8388608
sysctl -w net.core.rmem_default=65536
sysctl -w net.core.wmem_default=65536
sysctl -w net.ipv4.tcp_rmem=’4096 87380 8388608′
sysctl -w net.ipv4.tcp_wmem=’4096 65536 8388608′
sysctl -w net.ipv4.tcp_mem=’8388608 8388608 8388608′
sysctl -w net.ipv4.route.flush=1

Details:
Read the rest of this entry »

No Comments

client 4 rejected from IP x.x.x.x

Xming.exe: client 4 rejected from IP 192.168.1.215

Solution:
Edit: X0.hosts (lay in the installation directory)
add the ip you want allow. my X0.hosts
“localhost
192.168.1.215″
Restart Xming.

1 Comment