14 junio 2013

Elementary OS (& XBMC) en Intel NUC (Celeron)


Installation of Elementary OS on Intel NUC (Celeron)




This is a note reminder for myself regarding installation of Linux (Elementary OS) on Intel NUC, on USB flash stick. I'll share in case it is useful for anyone. There are lots of tutorials for using a Live USB, but none on using a target USB stick.
This is the same thing accomplished by OpenELEC when installing on target USB, but using a different approach and a full distro.


So, please notice  ---- this is NOT A LIVE INSTALLATION on stick ---, but a USB flash stick replacement of SSD HD. My purpose was to avoid using a SSD inside the NUC for budget and also thermal considerations.

So, NO INTERNAL HD on the NUC (no mSATA SSD, I mean, as is the only model which can be used on the equipment). The OS gets installed on the USB stick.




Hardware considerations:

We will use two USB sticks. One for the Live Installer, and one as the target system (the one that will behave as target hard disk). In my case I choosed any USB stick bigger than 2 GB for the Live install and a new 16GB Toshiba Transmemory USB Flash Drive for the target system. Why this Toshiba ? Because it was on sell on the store and seems a decent hardware (Write Speed: up to 7 MBytes/s, Read Speed: up to 17 MBytes/s). Brand doesn't matter, but don't buy the cheaper one, as write speeds use to be awful on the cheapest sticks. Also, don't use the "micro" type as they behave worse.

For 10 EUR, this was OK:

http://www.amazon.com/Toshiba-Transmemory-Flash-Drive-THNU48N16GTRT/dp/B007SRLF5C/


16 GB is ok. With only 8 GB, your media collection metadata can fill the USB disk fast. Also keep in mind 3,5 GB for the OS and 2 GB for swap space. So, go for the 16 GB stick. Best EUR/GB ratio. 32 GB are still expensive in comparison.


BUT, these modern USB sticks are "GPT" formatted, and not "DOS" formatted. This avoids booting NUC from it, so after installing sucessfully, you WON'T BOOT to your system !!! There's a workaround for this.





Steps:


0.- Using an existing system, destroy the target USB stick partitions, and label the TOC with the parted option "mklabel", as to get a "MSDOS" TOC instead of the original "GPT" TOC.

# sudo parted /dev/sdb
(parted) mklabel msdos


1.- Create a Live USB stick based on your favourite distro on the "crap" stick. This case, Elementary OS daily build, 64 bit ( elementaryos-beta2-amd64.20130506.iso ). You can find hundreds of easy tutorials for this task. I went the "unetbootin" way.


2.- Insert LIVE USB and boot NUC from this USB stick. Choose "Install Elementary OS".

3.- Partition the destination USB stick with the Custom/Advanced Option. Create a swap area and in the remaining space, create a ext4 partition. In my case, I choose to only have a 2 GB swap area although my system sports 4 GB RAM.


4.- Do a regular installation on the USB stick target.


5.- The tricky part:

After the installation, the bootloader does not get installed on the target stick, so, our system won't boot from it. We need to install the boot loader manually for this to happen, so, when the Elementary OS installer finally ends, DO NOT REBOOT YOUR SYSTEM:


- Maintain the "Reboot installer prompt" and get a root console using ALT+F2; from there, issue the following commands:


# sudo grub-install --boot-directory=/mnt/boot/ --recheck /dev/sdb

being /mnt/boot/ the directory where the Elementary kernel was copied; please note the /mnt directory, as we are still in LiveCD mode for we haven't rebooted after install.

/dev/sdb is the USB target stick device.

Please, take care of your device names, as you may have sdb, sdc, ... whatever, as you are using two usb sticks. If you fail to get this procedure ok, you can try again without reinstalling, using a different installed PC. Just take care with the naming and paths. This is the trickyest part, but it is a logical matter, more than a technical one. Your computer assigns name according to the order you plug them.


After installing the bootloader on USB stick, check/correct it's config file for your settings:


# sudo vi /mnt/boot/grub/grub.cfg

Look for "--set=root ...." directives inside grub.cfg and change them according to your USB stick universal naming.
You will find some lines such as:

 linux   /boot/vmlinuz-3.2.0-44-generic-pae root=UUID=5c7f2f52-08e1-4aa1-8558-34a9355957db

 Just make sure the long UUID number is the one belonging to your USB target stick. This is a universal unique name, so it should be easy. For knowing your devices' universal naming (UUID), issue:

# blkid /dev/sda (your HD if using an already installed PC)
# blkid /dev/sdb




Final thoughts:

- Writes are slow; operation such as regular os updates (apt-get) take a bit longer because of writes to USB memory, but everyday work such as XBMC, casual browsing and so on, maintain a very decent speed as don't usually involve heavy write operations.

- Reads are fast enough. Complete desktop boot on 70 seconds.


- My media contents are stored on a WiFi HD (Apple TimeCapsule) and offered to XBMC via a smbfs/cifs mount on /etc/fstab). No media contents are stored on the USB stick. Just the OS and XBMC metadata.


Elementary Desktop on Intel NUC


07 febrero 2013

Educación mal entendida

Entra en el vagón un hombre ciego de unos 60 años. Sin problema alguno cruza el espacio hasta la puerta del lado contrario y allí se apoya. Tras unos segundos, un joven le ofrece su asiento, el cual rechaza. Dos estaciones mas tarde, una mujer sentada le agarra por el brazo y le intenta ofrecer el suyo. El hombre también lo rechaza. Ser ciego no implica estar cansado ni tener falta de criterio.

Duda metafísica

¿Estarán vivos mañana todos los viajeros de este Metro ? ¿Y yo?

Ya no hay maneras

Un rockabilly con smartphone ??!
No me jodas, eso es una mala señal, malísima.

05 febrero 2013

Casualidades I

De nuevo en el Metro. Una joven pareja china pasa a mi lado en el andén. Llega el tren. Ellos entran por un extremo de un vagón y yo por el otro. Llego un segundo antes que ellos a los tres asientos libres que quedan. Les cedo los que están juntos y me siento en el tercero. Me fijo que el chaval chino, ya sentado frente a mí, lleva un vaso de papel con tapa de los que se usan para café. Lo curioso es que es la primera vez que yo entro con un vaso de esos en el Metro. Mas curioso es que voy escuchando música tradicional china.
Un revisor llega junto a sus asientos y abre una trampilla en la pared del vagón. Eso tampoco lo había visto antes.

04 febrero 2013

Pereza

Francamente, no puedo decidir quien me provoca más pereza, si los nacionalistas hispánicos o los independentistas catalanes.
En un mundo de mujeres, los problemas serían otros, pero seguro que no invertíamos tanto esfuerzo en ver quien la tiene mas larga.