Monday, May 16, 2011

Hostname Resolution with (K)Ubuntu

An entire home network can be a bit of a challenge to manage, which is part of the reason why I migrated years ago to the Linux world. The number of computers in my house kept increasing and Windoze takes way too much effort to just make useful, so I cheerfully went back to my *nix roots. It took a bit of effort to convert the family to the FOSS concept, but everyone (particularly me) has been quite happy with the conversion.
Though part of having a number of computers on the same network is the ability to manage all of them. For convenience, I prefer to have the machine's hostname accessible from the command line. Among other things, it makes my life easier when I have to do some work on a particular computer. Fortunately Ubuntu comes loaded with samba as part of the default installation.
There is basically only two steps to this. Open the samba configuration file for editing. You can use the command below, or use your own favorite method. That choice is up to you.
sudo nano /etc/samba/smb.conf
Once you have the file open, search for the workgroup line in the configuration file. Which for the version I'm running is on line 38 (I'm running version 3.5.8). The value on the right hand-side of the equal sign should be changed to the same workgroup that you're using for the rest of your home network. Once you're done, save the modified configuration file.
We are fortunate that Ubuntu comes with a working samba client installed, and doubly fortunate because it comes with winbind installed. So the next thing that we are going to do is modify another file.
sudo nano /etc/nsswitch.conf
Here we're looking to add something. Look for the hosts: line and insert wins after the word files, make sure that you leave a space between the words. Save the modified configuration file. Now you can either just restart the machine, or you can restart the services. To restart the services do the following.
sudo service smbd restart
sudo service networking stop; sudo service networking start
The service networking doesn't recognize the restart instruction, so you have to do it with a stop/start sequence. Once all that is done, you should be able to verify operation by doing a ping to the hostname and get a response.

Friday, May 13, 2011

Blogilo and the Blog

For a while I've been wanting to setup Blogilo to handle my different blog accounts on the different sites. Perhaps a certain sense of laziness comes into play, but I never saw the need to visit all of these different sites endlessly. I like to think that I've better things to do with my time than to spend it trolling one blog site after another. Though, I suppose that could be just me.

Regardless, I invested the time to actually make Blogilo work for me. Setting it up for LiveJournal was easy. The entire auto-configure thing worked like a charm for me. I was able to add, my blog, and the different communities that I belong to on LJ. Then I went to add this blog to it and the troubles began.

In a nut-shell, it would error out with something to the effect that there was an XML error. The fix for it was to not use the automated features for creating a blog. They apparently run the process right off the road and into the weeds. So, to work it was just enter the blog URL, username, password, and then move on to the advanced tab to select the Blogspot.com API and the Blog ID. It took me a little while to figure how to get the blog ID, but if you are looking at your Blogspot journal, you'll find it at the end of the URLs at the top of the page. Then the thing works like a charm.

The next item was to get it working for DreamWidth as well. A quick Google search turned up this page, which proved all sorts of useful. Towards the bottom of the page the even have an entry specific to the use of Blogilo. Following the success of creating an account for DreamWidth, I moved on to get my InsaneJournal account setup. I just used the same format for the link as I did for the DreamWidth account and it took off without any problems.

After completing this exercise, I am now left to ponder, do I really need all of these different blogs? I suppose I could come back to that another day, but that is not this day.

Now to just figure out how to deal with tags for the posts.

Saturday, October 17, 2009

Selective Site Restoration

Recently I had to find, copy, and recreate specific files from a directory tree. What had happened was a web site that I work on had every file with the word index as part of its filename overwritten with some hacker's private agenda. It wasn't a security issue with the site, apparently they hacked their way into the host's server and did it to everyone. Fortunately, I had a copy of the site code locally, because I develop the site locally and then upload what I changed. Unfortunately, there are differences between the two, because the local copy is configured to run locally.

To get the site back up, I just needed to replace everything that had index as part of the filename. To achieve this, I did the following from a terminal.
  1. I went to the top directory that needed to be grabbed.
  2. Typed in find . -iname 'index*' > ~/Web/tmp_files_to_copy to create a file with all of the names and locations of the files that I need to upload (or find . -mtime -60 to find files that have been modified within the last 60 days).
  3. Next I typed in tar cf ~/Web/tmp_files_to_copy.tar -T ~/Web/tmp_files_to_copy which created a tar ball of the files that would eventually be uploaded.
  4. Then I went to a temporary directory and typed in tar xf ~/Web/tmp_files_to_copy.tar to extract the desired files.
  5. Finally I then uploaded the entire directory structure to the web site.
