How-To: increase color depth in XP Mode

22 giugno 2011 Nessun commento
Ultima modifica di Spike il 22 giugno 2011 alle 17:23

If you want to increase the color depth in the Windows Virtual PC called “Windows XP Mode” (like I’m running inside my Windows 7 Professional):

  1. In the Windows XP operating system (remote system), click on Start menu, then Run.
  2. Type GPEdit.msc to open Group Policy Editor.
  3. Navigate to Local Computer Policy -> Computer Configuration -> Administrative Templates -> Windows Components -> Terminal Services.
  4. In the right pane, double-click on the Limit Maximum Color Depth setting.
  5. In the Properties dialog, select radio button of Enabled, and then set Color Depth value to 24 bit or Client Compatible
  6. Click OK when done.
  7. Restart the Virtual PC.

Enjoy :)

 

SOURCE:
How To Increase Color Depth and Quality of Windows XP Accessed Via Remote Desktop or Terminal Services

 

Categorie:Microsoft Windows Tag:

Change vMA keyboard layout

4 giugno 2011 Nessun commento

Edit /etc/sysconfig/keyboard

1
sudo vi /etc/sysconfig/keyboard

replace KEYTABLE to your language set (in my case italian)

1
KEYTABLE="it"

Reboot vMA.

 

Enjoy :)

Categorie:Ubuntu Tag:

How-To: script to shutdown ESXi Free via an USB UPS monitoring tool

7 aprile 2011 2 commenti
Ultima modifica di Spike il 9 ottobre 2011 alle 17:05

Introduction

The purpose of this How-To is to let an USB UPS (in my case an APC Back-UPS 800VA) communicate to ESXi to shutdown or suspend VMs and then shutdown host in case of power failure.
The source script’s author is helux where if you can find the original thread and the original script in the sources links at the bottom of this article.
I have customized the script with a logging system and with an option to decide if to suspend or shutdown the virtual machines.

 

The problem

Due to the fact that, since VMWare ESXi 3.5U4, read and write access from RCLI (Remote Command Line Interface) has been disabled, we are unable to use scripts like ghettoUPSHostShutdown.pl written by lamw (William Lam).
Our only possibility is to install the USB UPS monitoring tool in a Virtual Machine, then communicate to ESXi via SSH and then run a script copied on the ESXi itself.

In my case I have an Ubuntu Server 10.10 installed as a Virtual Machine. Here I have installed apcupsd software to monitor the UPS.

 

Create ssh keys

I have generated an SSH key for root to let the VM communicate with ESXi.

1
sudo ssh-keygen

Do not set a passphrase for the private key otherwise we can’t automate the process.
After having enable the SSH server in ESXi, transfer the public key of the VM to ESXi

1
sudo ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.0.100

Change the path to the public key file and the IP address of the ESXi.

 

The script

Download the script with wget in your linux VM or copy and paste the content in a new document

powerdown-esxi4.x_v0.5

Edit the script and, at the beginning, customize it on your needs, such as enable logging system, set the log file, decide what VMs should do (suspend, shutdown) etc.

1
2
3
4
5
6
7
# Set here if you want to suspend or shutdown the Virtual Machines
# Options available: suspend ; shutdown
VM_STATE=suspend

# To enable logging, set the following variable to 1
LOG_ENABLED=1
LOG_FILE=/vmfs/volumes/4c55e39f-3d85baef-7253-e0cb4e42250b/powerdown-esxi4.log

Then transfer powerdown_esxi4. to ESXi

1
scp powerdown_esxi4.1_v0.4.sh root@192.168.0.100:/bin

Please note that if you transfer a text/script file from Windows via vSphere Client to a datastore, a line feed “^M” will be added so the file will be unusable.
If you want you can wget it.
Now login into your ESXi server and make powerdown_esxi4.sh executable

1
chmod +x /bin/powerdown_esxi4.1_v0.4.sh

 

Change UPS monitor software behaviour

We have to tell our UPS monitor software that during the Shutdown Sequence he has to run our script.

Network UPS Tools

Edit /etc/nut/upsmon.conf, change the line

1
SHUTDOWNCMD "/sbin/shutdown -h +0"

and call a custom script instead

1
SHUTDOWNCMD "/usr/local/bin/nut-shutdown.sh"

Create the script /usr/local/bin/nut-shutdown.sh

1
2
#!/bin/sh<br />
ssh root@192.168.0.100 'powerdown-esxi4.sh'

The problem with Network UPS Tools and my APC UPS

