jlm-blog
~jlm

26-May-2009

Command-line wifi without nm-applet

Filed under: linux — jlm @ 13:43

If you use a Linux laptop, you probably have an ambivalent relationship with nm-applet, “Network Manager”, that thing which connects to your access points. Or often doesn’t, because — well, no one knows why, because nm-applet is fussy and tight-lipped.
Fortunately, you can do everything it does in the shell, if you know how. Here’s how:

  1. iwlist scan to scan the environment for WAPs
  2. iwconfig ath0 essid XYZ where XYZ is the ESSID from the scan that you want to connect to
  3. ifconfig ath0 up (turns the interface on)
  4. dhclient (registers with the WAP and gets an address)

Voilà, you’re connected (or at least have a meaningful error message), while nm-applet is still running around flailing its arms.
(I used ath0 as the interface in my example, but your interface might have a different name, like wifi0 or wlan0. Check by running ifconfig. Interface-affecting commands require root.)

2-Feb-2009

Recommended software: rsnapshot

Filed under: linux — jlm @ 20:26

rsnapshot is a fantastically simple, easy-to-use application for performing backups of one computer to another. It uses rsync so that the data sent over the wire is encrypted and only that of an incremental backup. It uses hardlinks across snapshots for unchanged files, so you have full snapshots for all the backups kept, at only a fraction of the diskspace otherwise needed.

It has turned my remote backups from a pain to a simple matter of running a command every day or two and entering my password. Entering my password manually is the only deficiency I find with it. The rsnapshot docs recommend making a passphraseless ssh key for it to use, but I don’t trust that. Sometime I’ll have to look into if I can make a ssh key which’ll only allow rsnapshot to perform its rsync download, not log in or run other commands.

18-Dec-2008

Ubuntu Eee: Not ready for prime-time

Filed under: linux — jlm @ 21:57

On Sunday I bought myself a new toy, an Asus Eee 900. The general opinion on the ’net seemed to be that the default Xandros Linux installed OS was inferior to Ubuntu Eee (note not a Canonical-endorsed project), so I installed it. I’m going to restrict my discussion to the software (you can find a lot written about Asus Eees themselves on the net).

The most serious problem by far is that WiFi was broken out of the box, due to faulty interaction of the wifi-on/-off and wifi-toggle ACPI event handlers. I found plenty of people complaining about this issue and several fixes by basic searching, but it’s utterly astounding to me that an OS distribution targeting a portable computer where WiFi is essential for its use could have this bug in release. The Eee exists to be a box accessing everything through wireless, no WiFi is a “game over, you lose” level bug. It was also made more frustrating by the various networking tools not even showing wireless as an option unless it was already on. Better would be to show the wireless interface as there and down (as it was) and let the user select it to bring it up (which still wouldn’t have worked, but at least you’re not making them waste their time figuring out why it’s not there at all).

There were some issues that popped up earlier, even before the first boot in the install app. The select keyboard layout section has a text area where you can test typing, but it uses the current keyboard layout instead of the new one you’ve selected in the tool, uselessly. (The change keyboard layout tool once you’ve booted into the OS has the same problem.) The time of day shown when you’re selecting the local timezone is wrong (and it says you can set it to the right time after boot), though after booting it gets the time of day correct.

After getting wireless working, the update manager said updates were available, so I let it install them. It got halfway through, then the laptop suspended itself because it was idle. When I un-suspended it, WiFi and X didn’t come back up and asusosd was busying the CPU. Restarting X brought up a login window on virtual console 9 (only discovered by seeing X running on tty9 in ps), but I had to reboot to get WiFi back so the update could finish. (The Eee seems to resume fine when it’s genuinely idle at suspend.)

