Politics, programming, math, and science.
Linux
Properly starting Compiz in GNOME
Aug 20th
The typical method under Ubuntu of setting fusion-icon, a Compiz manager that gives easy access to the Compiz settings manager, emerald themer, and window manager switcher, is to add an entry in Startup Applications. This isn’t an unreasonable assumption, but it turns out to not be optimal; among other things, it causes GNOME Do to drop into its standard, non-composited theme as it winds up starting before fusion-icon can launch compiz. Instead, add the line
to your ~/.gnomerc file, creating it if necessary. This way, GNOME will start compiz and never launch metacity to begin with, saving both login time and the effort of relaunching Do.
Note that if you do have an entry in Startup Applications for fusion-icon, you should edit it to
so that it won’t launch another Compiz instance itself.
Keep / and /home on a Separate Partition
Aug 13th
The title pretty much says it all; if you’re running Linux, I highly, highly recommend that you put /home on a separate partition of your hard drive than the root partition /. Why do this? The biggest reason is that in case you mess up your operating system and need to reinstall it, then you only need to overwrite the / partition, leaving your data in /home fully intact. Since most applications store settings in some su<b>b</b>directory of your home directory, you’ll even get to keep your settings. How do you do this? Simple: when you’re installing the operating system, specify an additional partition to be used as /home. You also might want to set up a swap partition with size about equal to your RAM, but you don’t strictly have to. As for sizing the root partition, I’d go with about 20GB or so; most applications don’t take up a lot of space. If you’re on a SSD and 20 GB is a lot of capacity, you can probably get away with 10; I wouldn’t go any lower than that, though.
Now, the natural question is: how do you set up /home on a separate partition if you already have it on the same partition as /? It’s possible, but dangerous; if you mess this up, you can leave your system in a state that would require a good deal of knowledge to recover. You should be fine as long as you follow these instructions, but I can’t guarantee anything, obviously. I also highly recommend you have an external hard drive of sufficient size to contain your current /home directory (which you can find out via du -sh /home ).
- Create a gparted CD or USB drive. You can’t modify a partition that you’re currently using, and you can’t unmount the root partition while you’re using that operating system. The natural solution: create a LiveCD or USB drive. First, you’ll need to download GParted from here. You can use brasero to burn the CD (pick ‘Burn image’) or usb-creator (both of which are likely in your repositories if you don’t have them already) to create a bootable USB drive from the .iso.
- Reboot and open up GParted. You should boot into the GParted CD/USB. If not, you did it wrong.
- Open up a terminal and GParted. Self-explanatory.
- Mount your current partition. Figure out which device is your Linux partition; look at the GParted window and take note of the entries in the ‘Partition’ column; your Linux partition will likely have filetype ext3, or ext4. For simplicity’s sake, I’m going to assume that it’s /dev/hda1, although you’ll likely have a different one. In the terminal, type the following:
mkdir /tmp/linuxpart
mount /dev/hda1 /tmp/linuxpart - Mount your external hard drive. For the sake of this tutorial, I’m assuming it’s already formatted to something like ext3 and it only has one partition. If you only have one internal drive, then you’re going to be using /dev/sdb1, if you have two, then /dev/sdc1, etc.
mkdir /tmp/exthd
mount /dev/sdb1 /tmp/exthd
mkdir /tmp/exthd/newhomeObviously, if the exthome directory exists already on your external, use a different filename.
- Copy. You can’t just use a plain ‘cp -R’ for this; you’d lose a lot of information. Instead, do
cp -avu /tmp/linuxpart/home/* /tmp/exthd/newhome
This will preserve various stuff, such as symbolic links. It’ll also take a while, so find something else to do.
- Delete. This is the moment of truth; so far, everything that you’ve done is harmless to your drive. Once you do this step, you’re essentially committed.
rm -rf /tmp/linuxpart/home/*
- Unmount. Unmount the internal hard drive with
umount /tmp/linuxpart
This will let you resize it. Don't unmount the external hard drive, though. - Shrink your old partition. Once that's done, you can right-click on the partitions in GParted to manipulate them; it's fairly self-explanatory. Right-click the main home partition, select Resize/Move, set it to however large you think you'll need (I recommend 10-20 GB).
- Resize/move your new partition. Right-click your new partition, pick Resize/Move, and stretch it out to fill all of the available space.
- Execute. So far, you've only told GParted what you want it to do; once you click 'Apply', it'll do all the formatting and resizing and such. Give it a while, especially if you have a big hard drive. Once it's done, make note of the partition device; I'll assume it's /dev/hda2.
- Mount the new partition and copy files back.
mkdir /tmp/homepart
mount /dev/hda2 /tmp/homepart
cp -avu /tmp/exthd/newhome/* /tmp/homepart - Edit your filesystem table. This is important; without this, your OS won't know where to find /home . In the terminal, run
mount /dev/hda1 /tmp/linuxpart
nano -w /tmp/linuxpart/etc/fstabYou should see a file pop up; you can ignore the lines that are already there and add one at the bottom that looks like this:
/dev/hda2 /home ext3 relatime 0 2Obviously, make sure to replace /dev/hda2 with whatever device your home partition is on; if you chose a filesystem other than ext3 for /home, then change that as well.
- Reboot You're done now; reboot, take the GParted CD out, and boot back into your freshly-partitioned Linux installation
Hopefully, this has all gone well and you now have /home on a separate partition. If it hasn't, well... that's why you make backups. You did make backups, right?
Linux on the MSI GT725
Aug 11th
So I finally managed to get my sound to come out of speakers other than the bass on my new GT725 in a way that; it’s not 100% perfect, as I think that the subwoofer isn’t being used, but it’s good enough for me; if you’re an audiophile, you shouldn’t be listening to anything through built-in laptop speakers anyway. The graphics fix I detailed in this post, so I’ll share the fix I found for the soundcard. It’s fairly simple; in a terminal, run
where soundfix.conf can be named anything you want, and then paste these three lines:
alias snd-card-0 snd-hda-intel alias snd-slot-0 snd-hda-intel options snd-hda-intel model=targa-dig
into the file. Reboot and you should have sound that doesn’t all come out of the bass speakers. If you want, you can replace targa-dig with one of the other models listed under the ALC888 section here; if one of them works better, let me know in the comments and I’ll edit it in.
Fixing graphics lag on ATI graphics cards with Compiz
Aug 10th
I recently picked up an MSI GT725 series laptop for portable gaming, and I’m fairly happy with it, although I haven’t had it for too long. One issue that irked me when I first set up Linux on it alongside Windows 7 is that when I enabled Compiz, many things would lag, such as window resizing, window moving, and the opening/closing of Tilda and Yakuake. It turns out that this is due to an old patch for xserver never having been included due to the fact that it causes corruption on Intel cards; however, since I wasn’t using an Intel card, I was able to apply it with no problems. Although the patch can be applied to the raw xserver source code, a much better way to fix it for Linux distros that use apt-get is to use a pre-patched version: simply add the two lines
deb http://ppa.launchpad.net/ubuntu-x-swat/xserver-no-backfill/ubuntu <span id="series-deb">jaunty</span> main
deb-src http://ppa.launchpad.net/ubuntu-x-swat/xserver-no-backfill/ubuntu <span id="series-deb-src">jaunty</span> main
to /etc/apt/sources.list (as root, obviously); then, add the key via
Update your repository information via
, then upgrade all the packages that come up as needing one. Reboot and you should be golden.
On another note, I’ve been unable to get the sound to not come out of the bass speakers on the laptop; as a result, everything has an excess of bass, which makes it sound absolutely horrible. If anybody has any idea what’s causing this, help would be much appreciated.
Irssi, ssh, and screen: Three great tastes that go great together
Jul 22nd
If you’re a total IRC addict like I am, then it can be extremely handy to have a client running 24/7 in case something interesting happens and your computer is off or whatever; if you have logging on, then you can just scroll through the logs. But the only way I know of to do this is to use Irssi, a terminal-based IRC client for Linux/Unix (although OSX ports do exist, and it can be installed on a Windows machine using cygwin). The long and short of it is: you SSH into a remote server and run Irssi under a screen session. If you know what all that means, great, you can go do that now; skip down to the ‘configuration” section below. If not, I’ll walk you through it step by step.
Setup
- Get a shell account on a server somewhere. This very well may be the hardest step for some; I don’t know offhand of any easily-obtainable free servers that will allow you to run Irssi under screen. Most of them either forbid long-running processes or any sort of IRC out right, due to abuse. I happen to know someone who gave me a shell account on their server, so I can’t speak as to the reliability of any free/paid servers that might be out there. If you have a computer that’s always on and runs Linux, you can install openssh via your distribution’s package manager and use that instead. Make sure to forward port 22 on your router, obviously.
- Get Irssi installed on that server. If you have admin rights on the server, then you can just install it via whatever package manager; otherwise, you’ll have to ask the admin nicely to do this for you.
- Start up Irssi under screen. Connect to the server and run screen -U; if all goes well, you should see a totally blank screen except for a new prompt. You are now inside screen, which is like a subshell inside your existing shell, only it won’t quit when you close the window. To get out of screen, press Ctrl-a and then d; to get back in, run screen -raAdU. You can make new ‘windows’ inside screen with Ctrl-a, c (meaning ctrl-a followed by a c) and delete them with Ctrl-a, k; use Ctrl-a, n and Ctrl-a,p to switch between windows. Once you have a screen window set up, just run irssi.
An Irssi primer
If you know how to work irssi, you can skip this part and go on down to the Configuration section. If you don’t, read on.
Irssi supports all the usual commands: /whois, /msg, /join, /connect, etc. But there are two major differences you’re going to have to get used to. The most obvious one is that, by default, you can only have one window visible at a time. You can switch via /win <number>, or by pressing Alt followed by the number of the window (using 10 for window 0); the letters q through o on the keyboard are mapped to windows 11-19. You can move windows around by switching to whatever window and using /win move <number>, and close windows with /win close <number> or just plain /wc <number>. Omit the <number> to close the current window. Alt-a will move you to a window with ‘activity’; I’m not sure how it picks which window to move you to though.
The statusbar indicates which windows have had some sort of activity since you saw them last; dark green indicates a /join or /part or something similar, white indicates someone actually saying something, and hot pink means that someone said your name or someone PM’d you. But I use a script called adv_windowlist, and I recommend you do too; it makes keeping track of windows much easier.
The other thing that you’ll need to keep in mind when using Irssi is that whenever you tell it to join a channel, open up a query with a person, etc., it’ll join the channel on the network you’re currently on, if you’re in a window with a channel or query open, or if you’re in the special status window (window 1), whichever network’s name is specified in the statusbar. You can switch the latter by pressing ctrl-X.
Configuration
Half the reason that you might want to set up in this way is so that you can log every conversation; useful in case there’s a dispute in a channel. Irssi doesn’t log by default, but you can easily enable it: simply /set autolog on. You can chagne the timestamps in the log by adjusting log_timestamp; I personally use “%H:%M:%S ” (without quotes, note the space after the S!), which produces lines of the form
23:31 <@Waxx> No magic ever, under any circumstances.
You can also set the irc autolog path via the variable autolog_path; it accepts the special variables $tag, which is the name of the server the channel/query is on, $0, the name of the query or channel itself. It also accepts all the special strings listed here, although the ones you’re most likely to use are %Y for the four-number year, %m for the two-digit month, and %d for the two-digit day. So, for example, an autolog_path setting of ~/irclogs/$tag/%Y/$0-%m-%d.log would produce logfiles at, say, ~/irclogs/synirc/2009/#site19-07-22.log.
One of Irssi’s key strengths is its ability to be customized by the end-user via perl scripts. Installation is simple; put them in your scripts directory, ~/.irssi/scripts, and then run them via /load scriptname.pl. If you want them to automatically run, put them in ~/.irssi/scripts/autorun and run them with /load autorun/scriptname.pl. The twothat I couldn’t live without are:
- splitlong.pl: Automatically splits long lines you copy-paste into Irssi to get around IRC’s character line limit. Install and forget; no configuration necessary.
- adv_windowlist.pl: Converts the window list into something actually useful: lists all your windows in a grid, along with their names. After downloading, running, and installing it, you might as well remove the standard activity statusbar itemwith /statusbar window remove act as it’s now redundant. You can modify how the window looks by following the instructions in adv_windowlist.pl; personally, I use
/set awl_display_key $Q%K|%n$H$C$S
/set awl_block -15to pad each window’s entry out to 15 symbols and to make each entry be hilighted appropriately as well as have the alt-keymap for that window (if available) prepended to the window name or have the window’s number (if not). Regardless, you should run
/statusbar window remove actto remove the ‘activity’ window, as adv_windowlist.pl renders it redundant.
There you have it; now you should be able to use irssi proficiently. As always, leave questions in the comments. I haven’t covered some of the other stuff you can do, such as theming and setting up automatic rejoin, but this post is getting long as it is and so I think I’ll put those in another post. Happy IRCing!
Gnawwy 0.0.2 out!
Jun 28th
And you said I couldn’t do it. Actually, so did I. I managed to motivate myself enough to get off of my ass and release version 0.0.2 of gnawwy, my little program I wrote to notify Linux users (specifically, Ubuntu users) of updates to Twitter and such via notify-osd. The big changes in v0.0.2 are e-mail account support, support for multiple accounts (Twitter and e-mail), and the movement of password information and such into a .gnawwyrc. The next version I plan on adding some actual error checking and debugging information, so I plan on calling it the actual v0.1.0 release. Now that I’ve motivated myself to get to work on this, I should actually have that out within a week or so. Still yet to come at some unspecified time in the future in no particular priority:
- Notification methods other than libnotify (perhaps even Windows support!)
- RSS feeds
- GUI configuration
- A tray icon to notify you of unread messages
- Actual comments in the code
- A shiny icon
Fixing screen flickers on Linux with NVIDIA
Jun 27th
I use Ubuntu 9.04 for my non-gaming computing typically; I enjoy the increased customizability, and the terminal program included by default is infinitely better than Windows’s shitty cmd.exe. But one of the things that bugged me for a while is that my screen would intermittently flicker black; parts or all of it would just turn black for a fraction of a second and return to normal. I managed to figure that it was only happening when I had the Compiz window compositing manager running, but all the suggestions I was given failed to fix it. Eventually, I tracked it down to PowerMizer, a feature NVIDIA includes with its graphics cards in order to decrease power usage. It’s useful, but sometimes changing power settings on the graphics card can cause the screen to flicker. So I did some quick Googling, and found a fix that works by disabling it entirely. But this will increase power consumption and possibly cause your laptop to heat up (not dangerously so, but enough to be noticeable), so for completeness’s sake I recommend you try these steps first:
- Disable Compiz and use your system for a while; by doing so, you should prevent PowerMizer from having to switch the power supply by ensuring the load on your GFX card never passes a certain level. If it’s still flickering, something else is the culprit.
- Run Compiz with the –loose-binding option but not with –indirect-rendering. If you’re using fusion-icon, which I heavily recommend, you can right-click it and toggle these under “Compiz Options”. If you’re manually starting it, you’ll need to add/remove these switches to whatever process you use to start it.
- Open CompizConfig Settings Manager, and in the Workarounds settings, under Utility, enable Force Synchronization between X and GLX.
- If steps 2 or 3 worked, play around with those three settings until you find something that works for you. I personally enable loose binding due to the performance increase it gives me, but your mileage may vary.
If all else fails, read on.
Avoiding Terminalitis with Yakuake
May 31st
If you’re a Linux user like me, there’s a good chance that you like to drop into the terminal for a lot of stuff; I just find it easier to open a terminal and type ‘cp /tmp/file ~’ than open up my graphical file manager and copy the file that way. The problem with this setup is that you wind up with about 20 terminals after a while; although they don’t take up much resources, it can be annoying when you’re alt-tabbing through windows and you have to skip through all those terminals. While there are solutions that make multiple terminals fit in the space of one (such as tabbed terminals or using screen to have multiple terminals in one), another solution avoids the problem entirely by having a single keyboard shortcut open and close a terminal; if you’ve ever played a first-person shooter game on a PC with a console, you’ll know the sort. And even though, strictly speaking, it’s a KDE app, it works fine on GNOME.
tsocks: Make any application SOCKS-compatible
May 18th
Most applications that require Internet access have at least some form of SOCKS compatibility to allow the usage of proxies, but not all of them do. That’s where tsocks comes in; it overrides certain internal functions of the programs you tell it to load and redirects them through its own versions, which are SOCKS-aware and hence can be used through ssh tunnels, etc. tsocks is dead simple to set up and install; Ubuntu users can just grab it from repositories, or get the raw source files here. Then create a file named /etc/tsocks.conf by running
and adding a line
; that’s it! If your SOCKS server runs on a non-standard port, or requires a username and password, add lines assigning to server_port, default_user, or default_pass respectively.
Using tsocks is easy; if you want to run a single command using tsocks, just add tsocks to the beginning, like
. To make all programs use tsocks until further notice, just run
with no arguments; it’ll create a shell within your shell. To exit back out and stop using tsocks, just type
to exit the subshell.
Gnome-Do: easy keyboard launching for Linux
May 14th
This is the first entry in what I hope will be a regular series: highlighting a useful Linux application that I use and that I think would benefit a significant number of people, as well as providing (Ubuntu-centered) installation and configuration instructions. I intend to keep a Monday/Thursday schedule, although certain events (more on those in a later post) might disrupt my schedule, as well as my general posting for the next couple of weeks.
GNOME-Do is probably one of the most useful programs for any operating system I have ever used, aside from basics such as word processing, music playing, and web browsing. It lets you search for applications and launch them, post to Twitter, control your music, open Firefox bookmarks, and even open ssh and VNC sessions, all without having to drop down into a command line. More >