Fixing the site didn't take long. It took significantly longer to figure out what had been broken on the site.

Someday I may modify this into a script that automatically finds for the latest script changes and uploads them to the correct locations on a web site, but that would be a task for a different day.

Sunday, April 12, 2009

Mounting ISO on Linux

Some people don't know how easy it is to mount and use an ISO image of a disc. Once it is mounted, you can access it fairly easily with most any Linux multimedia program. I wrote a script to handle mounting ISO images for me (so I wouldn't have to remember everything every time I wanted to mount an ISO image).

First, let's get some things set up. Make a directory in your home folder, and let's call it bin (you can call it something else, you can even place it somewhere else, but since this is your personal script, it should be in your home directory). To create a directory from the command line, do this: mkdir ~/bin.

The next prepatory thing you need to do, is make sure that the bin directory is included in the path. I did this by modifying my .bashrc file. Since you're in the terminal, the easiest path would be to modify it from here. So type this: nano ~/.bashrc. From within nano (the text editor), you can just page down until you reach the end of the file. Modify it so the end of the file includes the new bin directory.

PATH=${PATH}:~/bin
export PATH

This has the advantage that it doesn't mess with any of the existing PATH items, but it does add the new one to the list.

Here is my script, I named it mntiso for my convenience. You can create it in your favorite text editor and save it to your bin directory, or you can type this at the command line: nano ~/bin/mntiso.

#! /bin/bash
sudo modprobe loop
sudo mount $1 /media/iso -t iso9660 -o loop

Note: If you are using 9.04, then you need to skip the sudo modprobe loop line. It is no longer necessary.

If you make a script of it (something I strongly recommend), don't forget to make it executable. You can make it executable by typing this at the command line: chmod +x ~/bin/mntiso. My script also assumes that the directory /media/iso exists. If you don't have the directory, then I suggest you go ahead and create it (sudo mkdir /media/iso). To use the script, you would do the following: mntiso movie.iso. Once it is mounted, you can view your home movie ISO from kaffeine by opening the directory /media/iso. Once it is open, then your home movie will play and you don't have to worry about burning a disc only to find out that you don't like some feature that you included in it.

What to do once your done viewing your home movie? You'll need to unmount it before you can replace it with something new. So, I created another simple script to do this as well. You can by typing this at the command line: nano ~/bin/umntiso.

#! /bin/sh
sudo umount -d /media/iso

I named this one umntiso. If you changed the directory that you mount the ISO image, you'll need to make the change here as well. When you use this script, you won't have to pass it anything. The script just arbitrarily unmounts the ISO image from the preestablished directory.

Note: I do know that the unmounting generates an error on pre-9.04 systems, so I'll assume that you'll see the same error when you run the script.
ioctl: LOOP_CLR_FD: No such device or address
From what I can tell, this error has no impact upon things functioning correctly. It appears to be nothing more than an annoyance.

Wednesday, February 4, 2009

Kubuntu 8.10 and K3b

I went to rip a CD of mine and discovered that K3b kept erroring out every time I tried to get it to rip the CD to MP3. K3b seemed content with OGG, but not so much with MP3. So after some poking around, I found that a bug was already written up on it. The bug however led me to a workaround/fix. Apparently what resolves the problem is to edit the lame settings in K3b to enable both Swap Byte Order and Write Wave Header. Once these are done, then K3b rips the CD in MP3 without any further issue. Is this really a fix? No, it's a workaround.

As an additional note, you may also need to modify the string that is passed to the lame encoder. The string that I use is as follows:
lame -h --add-id3v2 --pad-id3v2 --abr 192 --tt %t --ta %a --tl %m --ty %y --tn %n --tc %c - %f

Basically what this does, is make sure that version two of the ID3 is filled in and that the average bitrate is set to 192. Aside from that, it also makes sure that all of the fields are actually filled in.

Now if I could only figure out why SoundKonverter fails to convert files to MP3, I just might get a bit closer to nirvanna.