I copied the photos from my recent vacation onto its SSD, and went to view them in the file viewer you get from the “Pictures” folder. This brought up Eye of Gnome, and as my camera takes more pixels than the Eee’s display has, you have to scroll. Unfortunately, EOG doesn’t scroll when you make the normal scroll touchpad gestures, but instead changes zoom level. Also unfortunately, EOG doesn’t scroll when you press the arrow keys, but instead switches to other pictures in the CWD. So, to scroll in EOG it seems you have to move the mouse cursor to the arrows on the scrollbar and hold the mouse button down, which is a pretty crummy thing to ask of the user of an Eee. Also unfortunately, if you go to the help menu in the file viewer to try and learn how to change the preferred app for pictures to one which doesn’t suck as hard, you get an error dialog saying there’s no help. Also also unfortunately, the “Preferred Applications” tool doesn’t let you change associations for pictures, only for a small handful of apps: Web browser, mail reader, terminal, and “multimedia” (videos & music) player.

Moving on to more minor stuff, at night, I turned the display brightness down, but twice it switched itself back up to full brightness a few seconds later. (Third time turning down seemed to stick, but it happened again this morning and took four turn-downs.) It was getting hot, because it wasn’t turning the fan on. (After installing cpufrequtils, the fan would turn on.) The Firefox start page is set to a file which isn’t installed. mtr needs root to run, and it’s not installed setuid.

The Eee’s “House” key does nothing — naturally, it should bring you back to the home menu display. This would be convenient, as you have to mouse over to the Ubuntu logo on the top left and click it to get there now, and the other top-left icons are available by cycling through Alt-Tab. There are often spurious mouse clicks generated by the touchpad when I’m trying to fine-position the mouse and it thinks I’ve tapped (the mouse should never require fine-positioning, but that seems to be a lost battle), and at the same time actual taps are often misinterpreted as short moves.

I’m not the first to run into these problems, they all seem to have been reported already, but that I’ve run into so many usability and functionality problems in so short a time means that Ubuntu Eee is clearly not ready for mainstream use. A sophisticated user can get around them (X didn’t come back after un-suspend? Alt-F1, login, start new X, ps, ah it’s on tty9, Alt-F9. — mtr can’t get raw socket? sudo chmod u+s =mtr) but it’s too much to expect from non-geeks, and falls well short of the goal of “it just works”. I’m optimistic about the future — hopefully Ubuntu Eee won’t make a release with such a severe bug ever again, and suspend/resume is getting a lot of work on it in the kernel right now, and a lot of this stuff just needs easy fixes (like putting the help files and start page where they’re looked for (Eye of Gnome OTOH has sucked for years and should just be taken out back and shot)). And it’s a pretty nice experience for me as a “power user”, once I’ve patched the wireless and gotten the big initial update complete and got my image viewer set to ImageMagick…, and I can accept the brightness resetting and suspend problems and the “House” key not working for a few more update cycles. But it’ll be a while still before the dreamed-of shiny usable Linux laptop arrives.

7-Nov-2006

What’s wrong with my sound?

Filed under: linux — jlm @ 13:03

The sound on my Ubuntu box stopped working this morning.
I was getting a ton of messages “ALSA lib pcm_dmix.c:819:(snd_pcm_dmix_open) unable to open slave”. I bounced artsd, and it said that very message on startup. After the usual futzing around, such as looking in syslog and finding nothing, I straced it, and searching for dev files noticed:
open("/dev/snd/pcmC0D0p", O_RDWR|O_NONBLOCK) = -1 EBUSY (Device or resource busy)
Well, that certainly looks like a culprit, would have been nice if artsd could have actually reported that as an error.
Now, let’s fuser /dev/snd/pcmC0D0p — huh, the two xpdf’s I’m running have it open. (WTF is xpdf permanently grabbing my pcm device?) Kill the xpdf’s, now artsd can start cleanly, and I have working sound again.
I have no idea how normal users (Ubuntu’s alleged target market) are supposed to handle this. Reboot, most likely. Works for Microsoft.

30-Jan-2006

screen tutorial

Filed under: linux — jlm @ 19:37

screen is really simple to use, but it can be hard to get started. It has so many features that the essentials get lost if you try (say) to read the manual. So here they are:

1: Start a new session with screen

This is the first thing to do, but it’s confusing, because when you do it you just get a shell prompt again. What happened? You’re actually in a new shell, inside of screen. To demonstrate, start a long-running command, like cat. Leave it up, and go on to

