Running .NET Core on GalliumOS
January 30, 2017TL;DR:
- GalliumOS is a lightweight Linux distribution optimized for Chromebooks.
- It's absolutely possible to run .NET Core on GalliumOS. Just follow through this blog post.
About a year ago I first read about GalliumOS and was really curious to give it a try.
GalliumOS is basically a very lightweight Linux distribution (based on Ubuntu) optimized for Chromebooks.
So I got myself a Thoshiba Chromebook 2 (for about 300€ at the time), replaced the ChromeOS installation with GalliumOS and had myself a fully functional Linux laptop.
This is the one and only laptop I am using and working with since then. Frankly, its hardware specs are not very impressive but it's quite sufficient for most of my use cases:
- Web development using Visual Studio Code and Node.js (both run absolutely perfect).
- Playing casual games on Steam.
- Slicing STL models for my FlashForge 3D printer and copying them on an SD card ready to print.
- SSH’ing into my RaspberryPis.
What about .NET?
Since I moved this blog to ASP.NET Core (which runs just fine on Linux), I naturally wanted to work on it using this Laptop.
Looking for official installation instructions on dot.net expectedly didn't help much, since GalliumOS doesn't play a big enough role to be considered there. Fair enough. But using this generic installation method should work fine, right?
sudo apt-get install curl libunwind8 gettext
curl -sSL -o dotnet.tar.gz https://go.microsoft.com/fwlink/?LinkID=835021
sudo mkdir -p /opt/dotnet && sudo tar zxf dotnet.tar.gz -C /opt/dotnet
sudo ln -s /opt/dotnet/dotnet /usr/local/bin
D'oh!
Trying to run the .NET Core CLI though, resulted in an error immediately.
$ dotnet --version
Failed to initialize CoreCLR, HRESULT: 0x80131500
So, an HRESULT on Linux! How crazy is that? This nearly made cry ...
Yet I still don't know whether these would be tears of joy or tears of despair.
But I did the same thing most mortals do when encountering cryptic HRESULT error codes: I googled whether someone else might have encountered them earlier. And as usual, someone had, which pointed me right towards the solution to this problem.
After figuring out the missing modules of the dotnet command ...
:~$ find /opt/dotnet -name '*.so' -type f -print | xargs ldd | grep 'not found'
libicuuc.so.52 => not found
libicui18n.so.52 => not found
... I was able to find, download and install them in the required version.
wget http://security.ubuntu.com/ubuntu/pool/main/i/icu/libicu52_52.1-3ubuntu0.4_amd64.deb
sudo dpkg -i libicu52_52.1-3ubuntu0.4_amd64.deb
w00t!
This time, running the .NET Core CLI yielded the expected result.
$ dotnet --version
1.0.0-preview2-1-003155
Then I tried the regular restore, build, run with this very web application and it worked like a breeze! Even the watch command did its trick.
dotnet restore
dotnet build
dotnet watch run
Brilliant!