Monday, February 2, 2009

Kubuntu 8.10 and DOSBox

In the continuing saga of my documenting getting things going again in Kubuntu 8.10, we will now touch on a fairly quick and simple item, DOSBox. DOSBox is this nifty little emulator that allows you to play those old DOS games that just never seem to go away. I personally have copies of things like Doom (1 & 2), Heretic (not sure where the original is at, but I'll find it again sooner or later), Hexen (both versions), and Warcraft (yes the first version). I'll need to dig around to see what other DOS games I've got squirreled away, but these will keep me entertained for a while.

Well, in 8.04 I ran across DOSBox and installed. I then immediately had fun just playing with the games, but then the 8.10 upgrade happened. It was then my keyboard began to act all funky, with the keys not behaving anything like they should. So, I began poking around yesterday and found the information that I needed to fix my problem.

First I had to edit my dosbox.conf file to change usescancodes from true to false. Once that was done, then I deleted my mapper.txt file. With these few minor changes, I was able to once again enjoy playing Hexen.

Please note, that I'm using a sort of standard US keyboard, so your mileage may vary.

Sunday, February 1, 2009

Kubuntu 8.10 and Nvidia

First a little background. When I decided to upgrade from Kubuntu 8.04 to 8.10, I figured I'd do a fresh install this time. Most of the prior upgrades went without a hitch, at least until the upgrade from 7.10 to 8.04. With that upgrade my audio became an unreliable thing. Sometimes it would work, frequently it didn't without some level of monkeying around by me. So, when I decided to upgrade to 8.10, I figured a clean install would be my best path.

Now as a general rule, I never jump on an upgrade as soon as it comes out. There always seems to be a number of things wrong with it, for whatever reason. So I always wait a couple of months before I go ahead with the upgrade. Well, the fresh install went without a hitch. I had moved all of the important stuff off to a secondary drive and was able to restore most things without too much difficulty. All of this was done within the last couple of weeks.

Enough background junk. The reason I'm posting all of this, is mainly as a place for me to keep track of what I had to do to get my Nvidia GeForce 8600 GT video card to play nice with Kubuntu 8.10. An exercise that I had to repeat just recently because of an update early last week.

First, I would recommend that you go to the Nvidia Driver Downloads and grab the latest driver from Nvidia. I know that the Ubuntu team offers up Nvidia drivers, but they are not the latest and in my experience they never fix the little issue of actually being able to work. For me they do nothing but cause the X-Server to crash repeatedly. Once you've entered information, Nvidia will require you to agree to their TOS and then you get to download your nifty new driver. Once that is in hand, or on your hard drive, log out. You don't need to reboot at this point, just log out.

Next, at the log in screen, select a console login from the menu selection at the bottom of the screen (you'll find it between the session type and the date/time). You're doing this, because it's the easiest path that I found to get this done.

Now that you're at the console go ahead and log in with your normal information (username and password). Note, if you don't do something quickly enough, it'll return to the graphical login and you'll have to do again. Once you are logged in, navigate to where you saved the driver download from the Nvidia website (in other words, use things like cd and ls). When you have found your way to the file, you'll need to enter something like this: sudo sh NVIDIA-Linux-x86-180.22-pkg1.run to run the script. Follow along with the instructions that it gives, they're actually pretty straight forward and clear.

When all of that is done, just type in exit and the X-Server should restart. If it doesn't, then you'll need to reboot the machine (sudo shutdown -r now). Once X-Server has restarted, just login like you would normally. Now you should be able to make use of any nifty graphical features that you couldn't get to work before.

If you are wanting to get into something like twinview because you've got yourself two monitors, then you'll need to open konsole (a terminal window) and enter the following string: sudo nvidia-settings to launch the Nvidia settings prog. Once it is up, you can make the changes that you need (or desire) to your setup. Two words of advice here. One, don't forget to tell it which monitor is the default or primary monitor. Second, don't use apply, just save your changes to the xorg.conf file and reboot. Theoretically you should be able to just reboot the x-server, but I always prefer a clean reboot at this point. Mainly just to make sure that there are no potential funkiness .

There we go. Nice simple and easy. I know there are other tutorials out there, but this one is mine.