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


14 comentarios:

  1. This is exactly what I was looking for! I spent a whole day trying to do this and didn't get anywhere! Thanks friend

    ResponderEliminar
  2. Hey there toposordo, amazing of you to share the steps, I'd like to ask you if the nuc sporting the Celeron processor would be good enough to play HD content, since I would maybe buy one as an HTPC for my livingroom, to mainly download torrents, as well as watch 1080p mkvs. Thanks!

    ResponderEliminar
    Respuestas
    1. For me it works really good, although truth is I don't consume too much HD content. Some film, here and there.
      No lag or whatever is noticed.

      The only real bottleneck for this setup is the USB disk as harddisk, as write operations are really slow compared with a real mSata harddisk, and you only notice when writing to disk (apt-upgrading, i.e.). But as a media center (read operations), it works amazingly.

      Eliminar
    2. Thank you for your answer mate :) I might just buy one, and use the usb disk as a hard drive (while I am a fan of SSDs and got some, I ain't too keen on buying a mSata, too pricey for now), since I just want the NUC to download torrents and playing media. Just one more question, if you don't mind: have you tried installing a full distro (not just xbmc oriented)? I might also want to use it with VPN settings to use netflix and the such when overseas! :)

      Eliminar
    3. Hi AFer:


      This setup which I describe IS based on a full distro ( elementaryos.org ) so, you can try any setup which works on an Ubuntu distro. XBMC is implemented just as a different user session, with it's own skin (and so, no desktop), but you just have to logout of XBMC and there is available your "full" Elementary Desktop session.

      Eliminar
    4. Thanks again :) I think I will be ordering the NUC right away!

      Eliminar
  3. I've bought a Intel Nuc DC3217IYE. I'm trying to install Elementary OS on the SSD. The installation went fine but it didn't boot after a restart. Can somebody please help me ..

    ResponderEliminar
    Respuestas
    1. Hi:

      I'll try to elaborate more, later.

      Have you tried to boot from USB installation stick choosing "Boot from HD" (SSD in your case) ? Seems like "grub" couldn't get installed on the SSD.

      Eliminar
  4. Hi,
    Thank you for your fast response. I couldn't find the "Boot from" option (only "Try elementary OS", "Install elementary OS", and "Check disc for defects"), but i'm sure it's installed (when i try to reinstall it, it recognizes the old install). Should i try it with an unstable build?
    Is there a way to install grub manually?
    Thanks again for your help, i love elementary os and it would be really awesome for me to this to work.

    ResponderEliminar
    Respuestas
    1. You should try with "Try elementary OS" or any other "Alternate Ubuntu CD".
      ( Unstable and Stable build offer same options, no need to try this.)

      There a way to install grub manually, but I am not using internal HD (SSD), so I can't guide you here. The only thing you need is a terminal prompt and from there, you can manually install Grub; (maybe you need to try the "chroot" method:

      Read again my "5.- The tricky part:" section and try to apply acording to your setup (SSD).

      If not, take a look at this:

      http://anl4u.com/blog/restorere-install-grub-in-elementaryubuntu-luna12-04/

      http://www.noobslab.com/2012/10/installrecover-grub-from-linux-live-cd.html

      https://help.ubuntu.com/community/RecoveringUbuntuAfterInstallingWindows

      Eliminar
  5. It works! Thank you very much!

    ResponderEliminar
  6. Hi,
    Which version of elementary Os you install, 32 or 64 bits?
    Thanks

    ResponderEliminar
  7. 64 bits, I think, as the CPU is 64 bit-enabled. I'll check tonight anyway.

    ResponderEliminar