LaslowNET Technical Rants, HOWTOs, and Writing

7Jun/100

From The Search Results: CLI Basics

To the person who found my blog by searching "what command to run on terminal emulator", I'd probably suggest the following:

help

7Jun/100

Rogers Wireless Hijacks Wildcard DNS Records

Rogers LogoAlthough I can't confirm when this happened (it may have happened a while ago and I just never noticed), I was browsing the internet last night on my Google Nexus One and noticed that, when I mistyped http://imdb.com, I was redirected to http://www20.search.rogers.com (which doesn't work outside of Rogers' network) instead of receiving a normal Not Found error. This all smacks of the infamous VeriSign Site Finder fiasco.

I'm no fan of browser redirects in any form, and I'm even less of a fan of Yahoo which Rogers partners with to, among other things, provide results on their hijacked landing page. But what can you do? It's their service, and there's no opt-out link on the page.

Well, the answer is to manually opt-out. Unfortunately, you need to have a rooted/jail-broken phone to do this. As stated above, I have a Google Nexus One which runs CyanogenMod, but this should work with any other rooted Android phone and even jail-broken iPhones (although the paths are different -- you'll need to alter them as applicable).

To manually opt-out, do the following (assumes Android phone):

  1. Open a shell on your phone. You can use ConnectBot, Terminal Emulator, or adb shell.
  2. Assume root (su command).
  3. Remount the system partition in to read/write mode --  mount -o rw,remount /system
  4. Browse to /system/etc.
  5. Use your favourite text editor to open hosts.
  6. Add the following to the bottom of the hosts file -- 127.0.0.1 www20.search.rogers.com
  7. Save and quit!

You're done! You've just manually opt'ed-out of Rogers Wildcard DNS hijack. Now you'll just get the normal 'Not Found' errors, as when Rogers see that the domain you've entered doesn't exist and tried to redirect you to their search page, your phone will point that domain to itself and fail as it isn't running a webserver.

TL;DR Version: To prevent getting directed to Rogers' Search Page when you mistype an address, edit your hosts file to point www20.search.rogers.com to the 127.0.0.1 loopback address.

26May/100

Rant: BP “SpillCam” is Windows-Only

So in the wake of this whole oil-spill thing going on, BP was forced to drop a camera down to the source of the link and broadcast the footage out over the internet. Initially, the site was wanged (see the Penny-Arcade definition) due to the huge amount of traffic it was generating, however it's working fine now, at this link:

http://globalwarming.house.gov/spillcam

Of course, unless you're using Windows, that link is no good to you. Why? Because, in this age of HTML5 video and Flash streaming, the video uses the Windows Media plugin - specifically, the Windows Media 9 Codec. There are ways to get it working short of a Virtual Machine running Windows, but it shouldn't be difficult. The video should be in an open, available format to allow everyone easy access.

Now, I'm no Microsoft-hater, and I'm not a Linux fanboy. All I want is to be able to watch video on whatever platform I want, be it Windows, *Nix, or even OS X. I don't think this is too much to ask, yet apparently it is.

Update: A Flash-based stream is available here: http://www.npr.org/templates/story/story.php?storyId=127258287&ft=1&f=1003

Tagged as: No Comments
20May/101

Android: Force Terminal Emulator to Open the BASH Shell as Root

I love my Android phone, but the root side of it still has some quirks. The default shell, for example, is pretty bare-bones. Fortunately, there are ROMs out there like CyanogenMod that help with that side of things by providing little extras like, for example, the BASH shell. BASH is incredibly handy on an Android phone as the default shell doesn't allow you to scroll back through your command history using the track ball.

So while BASH is included in some ROMs, it's not the default shell. Typically, I've been using ConnectBot (available on the Android Market) which works well, however I'd usually end up starting out every session like this:

su -c bash

It's only one line, but really, it's annoying to have to type it out every time. I'm in the IT field, so my nature is to be lazy and automate everything. Enter Terminal Emulator.

Available for free from the Android Market, Terminal Emulator is very basic. It doesn't allow you to SSH to remote systems or anything like that - instead, it just immediately opens a local shell. As an added bonus, the preferences let you specify the Command Line to the shell executable.

I thought this was my answer. I set the Command Line preference to "/system/xbin/bash -" (the location on CyanogenMod 5.x.x -- this may differ depending on your ROM. Make sure the path is correct before hand, as if you set it incorrectly it's nearly impossible to get Terminal Emulator back up and running) and re-launched it.

Success! I was in the BASH shell! However, I wasn't root, and this did cause a problem. As soon as I typed su to become root, my shell was changed back to the default one. After doing a little more digging, though, I found my solution.

In the Terminal Emulator preferences, there's another option for Initial Command - Terminal Emulator will execute this immediately on open. So, I inserted the line I was using in ConnectBot (su -c bash) and voilà! Terminal Emulator now immediately opens with a BASH shell as root.

The TL;DR version: Install Terminal Emulator from the Android Market, open it, hit the Menu button, then Preferences. Tap Initial Command and enter su -c root -- now it will always open with BASH running as root.

Extra Note: If you are using an Android phone without a physical keyboard, simply hold the Menu button on your phone for a few seconds in Terminal Emulator to force the virtual keyboard to appear.

UPDATE: As it turns out, you can do this in ConnectBot as well. Tap-and-hold on the local connection, then choose 'Edit Host' and 'Post-login automation'. Note that if you do this, though, ConnectBot will enter the command, but you still have to press enter to active it.

Tagged as: , 1 Comment
18May/101

Android: The cASE of the Missing Ringtones

A little while ago, I sold my old Rogers HTC Magic(+) to my sister, as I had managed to procure a Google Nexus One. Upon receiving it, however, she had troubles getting ringtones to detect in Settings >> Sound and Display >> Ringtones. A little troubleshooting led to the first problem, which was a ringtone downloaded from Rogers that was in the form of a .DM file. Unfortunately, Android devices aren't able to read these DRM-encrusted files. Even with that explained, though, there was another issue - the phone wasn't detecting any MP3's, either.

After remoting in to the computer and taking a look around, everything seemed normal. I had her mount the SD card, and after browsing around, everything looked alright. As instructed, she had created the correct folder structure on the SD card and placed the MP3 appropriately:

/Media/Audio/Ringtones

(relative to the root of the SD card)

I was a bit stumped, but then I had a brain wave, and renamed the folders as such:

/media/audio/ringtones

Sure enough, the phone then happily detected the MP3 as a ringtone.

The TL;DR version: Like most Linux-based operating systems, Android uses case-sensitive paths. Avoid the urge to properly capitalize your folder names!

7Feb/100

Short: Quantum Linux

Due to a failed kernel upgrade earlier today, I decided to wipe my MSI Wind and start over with the LXDE spin of Fedora 12. After the install, I went through installing my favourite packages, and notice the following while yum processed the dependencies for VLC:

schroedinger   i686   1.0.8-3.fc12   updates   208k

Closer inspection revealed the package to be a codec, but that only led to further questions. Does this package transport video, and then only determine whether it is encoded/decoded when your media player first tries to render it? Does the process involve acid, or radioactive material? Does it work with Boxee?

This has been your annual dose of quantum humour. I now return you to your Superbowl Sunday. Thank you.

Tagged as: , No Comments
27Dec/090

Set Hostname on an Android Phone (rooted with Cyanogen)

Warning: I accept no responsibility if you brick your phone while doing this.

I ditched my iPhone due to problems my local provider was having and got an HTC Dream instead. I promptly rooted it using the Cyanogen Mod, but noticed that by default, Android reports the hostname as 'localhost'. I don't really like this, so I set about finding an easy way to change it.

First off, even rooted, the / partition is mounted read-only when you boot normally, so you need to boot to Recovery Mode (Home+Power). In the recovery menu, choose to boot to console. From there, browse to /system/etc/init.d.

IMPORTANT: Make a backup of '05userinit' before continuing! You can do this by simply running the following command - 'cp 05userinit /05userinit' (without quotes). This will create a copy of it in the / directory. If you screw up your editing, you can just rm the messed up version and cp the backup back in.

To add the command to set the host name, we're simply going to echo in the following two lines:

echo  >> 05userinit

echo hostname NEWHOSTNAME >> 05userinit

Note that there are two spaces after the first 'echo' command. This creates a blank line at the end of the file. The second echo adds the hostname command. This way, whenever your phone boots, the hostname is set. Also, be sure to use two greater-than signs (>), as that appends - if you only use one, it overwrites the contents of the file.

Make sure the edits are correct by typing 'tail 05userinit' - as long as it isn't blank, and there's more than just the hostname line, you're golden. Reboot the phone by typing 'reboot' at the prompt and hitting 'Enter', and you're done.

Once you've booted back up, open up your terminal emulator of choice and type 'hostname' (by itself, no parameters) - it should echo out whatever hostname you specified.

Update (April 6th, 2010): To change your hostname on Cyanogen 5.x, add the following line to the bottom of /system/etc/init.d/01sysctl -- and make sure you make a backup of 01sysctl before editing it!

echo NEWHOSTNAME > /proc/sys/kernel/hostname

5Dec/090

Short: MSI Wind U123 and Fedora 12 Wifi

My MSI Wind U123 has an 802.11n wifi card that uses the Ath9k driver. Although it's technically supported by the 2.6.31 kernel used by Fedora 12, it constantly drops it's signal and often refuses to connect to my access point.

I'm happy to report, however, that after I manually compiled the 2.6.32 kernel and booted with it, the wireless card works perfectly!

Unfortunately, it seems the 2.6.32 kernel also breaks a few things - booting takes 3 minutes, and the machine hard locks on with a black screen if you close the lid. I'm going to try to iron out those issues, but overall I'm pleased with the results.

Edit: I re-installed Fedora 12, then updated to the 2.6.32.1 kernel using the FC13 rpm's from http://mirror.kernel.org - works like a charm now. I still can't close the lid unless I have the action set to 'do nothing', but I can deal with that.

Additional Edit (02/15/2010): I've enabled the Rawhide repo and set it to only include kernel* and dependencies. The 2.6.33 RC chain works perfectly.

20Nov/090

Short: NetworkManager, Bah!

I have a love-hate relationship with NetworkManager on Fedora. I love it on my netbook for the ease it provides when trying to connect to wireless networks. However, I hate it on my dual-NIC workstation at work as it always mangles the connections and tries to route traffic through eth1 when eth0 is the primary network. As such, my favourite commands of the moment are:

chkconfig NetworkManager off

chkconfig network on

Then, a quick change to

/etc/resolv.conf

/etc/sysconfig/network-scripts/ifcfg-eth0

/etc/sysconfig/network-scripts/ifcfg-eth1

in order to add the correct nameservers, gateway, and IP addresses, and life is good!

23Oct/090

MSI Wind/Fedora 12 Beta – Still Pulsing (Updated)

I like bleeding-edge technology. The newer, the better, as there are usually fun little things to discover and rarely does anything bleeding-edge actually work perfectly, giving me ample opportunity to mess around with things.

Enter Fedora 12. I've played with the initial Alpha release, several of the Snap releases, and as of this morning, the Beta release. So far, at least as far as my MSI Wind 123 goes, they're all unusable.

The biggest problem so far is the display - as soon as GDM kicks in, prior to the login screen loading, the screen starts to 'pulse'. To be more specific, if you were to tap the 'Brightness Up' and 'Brightness Down' keys fairly quickly between two different levels, you'd get the same effect. This continues incessantly, and makes it impossible to use the GUI. If I boot in runlevel 3 (direct-to-console), everything is fine, so the issue is restricted to Xorg.

As far as the beta goes, there's been a little regression. In the Alpha and Snap releases, I was able to get all the way to the desktop, despite the pulsing display. Now, with the beta, it takes just over 2 minutes just to get past the boot animation, and then it stalls before the login screen loads. Whether or not this has anything to do with the fact this is a livecd on a USB stick (made with the Fedora live-usbcreator for Windows, with persistent overlay), I'm not sure. I'll probably download another spin (maybe the KDE version) and see if I have any more luck.

Update: Progess! On a whim, I removed rhgb from the kernel line when booting (press Tab to cancel automatic boot, and then again to edit boot options) and was actually able to get to the desktop, albeit with no improvement to the speed of things. The screen still pulses, however I did notice something interesting: while the screen pulses (briefly before the login screen appears, then it stops until you choose a user, and then it starts again), if I switch to another terminal (CTRL+ALT+F2, for example), the login name starts to fill with "^@" repeated several times, and then stops. If I then switch back to the GDM terminal (CTRL+ALT+F1), the pulsing stops.

At least that gives me something to go on.