fredag 15 februari 2013

Media center part 4: Raspberry Pi with OpenELEC


So, the latest happenings on my media center is I flashed a 512 MB SD card with OpenELEC, and I can get it to play almost all of my media files from the server without any special config. I realized, though, that my wireless network USB dongle is too slow to transfer full HD material, so I'll have to pull wired network into my room, install a switch, and maybe tinker a little with the setup. I am preparing to flash another 8 GB card with RaspBMC, though, so I get a full-featured Debian install instead of OpenELEC bare minimum. This is solely because I want to be able to have an MPD server on the Pi to play music with the TV turned off...

My current setup is as follows:

  • Raspberry Pi: OpenELEC media center, connected to the TV.
  • CuBox: file server, and that's pretty much it. 
  • Kerstin: My old P3 low-power desktop running Debian to play music via MPD.

This is not optimal, as Kerstin could be optional. However, Kerstin is housing a Creative Audigy 2 ZS sound card, and I don't want to sacrifice that if I can avoid it. If I can get my hands on an ARM box with PCIe support, I might be able to do something about that. It would probably be easier to get a USB sound card, though. In fact, I do have one already. That'll be it about the media center, now on to some other Linux related.

In the book "After The Software Wars", Keith Curtis is (among other things) presenting a theory that eventually, all Linux distributions will merge into one single distribution that is the ultimate one. His reasoning follows Darwin's theory of survival of the fittest. However, there's a fact that he doesn't count in.

In the animal kingdom, there is not one animal suited for every environment on the planet. In the domain of operating systems, there is not one OS suited for every task a computer could accomplish. The Linux kernel has shown that it is possible to make a kernel that suits pretty much every possible application, but that does not apply on whole operating systems. Let us look at some examples:

  • Debian GNU/Linux is a distribution with a strong focus on stability and freedom. They simply do not allow unfree packages into their repositories, even Firefox is considered too "unfree" for Debian. Debian is also conservative, meaning they have a pretty old package database, compared to...
  • Arch Linux, which is a bleeding-edge, rolling release distribution with a focus on simplicity in code, and the user's abiĺity and right to reconfigure pretty much everything in the system. Arch Linux allows pretty much anything stable enough into the repositories, and for unstable or proprietary software, there is the source-based unofficial Arch User Repository. 
  • OpenELEC is a distro aimed at providing a media-center solution. It is built from scratch, and includes neither a package manager nor build tools, so adding extra Linux packages is not easily done, though not impossible. The OpenELEC OS is under 100MB in size, making it ideal to run on a Raspberry Pi with a 512MB SD card, for example. 
  • Ubuntu is a distro aimed at new users. It's philosophy is simplicity for the user, and the slogan is "Linux for human beings". This philosophy is nearly the opposite of Arch Linux, and Ubuntu is also built so that users should not nee to configure their system if they do not desire to do so. 

Is there an ultimate distro among these? One that is perfect for all tasks? No. Debian, Arch and Ubuntu may all work as media centers, but they won't run on a 128 MB SD card, and to get directly into the media center environment, non-trivial configuration is required. Both Debian and Ubuntu will work as server environments, but Arch Linux is not really a great choice for a web server, due to the natural unstability of a rolling release distribution compared to a fixed release cycle. OpenELEC is NOT a good server OS. For the desktop, Debian won't be a good choice for inexperienced users, as LibreOffice is not in the package repositories. Neither will Arch, as you get to a command line at first boot. For the tinkering developer who want an easy install of source code, Arch is perfect.

All of these different user cases may be seen as different environments. Of course, it is possible to make a distro, let's call it Z.org (X.org is used), that may be configured with a GUI at installation to be anything you want. To satisfy the tinkering user, it must  be complex and allow for a complex setup. To satisfy the first-timer, it must be point-and-click installation. These two wills do conflict with each other. It's possible to take care of this, but it requires a lot of effort, and smart people thinking. And when it is finally implemented, the system will NEVER be able to fit on a 128MB SD card. It may be installed to an SD card from another computer, though.

But neverthless, there is a clear conflict between the experienced users, who still prefer the command line, and the new, inexperienced users, who will most likely want to stay away from the terminal. Z.org would have to take this into account, and it might just be easier to have several distributions to deal with this. Moore's law might be able to solve the issue of large install media for Z.org, but given the current 29% yearly increment of internet traffic (numbers provided by Cisco), that will take a little while.

