Friday, May 29, 2015

ubuntu 14 on raspberry pi

I used a class 4 32gb miniSD card.
I used a Mac to load the image onto the SD card
The ubuntu image is here:
ubuntu 14 download: Download 2015-04-06-ubuntu-trusty.zip

the link can also be found here: https://wiki.ubuntu.com/ARM/RaspberryPi


Here is where I got the steps to format the SD card
https://www.raspberrypi.org/documentation/installation/installing-images/mac.md
I used their command line instructions
(https://www.raspberrypi.org/documentation/installation/installing-images/README.md they have walkthroughs for Windows and Linux also)

    diskutil list

    Identify the disk (not partition) of your SD card e.g. disk4 (not disk4s1):

    diskutil unmountDisk /dev/<disk# from diskutil>

    e.g. diskutil unmountDisk /dev/disk4

    sudo dd bs=1m if=image.img of=/dev/<disk# from diskutil>

    e.g. sudo dd bs=1m if=2015-05-05-raspbian-wheezy.img of=/dev/disk4

This may result in an dd: invalid number '1m' error if you have GNU coreutils installed. In that case you need to use 1M:

    sudo dd bs=1M if=image.img of=/dev/<disk# from diskutil>

This will take a few minutes.

where it says "if=image.img" you have to put the full path of the image.  I'm typically a windows user, so I'm used to doing c:/users/etc.  With mac it's similar, I had the image in my downloads folder, and the path is /Users/(username)/Downloads/(folder name for image)/(imagename.img)

After 'bs=" that is a 1(one)m.  I thought it was an L and kept getting errors.

"this will take a few minutes" is putting it lightly.  I have a new mac with an i5 and it took 15-20 minutes.  But being a class 4 SD probably slowed it down a bunch.


hit control+t to see the status of the transfer.


So when this is done, I put the card in my Pi and plugged it in.  Logged into ubuntu with the defaults (ubuntu/ubuntu for the user/pass) and was left at a command line.  Startx didn't do anything.  I bashed my head against the wall for the better part of a day trying to figure out why I kept running out of space, then returned to the original ubuntu wiki and found they had directions for exactly this kind of scenario.


Plug in the raspberry pi, log in (ubuntu/ubuntu)

$ sudo fdisk /dev/mmcblk0

Delete the partition by typing: d (enter) 2 (enter)

Recreate partition by typing: n (enter) p (enter) 2 (enter) (enter) (enter)

Write to disk by typing: w (enter)

press ctrl+alt+del to reboot the system

log back in (ubuntu/ubuntu)

on the wiki.ubuntu site, it says to run this:

sudo resize2fs /dev/mmcblk0p2

to resize the partition, when I ran it the directory wasn't found...

type:

lsblk

to see your partitions and their paths.  My p2 took up the rest of my card.  So I continued on creating the swap file, which wants to be 2gb.

sudo apt-get install dphys-swapfile

This failed because I ran out of disk space... so I re ran the

sudo resize2fs /dev/mmcblk0p2

And it completed successfully. Ive been known to mistype paths, which probably happened when I originally ran resize2fs.
After it finished, I tried to rerun the dphys-swapfile but terminal told me to run:


sudo dpkg --configure -a

Then I was finally able to install ubuntu desktop

sudo apt-get install lubuntu-desktop


After that, ubuntu was running.

But it was TERRIBLY slow.

I ran a slight overclock by editing the config.txt file per this website:

http://haydenjames.io/raspberry-pi-2-overclock/

In System Tools select UXterm or Xterm to get into Terminal
or hit ctrl+alt+T
type

sudo nano /boot/config.txt

At the bottom is a preloaded arm_freq option, I added the following

arm_freq=1000
sdram_freq=500
core_freq=500
over_voltage=2
gpu_mem=512
ctrl+O
ctrl+X


Close terminal and shutdown/reboot

Changing the arm_freq speeds up boot considerably,  The other settings help, but don't do much it seems.

Remember, you only have a 1gb of memory, streaming video like youtube is pretty painful, but if you let it buffer a bit it works fine.  Unless you go full screen...


*************************notes relating to not following directions************************

have to install the desktop for ubuntu.

First type: sudo apt-get update

Then type: sudo apt-get install ubuntu-desktop

Again, this process takes a while (probably due to my class 4 card, but whatever, it was 10 bucks)


At this point I kept running out of disk space.  The previous process formatted 1.8gb of the 32gig card.

so I ran this instead

sudo dd bs=1m if=2015-05-05-raspbian-wheezy.img of=/dev/rdisk3


which ran a lot faster than the previous method.

startx still didn't do anything

it told me to run:

sudo apt-get install xinit

this quickly ran and I got to a white terminal... nothing else.


formatted the SD card with Mac's Disk Utility.

Back in Terminal:

sudo diskutil unmountdisk disk1

sudo dd bs=1m if=/Users/(username)/Downloads/(folder containing image)/(image.img) of=/dev/rdisk1


again, using rdisk instead of disk made it go much faster.


on raspberry:

sudo apt-get update

sudo apt-get install build-essential

sudo apt-get install ubuntu-desktop


still not big enough, ran out of disk space


format, reload (rinse/repeat number 5 now.)

sudo apt-get update

sudo parted -l

get the device name for:

sudo fdisk /(devicename)

n for new partition

e for extended

enter defaults

sudo reboot

sudo parted -l

you will see a third partition using the rest of the disk space

sudo apt-get updated

sudo apt-get install build-essential

sudo apt-get install ubuntu-desktop


after following instructions on the first link...

sudo apt-get update

sudo apt-get install ubuntu-desktop

sudo apt-get install xinit

ubuntu loaded after a restart, unable to login

sudo apt-get remove xinit

sudo apt-get clean ubuntu-desktop

sudo apt-get remove ubuntu-desktop

sudo apt-get install ubuntu-desktop

sudo apt-get install ubuntu-desktop

Wednesday, May 27, 2015

DNS not routing to forwarder in Forward Lookup Zones

I recently had an instance where the server name contained dashes only.
I configured an lookup zone and A record like I do with many other sites, but this one wouldn't work.
Ping name-name couldn't be found.

After some Googling, I determined DNS was seeing the name as a single label name.
I also found out WINS used to handle situations like this (no running WINS server on my network)
But Microsoft offers a solution for server 2008 and above called GlobalNames

I will put the scripts I ran in Powershell here, at the bottom are the pages I pulled the information from, their pages contain GUI instructions.

dnscmd servername /config /Enableglobalnamessupport 1 (you will do this step on all servers running DNS, cool thing about powershell is you can do it all from this one prompt, just up arrow, change the server name and hit enter.)
dnscmd servername /ZoneAdd GlobalNames /DsPrimary /DP /forest

At this point you can go into your DNS manager GUI (Start>Admin tools>DNS) go to your Forward Lookup Zone and find GlobalNames.
Right Click
New Host (A or AAA)
Enter the name (it will show up name.globalnames)
Enter IP address (remove checkmark in create associated pointer (PTR) record)

done.

I had to flush dns (ipconfig /flushdns) and I reran the 'enableglobalnamessupport 1' on a couple servers running DNS after creating the A record.

Monday, May 11, 2015

Restart services the easy way and without end user interaction

Occasionally I've had to do a full ip release and renew to get things working again.  When I'm remoted in I've done the ipconfig /release and had to have the end use type in ipconfig /renew.
There's been a 'solution' to my 'problem' all along:
ipconfig /release && ipconfig /renew

This will release the IP and renew the IP once the previous command completes.

This will also work if you have to do something like restart a spooler
net stop spooler && net start spooler

Or any other services that you have to stop start rather than just restart.

Getting RTL8812au passed to Virtualbox VM (Ubuntu)

There are no guarantees, I just write these notes so I can come back to them. First, get the dongle working on the host OS. After going thro...