Installing VMWare Tools on Debian 6 (squeeze)
July 17th, 2012 . by adminBefore install VMware Tools on Debian 6 you must install following packages:
# aptitude install gcc make linux-headers-$(uname -r)
Before install VMware Tools on Debian 6 you must install following packages:
# aptitude install gcc make linux-headers-$(uname -r)
Test Bonding on Debian(Lenny) using VMWare Workstation
First create a Linux(Debian) host with 3 NICs:
Power on ther virtual machine then run:
deb5:~# mii-tool SIOCGMIIPHY on 'eth0' failed: Operation not supported SIOCGMIIPHY on 'eth1' failed: Operation not supported SIOCGMIIPHY on 'eth2' failed: Operation not supported no MII interfaces found
TODO: load module e1000
deb5:~# lsmod | egrep 'pcnet32|vmxnet|e1000' vmxnet 18100 0
deb5:~# modprobe e1000 deb5:~# lsmod | egrep 'pcnet32|vmxnet|e1000' e1000 102656 0 vmxnet 18100 0
Add to file bonding.vmx:
.. ethernet0.present = "TRUE" ethernet0.virtualDev = "e1000" .. ethernet1.present = "TRUE" ethernet1.virtualDev = "e1000" .. ethernet2.present = "TRUE" ethernet2.virtualDev = "e1000" ..
Power on the client, run mii-tool
deb5:~# mii-tool eth0: negotiated 1000baseT-FD flow-control, link ok eth1: negotiated 1000baseT-FD flow-control, link ok eth2: negotiated 1000baseT-FD flow-control, link ok
First check and load kernel module bonding:
deb5:~# lsmod | grep bonding
also, kernel module bonding is not loaded. We want to load it
If nonding module exists
deb5:~# modprobe -l bonding /lib/modules/2.6.26-2-686/kernel/drivers/net/bonding/bonding.ko
Load it
deb5:~# modprobe bonding
Check if module bonding loaded?
deb5:~# lsmod | grep bonding bonding 69604 0
deb5:~# cat /proc/modules | grep bonding bonding 69604 0 - Live 0xf0bcb000
- On debian ifenslave must be installed
what is ifenslave?
ifenslave is a program to attach and detach slave network devices to a bonding device.
# apt-get install ifenslave-2.6
see: man ifenslave
Edit file /etc/modprobe.conf (Create if not exists)
alias bond0 bonding
options bonding mode=1 miimon=100
include /etc/modprobe.d/
How to read this:
- bond0 is a alias name for module bonding
- options for bonding/bond0 is: mode=1, miimon=100
- miimon: specifies the MII link monitoring frequency in milliseconds.
This determines how often the link state of each slave is inspected for link failures. A value of zero disables MII link monitoring. A value of 100 is a good starting point.
more see:
man modprobe.conf
modinfo bonding
Bonding parameter:
deb5:~# modinfo bonding
filename: /lib/modules/2.6.26-2-686/kernel/drivers/net/bonding/bonding.ko
author: Thomas Davis, tadavis@lbl.gov and many others
description: Ethernet Channel Bonding Driver, v3.2.5
version: 3.2.5
license: GPL
srcversion: 8020E5C15A155D4B4664A91
depends:
vermagic: 2.6.26-2-686 SMP mod_unload modversions 686
parm: max_bonds:Max number of bonded devices (int)
parm: miimon:Link check interval in milliseconds (int)
parm: updelay:Delay before considering link up, in milliseconds (int)
parm: downdelay:Delay before considering link down, in milliseconds (int)
parm: use_carrier:Use netif_carrier_ok (vs MII ioctls) in miimon; 0 for off, 1 for on (default) (int)
parm: mode:Mode of operation : 0 for balance-rr, 1 for active-backup, 2 for balance-xor, 3 for broadcast,
4 for 802.3ad, 5 for balance-tlb, 6 for balance-alb (charp)
parm: primary:Primary network device to use (charp)
parm: lacp_rate:LACPDU tx rate to request from 802.3ad partner (slow/fast) (charp)
parm: xmit_hash_policy:XOR hashing method: 0 for layer 2 (default), 1 for layer 3+4 (charp)
parm: arp_interval:arp interval in milliseconds (int)
parm: arp_ip_target:arp targets in n.n.n.n form (array of charp)
parm: arp_validate:validate src/dst of ARP probes: none (default), active, backup or all (charp)
parm: fail_over_mac:For active-backup, do not set all slaves to the same MAC. 0 of off (default), 1 for on. (int)
Edit file /etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.37.55
netmask 255.255.255.0
network 192.168.37.0
broadcast 192.168.37.255
gateway 192.168.37.2
auto bond0
iface bond0 inet static
address 192.168.1.25
netmask 255.255.255.0
network 192.168.1.0
gateway 192.168.1.1
up /sbin/ifenslave bond0 eth1 eth2
down /sbin/ifenslave -d bond0 eth1 eth2
Reboot or run:
/etc/init.d/networking restart
deb5:~# cat /proc/net/bonding/bond0 Ethernet Channel Bonding Driver: v3.2.5 (March 21, 2008) Bonding Mode: fault-tolerance (active-backup) Primary Slave: None Currently Active Slave: eth2 MII Status: up MII Polling Interval (ms): 100 Up Delay (ms): 0 Down Delay (ms): 0 Slave Interface: eth1 MII Status: up Link Failure Count: 0 Permanent HW addr: 00:0c:29:32:f5:02 Slave Interface: eth2 MII Status: up Link Failure Count: 0 Permanent HW addr: 00:0c:29:32:f5:0c
deb5:~# ifconfig bond0 Link encap:Ethernet HWaddr 00:0c:29:32:f5:02 inet addr:192.168.1.25 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe32:f502/64 Scope:Link UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1 RX packets:3 errors:0 dropped:0 overruns:0 frame:0 TX packets:7 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:556 (556.0 B) TX bytes:510 (510.0 B) eth0 Link encap:Ethernet HWaddr 00:0c:29:32:f5:f8 inet addr:192.168.37.55 Bcast:192.168.37.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe32:f5f8/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:5 errors:0 dropped:0 overruns:0 frame:0 TX packets:11 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:364 (364.0 B) TX bytes:814 (814.0 B) eth1 Link encap:Ethernet HWaddr 00:0c:29:32:f5:02 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 RX packets:2 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:308 (308.0 B) TX bytes:0 (0.0 B) eth2 Link encap:Ethernet HWaddr 00:0c:29:32:f5:02 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 RX packets:1 errors:0 dropped:0 overruns:0 frame:0 TX packets:7 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:248 (248.0 B) TX bytes:510 (510.0 B) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:14 errors:0 dropped:0 overruns:0 frame:0 TX packets:14 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:860 (860.0 B) TX bytes:860 (860.0 B)
Test bonding per Nagios check check_linux_bonding
Download check-linux-bonding_1.3.0-1_all.deb and install the package:
# dpkg -i check-linux-bonding_1.3.0-1_all.deb
| Test | |
|---|---|
| eth1 is active, eth2 is passiv |
deb5:~# /usr/lib/nagios/plugins/check_linux_bonding Interface bond0 is up: mode=1 (active-backup), 2 slaves: eth1!, eth2 |
| Switch eth2 to active |
deb5:~# ifenslave --change-active bond0 eth2 deb5:~# /usr/lib/nagios/plugins/check_linux_bonding Interface bond0 is up: mode=1 (active-backup), 2 slaves: eth1, eth2! |
| Down a NIC |
deb5:~# ifconfig eth1 down deb5:~# /usr/lib/nagios/plugins/check_linux_bonding Bonding interface bond0 [mode=1 (active-backup)]: Slave eth1 is down |
| Down 2 NICs |
deb5:~# ifconfig eth2 down deb5:~# /usr/lib/nagios/plugins/check_linux_bonding Bonding interface bond0 [mode=1 (active-backup)] is down |
| Up 2 NICs again |
deb5:~# ifconfig eth2 up deb5:~# ifconfig eth1 up deb5:~# /usr/lib/nagios/plugins/check_linux_bonding Interface bond0 is up: mode=1 (active-backup), 2 slaves: eth1, eth2! deb5:~# |
Which NIC is the active, which is passiv by mode=1?
# cat /etc/proc/bonding/bond0
Which bonding mode is running?
# cat /sys/class/net/bond0/bonding/mode
Switch other NIC active, exm eth2
# ifenslave --change-active bond0 eth2
motd – Message of the day
is the message that you will see when you first log into your shell either through ssh or on the machine
deb5:~# ls -l /etc/motd* lrwxrwxrwx 1 root root 13 2010-01-28 12:03 /etc/motd -> /var/run/motd -rw-r--r-- 1 root root 286 2010-01-28 12:03 /etc/motd.tail
/etc/motd is just a link to /var/run/motd and /var/run/motd is created in
/etc/init.d/bootmisc.sh
.. # Update motd 44 uname -snrvm > /var/run/motd 45 [ -f /etc/motd.tail ] && cat /etc/motd.tail >> /var/run/motd ...
Now make a test,
first backup motd.tail
# cp motd.tail motd.tail.bak
Overwrite file /etc/motd.tail with:
*******************************************************************************************
Welcome to SSH world!
Have a nice day!
*******************************************************************************************
Reboot or run this manual:
# uname -snrvm > /var/run/motd # [ -f /etc/motd.tail ] && cat /etc/motd.tail >> /var/run/motd
Test
deb5:~# ssh deb5
Linux deb5 2.6.26-2-686 #1 SMP Mon Aug 30 07:01:57 UTC 2010 i686
*******************************************************************************************
Welcome to SSH world!
Have a nice day!
*******************************************************************************************
Last login: Tue Nov 17 13:23:23 2010 from deb5.mydom.com
Voila!
Some data for test
hugo@deb5:~$ mkdir mydata hugo@deb5:~$ cd mydata hugo@deb5:~/mydata$ touch file1.txt hugo@deb5:~/mydata$ touch file2.txt hugo@deb5:~/mydata$ cd ..
hugo@deb5:~$ tar -cv -f mydata.tar /home/hugo/mydata tar: Removing leading /' from member names /home/hugo/mydata/ /home/hugo/mydata/file1.txt /home/hugo/mydata/file2.txt
This warning: Removing leading `/’ from member names appears when an absolute path is specified in tar command
Solution:
hugo@deb5:~$ tar -C / -cv -f mydata2.tar home/hugo/mydata home/hugo/mydata/ home/hugo/mydata/file1.txt home/hugo/mydata/file2.txt hugo@deb5:~$
The ‘–one-file-system’ option causes tar to modify its normal behavior in archiving the contents
of directories. If a file in a directory is not on the same file system as the directory itself,
then tar will NOT archive that file. If the file is a directory itself,
tar will not archive anything beneath it; in other words, tar will not cross mount points.
This option is useful for making full or incremental archival backups of a file system.
If this option is used in conjunction with ‘–verbose’ (‘-v’),
files that are excluded are mentioned by name on the standard error.
Exm:
Create some data for test:
hugo@deb5:~$ mkdir mydata hugo@deb5:~$ cd mydata hugo@deb5:~/mydata$ touch file1.txt hugo@deb5:~/mydata$ touch file2.txt hugo@deb5:~/mydata$ mkdir shares hugo@deb5:~/mydata$ sudo exportfs /forshares/d1/forshares/d2 hugo@deb5:~/mydata$ sudo mount deb5:/forshares/d1 shares
hugo@deb5:~/mydata$ ls -l shares total 8 -rw-r--r-- 1 root 0 3 2010-05-25 13:00 f1 -rw-rw-r-- 1 tim 1006 6 2010-05-25 14:35 f3 -rw-rw-r-- 1 bill 1007 0 2010-05-25 14:38 f4 -rw-rw-r-- 1 tim2 1008 0 2010-05-25 14:40 f5
shares is a subdirectory with in mydata but shares is not on the same file system as mydat, shares is a NFS mount point, now create a tar file of directory /mydata includes /mydata/shares
hugo@deb5:~$ tar -cv -f mydata_all.tar mydata mydata/ mydata/file1.txt mydata/file2.txt mydata/shares/ mydata/shares/f3 mydata/shares/f4 mydata/shares/f5 mydata/shares/f1
Result:
hugo@deb5:~$ tar -tv -f mydata_all.tar
drwxr-xr-x hugo/1000 0 2010-11-01 12:22 mydata/
-rw-r--r-- hugo/1000 0 2010-11-01 11:32 mydata/file1.txt
-rw-r--r-- hugo/1000 0 2010-11-01 11:32 mydata/file2.txt
drwxrwxrwx root/0 0 2010-05-25 14:40 mydata/shares/
-rw-rw-r-- tim/1006 6 2010-05-25 14:35 mydata/shares/f3
-rw-rw-r-- bill/1007 0 2010-05-25 14:38 mydata/shares/f4
-rw-rw-r-- tim2/1008 0 2010-05-25 14:40 mydata/shares/f5
-rw-r--r-- root/0 3 2010-05-25 13:00 mydata/shares/f1
now with –one-file-system
also create tar file of /mydata but not subdirectory shares within it
hugo@deb5:~$ tar -cv --one-file-system -f mydata_one_file_system.tar mydata mydata/ mydata/file1.txt mydata/file2.txt mydata/shares/ tar: mydata/shares/: file is on a different filesystem; not dumped
Result:
hugo@deb5:~$ tar -tv -f mydata_one_file_system.tar
drwxr-xr-x hugo/1000 0 2010-11-01 12:22 mydata/
-rw-r--r-- hugo/1000 0 2010-11-01 11:32 mydata/file1.txt
-rw-r--r-- hugo/1000 0 2010-11-01 11:32 mydata/file2.txt
drwxrwxrwx root/0 0 2010-05-25 14:40 mydata/shares/
Files f1,f3,f4,f5 in mydata/shares/ are NOT in tar file!
When run mii-tool on client Linux on VMWare Workstation:
hb1:~# mii-tool SIOCGMIIPHY on 'eth0' failed: Operation not supported no MII interfaces found
The situation:
VMware ESX Server supports the following virtual network devices:
- vlance – AMD Lance PCNet32 ethernet adapter
- e1000 – Intel e1000 ethernet adapter
- vmxnet – VMware high speed virtual ethernet adapter
see: http://www.sanbarrow.com/vmx/vmx-network.html
hb1:~# modinfo -d e1000 Intel(R) PRO/1000 Network Driver hb1:~# modinfo -d vmxnet VMware Virtual Ethernet driver hb1:~# modinfo -d pcnet32 Driver for PCnet32 and PCnetPCI based ethercards
Which modules are existing?
hb1:~# modprobe -l | egrep 'pcnet32|vmxnet|e1000' /lib/modules/2.6.26-2-686/misc/vmxnet3.ko /lib/modules/2.6.26-2-686/misc/vmxnet.ko /lib/modules/2.6.26-2-686/kernel/drivers/net/e1000e/e1000e.ko /lib/modules/2.6.26-2-686/kernel/drivers/net/e1000/e1000.ko /lib/modules/2.6.26-2-686/kernel/drivers/net/pcnet32.ko
Which modules are loaded?
hb1:~# lsmod | egrep 'pcnet32|vmxnet|e1000' vmxnet 18100 0
Only module vmxnet is loaded!
Now load module e1000:
hb1:~# modprobe e1000 hb1:~# lsmod | egrep 'pcnet32|vmxnet|e1000' e1000 102656 0 vmxnet 18100 0
Shutdown guest machine, open file virtualmachinename.vmx per notepad edit:
under line ethernet0.present = "TRUE"
ethernet0.virtualDev = "e1000"
and do it for all NICs ethernet[0]…ethernet[n]
Power on the Linux client, run mii-tool and ethtool again:
hb1:~# mii-tool eth0: negotiated 1000baseT-FD flow-control, link ok
hb1:~# ethtool eth0 Settings for eth0: Supported ports: [ TP ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Supports auto-negotiation: Yes Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Advertised auto-negotiation: Yes Speed: 1000Mb/s Duplex: Full Port: Twisted Pair PHYAD: 0 Transceiver: internal Auto-negotiation: on Supports Wake-on: d Wake-on: d Current message level: 0x00000007 (7) Link detected: yes
Structur of file /etc/drbd.conf
global {}
common {}
resource res-0 {}
..
..
resource ress-n{}
where resource is:
resource name {
on {}
on {}
startup {}
syncer {}
handlers {}
net {}
disk {}
protocol {}
}
Each resource section needs:
- 2 on host sections
- May have a startup, syncer, handlers, net, disk.
- Required parameter in this section: protocol.
where:
on alf {
device /dev/drbd0;
disk /dev/hdc5;
address 192.168.22.12:7788;
meta-disk internal;
#or meta-disk /dev/sdbx[idx];
}
startup {
wfc-timeout
degr-wfc-timeout
wait-after-sb
become-primary-on both
}
syncer {
rate, after, al-extents
}
handlers {
pri-on-incon-degr
pri-lost-after-sb
pri-lost
outdate-peer
local-io-error
split-brain
}
net {
sndbuf-size, timeout, connect-int, ping-int, ping-timeout, max-buffers,
max-epoch-size, ko-count, allow-two-primaries, cram-hmac-alg, shared-secret,
after-sb-0pri, after-sb-1pri, after-sb-2pri
}
disk {
on-io-error, size, fencing, use-bmbv,
no-disk-flushes, no-md-flushes
}
protocol { A | B | C }
Parameters:
pri-on-incon-degr: primary on inconsistent data, degraded(cluster with only one node left)
pri-lost-after-sb: primary lost after split brain
wfc-timeout: wait for connection timout
degr-wfc-timeout: degraded wait for connection timout
rate: on 100Mbit ethernet, you cannot expect more than 12.5 MByte
after-sb-0pri: after split brain zero(no) node is primary
after-sb-1pri: after split brain one node is primary, other is secondary
after-sb-2pri: : after split brain two node are primary
for more see:
man drbd.conf
man drbdsetup
less /etc/drbd.conf
On my test cluster with heartbeat, drbd, nfs when i try to awitch a node goto standby, also i run:
deb5:~# /usr/lib/heartbeat/hb_standby 2010/10/20_14:36:25 Going standby [all].
It work not! The node do a reboot!
The log file /var/log/ha-log show:
heartbeat[4710]: 2010/10/20_14:36:26 info: deb5 wants to go standby [all] heartbeat[4710]: 2010/10/20_14:36:26 info: standby: deb6 can take our all resources heartbeat[5813]: 2010/10/20_14:36:26 info: give up all HA resources (standby). ResourceManager[5826]: 2010/10/20_14:36:26 info: Releasing resource group: deb5 IPaddr::192.168.37.11/24/eth0 drbddisk::res0 Filesystem::/dev/drbd0::/mydata::ext3 nfs-kernel-server ResourceManager[5826]: 2010/10/20_14:36:26 info: Running /etc/init.d/nfs-kernel-server stop ResourceManager[5826]: 2010/10/20_14:36:26 info: Running /etc/ha.d/resource.d/Filesystem /dev/drbd0 /mydata ext3 stop Filesystem[5900]: 2010/10/20_14:36:26 INFO: Running stop for /dev/drbd0 on /mydata Filesystem[5900]: 2010/10/20_14:36:26 INFO: Trying to unmount /mydata Filesystem[5900]: 2010/10/20_14:36:26 ERROR: Couldn't unmount /mydata;trying cleanup with SIGTERM Filesystem[5900]: 2010/10/20_14:36:26 INFO: No processes on /mydata were signalled Filesystem[5900]: 2010/10/20_14:36:27 ERROR: Couldn't unmount /mydata;trying cleanup with SIGTERM Filesystem[5900]: 2010/10/20_14:36:27 INFO: No processes on /mydata were signalled Filesystem[5900]: 2010/10/20_14:36:28 ERROR: Couldn't unmount /mydata;trying cleanup with SIGTERM Filesystem[5900]: 2010/10/20_14:36:28 INFO: No processes on /mydata were signalled Filesystem[5900]: 2010/10/20_14:36:29 ERROR: Couldn't unmount /mydata; trying cleanup with SIGKILL Filesystem[5900]: 2010/10/20_14:36:29 INFO: No processes on /mydata were signalled Filesystem[5900]: 2010/10/20_14:36:30 ERROR: Couldn't unmount /mydata;trying cleanup with SIGKILL Filesystem[5900]: 2010/10/20_14:36:31 INFO: No processes on /mydata were signalled Filesystem[5900]: 2010/10/20_14:36:32 ERROR: Couldn't unmount /mydata;trying cleanup with SIGKILL Filesystem[5900]: 2010/10/20_14:36:32 INFO: No processes on /mydata were signalled Filesystem[5900]: 2010/10/20_14:36:33 ERROR: Couldn't unmount /mydata, giving up! Filesystem[5889]: 2010/10/20_14:36:33 ERROR: Generic error
Problem: Also here heartbeat try to stop resource, it has problem when unmount ans stop daemon nfsd
After long search on the web i find this:
http://www.linux-ha.org/HaNFS
see: Hint 3
For my environment (Debian) i try this:
# vi /etc/init.d/nfs-kernel-server
stop)
log_daemon_msg "Stopping $DESC"
log_progress_msg "mountd"
start-stop-daemon --stop --oknodo --quiet \
--name rpc.mountd --user 0
if [ $? != 0 ]; then
log_end_msg $?
exit $?
fi
if [ "$NEED_SVCGSSD" = "yes" ]; then
log_progress_msg "svcgssd"
start-stop-daemon --stop --oknodo --quiet \
--name rpc.svcgssd --user 0
if [ $? != 0 ]; then
log_end_msg $?
exit $?
fi
fi
log_progress_msg "nfsd"
start-stop-daemon --stop --oknodo --quiet \
--name nfsd --user 0 --signal 9
if [ $? != 0 ]; then
log_end_msg $?
exit $?
fi
..and it works!
I can now switch a node(per hb_standby/hb_takeover) from active to passive and vice versa!
hb1:~# cat /proc/drbd version: 8.0.14 (api:86/proto:86) GIT-hash: bb447522fc9a87d0069b7e14f0234911ebdab0f7 build by phil@fat-tyre, 2008-11-12 16:40:33 0: cs:Connected st:Primary/Secondary ds:UpToDate/UpToDate C r--- ns:104 nr:0 dw:104 dr:157 al:5 bm:0 lo:0 pe:0 ua:0 ap:0 resync: used:0/61 hits:0 misses:0 starving:0 dirty:0 changed:0 act_log: used:0/257 hits:21 misses:5 starving:0 dirty:0 changed:5
cs: Connection State(WFConnection, StandAlone, Connected..)
st: (state prios 8.3; is equal ro:)
ro: Role of (local node /partner)
ds: Disk State(UpToDate, DUnknown..)
ns: Network Send
nr: Network Receive