One thing the Linux distros could really settle between them though is the packaging. Having RPM, .deb, .tar.xz, and many others doesn't make much sense. I'm not the right person to determine which format to use, though I prefer the Arch Linux package manager, pacman, which uses .tar.xz-packages.

måndag 21 januari 2013

No media center this time, but the dock and battery arrived

So, I receieved the dock and external battery for my Lenovo Thinkpad a few days ago, and I love them! The battery combination currently reports 80% and 15 hours left, after being in school for two hours and using the computer on the way here. The dock is a different story, and I am still working on getting the monitor inputs to work. However, I found a way of enabling the external monitor which requires minimal Xorg configuration, and will (hopefully) get me into a working triple monitor setup. The guide is avaliable here, if you're also a concerned Thinkpad user. So far, the external monitors does not work flawlessly, but I am working on it and expect to have a fully usable dual monitor setup by the end of the week.

One thing happened on the media center, I found a TV. It is a 46 inch Panasonic plasma, and I was very lucky to find it. We tested it with the Xbox 360 and a couple of movies, and I can say it was a very good deal. So now I can finally test the CuBox without having to move down to the bottom floor and borrow the living room TV. I have begun a little hacking on the Raspberry Pi, but just a little. The CuBox is the main focus for the moment, and a working XBMC and file server in the same unit is my goal. We'll see about that.

lördag 12 januari 2013

Building a home media center, part 3: New drives and Kerstin back online

So, I now have three 3 TB drives attached to the CuBox in a RAID5 array, which gives me a total storage of 5,46 TiB. That's pretty much all that has happened to the media center building since the last post, except that I managed to install Debian 7 "wheezy" on Kerstin, and use her as a headless music player. She refused to boot properly with the Debian 7 CD, though, so I used an old Debian 5 CD and went through two dist-upgrades. It was smooth, though time-consuming, and I have a working Debian 7 installation with Linux 3.2, MPD (music player daemon) and a mounted NFS share from the CuBox containing all the music. She boots perfectly fine headless, and also shuts down properly whenever the power button is pressed. I do have SSH access though, for system maintenance and updates.

Apart from that, not much has happened. I have a steady 8 MB/s transfer rate over wireless network from the server, and a good 30 MB/s over a wired connection. The hard drive stack is capable of MUCH more, but either the CuBox or the router is bottlenecking me and preventing that. Currently, I am happy with this setup, though photo browsing is considerably slower than it was when I used a local hard drive for the photos. But on the other hand, is anyone seriously surprised by that fact?

Lisbeth (my main laptop and workstation) have receieved an upgrade, with 16 GB additional RAM, now giving her a nasty 20GB of avaliable DDR3-PC12800 memory. I will tweak my ramdisk a little to take more advantage of this memory, as I think my Linux system will not use more than 6-7 GB of memory even during the nastiest multitasking scenarios. I do however not plan on running a 10+ stack of virtual machines at the same time as I am using the ramdisk fully, so allocating 14 GB to the ramdisk should be safe. Also, that allows me to place a full HD-quality movie in the memory, saving some power in both the laptop and on the server. I love having excess RAM!

Also, I wrote to a business-to-business company and asked to buy the slice battery and dock for my computer from them. They accepted, paymen is sent, and I expect delivery in the middle of next week. Exactly how I will get multihead displays working as desired will be a later question, but I am 100% certain it is possible. I have read up on some other people getting multihead to work with ThinkPads running Linux, and though it does not seem to be easy, it seems perfectly possible. Challenge accepted, my friends! At least three displays working should not be too hard.

tisdag 25 december 2012

Building a home media center, part 2: testing the CuBox

So, I have tested a variety of things with the CuBox. Currently, it is hooked up to a 250G eSATA hard drive and serving as a simple file server. This is what I have tested so far:

  • Video playback, I have not got it working in XBMC under Arch Linux. Probably driver or codec problems, it's almost always drivers or file permissions. 
  • Truecrypt performance. Transfer speeds are 17 MB/s for Twofish, and 6,5 MB/s for AES encryption, which is not enough for a demanding file server, but will work fine for a simple home media center. 
  • Unencrypted transfer speeds over gigabit network seems to be peaking at about 30 MB/s on the file server, I am not sure however if this is due to the CuBox or the network, as I cannot verify any other sources as faster on the network. The router states 300 Mbit/s, and that might be for wired connections too. 