2: Detach from inside screen with “Ctrl-A d”

You should get a message saying screen detached and a shell prompt. This is the prompt from your old shell: It actually ran the command screen, the stuff between then and now was all inside screen, and now the screen command just exited and we’re back at the old shell. Now you can do whatever, log off, log back in, just don’t reboot, then

3: Reattach screen with screen -r

Hey, hey, we’re back where we were when we ran screen in step 1, and our cat is still there waiting for input! That’s the most fundamental concept, the core of screen: It keeps these pseudo-terminals going for you, while you log off, go to bed, switch computers, whatever. There’s a parent “SCREEN” process that screen made, and as long as that process sticks around, you can go back to your pseudo-terminals with screen -r. There’s one other fundamental:

4: Detach from outside screen with screen -d

When you try to reattach a session which screen already has attached elsewhere, it gives you an error. (Try it from another shell.) Maybe the network kills your connection while you’re in screen. Maybe you absent mindedly left it attached from visiting the Timbuktu regional office. Maybe you had to leave in a hurry and couldn’t do petty housekeeping like detaching your session. But you need to reattach that session here. So screen -d will detach the old connection, and now you can screen -r freely. Try it!

That’s the ultra-basics. When you’re comfortable with them, you can read about how to do copy and paste, multiple windows, multi-display, and lots of other useful features… At leisure. You’ve got the core now.

15-Dec-2005

Resetting graphics card without resetting X

Filed under: linux — jlm @ 21:00

Hmm, been a while since I put anything here. How about a tip o’ the month?

Say your graphics card gets all wonky, but you still have a lot of state in your X session which you don’t want to lose. A good thing to try is “sudo chvt 1” to switch to a text console. Then when you bring X back with Alt-F7 or whatever, the X server shifts the card back into graphics mode from a clean slate and then displays everything you have up. Of course, it doesn’t work if it’s the X server itself which is messed up, or if the card’s state is too far gone to switch to text and back.

14-Nov-2005

Restarting firefox after a crash

Filed under: linux, web — jlm @ 15:11

After a crash, do you get messages saying firefox is already running and to shut down your old instance before starting up a new one? You need to delete the invisible “.parentlock” file in ~/.mozilla/firefox/$profile. It might also help to kill any gconfd processes and remove any files named ior anywhere under ~/.gconf (find them with find ~/.gconf -name ior).

Why can’t these apps store some kind of host-process identifier in their lockfiles, so they can detect staleness? (See eg. screen, which easily distinguishes local-live, local-dead, and remote.) gconfd is especially annoying, because it doesn’t report the errors except to the syslog, so the user just gets the mysterious symptom of their configuration settings disappearing.

24-Aug-2005

suphp and WordPress

Filed under: linux, web — jlm @ 13:14

Okay, so I now have WordPress working with suphp, which allows for the use of Unix user accounts in php scripts. Steps:

  • I made a dedicated jlmphp account, so php won’t have access to my main account.
  • The hosting server (ofb.net) runs Debian, so I installed suphp with
    apt-get install libapache-mod-suphp
  • In the Apache config, I put the lines:

    LoadModule suphp_module /usr/lib/apache/1.3/mod_suphp.so
    suPHP_Engine on

    and

    <VirtualHost *>
    ServerName php.mandelson.org
    DocumentRoot /home/jlmphp/www/data/
    </VirtualHost>

    The first set turns suphp on, the second set makes a virtual host “php.mandelson.org” with its own www directiory in jlmphp’s homedir.

  • Made a CNAME aliasing php.mandelson.org to mandelson.org, so that when you look up php.mandelson.org you get this server.
  • Changed the blog address to be http://php.mandelson.org/wordpress/
  • In the .htaccess file for jlmphp, put

    AddHandler x-httpd-php .php

    (which tells Apache to use suphp for .php files in this directory), and put in redirects from the old blog address to the new.

  • Made wp-config.php user-readable-only and change the passwords. (Which is the whole point!)

Powered by WordPress