Wednesday, March 12, 2014

How to change your password when you are in RDP session

Press Ctrl-Alt-End to change your password.

[∞]

How to fast login to a domain Windows 7 machine with local user account

When a Windows 7 machine has joined a domain, try to login as a local user account becomes a pain since you have to type the full machine name with your local username in order to use your local account. You can type .\<local username> in the username input field. This will save you the time to type the computer name.

[∞]

Monday, March 10, 2014

How to run Clonezilla on MacBook Air 2013 model

Clonezilla is an awesome imaging tool for cloning and deploying images for massive amount of computers especially with multicast enabled by your network administrator. Unfortunately most of the cool features are not supported by the latest model of MacBook Air 2013 since there is no Ethernet port or build-in CD/DVD drive anymore.

At the beginning, I thought IPXE is a good solution to boot a MBA and connect to our existing Clonezilla server but it failed. I can't even get the MBA boot into IPXE shell via the USB thumb drive.

So I change my focus on Clonezilla Live since it is a full operating system and I should be able to do more tweaks. Follow the instruction of Clonezilla Live on USB to create a bootable thumb drive. Personally I prefer to use Universal-USB-Installer to create the start up USB drive.

Here is the tools and versions used by me:
1. Clonezilla Live alternative stable releases - 20140114-saucy since Ubuntu is more new hardware friendly OS
2. Universal USB Installer 1.9.5.2

Boot the MBA via the Clonezilla Live USB and everything is running good, except the familiar Clonezilla interface is not showing up but the normal command login shell is provided. Use the Clonezilla default username "user" and password "live" to login.

Here comes the fun part, the MBA 2013 (MacBook Air 6,2) only comes with Broadcom BCM4360 802.11ac wireless network card which unfortunately can not be used without install the kernel patch bcmwl-kernel-source.

user@saucy:~$sudo bash
root@saucy:~#lshw -C network
  *-network UNCLAIMED
      description: Network controller
      product: BCM4360 802.11ac Wireless Network Adapter
      vendor: Broadcom Corporation
      physical id: 0
      bus info: pci@0000:03:00.0
      version: 03
      width: 64 bits
      clock: 33MHz
      capabilities: pm msi pciexpress bus_master cap_list
      configuration: latency=0
      resources: memory:b0600000-b0607fff memory:b0400000-b05fffff