Currently, the CuBox is serving the network with music, and in the short-distant future, it will probably be movies, CD-books and other files too. The 250G-drive will be exchanged for a pack of 3 RAIDed 3T-drives after christmas. I really need some extra storage space, both my 500G encrypted drive and the 750G drive from the old laptop are nearly filled. I'll try to organize them a little and save some space, but I do need more storage space, even though I might be able to save some by cleaning the two external drives I have. I have to order drives soon, though. 

I also have got myself a memory card for the Raspberry Pi, so now I just have to flash it with the Raspbian image and start configuring it. I will most probably send it to a friend as a torrent seeding server to distribute music for local bands, a little project I have been thinking about for a couple of days. For that, I'll need the 500G-drive avaliable, though. So I need to get myself some storage space. I'll get my hands on some 3T drives soon enough, and then I just need a case for them. I have been looking around for that for some time, but without much luck. I found one, which then became out of stock everywhere. But I'll keep my eyes open. 

I'm still hoping to get my hands on a Cubieboard soon enough, as they have started shipping them to peope who preordered. I'll prepare a home media center ready for our livingroom at least for next christmas, but it needs rigorous testing before I can give it to my parents. Anyway, not much more to do at the moment Merry christmas! Even though christmas technically ended before I finished writing this...

söndag 2 december 2012

Building a home media center, part 1: testing the CuBox

So I have gathered all the necessary peripherals for testing the CuBox:

  • 1 CuBox and power supply
  • 1 eSATA hard drive, eSATA cable and power supply
  • 1 USB2 hard drive, cable and power supply
  • 1 Deltaco 7 port USB hub
  • 1 micro-USB cable to access the TTY
  • 1 Logitech MX400 mouse
  • 1 Razer Arctosa keyboard
  • 2 short gigabit ethernet cables
  • 1 Dovado 3G-router for testing wired network transfer
  • 1 HDMI-cable
  • 1 Philips LCD-CCFL-TV
  • 1 4-slot power extension cord
  • My main workstation laptop and power supply
Will report back with test results as soon as I have them. It seems like the CuBox video drivers does not want to play nice with my Ezio DVI-monitor, it is reporting a refresh rate of 37,5 Hz, which it cannot handle as soon as I start X. Console is working, though. I will use both LXDE and XBMC for testing, as well as SAMBA. Most of it is already set up and working. Wish the little coputer good luck, people!

onsdag 28 november 2012

Building a home media center, part 0


Starting today, I will make a series of posts about the progress of building a media center. The thoughts, tests, links to interesting articles, and other stuff I try during the build of a complete Linux-based media center. This first post, I will concentrate on the plans, the hardware I have, and the hardware that needs to be fetched.

I have been thinking about building a media center for some time, but I realized I now have almost all the required hardware, when my CuBox arrived about two weeks ago. What I have, that might be used:

  • CuBox, an ARM-based microcomputer with a great potential and an eSATA port, capable of full-HD video playback. 
  • Mika, an old Acer laptop cirrently standing behind the printer and supplying our home with shared music. 
  • Alice, my old workstation laptop, with a broken gigabit ethernet and an overheating problem probably caused by a four-year intensive use and excessive dust in the fan. 
  • Native Instruments komplete audio 6, an external fully Linux compatible sound card I bought when I realized the Tascam US-144mk2 had no Linux support whatsoever. 
  • A complete 2.1 music system, with good speakers and a NAD amplifier. 
  • Two external small hard drives, retrieved from laptops. 500GB and 750GB in size. 
  • An almost complete scrapheap of old computers, and lots of really old but mostly working mixed-size hard drives raging from 10GB to 250GB. 

My brother and I will invest in a used plasma TV also, we're looking for one which cost 3 000 SEK or less with good picture quality. 

So, what to do with this? 

The expensive stuff, the audio hardware, is already in place. I tested the CuBox on our other TV a couple of days ago, and XBMC worked like a charm after I installed Arch Linux to the SD card and ran a full system update. Installation instructions for Arch Linux here, and then you can install the xf86-video-fbdev package for video drivers, and xbmc-cubox-git to get XBMC working. XBMC is version 12.0 "Frodo", meaning it's the first version to support live TV and PVR, which is great. XBMC is not as fast on the cubox as it was on my new Lenovo W530, but remember we're comparing a device 2"x2"x2" in size supporting an 800MHz ARM CPU with a workstation-class laptop supporting an Intel Core i7 3610QM here. They are NOT supposed to be equal. 

The test of XBMC was successful. However, I have not yet tested playing video on the device, since my external hard drive is now encrypted with truecrypt, which is currently not installed on the CuBox. So, that is still to be tested. 

