Saturday, January 15, 2011

Debian - Bad Module, Apt, Rescue Mode

v0.2
I spent a rather frustrating hour today fixing a self-inflicted non-X-booting Debian system.  On the good side, I learnt some more and gained an appreciation for being able to use the command line.

In a flash of irresponsibility, I thought I'd install the nvidia 3d module the Debian Way - without doing the research but just using a "she'll be right" approach.  The module compiled and installed.  I rebooted.  When X started, all I got was a blank screen with a flashing underline cursor at the top left.

Bother!

Ctl-Alt-Backspace would not kill X
Ctl-Alt-Del gave me a reboot.


Rescue Mode

When you boot a Debian system, at the Grub screen, each Kernel choice has two entries - the normal boot entry, and under that a "Rescue Mode" kernel choice which allows you to boot (eventually) to a root prompt.  The boot process finishes with an invitation for you to enter the root password, or to press Ctl-D.  Entering the root password drops you to a root prompt # .


Modules

Drivers are called "modules" in Linux and are loaded for the Kernel to get access to them.  Once I was in the root prompt above, I checked to see if the nvidia module was indeed causing the trouble.

# lsmod

The list streamed up above the page, so pipe the output of lsmod to a pager, like "more"

# lsmod | more

Better - and there was the nvidia driver in the list.  now to remove the module

# rmmod nvidia

Check the module list, and it is not there.  So reboot.  The system was as before, so the module commands only do a temporary job.

To cut a long story short, I did the brute force approach.  I found the module in
" /lib/modules/ (kernel-name) /nvidia/nvidia.ko"
and renamed it to nvidia.ko.bak.  When I rebooted, the system worked as before.


Xorg

In the past, when I've been confronted with something like this, I've simply edited the xorg.conf file to change the video driver back to the default "vesa" or "nv".  When I looked at doing this, there WAS no xorg.conf any more.  I'd heard a little about this, but not paid too much attention.  Another project - update my knowledge of Xorg.


Apt / Aptitude

Now the bit that would have saved me a lot of trouble.  Debian has a wonderful package management system.  I have only been really worried about using the graphical tool "synaptic", because it is easy to pick up the basics with.

However in the case I was faced with, there was no graphical interface and I hadn't learnt very much of Aptitude either.  It would have been easy to just search for the nvidia packages and then remove them.  Two minutes work.

So the lesson is - learn the command line and learn the command line Apt tools.  They will save you an awful lot of frustration and time.


Later .....

Thursday, January 13, 2011

Finding Emacs - "Learning GNU Emacs"

v 0.2
I was googling for some information on "nroff-mode" in Emacs, and unexpectedly, I found a Google copy of "Learning GNU Emacs" in Google Books.

I now have found two brilliant books on Emacs.  First is the reference manual by Richard Stallman, and the second is this.  From what I've read of it so far, I think Amazon will sell another copy.  Unlike most, this is more of a TUTORIAL rather than a reference manual, so it lets you put things in perspective.

As I have come to realise, Emacs is a long term project - but one which will repay the effort many times over.



Later.

Update

There are significant differences between the 2nd and 3rd editions.  For example, Mail is not covered in the 3rd edition.

Tuesday, January 11, 2011

Server - eepc - VNC

v 0.1
To achieve viewing a remote desktop, you need a VNC SERVER on the machine you want to view, and a VNC VIEWER on the machine you want to view with.

I had a look at a couple of tutorials and used a couple of VNC servers, however I found that TightVNC was the most successful.


So, on the eeepc Debian Squeeze setup:

# aptitude install tightvncserver
$ tightvncserver :1
$ tightvncserver -kill :1

I found there was an unusual problem with running Xfce4 and wanting to have Xfce4 on the VNC viewer.  I've included the link above that I found explaining this, however in the meantime, I installed Fluxbox and used that setup similarly to as explained in the tutorial ... except I had "fluxbox" instead of "gnome-session".

Now to run a session:

$ tightvncserver :1

Go to another machine, fire up tightvncviewer or "chickenoftheVNC" on the Mac, enter the IP address you want, and the screen then go.

(networkaddressofthemachine):(screennumber)
for example
192.168.0.15:1

