Not quite running the samples on McCoy – my be… Linux VM

The status of the quest to get a bare bones ASP.NET 5 (aka vNext) website running on a shared Linux hosting account:

So now that dnx is running on the McCoy Linux VM, it should be a breeze to get the ASP.NET 5 samples up and running, shouldn’t it? Let’s see.

Referring back to the “Running the samples” instructions, we got stuck at step 3 “Run dnu restore to restore the packages required by that sample.”

Ok. Fire up Leonard on McCoy, change to the folder of the project I chose to use as our proof of the pudding (the HelloMvc project) and run that dnu restore command. Hey ho! This time that command actually starts a whole lot of activity. It looks all nice and dandy, except that it comes to a premature high-pitched screeching halt.

dnu restore crash

What the …?!? Isn’t there anything about this quest that can go right in one take?

At least there is a stacktrace and some debug information: “This usually indicates a fatal error in the mono runtime or one of the native libraries used by your application.”

Should be nonsense of course, didn’t mess with the mono runtime and I didn’t code the sample, so if any native libraries are used by the project, they should not normally pose a problem. After all, can’t imagine the ASP.NET team wanting to shoot themselves in the foot by providing faulty samples. So, it must be something on McCoy (again!)

Then I notice the “1.0.0-beta5″ in the folder name. D’oh. To solve our DNX challenges, we upgraded to the latest version. Would it be wise to upgrade the ASP.NET 5 source and samples as well? Well, ya, d’oh! While we are at it, let’s make sure everything ASP.NET 5 connected is upgraded to the latest version. Which means

  • First DNVM itself (as we learned the hard way)
    • dnvm update-self
    • and . ~/.dnx/dnvm/dnvm.sh
  • then DNX
    • dnvm upgrade -u
  • and finally the ASP.NET 5 source with its sample projects
    • git clone https://github.com/aspnet/home

Now, we are still in the ~/home/samples/1.0.0-beta5/HelloMvc folder, while our upgrade just installed 1.0.0-beta7. That’s perhaps being stubborn. The lack of a GUI doesn’t make me want to go hunt for newer vesions. If the version numbering pattern I think I spotted, has some merit, then there should now be a ~/home/samples/1.0.0-beta7/HelloMvc folder. Nope, no such luck. According to GitHub there are samples specific for beta6. So let’s try those. Nope, no luck. No 1.0.0-beta6 folder under samples. There is a latest, but if we don’t have 1.0.0-beta6, then latest most probably wasn’t updated.