My plan is as follows:
I will use the CuBox as a media center, and supply it with a 5-disk external SATA hard drive cabinet, connected via eSATA. The CuBox will run XBMC, a SAMBA file sharing server, and MPD (music player daemon) so I can play music without having the TV turned on. 

XBMC was a success, SAMBA will most probably work, and since the ALSA drivers for my sound card is in the Linux kernel, I don't expect any issues with MPD either. However, there are still potential issues with the device and the use I am planning. 
  • Capacity. Playing a full-HD movie, while streaming to another computer in the house over network, requires a lot of juice. The CuBox might not be able to provide both of these services at the same time. That will have to be tested. 
  • The lag in XBMC. It is not a real issue, however it is noticeable. How will it perform while browsing the menus, when a movie is playing in the background?
  • Encryption. The Truecrypt AES encryption I use also require some juice, and I am not sure whether the CuBox can do that while playing 1080p content. This can become a problem, and I will have to test it. Encryption can be done in the external cabinet, but that requires more expensive hardware. A test with my USB drive is to be done. 
Separating the media center and the server is an option, but that requires me to get another microcomputer. Preferrably an OpenRD Client or OpenRD Tasman (link) is an interesting option, but they seem almost impossible to get at the moment. I have tried, believe me. I am yet to determine a better file sharing server than the CuBox (gigabit ethernet and eSATA is heavy), but regarding media center capabilities, the Mele A1000 is an interesting option. It does not have eSATA (though it has normal SATA), but it does have wireless network built in, which makes deployment as a media center easier. Also, it is not very expensive. I tried to get one, but got problems with the payment, so it is yet to be done. 

Another option is the Raspberry Pi, but it is limited to h.264 encoded video, and the amount of XviD in our library is too great to be converted easily. The Mele A1000 is capable of as much as the CuBox, and has an even more powerful CPU. It is also cheaper. So, as a media center, it is definitely an option. Stay put for part 1, which will probably be about truecrypt. 

CuBox drivers, and a tl;dr on why Linux does not dominate the enterprise market

I got my CuBox's video drivers working, and managed to run XBMC on it. In honor of that, I will be posting a tl;dr post translated from swedish. Google Translate is really good at this, there are only minor issues left to correct after an automatic translation.

I find it strange that not more companies are using Linux / Unix to a greater extent. Whenever there is a problem with Windows, it means reinstalling, there's no use in troubleshooting it. Update takes a hellish time, and one must often restart the computer after an update. A full update of my computer takes a maximum of fifteen minutes, a little more if it's a major update and the internet is slow. But the update is fast, and so far it has never required a restart. Updating the kernel requires a reboot, but that can be done at the next normal restart. The time delay given by the kernel update is not noticeable, although it probably is measurable.

Windows got slowed down down on my new laptop after 10 hours of running time, to a level that not even my now four year old Acer laptop reached after having had Linux for almost a year. Yet both systems are bloated, the Linux system had KDE (which I did not use) and Windows had a Lenovo software suite.

Both of the old timers I talked to who have had to run Unix on universities and in the the industry agree that Windows is pretty bad in comparison. Stability is low, and it is impossible to debug properly. Added to this is that Linux is free, takes less disk space, and supports many more processor architectures. Everything from NAS drives, routers, small ARM PCs and Korg Oasys (yep, a keyboard that is) up to the largest super computers can run Linux. Windows will run on x86 and x86_64/amd64, Debian has the time of writing support for 11 processor architectures.

With Linux, you can build a home server, a media center and a NAS for less than 1000 SEK, excluding hard drives for the NAS. Note that you could have all three services in the same machine (!). You can build a router / firewall with a capacity equivalent to a small IT office needs for 2000 SEK, and with a security equal to any common web hotel anywhere. The knowledge you need to accomplish it, is free. As with all software.

Anders Sandström, teachers in particular organic chemistry at the Swedish University of Agricultural Sciences, told me that they had tested Matlab on an old computer that ran Linux, and then test drove it and compared with a new and much more powerful Windows PC. The Linux machine won, it was faster. Munich (the German city, that is) has recently switched to Linux. They have saved 40 million Euros, just in license charges imposed. IT management has not increased, there was no need for more technicians to maintain the system. They have yet to see how much they save on using less powerful computers due to Linux less resource-intensive approach, but it's already clear that they will save on it.