A final note.

You'll observe that so far all this relies on there being a log-in on the server.  We shall get round this, but one step at a time.  It is also far from secure, just showing proof of concept at this stage.



Later .......

Monday, January 10, 2011

Server - Thoughts

v0.1

I've been finding my little eeepc server rather entertaining, and I'm learning a lot.

SSH

I can log in to the server from the local network and from the internet using my IP address, having port-forwarded the router ports.  Using the Secure Copy function of SSH I'm looking into copying files between machines.

IP Address

Dynamic DNS providers - the free accounts seem to expire if you don't use them for  a month or so, so that is a consideration.  If you don't turn your router off, then your IP address should stay the same and you can use that.

Opera Unite

Opera has what is effectively a free dynamic dns service together with FTP, Web servers, Media streaming, Web Cam broadcast etc through their web browser than I'm going to have a better look at.  It turns your computer into a server with no special configuration.  May well serve for what most people would find useful.

VNC

Definitely a function I need to investigate.  I did have a play with it a few months ago, but now is the time to get it resurected.


Some more later ........

Sunday, January 9, 2011

Server - eeepc - Debian

v 0.2.3

I know, I'm predictable.  I loaded Debian Squeeze onto the EeePc.  I've had it on there for a while, in fact, having eliminated the original Xandros install.  Two valuable resources for loading Debian onto the EeePc are:
The eeepc does not have a DVD drive, so when I originally purchased it, I had also purchased an external DVD drive.  It has proved useful for a number of tasks over the years.  I first prepared the SSD using my gparted program on bootable CD.  The eeepc 701 has 3 partitions on its SSD.  I left the small one alone and simply combined the 2.5  and 1.5 gig partitions into one.  I did not use a Swap partition.

I installed Debian Squeeze using the Xfce install CD.  I know that perhaps a GUI was not needed, but at that stage I was after a lightweight desktop, and after deciding to keep the machine for a server, just left it there.  It all installed fine using the standard installer, the only addition being to install the Gnome Network Manager, and make the config file correction noted previously in the Debian Wiki.  The WiFi connection to my router works fine.

Xfce recognises the external drive however it drops off occasionally.  In any case, if this is to be a server, then mounting the drive in the fstab file is a necessity for reliability.

Next, sort a static IP within the network.  All the tutorials I found simply configured the wifi entry for a specific IP address.  I took a different route, making a note of the mac address of the wifi card using " ifconfig " and writing down the hardware address.  Then I went to the network router and assigned a specific IP address to that mac hardware card.

Now to be able to access the server from another machine on the network.  The simplest and most straightforward way is to install a secure shell server on the machine, and then log in from another one with the ssh client.  For windows, use putty, and for mac or linux, just use ssh.  Using aptitude on the eeepc Debian install:

aptitude install openssh-server openssh-client

Once the installation is complete, the ssh-server is running as a service on your machine.  There are plenty of tutorials about how to connect with ssh, so I won't repeat them here, needless to say, I can connect from my mac by just entering:

ssh username@(network-ip-address)

If you have modified your hosts file, then you can substitute the hostname for the IP address.  Enter your password if you haven't set up authentication and you can log on as an appropriate user.  Yes, you do need to set up your user account on the server first, since all you are doing is logging on to it as a user, but from over the network.

So there we are, we now have our eeepc server up and running on a static network IP and a SSH server running.  Not much, but it is getting there.


Later .....

Update - Manipulate NTFS file system:

In my case, the drive I have for my server is an external 2.5 inch drive.  Since they all come formatted to ntfs, I have two choices, accept ntfs or reformat.  I shall accept ntfs, so we need to install the ntfs driver:

aptitude install ntfs-3g

Then we need to make a mount point in the .. er .. /mnt directory ..

mkdir /mnt/external

Now we need to edit the fstab file

In fstab, add a line (obviously similar to this - you will have to check your disk drive device)

/dev/sdb1  /mnt/external   ntfs-3g   defaults   0  0

Done!

Debian Squeeze - Thoughts - 2

v0.1
With this post, I want to finish off some general thoughts I have about Debian Squeeze and some of the installation issues that people will or will not see.  I'm not going to cover dual-booting with Windows as there are plenty of how-tos available, and since I don't have Windows 7 I have no first-hand knowledge of setting up with the latest Windows.