How can we install the patch without working network connection? The only solution I figured out is to use another machine with Ethernet port (because this blog doesn't exist yet :D). Boot the machine with Ethernet port by the Clonezilla Live USB (make sure you choose the option "Clonezilla live (To RAM, boot media can be removed later)" from the GRUB menu), enter the command shell and run (please ignore the network interfaces changes or change the options if your network card is recognized and automatically ):

user@saucy:~$sudo bash
root@saucy:~#echo "auto eth0" >> /etc/network/interfaces
root@saucy:~#echo "iface eth0 inet dhcp" >> /etc/network/interfaces
root@saucy:~#service networking restart
root@saucy:~#apt-get install -d bcmwl-kernel-source
root@saucy:~#uname -a
linux saucy 3.11.0-15-generic #23-Ubuntu SMP Mon Dec 9 18:17:04 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
root@saucy:~#apt-get install -d linux-headers-3.11.0-15-generic

You need download the proper version of linux headers according to your Clonezilla Live kernel's version (in my case is 3.11.0-15). The option "-d" will download all the dependencies packages to "/var/cache/apt/archives/" instead of install them. Copy all the files from the cache folder to your USB drive. I will save all the files under the same thumb drive of Clonezilla Live USB

root@saucy:~#mkdir /mnt/pen
root@saucy:~#cd /mnt/pen
root@saucy:~#mount /dev/sdb1 /mnt/pen
root@saucy:~#mkdir apt-get
root@saucy:~#cp -p /var/cache/apt/archives/* /mnt/pen/apt-get/

Please change the "/dev/sdb1" to your proper device label, you can find out the path by

root@saucy:~#ls -l /dev/disk/by-label/
total 0
lrwxrwxrwx 1 root root 10 Mar 10 05:12 EFI -> ../../sda1
lrwxrwxrwx 1 root root 10 Mar 10 05:12 Macintosh\x20HD -> ../../sda2
lrwxrwxrwx 1 root root 10 Mar 10 05:12 PENDRIVE -> ../../sdb1
lrwxrwxrwx 1 root root 10 Mar 10 05:12 Recovery\x20HD -> ../../sda3

If you received the error message about device is busy which means you didn't choose boot Clonezilla live to RAM. Of cause you can save the files into another USB drive but that just adds more complexities.

I have compressed all the packages into one and you can download it from
https://drive.google.com/file/d/0B9J1-nOckLvcOUhmTU1BQ0lyNFk/edit?usp=sharing

bcmwl-kernel-source_6.30.223.141+bdcom-0ubuntu1_amd64.deb
cpp_4%3a4.8.1-2ubuntu3_amd64.deb
cpp-4.8_4.8.1-10ubuntu9_amd64.deb
dkms_2.2.0.3-1.1ubuntu4_all.deb
gcc_4%3a4.8.1-2ubuntu3_amd64.deb
gcc-4.8_4.8.1-10ubuntu9_amd64.deb
libasan0_4.8.1-10ubuntu9_amd64.deb
libatomic1_4.8.1-10ubuntu9_amd64.deb
libc6-dev_2.17-93ubuntu4_amd64.deb
libc-dev-bin_2.17-93ubuntu4_amd64.deb
libcloog-isl4_0.18.0-2_amd64.deb
libgcc-4.8-dev_4.8.1-10ubuntu9_amd64.deb
libgmp10_2%3a5.1.2+dfsg-2ubuntu1_amd64.deb
libisl10_0.11.2-1_amd64.deb
libitm1_4.8.1-10ubuntu9_amd64.deb
libmpc3_1.0.1-1_amd64.deb
libmpfr4_3.1.1-2_amd64.deb
libquadmath0_4.8.1-10ubuntu9_amd64.deb
libtsan0_4.8.1-10ubuntu9_amd64.deb
linux-headers-3.11.0-15_3.11.0-15.25_all.deb
linux-headers-3.11.0-15-generic_3.11.0-15.25_amd64.deb
linux-libc-dev_3.11.0-18.32_amd64.deb
make_3.81-8.2ubuntu3_amd64.deb

Now we need work out the proper installing order of all these packages, here is the bash script used by me to install all the packages:

#!/bin/bash
#bcmwl-kernel-source cpp cpp-4.8 dkms gcc gcc-4.8 libasan0 libatomic1 libc-dev-bin libc6-dev libcloog-isl4 libgcc-4.8-dev libgmp10 libisl10 libitm1 libmpc3 libmpfr4 libquadmath0 libtsan0 linux-libc-dev make

dpkg -i linux-headers-*.deb
dpkg -i make_3.81-8.2ubuntu3_amd64.deb
dpkg -i linux-libc-dev_3.11.0-18.32_amd64.deb
dpkg -i libtsan0_4.8.1-10ubuntu9_amd64.deb
dpkg -i libquadmath0_4.8.1-10ubuntu9_amd64.deb
dpkg -i libgmp10_*.deb
dpkg -i libmpfr4_3.1.1-2_amd64.deb
dpkg -i libmpc3*.deb
dpkg -i libitm1*.deb
dpkg -i libisl10*.deb
dpkg -i libatomic1*.deb
dpkg -i libasan0*.deb
dpkg -i libgcc-4.8-dev*.deb
dpkg -i libcloog-isl4*.deb
dpkg -i libc-dev-bin*.deb
dpkg -i libc6-dev*.deb
dpkg -i cpp-4.8*.deb
dpkg -i gcc-4.8*.deb
dpkg -i cpp*.deb
dpkg -i gcc*.deb
dpkg -i dkms*.deb
dpkg -i bcmwl-kernel-source*.deb

Roughly reverse the installation order prompted by apt-get will do the job. Now we can see the wireless card is recognized by Ubuntu:

root@saucy:~#lshw -C network
  *-network
      description: Wireless interface
      product: BCM4360 802.11ac Wireless Network Adapter
      vendor: Broadcom Corporation
      physical id: 0
      bus info: pci@0000:03:00.0
      logical name: eth0
      version: 03
      width: 64 bits
      clock: 33MHz
      capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
      configuration: broadcast=yes driver=wl0 driverversion=6.30.223.141 (r415941)ip= latency=0 multicast=yes wireless=IEEE 802.11abg
      resources: irq:18 memory:b0600000-b0607fff memory:b0400000-b05fffff

The new driver gives the adapter a confusing logical name "eth0" but this will not affect us to use it as we need. Change the network configuration file "/etc/network/interfaces" to following:

auto eth0
iface eth0 inet dhcp
wpa-driver wext
wpa-ssid eduroam
wpa-ap-scan 1
wpa-eap PEAP
wpa-key-mgmt WPA-EAP
wpa-identity <your user name>
wpa-password <your password>
wpa-phase2 auth=MSCHAPV2

I'm testing the imaging mechanism via "eduroam" wireless network which is very common among universities with WPA2 Enterprise security settings. A very good reference of all the settings for Ubuntu Wireless Security can be found here http://ubuntuforums.org/showthread.php?t=318539.

Now we can start Clonezilla Live interface by running:

root@saucy:~#export CURRENT_TTY='/dev/tty1'
root@saucy:~#ocs-live-general

For some reasons, Clonezilla Live cannot set CURRENT_TTY properly and start up normally, therefore, we need manually export the CURRENT_TTY with value "/dev/tty1" in order to bring up the GUI interface.

I hope this blog can save others sometime of googling and scratching head as I have been :D, enjoy.

[∞]