I encountered 2 problems using my APC UPS:
1) NUT can’t power on my APC after power outage
2) My APC has ups.delay.shutdown= 20
That means that the amount of time the UPS will wait before shutting down is only 20s. I saw that I need at least 1:10 min, so I had to change it to 90s.
I did it with

1
sudo upsrw -s ups.delay.shutdown=90 -u local_mon -p mypass apc@localhost

but after a service restart, the UPS loses this setting.

apcupsd

Edit /etc/apcupsd/apccontrol this way

1
2
3
4
5
doshutdown)
echo "UPS ${2} initiated Shutdown Sequence" | ${WALL}
ssh root@192.168.0.100 'powerdown_esxi4.1_v0.4.sh'
${SHUTDOWN} -h now "apcupsd UPS ${2} initiated shutdown"
;;

The problem with apcupsd and my APC UPS

As stated in 2 thread in VMWare Communities:
ESXi-4.1: USB passthrough problem with APC Back-UPS CS 650
apcaccess: status output minimal when using USB device passthru on ESX

There is a problem in the USB passthrough of APC UPSes: apcupsd doesn’t recognize many parameters.
However essential parameters like LOADPCT (Percent Load Capacity), BCHARGE (battery charge), TIMELEFT, MBATTCHG (Minimum Battery Charge), MINTIMEL (Minimum Time Left) are properly recognized so we can continue using our script.
At the moment it is the best solution I have found.

 

Compress everything and generate oem.tgz

To load the ssh key and the script at system boot, you have to add it to /bootbank/oem.tgz, as ESXi will clear everything that doesn’t belong to the system itself.
If you don’t have any oem.tgz, create it with

1
tar -cvzf /bootbank/oem.tgz .ssh/ /bin/powerdown_esxi4.1_v0.4.sh

If you have already an oem.tgz for something else, extract the content to a folder, as the tar installed in ESXi doesn’t support appending of files,

1
2
mkdir oem
tar -xvzf oem.tgz -C oem/

copy the script preserving the directory structure of /bin

1
2
mkdir /bootbank/oem/bin/
cp /bin/powerdown_esxi4.1_v0.4.sh /bootbank/oem/bin/

copy also the ssh key

1
cp -R /.ssh/ /bootbank/oem/

compress again the archive

1
2
cd /bootbank/oem/
tar -cvzf /bootbank/oem.tgz `ls -A`

Enjoy :)

 

 

SOURCES:
VMWare /etc – ESXi U4 Ends Free Version Read and Write Access from the RCLI

VMWare Communities: esxi shutdown script for ups monitoring by helux

VMWare Communities: ghettoUPSHostShutdown.pl

vuemuer.it – Spegnere ESXi tramite un UPS APC

How-To: install NUT on Ubuntu 10.10 Maverick Meerkat

28 marzo 2011 Nessun commento
Ultima modifica di Spike il 31 marzo 2011 alle 20:30

In this How-to I will explain how to install and configure Network UPS Tools on Ubuntu 10.10 Maverick Meerkat.
I will configure it with my APC BackUPS RS 800.
Install the package

1
sudo apt-get install nut

Now we need to find out what driver we need to use.
Check it out at the Hardware Compatibility List.
In my case the driver is usbhid-ups.
Edit /etc/nut/ups.conf and add the following

1
2
3
[apc]
driver = usbhid-ups
port = auto

Start the driver

1
sudo upsdrvctl start

but you can get this error

1
2
3
4
5
Network UPS Tools – UPS driver controller 2.4.3
Network UPS Tools – Generic HID driver 0.34 (2.4.3)
USB communication driver 0.31
Can’t chdir to /var/run/nut: No such file or directory
Driver failed to start (exit status=1)

Do the following to fix the problem

1
2
3
sudo mkdir /var/run/nut
sudo chown root:nut /var/run/nut
sudo chmod 770 /var/run/nut
sudo mkdir /var/run/nut
chown root:nut /var/run/nut
chmod 770 /var/run/nut

Try again with the command

1
sudo upsdrvctl start
sudo mkdir /var/run/nut
chown root:nut /var/run/nut
chmod 770 /var/run/nut
Network UPS Tools – UPS driver controller 2.4.3
Network UPS Tools – Generic HID driver 0.34 (2.4.3)
USB communication driver 0.31
Can’t chdir to /var/run/nut: No such file or directory
Driver failed to start (exit status=1)

if it works, you should have an output like this

1
2
3
4
Network UPS Tools - UPS driver controller 2.4.3
Network UPS Tools - Generic HID driver 0.34 (2.4.3)
USB communication driver 0.31
Using subdriver: APC HID 0.95

Now edit /etc/nut/upsd.conf and add the following lines