Building a computer lab with Windows computers to a school, will cost nearly 200,000 SEK. Building a computer lab with Linux computers will cost approximately 120 000 SEK, if you're going to have the same hardware. Windows costs money, and Microsoft Office costs money. Building a computer lab with ARM PCs, costs instead of the order of 40 to 60 000 SEK, depending on what screens you choose. The computers are then cheaper than screens. A server to manage Active Directory and other Windows services and domain services to the computer room, will cost 10 to 15 000 SEK. Network equipment cost 3 0000 SEK. If you have Linux, you can have a server that costs 5-7000 SEK instead, and it is capable of the same tasks.

4A Consulting AB has a server that manages the database of their software suite Svala. It is a standard SQL database, and the server is running Windows server 2003. They take it offline an hour each month to perform maintenance.

Pick a web hosting server from a hosting company, choose a machine with Debian GNU / Linux. It runs Apache web server, PHP, MySQL, and in some cases some background stuff and other things like PHPmyAdmin, NFS or SAMBA, and most probably an FTP server. There are examples of machines that have been running for two years, without any manual maintenance. No crashes. These machines are running systems that are significantly more complex than the Svala server.

4A Consulting AB uses SuSE Enterprise 10.2 for the SPAM filter server. It is virtually maintenance free. No one has touched it since their former Linux literate person stopped. There was no need.

There's free CAD software for Linux, both 2D and 3D. I have them both, but have not had time for any extensive testing of them. There is a music recording program that is an adequate challenger to Pro Tools, Cubase, Logic, Reaper, Studio One, Reason and all the others. It's called Ardour, and is free. It is good, and incredibly powerful, but a bit tedious to learn to use, as it gives you full control over EVERYTHING. In other words, a lot to learn and test.

There is a vector graphics application called Inkscape, a contender to Adobe Illustrator. I have it, but have not learned to master it yet. GIMP, the GNU Image Manipulator is a proper contender to Adobe Photoshop. In my mind even beter. There are several Office Suites, including LibreOffice and OpenOffice.org, which are both challenging Microsift Office. They are faster and more stable, but do not have as many plugins. However, they support more than 20 different document formats, while MS Office still lacks acceptable support for the ISO-standard Open Document Format.

Then we have TeX, available in Windows, but dominating on Linux. And it's easy to understand why, when you start using it. Especially if you write mathematical text, or physics, or chemistry. It's good on a scientific text, and writing reports, essays and the like.

There is XBMC, the Xbox Media Center, available for XBOX, Linux, Windows, Mac and BSD. It has much more potential to be run as a proper media center in Linux than in Windows. Music players for Linux are plentiful, and there is the music server MPD, which lets you use your own computer as a remote control to another computer. Much like SONOS, but open source and a bit tedious to set up the first time.

Someone said that there are no games to Linux. This applies primarily to commercial games. For non-commercial or indie games, there are quite a lot of them. RTS game 0AD is a fairly new idea from Wildfire Games, similar to Age of Empires. On stabyourself.net, there's mari0, a Mario clone where you can use portal guns. The range of games on Linux is by far smaller than the supply of Windows games, but to say that there are no games to Linux is not true. Also, Valve seems interested in making Linux games, and a port of Steam to Linux is already in closed beta.

Linux can run Windows applications. Wine lets you run Windows software on your Linux environment. Integration is not perfect, but World of Warcraft, Left 4 Dead, Steam, Reaper, Roland JUNO STAGE editor and many other programs work well in Wine.
  • Arch Linux has 19,000 precompiled packages ready to be installed, and 5000 to be built from source code with one simple command. Debian has almost 30 000 prebuilt packages, ready to be installed. So lack of software is not a problem.
  • Lack of skilled workers is not a problem, at least not globally.
  • Lack of stability is not a problem.

But, what is the problem then?
  • The lack of commercial support and guarantees. Does not matter in real life, but legally, the difference is huge, and some people still believe that all paid apps are better than free alternatives, just because they cost money.
  • Marketing. Linux does not market themselves and, consequently, no one cares. You haven't heard about it, so it is scary.
  • The myth that Linux is "difficult". That was true at one time, but hardly anymore. Microsoft has lowered its license prices in Thailand by a factor of 15, but still can not sell, people prefer Linux. Since it is "easier" and "more intuitive".
  • The lack of specialized business solutions. In Linux it is easy to make applications, so the system administrator on the local company can provide the solution that does not yet exist, but almost no companies are willing to work that way. It is convenient to outsource the service instead. Aka, buy a program that does it for you. If companies got together and created programs they need as Open Source projects, everyone's costs would decrease. But it leads to less turnover in the economy, which is obviously bad. No one knows why, but it's bad.