Ok, so git clone didn’t do what I expected it to do? It did all sorts of stuff, but it didn’t update to the latest version. No, blondie, of course it didn’t. Well I dispute the “of course” bit, but to update a cloned repository with the latest changes on the remote, we need git pull. Yes. That brought down a whole lot more, including a samples1.0.0-beta6` folder.

So let’s restart the “running the samples” instructions, cd to the beta6 folder and run dnu restore from there. Yes, it starts doing its thing again. Keeping our fingers crossed… And … we screech back to a halt. This time on a different package, one before the package that caused trouble before.

second dnu restore crash

At least it is getting the newer packages. The number on the “Cannot handle address family” is different as well. But the debug information is the same: “This usually indicates a fatal error in the mono runtime or one of the native libraries used by your application.” Working on the assumption that we just addressed the “native libraries used by your application” by upgrading everything that is ASP.NET and samples related, this now points to Mono as the culprit?

Hang on.
Why was I doing this again?
… To run ASP.NET on a shared Linux hosting account.
Why did I want to do that again?
… Because umpteen years in the past Linux hosting was much cheaper than Windows hosting.
… Oh and yes, because I like learning.

The first is moot. Reasonably priced Windows hosting is easily found, even if you get less resources (disk storage, traffic, databases, or whatever) than for Linux hosting at the same price.

The second is still true. And giving up usually is not an option for me. But in this case, I think I have had my fill. So, sorry, but I am calling it and throwing the towel into the ring. It’s not like someone is paying me to get this working. And even then… there are so many other things to learn that will be a lot more enjoyable to dig into.


If you don’t want to miss any of my future adventures: subscribe below and get every post delivered straight into your inbox.

Posted in Learning
Tags: , , , ,

Suddenly we have lift off

Right. I like a challenge. This ASP.NET on Linux quest had me stumped though. And that was getting on my nerves. I had been following all the instructions and shaving a few Yaks on the go and yet it still refused to work.

Which is nonsens of course.

I am not the only trying this. Others have gone before. And there have not been any outcries of the stuff not working at all. So it has to be Leonard or McCoy, or the installation so far.

Which means, that apart from calling in the help of a few good men like Hugo and Kit, I am looking at posing a question on the stackexchange network or one of the asp.net or linux / ubuntu forums.

Distilling down what I have done so far is going to take a lot of time though. So let’s first try to use my Google Fu to see whether I can bring up any results showing other people having the same kind of trouble I am having.

Typing in dnvm dnx linux brings up all the installation and running samples information I have already seen. But, second in those results, is an entry that catches my eye.

Search result

incompatible
download but not make dnu or dnx executable

That sounds interesting.

It could explain the “already installed” and “not found” confusion. Sort of anyway. When you take “not found” to (also) mean “I found it, but it isn’t marked executable”.

This search result leads to [Linux] Latest DNX packages are incompatible with older dnvm.sh scripts #31. While the versions are different – I have 1.0.0-beta5 and the information talks about “from 1.0.0-beta6″, the page provides a solution and I decide to give it a go.

Leonard is fired up on McCoy and told to

dnvm update-self
. ~/.dnx/dnvm/dnvm.sh

Update self

The first ensures that dnvm itself is updated. No explanation as to what the second does, but I guess it executes that “dnvm.sh” script that takes care of adding folders to the Linux equivalent of a Windows’ search path.

Then I ask McCoy to upgrade dnx with the latest – unstable – version (-u flag).

dnvm upgrade -u

Beta7 installed

And hey ho, DNX is upgraded to 1.0.0-beta7. And without any “not found” complaints!

So I get all gung ho and giddy with excitement and tell McCoy to dnx. And …

Lift off

Yes! Lift off!
Finally!

So all you boys and girls out there, be sure to update dnvm itself and executing dnvm.sh before getting it to get new dnx versions. Just adding those two commands may save you a whole lot of headaches.


If you don’t want to miss anything: subscribe below and get every post delivered straight into your inbox.

Posted in Learning
Tags: , , , ,

DNX on Linux troubles aren’t over yet

Our quest to get a bare bones website running on a shared hosting Linux server, got stalled at trying to run the ASP.NET 5 examples on a (virtual) dedicated Linux server.

Running these samples of course is intended to prove that the machine could run a website known to work elsewhere. That is always a good way to keep you sane when on quests like these. It limits the number of variables and points of failure.

And we indeed got stuck. The good thing is that we know it can’t be something to do with our bare bones website as that hasn’t even come into play at all yet on this Linux machine.

According to the instructions for running the ASP.NET 5 examples, we need to run dnu restore from the folder with the website project to ensure that NuGet restores all the packages needed by the example site.

Unfortunately McCoy (the Linux VM) complained it didn’t know dnu. Can’t blaim it really, I have no clue what it is either. Combined with the “already installed – not found” confusion on dnvm itself, I figure it has something to do with the search path. Now, how do you change that on a Linux machine and what do I need to change it to?

Googling for “dnu restore” brings up several results that seem to hold the answer to both what dnu is and what to do to get it working.

DNU is short for the DNX Utility. A tool “responsible for all operations involved with packages in your application.” (See).

That explains nicely why we need to run dnu restore to restore the packages for a project. Its GitHub page, however, doesn’t help much in figuring out how to make it work. That plus the fact that everybody seems to assume you can run dnu commands after installing dnvm makes it a fair bet that it is already installed and we only need to make it so it can be run from any folder.

Which means: back to how to change search path on McCoy.

The Google results for “dnu restore” also listed “ASP.NET 5 and Visual Studio Code End to End“. Right below the links for installing ASP.NET 5 and DNX for the various platforms on that page, is some interesting information:

Bash tip

While it doesn’t explain what the commands do, it does tell us why. Yay!

So, let’s wake McCoy, find Leonard’s .bash_profile, change it, restart the terminal (the PuTTY session I guess) and see what the effect is on the dnvm installation.

McCoy wants a restart. Having figured out whether I should comply and how to do that, let’s shampoo this Yak we’re shaving and find out more about that .bash_profile.

Right, .bash_profile is like the autoexec.bat from my DOS days. Apparently there also is a .bashrc which is used when logging in graphically, while .bash_profile is used for terminal (console) logins (See). Arrgh. That will create more than its share of confusion. I would certainly use the advice given in multiple places: to only maintain one and make the other one use it. Easiest way to do it seems to be given here. Still, I’ll leave that for another yak shaving as the chances of me using a graphical login on McCoy are slim indeed.

That leaves the question of how to change the contents of any such file. This question on superuser has all kinds of suggestions, of which this one seems simplest and most straightforward. Thanks Vincent!

Let’s see whether McCoy is back up.

Judging from the fact that vi mentions it is creating a new file, I apparently didn’t have a .bash_profile file yet. Anyway, with Vincent‘s help, I managed to enter these lines and save the file.

source dnvm.sh
export MONO_MANAGED_WATCHER=disabled

Closed and reopened PuTTY to restart the terminal as instructed by the article that provided them. Bash is complaning now:

No such file or directory

Seems we need to adjust some stuff. Where is that dnvm.sh fie (or directory?)? Tried a dir command. That doesn’t show much. Just a “~”. Hmm. Help reveals that while dir previously helped me find the “home” directory, it doesn’t quite do what I expected it to do: list the files and folders in the directory I am in. Brain farts ls at me. Could be short for “list”, I guess. Yes, that reveals a single entry “home”. And listing the contents of that directory reveals the presence of a “dnvm.sh” entry.

Using the skills I just acquired, I change the contents of my .bash_profile to

source home/dnvm.sh
export MONO_MANAGED_WATCHER=disabled

(Hey, that “.bash_profile” file wasn’t listed when I asked for the contents of the Leonards home directory. Must be something to do with the initial dot. Remember reading about that, just not where.)

Restarting the terminal session for Leonard, now no longer complains about dnvm.sh not being found. One step forward finally then? Hmm, dnx still results in a “not found” message. That doesn’t bode well. Still, let’s switch to the sample dir and run dnu restore. Maybe that’ll fare better. Nope. That also still produces a “not found” message.

At least having seen the “no such file or directory” message gives me confidence that the “.bash_profile” file is being read and executed.

So, who is lying to me? Or what do I not understand in “The first line will ensure that you can always run the dnvm and dnu commands.”?

Looking at the contents of the dnvm.sh file in the home folder reveals that the paths used there probably are wrong. Either missing “home” information or being referenced from the wrong folder. Not about to start messing with that stuff. So let’s re-run the command to get dnvm

This provides some interesting information:

Better source command

Changing my “.bash_profile” accordingly and running the source command manually, still doesn’t help much though, neither does restarting the terminal for Leonard.

source /home/leonard/.dnx/dnvm/dnvm.sh
export MONO_MANAGED_WATCHER=disabled

The instructions for installing DNX on Windows included running a dnvm upgrade after installing dnvm. Tried that already, tried it again now. Still the same “already installed” “cannot find” confusion. Running the suggested dnvm instal 1.0.0-beta5 also still produces exactly the same result.

Same trouble still

Jeezzzzzz

What’s a girl to do to get this working?

Call in some help, I guess. Hugo? Kit? Any ideas?


If you don’t want to miss anything: subscribe below and get every post delivered straight into your inbox.

Posted in Learning
Tags: , , , ,

Deploying the bare bones site

The quest to get a bare bones ASP.NET 5 (aka vNext) website running on a shared Linux hosting account, is now at the stage where we should be able to deploy a website and see it in a browser.

Unfortunately, the documentation only has entries on how to deploy to IIS and for when you use Docker. Nothing about deploying to Linux… :(

034-Publishing-and-Deploy-documentation

The DNVM installation instructions got us to install Libuv “so we can use the KestrelHttpServer”. Let’s see whether that leads anywhere.

The link in the DNVM installation instructions leads to the KestrelHttpServer GitHub page. The readme directs us to the “ASP.NET 5 Home repo”, i.e. the home page of the ASP.NET 5 project’s repository.

You know what? It’s hot… I am going to take my dog for a swim first…

Right. The ASP.NET 5 project’s home page also has same instructions for installing DNVM. These instructions are the same as on the page I have been working from, but this page shows more than just installation instructions. In the “Running an application” it also tells you to execute dnvm upgrade and how to run the samples. So let’s see.

Running dnvm upgrade (yes, I did manage to remember my password this time around), instantly puts the brakes on this quest by reporting that it needs unzip to proceed.

035-Needs-unzip

That’s a yak to shave, but one that seems unavoidable. Let’s shave it. Google brings up a couple of interesting results. And a quick scan reveals that it should be possible to install unzip in the same way as we installed make:

sudo apt-get install unzip

Yup. Re-executing the dnvm upgrade now no longer complains about unzip. The output is confusing though. It says dnx-mono.1.0.0-beta5 is installed, but it also says that it cannot find dnx-mono.1.0.0-beta5…?!

036-AlreadyInstalledYetCannotFind

I am choosing to ignore that for now and move straight on to the instructions for “Running the samples” on the ASP.NET 5 project’s home page.

It says to clone the ASP.NET 5 Home repository.

Ya. Right. I am sensing another couple of yaks in need of shaving:
Is Git installed at all? Considering that make and unzip were not… probably not
What is the Git command I need to comply with the instruction?
Remember I am spoilt rotten with GUI interfaces that shield me from having to remember all sorts of commands and options!

Telling Leonard to run Git brings a nice surprise. An actual helpful error message that not only says what’s wrong but also tells you how to remedy it:

037-Typing-Git

While that is running let’s find out what command I need to clone the ASP.NET 5 repository. Google results lead to documentation that results in information overload. I am not interested in all the intricacies of the git clone command. I just want a copy of the samples on my Linux server, because that is needed to get them running.

Blond moment required. Let’s just tell Leonard to run git clone https://github.com/aspnet/home. Seems to have worked. I have no idea where the files ended up, though. And I don’t have any stomach for hunting for them. There is absolutely no fun in browsing a file system without a GUI.

038-Git-Clone

[aside]
If anybody has any suggestions for a GUI app that will allow me to browse McCoy’s file system, I’m all ears.
[/aside]

The “Running the samples” instructions second step is to “Change directory to the folder of the sample you want to run”. Bummer. No choice then. I’ll have to figure out where git clone put the files…

As the Libuv source files ended up in /usr/local I am guessing they have probably ended up in the same general location. Nope. There is a src folder there, but that is a remnant of the Libuv installation and completely empty. So back to the root. A dir reveals a home folder. That must be it then. The output from the git clone command did mention Cloning into 'home'. My assumption that it would have used a subfolder of something under /usr/local was obviously incorrect.

As browsing a file system using cd and dir is blatantly painful to me, I am going to cheat. I’ll look for the sample I want to run on GitHub and then use cd to navigate straight to it. I picked the HelloMvc sample. No particular reason. According to GitHub that is in Home/samples/1.0.0-beta5/HelloMvc except that cd’ing to it brings up a “No such file or directory.”

Oh boy, the joys of a case-sensitive file system… It has to be home/samples/1.0.0-beta5/HelloMvc

[aside]
Why didn’t the git clone command copy the casing? Or did it? I entered “home” lower case, but the repository uses an upper case ‘h': “Home”. Now I can understand a case sensitive system doing what it’s told, but GitHub understood that I meant Home while saying home and urls are only case insensitive up until the TLD. Everything after that is case sensitive.
[/aside]

Ok. Let’s run the dnu restore. According to the “Running the samples” instructions that should “restore the packages required by that sample”.

Except, it doesn’t.

039-Unsuccessful-dnu-restore

Running dnu after installing dnvm and running the dnvm upgrade did work when I did it on my laptop. Why doesn’t it work on this Linux machine? Could it have something to do with those conflicting messages earlier. The ones about dnx-mono.1.0.0-beta5 already being installed, but still unable to find it?

Probably.

What did the message say again about what I might need to run? “do you need to run ‘dnvm install 1.0.0-beta5‘?” Let’s do that and see what happens. Same as before “already installed” and still “cannot find”…

Hmm. Looking back at what I did on my laptop, the command after installing dnvm wasn’t dnu but dnx. Unfortunately McCoy has no idea what to do with that either.

Me thinks this is a wee road block.

I’ll need to do some investigating. Is it dnu or dnx that I need? And if it is dnu what actually is it and how do I get it? And if it should be dnx, how do I get past the already-installed-not-found confusion?

I'll-be-back

I’ll be back!


If you don’t want to miss anything: subscribe below and get every post delivered straight into your inbox.

Posted in Learning
Tags: , , , ,

On to Linux – part 2

Right, where were we?

The status of the quest to get a bare bones ASP.NET 5 (aka vNext) website running on a shared Linux hosting account:

  • We have a bare bones site running locally on my Windows development machine.
  • We have a dedicated Linux virtual server.
  • We have Mono installed so we can run the .Net framework on our Linux machine.
  • We started to install Libuv, multi-platform asynchronous IO library, so we can use the KestrelHttpServer (as per the instructions, I have no opinion on this yet).
  • We got stuck at the sudo make command, which resulted in sudo: make: command not found.

Since then, while life got in the way of this quest, I have received several offers of and with help. Absolutely awesome! Please keep it coming. If you can accompany any instructions with an explanation of why they would solve the problem at hand, that would be doubly awesome.

At this moment, sudo make needs to be made to work without complaint. The make part seems obvious: something is to be “made” which when dealing with software means source code needs to be compiled and/or linked into something a computer can execute.

But what the … is sudo?

The installation instructions for both Mono and Libuv consisted almost entirely of sudo commands. So I assumed it was something standard in Linux and didn’t think twice about it. The sudo make failing with command not found, leads me to think that sudo is some kind of framework or utility which can be extended with/by libraries to do more than “just” what is delivered out of the Ubuntu box. And that make is some utility that needs to be installed before sudo can actually put it to work.

Ah, Google tells me, my hunch wasn’t all that far off:

027-what-is-linux-sudo

And Google also helps in finding out how to get sudo to make stuff:

According to this question on the AskUbuntu StackExchange site, I just need to run

sudo apt-get install make

Now, what was that password again?
Darn. Forgot.
Double Darn. Thought I’d saved it to LastPass, but didn’t.
Ah well, onto Azure to reset it then…

028-Installing-Make

With that out of the way, let’s continue the installation of Libuv. The instructions included a change of current directory, so let’s do that. It’s a simple step to take and will probably avoid a whole slew of error messages. Then resume from the sudo make command that failed earlier.

Yay! Lift off. It’s compiling or whatever CC and CCLD mean.

029-make-libuv

Apparently, the sudo make install command installs the library file we just created somewhere on the Linux search path:

030-make-install

The sudo rm -rf /usr/local/src/libuv-1.4.2 && cd ~/ command will probably remove the source files and returns us to the original directory or the root – which just happens to be the same (not spending time today finding out what cd ~/ does). Yup. Certainly looks that way.

So, onto the last command sudo ldconfig. No idea what it does, probably some configuration. No stomach to find out. At the moment, if the instructions say to do something, I’m just doing it and keep my fingers crossed that everything is indeed going according to what the instruction writers had in mind.

Hang on, the writers did actually provide an explanation. Kudos to them!

031-make-explanation

Having installed both Mono and Libuv, DNVM is next. The instructions give a very long command and says that once that’s done, you should be able to use dnvm and get some help info. However, the output from the command seems to suggest having to type some other commands.

032-getting-dnvm

Lazy as I am, I just type dnvm and low and behold: we have succeeded in installing DNVM:

033-dnvm-response

That should be it!

[aside]
The instructions do talk about configuring NuGet to get additional package sources, but I am not going to bother. After all, we just have a bare bones website, so the default packages should be more than enough.
[/aside]

We are well on our way now. All we should have left to do is to deploy the site. More on that next time.


If you don’t want to miss anything: subscribe below and get every post delivered straight into your inbox.

Posted in Learning
Tags: , ,

Don't want to miss out?

Subscribe now and receive a regular influx of practical information on ASP.NET vNext, unit testing and software design.
* = required field