The One with the Thoughts of Frans

Archive for June, 2011

Switching µTorrent from Windows to Linux

When I wrote this post I spoke as if qBittorrent was an inferior alternative to µTorrent, which it was. However, since 2013 it has reached feature parity with the µTorrent functionality I was depending on. Of course there are still some advantages to using the method I described if you happen to be using µTorrent already, plus it’s made easier by the fact that official stable Linux packages are now available. But if you just want a regular torrent client and you don’t much care for Transmission, I recommend qBittorrent.


A while ago, I wrote about using Wine in order to switch completely to Linux a lot quicker than would be possible if you had to figure out replacements for various pieces of peripheral software. In the case of µTorrent this meant that I could keep on seeding all the torrents I’ve downloaded over the years and not having to set up my RSS feeds and other preferences once more, but it’s not all sunshine. Aside from minor bugs in Wine, it simply uses a lot more memory and sometimes CPU. As an unscientific guestimate, it seems about 5 times as memory hungry as on Windows.

In the not too distant past, fixing this would’ve required a switch to e.g. qBittorrent, but an alpha version of µTorrent Server is now available for Linux. It can do everything normal µTorrent can, but not everything is necessarily available through its default WebUI. Luckily an alternative WebUI is available and I’d highly recommend it over what comes with the µTorrent Server by default. It enables RSS feeds and filters, among other things. I think it’s probably no more than a newer version, so perhaps you can ignore this part of this post if you’re reading this in a few months time.

One thing that doesn’t seem to be mentioned in the documentation anywhere is that you can access the WebUI through http://localhost:8080/gui/.

Now for switching over the data and configuration files. Luckily µTorrent for Linux uses the same data files, so you can easily copy over rss.dat (feeds configuration) and resume.dat (locations of torrents). Of course that won’t fix the problem that directory structures are slightly different on the respective platforms, and I don’t think you can make symbolic links to drive letters except in Wine. That’s where BEncode Editor comes in, as described in an article about moving your µTorrent files. I couldn’t find a similar utility for Linux, but no matter, it works quite well in — drum roll — Wine. I downloaded version 0.7.1.0, the latest at the time of writing.

You should read through the guide I linked, but of course some slight adjustments will have to be made. In my case I did some reorganizing of my HDDs after I hadn’t booted into Windows for a month, but the differences for my torrents weren’t that big. I replaced D:\downloads\torrents\ globally with /media/downloads/torrents/ as outlined in the text. I repeated similar commands for my E:\ and I:\, but of course the specifics will be different for everyone. To finish it off you can replace all instances of \ with /.

Something similar can be done for rss.dat, but I had already adjusted all my filters manually in the µTorrent WebUI.

Assuming you run this command in the directory where you put the µTorrent Server executable, you can run cp /somewhere/uTorrent-for-Windows-folder/*.torrent to copy over all the relevant *.torrent files.

There are some slight inconveniences. For example, you can’t open in folder directly, but you have to navigate there manually or copy the location from the WebUI. However, if you were using Wine you’d already given up on proper integration regardless. I think it’s easier to copy the proper Linux path from the WebUI than to mentally line up Wine drives and directories with real ones.

As one final caveat this method didn’t seem to remember proper times when downloads finished and instead “downloaded” all my torrents at that point in time. I’m sure that could be avoided somehow (perhaps by copying over settings.dat?) but for my purposes it didn’t matter.

Comments

More Fun with Screen and SSH with Byobu: Automatic Reattaching

A while ago I wrote about screen, which makes your SSH experience more satisfying. There are some enhancements you can make to screen with .screenrc, but Byobu does more by default than I ever could be bothered to figure out. It seems to come pre-installed on Ubuntu, while aptitude install byubo suffices for Debian.

I thought it’d be even better if screen automatically attached itself when logging in through SSH, and clearly I wasn’t alone in that thought. I made a slight adjustment to the code I found so that Byobu is utilized when available and otherwise regular screen will load. Screen is often installed by default, unlike Byobu, so that way I won’t have to install or compile Byobu to reap the benefits of my custom .bashrc.

# From http://tlug.dnho.net/node/239
# "The following code when added to your .bashrc file will, after logging in via ssh, look for any unattached screen sessions and automatically attach to the first one found. If only attached sessions are found then a list of these will be outputted to std out. Finally, If there are no screen sessions running at all then a new screen session will be created."
if [ $SSH_TTY ] && [ ! $WINDOW ]; then
	SCREENLIST=`screen -ls | grep 'Attached'`
	if [ $? -eq "0" ]; then
		echo -e "Screen is already running and attached:\n ${SCREENLIST}"
	else
		type -P byobu &>/dev/null && byobu -U -R || screen -U -R
	fi
fi
# Optionally adding the following will alter your prompt to let you easily know which window within a screen session you are currently in.
if [ $TERM = "screen" ]; then
	PS1='window ${WINDOW} '$PS1
fi

Comments (2)