1
2
LISTEN 127.0.0.1 3493
LISTEN ::1 3493

This way, upsd will only listen to localhost port 3493/tcp.
Start the network data server

1
2
3
4
5
6
sudo upsd

Network UPS Tools upsd 2.4.3
listening on ::1 port 3493
listening on 127.0.0.1 port 3493
Connected to UPS [apc]: usbhid-ups-apc

Check the UPS status

1
2
3
sudo upsc apc@localhost ups.status

OL

OL means your system is running on line power.
Look at all of the status data which is being monitored

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
sudo upsc apc@localhost

battery.charge: 100
battery.charge.low: 10
battery.charge.warning: 50
battery.date: 2001/09/25
battery.mfr.date: 2007/03/14
battery.runtime: 641
battery.runtime.low: 120
battery.temperature: 29.2
battery.type: PbAc
battery.voltage: 27.4
battery.voltage.nominal: 24.0
device.mfr: APC
device.model: Back-UPS BR  800
device.serial: QB0711130221
device.type: ups
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.version: 2.4.3
driver.version.data: APC HID 0.95
driver.version.internal: 0.34
input.sensitivity: high
input.transfer.reason: input voltage out of range
input.voltage: 232.0
input.voltage.nominal: 230
output.voltage: 230.0
output.voltage.nominal: 230.0
ups.beeper.status: enabled
ups.delay.shutdown: 20
ups.firmware: 9.o2 .I
ups.firmware.aux: o2
ups.load: 20.0
ups.mfr: APC
ups.mfr.date: 2007/03/14
ups.model: Back-UPS BR  800
ups.productid: 0002
ups.serial: QB0711130221
ups.status: OL
ups.test.result: No test initiated
ups.timer.reboot: 0
ups.timer.shutdown: -1
ups.vendorid: 051d

Now edit /etc/nut/upsd.users and add the following lines

1
2
3
4
5
6
[monuser]
        password = mypass
        actions = SET
        instcmds = ALL
        upsmon master
        # or upsmon slave

change the password field with a real password.
Reload upsd

1
upsd -c reload

Edit /etc/nut/upsmon.conf, create a monitor directive for upsmon

1
MONITOR apc@localhost 1 local_mon mypass master

Edit /etc/nut/nut.conf and change the mode to Standalone

1
MODE=standalone

Now you can start NUT with

1
sudo service nut start
echo “$*” | mailx -s “UPS Notice” test@example.com

 

 

If you want to enable e-mail notifications for UPS events, as suggested by Witwolf, edit again /etc/nut/upsmon.conf and add

1
2
3
4
5
6
7
8
9
10
11
12
NOTIFYCMD /usr/local/bin/nut-notify.sh

NOTIFYFLAG ONLINE   SYSLOG+WALL+EXEC
NOTIFYFLAG ONBATT   SYSLOG+WALL+EXEC
NOTIFYFLAG LOWBATT  SYSLOG+WALL+EXEC
# NOTIFYFLAG FSD     SYSLOG+WALL
# NOTIFYFLAG COMMOK  SYSLOG+WALL
# NOTIFYFLAG COMMBAD SYSLOG+WALL
NOTIFYFLAG SHUTDOWN SYSLOG+WALL+EXEC
NOTIFYFLAG REPLBATT SYSLOG+WALL+EXEC
NOTIFYFLAG NOCOMM   SYSLOG+WALL+EXEC
NOTIFYFLAG NOPARENT SYSLOG+WALL+EXEC

Create the script /usr/local/bin/nut-notify.sh and paste the following

1
2
#!/bin/sh
echo "$@" | mail -s "NUT Notice" test@example.com

make it executable

1
sudo chmod +x /usr/local/bin/nut-notify.sh

 

 

Enjoy :)

 

 

SOURCES:
Network UPS Tools: User Manual – Configuration notes
Witwolf: My new APC Back-UPS Pro 900 arrived!

Categorie:Ubuntu Tag:

VMWare Server: guests power on hangs at 95%

28 marzo 2011 Nessun commento
Ultima modifica di Spike il 28 marzo 2011 alle 09:28

Host: Ubuntu Server 10.10 Maverick Meerkat
VMWare Server 2.0.2

If the host shut down unexpectedly, then it is possibile that you can’t start guests, hanging at 95% during startup process.
To solve, you need to:

  1. delete .lck file from the virtual machine’s folder
  2. delete file /etc/vmware/not_configured

Enjoy :)

SOURCE:
Zenware – VMware won’t boot after reboot: A general system error ocurred 95% boot and Stuff!

Categorie:VMWare Tag: