Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Saturday, December 11, 2010

Linux Mint 10

According to two articles on Linux Magazine, Linux Mint is the next big Linux distro. Taking the advice of the latter article ("Linux Mint 10: A Perfect 10?"), I decided to download the Linux Mint 10 install live DVD and give it a spin in a VirtualBox OSE virtual machine.

Unfortunately, it was quite possibly the most frustrating and dissappointing Linux live installer I have ever tried. I shall now enumerate the problems I encountered:

1. Metacity crashes

Or, at least, I think it was Metacity. The title bars would disappear from all open windows, and I could no longer change the window Z-order. I have seen this before, and it was repairable by restarting metacity. I cannot find a reliable sequence of actions to reproduce the problem, unfortunately.

Additionally, even the task bar would crash and restart itself, and I managed to crash the installer by choosing "Quit" from the first page.

2. No LVM

LVM is not installed in the live image, and the installer does not allow configuration of LVM. But even when I installed LVM using apt-get, the installer would not recognize the logical volumes I created. I can understand LVM configuration being a big task for an installer, but at least if it would recognize logical volumes, an advanced user could still set up the system properly.

3. Personal Information Page Broken

The installer page that takes personal information to create the first user refused to take any input in any of the text fields, either during or after the installation finished. By the way, I was very impressed by the installer collecting only the essentials and beginning the copying of the system while the rest of the information was collected. But then it stopped collecting information, and did not finish the install.

I was able to repair the install, but I would be surprised if many users would know or even think to manually repair a broken install. If such a user happens across this entry, here is how to make your system work if the installer fails before finishing:

Step 1: Put yourself into the installed system

Get a root prompt and set up a directory containing the new install:
$ sudo su
# cd /mnt
# mkdir root
# mount /dev/sda5 root
# cd root
# mount -t devtmpfs none dev
# mount -t proc none proc
# mount -t sysfs none sys
# mount /dev/sda1 boot
# mount /dev/sda6 home
# chroot .

Obviously, your partitions will likely be different. The above layout depends on a partition table that looks like this:
/dev/sda1 /boot
/dev/sda2 swap
/dev/sda3 [extended]
/dev/sda5 /
/dev/sda6 /home

Step 2: Create your user

Create a new user for yourself:
# useradd -d /home/jonathan -m -s /bin/bash -U jonathan
# usermod -a -G adm,dialout,cdrom,plugdev,lpadmin,admin,sambashare jonathan
# passwd jonathan

Step 3: Set up grub

Tell Grub to install itself. This is surprisingly easy with Ubuntu-based systems, as the update-grub2 command will do it all for you:
# update-grub2

You should now be able to reboot into your new system (don't forget to remove the disc).

4. Keyboard Layout Not Saved

I use the Dvorak keyboard layout because it feels like my fingers flow better than with the Qwerty layout. I can still use Qwerty, but it feels clumsy. So, when the installer gets to the keyboard layout page, I chose Dvorak. But it did not remember that choice when I booted into the new system, and instead was using the Qwerty layout.

Impressions

Once I had the system running, I really liked what they did with the menu (what I would call the Start menu if it was Windows). It has big icons for all of the important programs right on the first display, along with smaller choices for the other useful but less common programs. They realized something that most other environments have not yet: If you are using the system menu, you are not interacting with another program, so why not take advantage of the screen to display everything well?

I also liked the clean interface. From the boot splash screen to the standard set of sounds, everything is simple and clean, and seems to be inspired by Apple. The icon sets are attractive, and different enough from what you may be used to that they are actually worth looking at.

Conclusions

I will not be using Linux Mint 10 as my OS of choice. I was impressed with the concurrent install/extra setup info, and with the few pieces of the main system after I had it running, but my heart just wasn't in the exploration. Once I discovered that I would be unable to use LVM, I completely lost interest in actually using the system. LVM is to partitioning a hard drive as directories are to a completely flat filesystem, and I cannot live without it.

Perhaps I will try the Debian-based version, or Linux Mint 11 when it comes out, but I am quite satisfied with Kubuntu 10.04 LTS for now.

Tuesday, April 21, 2009

Termios

So it's apparently been quite a while since my last update... So why the long break? Well... mostly because I forgot to write. Oops.

Here's a quick summary of what's happened since my last update:

  • Took a weeklong vacation to Amsterdam, Holland, with my wife. A very fun adventure, although there were some difficulties coming home. A couple couple of birthday gifts were in the carry-on instead of the checked bag, and were confiscated because they weren't allowed on the plane.
  • Finally finished stripping wallpaper and painting another room in the house. Only a bit more wallpaper left to strip, and a few more rooms to paint, and it'll be time to move on to more expensive projects.
  • My wife has decreed that we are getting a dog. Next week. She had an attack of Florence Nightingale Syndrome at the veterinary office where she works. An American Bulldog in really bad shape came in after being rescued by the local animal shelter. She decided that when he gets better, we're taking him. I met him a couple weeks later, and still am not as excited as her, but I have been wanting a dog, so hopefully everything goes well.
  • And finally, to the topic of this post: Termios.

Occasionally over the last few months, I have tried to figure out how programs like Vim and libraries like Curses and Readline are able to read and act upon individual characters from the terminal without waiting for the user to hit Enter. I tried internet searches, and even browsing the source of the NCurses library, but didn't have any luck.

Then, last night, curiosity struck again, so I made some more internet searches, and I finally hit upon the answer: Termios. If you open the man page for 'termios,' it will describe a large number of options, many of which deal with serial port settings. (In fact, I dealt with it a couple of years ago while writing a JNI serial port interface, but forgot about it shortly afterward.)

If, however, you skip the serial port settings, you will find an option under the 'c_lflag' constants named ICANON. The description is brief: "Enable canonical mode (described below)."

If you are intrigued enough to read below, you will discover that canonical mode is what determines whether characters are available immediately or queued until an end-of-line is encountered. This is exactly the option I was looking for!

So I had finally found my answer. Of course, at this point, I had completely forgotten what I really wanted to do with it when I first started searching. But I still had to play with it, so I wrote this program. It will read input in groups of up to 15 characters, outputting the groups of character codes. (Some keypresses generate multiple character codes, such as the arrow keys or the Delete key.) Press Escape to exit (that character code, 27, will be printed as well).

Thursday, October 16, 2008

Shell Scripting

One thing that Linux and its brethren have always done well is shell scripting. Windows users are unfortunately missing out on this wonderful tool.

Oh, sure, Windows has DOS .bat and .cmd files, PowerShell scripts, and VBScript .vbs files. That's three different scripting languages to learn, if you want to work with other people (since in a group, someone else is bound to prefer something different than you). Plus, I have an intense dislike of VBScript, mainly for reasons like this:

Three lines to copy a file? Honestly? Anyway, I digress.

Shell scripting may not always be clear, but it does provide powerful tools for doing tasks that would otherwise take forever. Here are a few examples that may help with your media collection:

Rename with Lowercase Extensions

This will rename all files in the current directory and all subdirectories to have lower-case file extensions. It also demonstrates how you may get around the spaces-in-filenames issue that plagues most script writers:

Convert All Files to AVI

Here is one example that I use regularly at home. It takes all non-AVI files in this and all subdirectories and makes them into 2-pass encoded XviD AVIs using MEncoder. My wife and I own a DVD player that plays DivX/XviD files, so this makes any videos we may acquire playable on it:

I hope these are useful. Check back again for other scripting tips.

Tuesday, October 14, 2008

NVidia CUDA

The other day I picked up NVidia's CUDA (Compute Unified Device Architecture, which I must say is a pretty bad acronym) to have something new to play with. (Some people tinker with car engines, I tinker with software packages... I know, I'm a little odd.) I've always had an interest in parallel programming, so CUDA seemed right up my alley.

Then I tried to install it. Maybe others have had an easier time of it, but my experience was less than top-notch. I run a dual-boot system at home, Windows XP Pro and KUbuntu 8.04.

Windows

I had no trouble at all installing CUDA on Windows, but the compiler that comes with it enforces a requirement for version 7.1 or 8.0 of Microsoft's compiler (Visual Studio 2003 or 2005, respectively). I don't have either of those, and it didn't seem worth hunting down a copy, so I gave up at that point.

Linux

Being created by and for software developers, I've found that the one thing you can always count on in Linux is the C compiler. It never seems to break.

Unfortunately, drivers are another issue. CUDA requires a new version of NVidia's device drivers, and the drivers require a new version of the Kernel module that supports them. I must have installed the drivers four or five times, always getting the same failure back from the device query program that comes with the CUDA SDK. It kept reporting that the driver was version 173.something, and the kernel module was version 167.someotherthing.

I fought with it for a day and a half, only to discover from a forum post that I needed to add "nv" to the list of disabled kernel modules in some /etc file that I'd never seen before. And suddenly it worked! I love that feeling of accomplishment when something suddenly works, even if I needed help. Sort of like when you finally kill the mosquito that bit you three times and has been buzzing in your ear for half an hour.

So expect some updates soon about how my CUDA programming is coming.