XenServer 6.2: Fix Unrecognized LVM Volume on Boot

Tags: May 18, 2014 6:44 PM
0 comments

Default Xenserver 6.2 root partition is 4GiB that's very small. So I want to separate the /tmp and swap to other partition in this case a LVM volume. The bad news is LVM volumes does not activate on boot. So entries in /etc/fstab which relies on LVM would fail and the boot process got stuck since the system would try to do some file system checking on every partition listed.

Activate LVM on Boot on XenServer 6.2

To activate on boot we need to make small modification to file /etc/rc.sysinit around line 487 to 489. Take a look into these lines:
#if [ -x /sbin/lvm.static ]; then
# action $"Setting up Logical Volume Management:" /sbin/lvm.static vgchange -a y --ignorelockingfailure
#fi
That's the problem, the lines which activate the LVM volume is commented. That's why we ended up with the problem. Now just uncomment those lines and save the file. But make sure you made a copy of it. Reboot the server and all LVM volumes should be detected on boot. Here's an example of my XenServer custom partition scheme:
LABEL=root-mterkkri    /         ext3     defaults   1  1
#/var/swap/swap.001          swap      swap   defaults   0  0
none        /dev/pts  devpts defaults   0  0
none        /dev/shm  tmpfs  defaults   0  0
none        /proc     proc   defaults   0  0
none        /sys      sysfs  defaults   0  0
/opt/xensource/packages/iso/XenCenter.iso   /var/xen/xc-install   iso9660   loop,ro   0  0

/dev/mapper/VG--XEN01-Dom0--TMP /tmp ext2 defaults,noexec,nosuid,nodev 1 2
/dev/mapper/VG--XEN01-Dom0--SWAP swap swap defaults 0 0

/tmp /var/tmp   none rw,noexec,nosuid,nodev,bind 1 2

Share on Facebook Twitter

Switching USB Modem to Serial Manually

Tags: May 12, 2014 3:56 AM
0 comments

Without having to use usb-modeswitch switching the USB modem can be done easily. In this example I use USB CDMA modem with vendor ID 201e and product ID 1023 (when detected as CD-ROM storage) and product ID 1022 (when detected as USB modem or USB storage).

Requirements

Most of these module are present in all modern linux distro.
  • Kernel module: option (USB Driver for GSM modems)
  • Kernel module: usbserial (USB Serial Driver core)

Step 1: Detach the CD-ROM Storage

When you first plug your USB modem it might detected as CD-ROM storage. To identify the modem you can use dmesg and lsusb commands. Make sure running these commands as root.

Share on Facebook Twitter

Ubuntu TP-Link TL-WN723N Ad-Hoc Network

Tags: May 11, 2014 3:20 PM
0 comments

The Wifi ad-hoc network configuration that will be created for this task are composed from the following devices:

  1. Computer A (TP-Link TL-WN723N) IP: 192.168.1.25/29
  2. Computer B (Other Wireless) IP: 192.168.1.26/29

Step by Step Ad-Hoc Configuration

This is important, the Computer B should be configured first followed by Computer A. It might not work if configured using opposite order. Bug: https://github.com/lwfinger/rtl8188eu/issues/4

Share on Facebook Twitter

Ubuntu Linux TP-Link TL-WN723N Driver

Tags: May 9, 2014 11:18 PM
0 comments

Update

The more recent driver for TP-Link TL-WN723N can be found on https://github.com/lwfinger/rtl8188eu. This new driver address problem for kernel 3.8+. Do not forget to copy the firmware file rtl8188eufw.bin to /lib/firmware/rtlwifi/. Failed to do so, you might can not bring the device up.

 

I just bought a nano wireless adapter from TP-Link, the TL-WN723N. But my Xubuntu 12.04 did not recognize it, well that sucks. But thanks to this guy he made the driver for it: https://github.com/gleb-chipiga/rtl8188eu.

Driver Installation

Make sure the compiler and git already installed on the system.
$ mkdir -p /tmp/tp-link && cd /tmp/tp-link
$ git clone https://github.com/gleb-chipiga/rtl8188eu
$ cd rtl8188eu
$ make
$ CURRENT_KERNEL=$( uname -r )
$ sudo cp 8188eu.ko /lib/modules/$CURRENT_KERNEL/kernel/drivers/net/wireless/
$ sudo depmod -a
$ sudo modprobe 8188eu
$ ip link show
The wireless adapter should be detected, no need to reboot.

References

Share on Facebook Twitter

Bash Trim Whitespace

Tags: May 2, 2014 10:45 AM
1 comments

To remove leading and trailing whitespace from a subset of strings in a shell we can use sed.

$ echo '   #FOO#   ' | sed -e 's/\s*$//' -e 's/^\s*//'
#FOO#

Function 'trim'

To reuse it in another place, it is good idea to wrap it as a function.
# Function to trim leading and trailing spaces
trim() {
  # Accept input from argument or STDIN
  # So you can do both:
  # $ echo '  #FOO#   ' | trim
  # or
  # $ trim '   #FOO#   '
  local STRING=$( [ ! -z "$1" ] && echo $1 || cat ; )
  
  echo "$STRING" | sed -e 's/^\s*//' -e 's/\s*$//'
}
Now it can be used to trim a string both from argument or standard input.
$ echo '   #FOO#   ' | trim
#FOO#

$ trim '   #FOO#   '
#FOO#

Reference

Share on Facebook Twitter