My experience with the Debian Installer has been very good overall.  I have found it to be the most reliable of any that I've dealt with (Slackware would be on a par).  There have been a number of times I was looking at installing an "easy to use" Distro on someone's older machine and some issue or another got in the way, and I continually found myself returning to Debian's Installer to get the job done.  I should note that I always use the text version of the installer, not the Graphical interface.  It is faster and more reliable, and is effectively the same thing.

I've already noted the excellent install guide at Howtoforge but there is one other step I find really helpful.  Before I start the installation, I use a specialist Distro like PartedMagic to prepare the disk with gparted.  It just lets me get the installation disk set up the way I like before I start the main installation.  Whilst I'm talking about that, I use a minimum of three partitions, one for root, one for home and a swap.  The advantage of the home partition is that if you ever need to re-install, or want to install a different flavour, you can do that without disturbing your user data.

Don't worry about a failed installation - all you need to do is to go back and do it again.  You will learn something from every install - it is just part of life.

It is possible there may be an issue with NetworkManager that needs minor correction to ensure reliable wired Internet connection.

After installation, understanding the package management and how to add and delete programs, installing drivers for webcams or 3d and then how to get those printers working, comes high on the priority list.  The good news here is that these chores have been made much easier lately.  Even when manual intervention is needed, these things are really quite straightforward - like a lot of things, it is easy when you know how.


later ....

Saturday, January 8, 2011

Text - Groff and Mom

v 0.3

I've always had a partiality towards producing documents using text markup.  It has been limited in the past towards having a play writing my on personalised "Man" pages for my Linux machine, or writing html using markup (which drives my Nephew nuts because he likes Dreamweaver).  It rubs off onto my Daughter as well, since she prefers markup for her html coding as well.  Perhaps the fact that she is a Script-writer has something to do with it.

I was interested to see that Groff is included in my Cygwin install (unsurprisingly) so I started to wonder if it was a useful tool for writing letters and other documents.  If you have a useful template, then just changing some of the content is far easier than opening a Word Processor and starting afresh - or even finding that letter that you wrote some time ago to change a few things.  Of course, that the hardware needs of such a system are far less than the requirements of a Word Processor come into play.

