Setting up a headless server - a few lessons

bellamatt
Posts: 57
Joined: Wed Jan 05, 2011 5:38 am

Setting up a headless server - a few lessons

Postby bellamatt » Sat Jan 08, 2011 5:49 am

I have just upgraded my home server from a very simple ubuntu server box (basically just a network share and printer drive) to a headless HDA. As pretty much a linux noob apart from the few things needed to set up the ubuntu server, I had some trouble and thought I'd share some of the things I worked out along the way that weren't adequately covered in the wiki (from a novice's point of view!).

Firstly, I had quite a lot of trouble with the whole headless thing. I think a step by step guide to do this would probably be helpful! After setting up the HDA normally and checking everything worked ok, I ran nano /etc/inittab to set up the server to start at runlevel 3. I wanted it to all start up automatically in case of power failure so wanted autologin without a password and with all the services starting up.

Trying this I came across a problem - autologin using the edits to /etc/gdm/custom.conf quoted in this thread does not work at runlevel 3. I gather it only works to log in to the full x window or something. Anyway, this was important as none of the services seemed to work until someone was logged into the machine, so I couldnt go headless yet!

After a bit of googling, I found this post which included a very simple method that did work at runlevel 3:
edit /etc/event.d/tty1 to change

Code: Select all

exec /sbin/mingetty tty1
to this (replace "user" with your username you want to autologin)

Code: Select all

exec /sbin/mingetty --autologin user tty1
"And any command you want to execute upon login you can enter in your .bash_profile"

I had previously used the "Passwords and Encryption Keys" thing to set an empty keyring password, not sure if this was important in the end but anyway the machine was logged in automatically on boot now.

This leads to the second problem. Everything works perfectly at runlevel 3, apart from vncserver. I could not get it to work properly, although it had been working fine in test with everything connected. Some troubleshooting using SSH to the machine:
1. service vncserver status gave "Xvnc is running"
2. However, using portqry from my windows machine, I could see that the HDA was "not listening" to the expected TCP port. That is, somehow the service was running but not doing anything.
3. Running vncserver gave response "started applications specified in .vnc/xstartup" and details of the desktop session. Portqry then showed that the HDA was now listening, and running TightVNC from Windows worked a treat.

I had run chkconfig vncserver on from root user already. I did it again anyway and also from my username for safe measure, but I dont know if I've fixed it (and cant be bothered restarting the HDA!). I am guessing it has something to do with the order in which services are started up or something like that.

I'm sure there were other things I've worked through but I cant think of anything else that took ages to figure out. I did a lot of googling and reference to threads on this forum or the wiki. One thing I found out which is not related to Amahi at all is that my motherboard won't start up without a video card connected, even if the BIOS is set to stop on no errors. Which sucks because the video card is not needed at all to run headless, and is a massive waste of energy and quite noisy (the HDA is set up on a five year old ex-gaming rig - Athlon 3500+ with a Gigabyte GA-K8N SLI board and 7600GT video card). It used to be overclocked a bit but I've set it all back to factory settings for this purpose. I will investigate further... maybe I can disable somehow or buy a dummy card or something. Or install a new motherboard etc I suppose, but half the point of this exercise was to make use of the old pieces in a redundant machine!

Finally, some general thoughts on Amahi from a new user:
- you dont need to hear this one, but as a whole Amahi is amazing! It was relatively easy to set up and is so much more powerful than the simple network I had going before. I'm streaming media to my ps3 and ipod, have a much improved storage/print setup, sabnzbd works way better than anything I've used previously to manage usenet downloads... everything I've tried so far is just fantastic, and I've just scratched the surface!
- one that will probably offend you guys as expert linux users, as a Windows user the terminal is pretty scary. I had used it to set up Ubuntu on the earlier network and appreciate how powerful it is to have complete control like that, but it has a steep learning curve - basically I needed to google everything I did at first. And I have to wonder why you would prefer VI over anything with a decent UI! I found nano a much easier editor to use. I didnt use gedit as I had read somewhere that it stuffs up permissions, or something. Anyway nano was ok once I got used to it and I figured it would be helpful to get used to it so I could work with a SSH link to the server.
- Amahitunes is great. One extra thing I do though for PCs, which I worked out for the old server, was that different machines can share a library on the share drive - you just have to make the share drive the default music location for all machines, and hold [shift] when starting iTunes for the first time to point iTunes to a library on the share rather than on the local drive. This works great for me and means I can sync my iPod from a laptop which has no local music stored.

Anyway, mark me down as a happy customer!

bellamatt
Posts: 57
Joined: Wed Jan 05, 2011 5:38 am

Re: Setting up a headless server - a few lessons

Postby bellamatt » Sat Jan 08, 2011 7:57 am

Follow up - for those with a TiVo, I followed this tutorial (for Ubuntu - the only changes needed were apt-get to yum) and have pyTivo running on my HDA. I'm currently watching a movie that is transferring to the TiVo from my HDA seamlessly.

Yet to see if the script to start pytivo as a service on startup actually works (dont want to test it right now) but so far it looks great.

kiwibean
Posts: 17
Joined: Sun Dec 05, 2010 7:29 am

Re: Setting up a headless server - a few lessons

Postby kiwibean » Sun Jan 09, 2011 7:08 am

Thanks for this writeup. As a fellow n00b migrating over from WHS now that I've given up waiting for Fail, I must join in the kudos. Amahi rocks!

Before I go headless, though, a question - what are advantages over leaving the standard UI and just unplugging the keyboard/mouse/monitor? Being completely new to Linux, having the UI to fall back on over VNC seems like a nice safety net.

bellamatt
Posts: 57
Joined: Wed Jan 05, 2011 5:38 am

Re: Setting up a headless server - a few lessons

Postby bellamatt » Sun Jan 09, 2011 1:56 pm

I think it uses less power in the server if you're not running the terminal version. When you use VNC it still shows up as a full runlevel 5 session though.

rshibley
Posts: 4
Joined: Mon Dec 27, 2010 3:34 pm

Re: Setting up a headless server - a few lessons

Postby rshibley » Sun Jan 16, 2011 8:24 am

Bellamat,

Did you also use the script they provide in that tutorial they linked to? I am planning to try installing pytivo on my HDA making ONLY the change you suggest (changing apt-get to yum - I am a total linux noob) and changing the directories for video shares, but I wanted to know if the script they provide also works without modification. I feel like it should unless the directories are different (and frankly the Linux directory structure still confuses the heck out of me) but again I don't know for sure. Any help would be appreciated!

If it does work, maybe I will add amahi/fedora directions to the PyTivo wiki at pytivo.sourceforge.net so others don't have the same problems. I bet a lot of Amahi users have Tivo too.

PyTivo would be a great addition to the list of apps for Amahi! If I knew what I was doing I would totally package it up.

bellamatt
Posts: 57
Joined: Wed Jan 05, 2011 5:38 am

Re: Setting up a headless server - a few lessons

Postby bellamatt » Sat Feb 05, 2011 12:45 am

Yes I did use that script. My TiVo is connected wirelessly and it does drop out every now and then but I think that's a TiVo problem not the HDA. Still working fine :)

rshibley
Posts: 4
Joined: Mon Dec 27, 2010 3:34 pm

Re: Setting up a headless server - a few lessons

Postby rshibley » Mon Feb 07, 2011 10:29 am

Great! Thanks for the info.

Who is online

Users browsing this forum: No registered users and 55 guests