The first thing I stumbled on was this linxgazette article on Groff and Mom.  So then I went to the Mom Homepage and started reading further.  Despite Mom being included in Groff (and it is, in Cygwin as well) I downloaded the latest version of Mom to have a look.  Within the file there is the documentation and numerous examples, as well as the macro definition file " om.tmac ".  There is an " install " file to read, however in the end, if you put the " om.tmac " file in the home directory, all should be well (though I haven't tried that yet).

The moment of truth.  I opened a Cygwin command line window, which, since I've set the HOME environment variable, opened in my HOME directory.  I'm not going to go into the logic of the Unix command line here - please refer elsewhere - the Rute User Tutorial on the links page is an excellent place to start.  Using one of the sample " mom " files that came with the Mom download:

groff -mom letter.mom > letter.ps

And low and behold, a postscript file appeared.  The documentation had a slightly different syntax to send the file to the printer, so I tried that, even though my default printer is not postscript.

groff -mom -Tps letter.mom | lpr

The raw postscript printed fine on my default printer, so even though I didn't have the "beautiful" result at this stage, I did know that the command line worked and sent files to the printer.

Windows does not have the capabilities to read postscript files in a viewer that other operating systems do, so the next step is to get Ghostscript, the free Postscript interpreter and viewer.  The presentation of postscript files is a little problematical, depending on the font that is used, however the printed article seems to work fine.

There is a script included in Ghostscript that you can use to convert the file to a "pdf" file.

ps2pdf letter.ps > letter.pdf

NOW you can open the letter in a pdf viewer and print it from there.  You'll notice that the clarity of the text in pdf format is MUCH better than the postscript viewer.

All you have to do now is read the documentation, and have a play.  You are up and running with Mom!!

Update 17th Jan

Other Macro Packages

The other two macro packages I could find documentation for were the "ms" and "me" packages showing how to use them.  See the Links page.


Using Emacs to Edit Groff

Emacs has a built in " nroff " mode.  To activate it, either issue issue the command via:

M-x nroff-mode

or making the first line of your Groff source document:

\" -*- mode:nroff -*-

\"  is the comment in Groff, so the mode instruction line will remain invisible.  Using Nroff mode, all macros will be highlighted for easier editing.


Later ....

Friday, January 7, 2011

Server - eeepc - Hardware

v 0.1

I have an Asus eeepc 701 netbook, which I bought several years ago when they were first released.  I used it extensively over the next year as my travel computer and it did a great job.  I left the default Xandros Linux operating system on it, installing Debian Lenny onto an SD card as an alternative - that worked really well.

The poor machine has been lying dormant for a while, and the thought of using it as a home server has been niggling at me.  So what does it have going for it?

  • 4 gig SSD
  • Processing power about a third of my Pentium 4 3.0 Desktop computer
  • 1 gig memory (I added some extra)
  • 3 USB ports
  • SD Card Slot
  • Ethernet port
  • Wireless networking
  • Very low power useage

The final part of the mix is storage - the internal SSD will be used almost exclusively for the operating system, so I had a thought about external HDD units.  I finally settled on a Seagate 2.5 inch 1 terrabyte drive.  It is powered exclusively through the USB port, so will draw significantly less power than a 3.5 inch drive.

Obviously this will be no powerhouse home media centre, however I can see that it would be useful in so many other areas, particularly since it will cost so little to run.  Of course the most important thing as far as I am concerned is that I have a low cost test bed to learn on.

Well, there I have my hardware setup.  Works smoothly and sits there unobtrusively.



Next, the Software and options to think about.....

Power and the Atom

v0.1

As the number of computers is increasing in households, a few months ago I started thinking about the power consumption issues.  Until now I've paid scant attention to the electricity costs of the Computer in the corner and have been enthusiastic in recycling older machines for people's use.

Last time the electricity bill came in, I had a look at the cost - 25c per KWhr.

My nephew has just constructed a Server to use as a media centre.  It is powered by an Atom D525 cpu, and has a terrabyte HDD with nVidia ION graphics, as well as more interface ports than you can poke a stick at.  It draws less than 50w at maximum stretch playing 1080p HD Video.

Note:  Asus produce a similar product called the "eee Box".

An older desktop I use is a Pentium 4 3.0 machine with two HDD of 160 gig and 500 gig and an nVidia 6800GT video card.  This was my gaming machine for IL2, a combat flight simulator until a couple of years ago. Now before going away to work it out, I guess that this machine would draw about 350w at full steam.  I know that I did blow up a 280w power supply at one stage on it.  I'm breaking it down as:

  • CPU 65w (subsequently found to be 80w)
  • HDD 50w ea - 100w
  • Motherboard - 20w (probably too modest)
  • Video Card - 150w (really 185w)
So, 350 w to 380 w is the ballpark consumption of this machine.

I found it was difficult to get the power consumption discrepancy below 200w (even with a pretend lower powered video), which surprised me because I've always thought of it as about a 100w saving.  Based on all that, there is about a $400 per year saving in electricity (assuming the machines were left on all the time) using the Atom based machine, which has more than adequate video capabilities for all but demanding 3d games, and more computing power than the older machine, even more than matching the faster P4 3.8.  After 2 years you have a free system and the savings mount after that.

It all made me think about how much computing power you really DO need these days.  Do you REALLY need that Intel i7 machine?  

Some Performance / Power links




Later ......

Thursday, January 6, 2011

Debian - Software Repositories

v 0.1

A computer with Debian installed has a symbiotic relationship with the Internet.  From the moment Debian starts to install on your machine, it wants to know where it can find a Debian Repository.  Of course, you can have a very successful install without access to the Internet or a Repository, however doing so deprives your machine of one of Debian's greatest features.  Debian Internet Repositories have arguably the largest collection of ready-to-run Linux software available, with security updates and bug-fixes as well.  How can this not be a good thing?

How large?  Were you to download the entire i386 Debian Squeeze collection, you would be up for 53 CDs.  Of course, as I've said before, an initial default Debian install needs at the most, the first CD.

So, how does all this work?  Well, for an installation it matters little whether you download the netinstall CD or the CD1.  The only advantage of CD1 is that you can install a full desktop without any internet connection, whereas you will need it for the netinstall CD.  Other than that, they appear identical during the install process.

I probably should give an overview of the install process to give some background.  Once the base install of the system has been completed, it runs a script called "tasksel" which asks you what you want to use the computer for.  "Desktop" is the default, so once you give the OK after carefully making sure you have put an [X] next to your choice, then it goes away to the chosen Internet repository (or the CD) to get the packages needed and in the end, you reboot into a Gnome Display Manager, from where you can log into your Gnome Desktop.  I should mention that the installation process will, near the end, search for any other operating systems on your machine, ask you if it can install a boot manager at the start of the disk, and then install GRUB2 to manage which system you boot into.  See a previous post on how to adjust the default boot system.

A warning.  Windows has never played well with other children, so see what you may need to do as far as managing Vista or Win7 alongside Linux.  I only have WindowsXP, which is manageable.

Back to talking about the repositories.  From now on, you may use the command line apt / aptitude tools or a graphical program such as Synaptic to view the packages available, choose which you would like to install to your machine and then have a cup of tea or coffee while it is downloaded and installed for you.  Once the program is installed it appears within the Debian menu structure ( if that is suitable) and you are set.

And there we are again, talking about Debian's apt and menu systems.


Later .........

Saturday, January 1, 2011

Debian, Slackware and Bling

v 0.1.3

After writing the first part of my "Debian Thoughts" post, I had the urge to diverge slightly and write about one of the interesting intrusions into the Linux world - Bling!

Increasingly when I read reviews of Linux distributions there is a seeming expectation that once the installation CD is inserted into the drive, the install routine will engage the ESP function and set itself up to the exact configuration that the user will like.  Naturally, Slackware and to a lesser extent Debian fail miserably in this test as the ESP package never makes it into the repositories. That Slackware has a "Gasp" TEXT install routine is enough to have some reviewers go wash their mouths out to eliminate the taste.

A confession .... yes, I have been observed on occasion to be the perfect candidate for a TV series called "Grumpy Old Men gone Troppo".  I would like to think that these people with challenged attention spans will mature in time, but as I grow older I become less optimistic.  Back to the article ....

The problem I see is that the reviewers have unrealistic expectations of what can be achieved out of the box and they never realise what a disaster Windows is to install.  The review is really a review about how easy the distribution is to install by mind control.  I once read a review someone did of a Windows install, and it was not pretty.

Now, enough of giving a man a Fish for a meal, and about teaching him HOW to fish so he can eat forever.

Both Slackware and Debian are high quality distributions with great depth.  They have extensive documentation and can be used for almost any task.  It is a bit like Emacs v a standard text editor.  On first blush the standard editor is easy to use, however after a while, it plateaus whilst Emacs just keeps climbing as you learn all those new things it can do.

I fell in love with Debian the first time I met it a long time ago.  I was aware of Slackware but a little wary of its lack of "package management dependencies".  I was using Red Hat 7 for a while and one day after I'd been sucked into "RPM Dependency Hell" I chanced upon this review by Eugenia at OSNews.  By chance, I'd been looking at Vector linux on an older machine I had and had come to realise how really easy the init routines were to manipulate (how hard can it be to remove a comment character?). I was sold and had Slackware for  a couple of years until sometime just before Debian Etch was released.  Whilst I still loved Slackware, Debian was more suited to what I needed.

Which leads me on to the Slackware package management and in particular lack of dependency checking.  Who exactly decided that this was a problem?  It all seems pretty straight forward to me.  If you want to install a package onto Slackware 13.1 for example, then install the one that was prepared for your Slackware version.  And if it doesn't come with a note telling you if there are any additional dependencies then there is a big question mark over the head of the person who prepared the package.

Am I missing something?

Oh yes, I was talking about Bling, wasn't I?

I applaud people for trying to make Linux easier to use and understand, but as I've learnt from my Emacs adventure, there is only so much that can be achieved.  Flashy things are great for the surface, however these days you need something that has depth, is bug free and that will serve you well for a long time.  Many derivative distributions of both Slackware and Debian seem to try to "outbling" each other and as they fork, they introduce incompatibilities with the original graft stock.  We have to learn enough new things on a daily basis these days without having to re-learn the operation of our computer.

To me, the ideal derivative distro would be that it simply modifies a base.  An excellent example of this concept is the "GenieOS" that was based on Debian Sarge.  It used the Debian "preseed" functinality to present the user with an install that had useful customisations.  Any derivative distro that loses compatibility with its graft stock makes me seriously concerned.

I think I've imposed my views for long enough now, I hope it has been both entertaining and of value.  There are a couple of ideas I'll expand on later.


Later.



Debian Squeeze - Thoughts - 1

v 0.1.1

As I sat down to write this, I thought of the Debian development cycle and thought I'd follow its principle in writing articles for this blog.  I've already started adding any corrections or additional information to other pages, and I thought for this piece in particular I should just post what I have and add extras when I find them.  It may be irritating to some, however it keeps all the information on each subject together and I think that is important.
so ..

Debian Squeeze is almost ready to be declared "Stable".  I was secretly hoping it would happen on Christmas day, and then by the end of the year, however that was not to be.  It is currently the morning of the New Year here on the East Coast of Australia, and so there is still plenty of time for the release to occur on the First of January, US time.  Here's hoping.

But - does it really matter if the official release happens?  Well no, not really - after all the distribution is readily available and the only significance is an entry on the Calendar.  To understand what that really means, one has to understand that unlike many other Linux distributions, Debian is a "rolling" distribution with three different subsections that appeal to different categories of users.  When a new package is released by the authors, for example a new version of Open Office, it must first spend some time in the "Unstable" branch/section to make sure there are no glaring bugs in it.  If it passes that test, then it is progressed to .. er .. "Testing".

Now, remember I said Debian was a rolling distribution?  Well, only partly.  You see "Testing" forms the basis for the next official Debian release.  When "Testing" has progressed to the point it meets the goals for the next release, AND all release critical bugs are eliminated, THEN it becomes "Stable".  "Stable" never gets new packages or features - the only fixes are bug fixes.  So we see in the current Debian "Stable" release, Lenny v5.07 there have been eight releases of Lenny, however ver 5.07 only differs from 5.00 in bug and security fixes.  Given it has been nearly two years since the last Debian official release, Debian Lenny is looking quite dated with "old" software, HOWEVER this has a benefit.  Debian Stable IS stable.  It just works.  It is exceptionally well documented, so you will probably find instructions to enable you to do whatever you want with it.

Before I continue, some links that give excellent background:
People could be surprised at the inclusion of the "Slackware Book Project", however it is an excellent resource when it comes to understanding Linux - and anyway, Slackware is another just wonderful distribution.  Its reputation for difficulty is, in my view, undeserved since all you need to do is to RTM.  The boot files are wonderfully documented and easy to edit just the way you like for startup.

As you can see from the extensive list of download options for Debian, it supports a large variety of computer architectures - more than any other operating system in fact.  This is one of the reasons why Debian seems a little slower to get releases out than other Distros that only have to cater for one or two architectures.

In order to have a viable Debian system, you only need to download at the most, the first CD - this will give you a system with the default Gnome desktop.  There are alternative CDs that will provide a KDE or Xfce desktop if you wish.  Of course, the alternative desktops are always available by a simple load through the Debain toolchain or Synaptic if you are using a Graphical environment.

Downloading the Net-install CD is a faster download and gives better flexibility.  It contains the packages to allow you to install a base system, after which the installation routine gets the extra packages from a suitable Debian repository.

Download speeds from Debian are good, however using BitTorrent will give excellent results all the time and ease the burden on the Debian servers.

Well, it seems I got a little diverted from my original intention, however all this is worth knowing and if you proceed with an installation then it is all useful knowledge.  Later I want to talk about how I view Debian (and indeed Slackware) from the large number of alternative / derivative distributions of Linux and why Debian gives ( in my view ) a more satisfying experience.  I'll also discuss why the "apt" and "menu" tools are so important and the role the Debian repositories play in its success.


Later ....