Usenet and Linux CLI

Table of Contents (TOC)

Usenet providers
Searching Usenet
Using nzbget
Using a VPN

There are many articles, seemingly mostly based on Ubuntu, about using Linux with usenet. However most of these deal with setting up a graphic client.

This is not intended to be a comprehensive Usenet guide. It just gives a quick overview of using Usenet with Linux and includes some command line tools.

Providers

As you probably know, access to Usenet groups that provide binaries usually costs, at least in the United States. Giganews has been around for awhile, and some of their premium accounts include vyprvpn. They are Linux friendly, they have setup guides explaining how to use their VPN service with Linux. They specify Ubuntu, but it can really be used with any distribution that uses a version of NetworkManager that works with pptp or openvpn. I cover more about command line vpn setup below.

They are more expensive than most of the other providers. Reviews of the major providers vary--some say that astranews, around $10-$12 USD per month for unlimited access is good, others say that it's slow with SSL. The reader is advised to find recent reviews of the main providers. Many offer a free trial as well. The newsgroupreviews site offers reviews of many providers.

There are also sites, such as blocknews, that offer block accounts. That is, you can buy a block of 200 GB, and then pay again when your limit is used up. I'm not sure about other sites that sell blocks, but with blocknews, at least, you have unlimited time in which to use whatever you purchase.

TOC

Searching Usenet

Once you have gotten a provider, the next thing to do is find something you want. Binsearch is a good, and free, place to start. There are other popular free search sites, such as nzbindex, mysterbin and nzb.cc

I would recommend doing a bit of googling to find out how to determine if a file a is good or not. Binsearch, and other search tools, give you the option of creating an nzb file, which you can then download. I've never even tried to do this without a GUI browser though, as usenet is quite old, older than www, I'm sure it's not that difficult.

There are various paid newsgroup search engines. Sometimes, for various reasons, some legit, many less so, they get taken down. The best thing to do is to google for something like usenet search engine. I believe Giganews provides its own search engine.

TOC

Using nzbget

Now that the nzb file has been downloaded, it's time for a client. My personal needs are very simple--I don't download very much, so I will only be working on one nzb file at a time.

Installing nzbget is simple on most modern distributions. They have binaries that should work on most Linux installations. You should have p7zip and unrar installed. Their pages give a list of requirements. Note that their latest, as of September 2016, uses c++14. They have instructions for compiling on CentOS and Redhat at in their instructions though they state that support for it is considered temporary. See below, for CentOS-7, I had to use the binary for 18.1 and the binaries use different default locations.

The default locations often change, both in location and name. For example, completed files used to be put in a directory called dst, as in destination, but now go in one called completed with the Linux binary installer. On the other hand, FreeBSD's default directories are still ~/downloads/dst for completed downloads. Once nzbget is installed, one has to configure it. We'll assume that your provider is giganews, your username is john and your password is 1234. The binary version will create an nzbget directory from where you run the install script. We'll assume you downloaded it to your home directory, and after running the script, have a $HOME/nzbget directory. In there you will see the nzbget binary as well as an nzbget.conf file. If you don't rename that file (for example, to nzbget.conf.default) nzbget will view that file. If you do rename it, usually it will look for a $HOME/.nzbget configuration file. The rest of this will just deal with Linux self contained install. In FreeBSD, you can see the default directories by looking at /usr/local/etc/nzbget.conf, and you may have to create some of the directories.

Now edit it. It's a long file, but you're only looking for a few lines to change. By default, as of nzbget 20, it will use $HOME/nzbget/downloads. You will put your nzb files in $HOME/nzbget/downloads/nzb and it will put completed downloads in $HOME/nzbget/downloads/completed. You can change these if you wish, by editing the nzbget.conf file. For example, it used to put things in $HOME/downloads/dst so I can alter the MainDir variable to ~/downloads. It recognizes the tilde, ~, as $HOME. You may want to change the MainDir location and the DestDir. Again, because of what I did with older versions, I change the DestDir to ${MainDir}/dst rather than the default of completed.

Next look for
Server1.Host=my1.newsserver.com

We'll change it to giganews.
Server1.Host=news.giganews.com

Underneath that, you'll see several options for Server1. If you're using the default port 119 leave the port line, alone, if using SSL then change the Server1.Port= line to 563. (On Giganews, as per their web page's instructions--your provider may use different ports.) Also, if using SSL change the default of Encryption=no to Encryption=yes. If not using SSL then leave both the port and the Encryption line alone.

Also change the Server1.Username=user and Server1.Password=pass to your user name and password. In the past one used to change the default of Server1.JoinGroup=no to yes, but these days, it doesn't seem necessary. downloads from your provider are failing you can try changing it to use, but it shouldn't be necessary.

So, assuming we kept most of the defaults here, our Server1 section, using SSL would have the lines to be changed reading
Server1.Host=news.giganews.com
Server1.Port=563
Server1.Username=john
Server1.Password=1234
Server1.Encryption=yes

If you installed from your distribution, it probably pulled in par2cmndline or par2--the name of the package varies between distributions, but you do want to have it. Check that you have the command par2verify.
which par2verify

If it's not there, find it with your distribution's search function. In CentOS' case, even though I had to find the par2 libraries, the actual par2verify command is supplied by the par2cmdline package. In some Debian or Ubuntu distributions, it's provided by the par2 package. It is probably necessary for the postprocessing scripts of nzbget.

The free version of unrar, available with almost all distributions is also necessary for post processing to work. Running nzbget is very simple. We have the nzb file we downloaded earlier, we'll call it myfile.nzb
nzbget myfile.nzb

You'll now see a screen showing that it is downloading parts of the file. When done, you will see that your MainDir has several subdirectories. If you stuck with defaults, under downloads, you'll see completed, nzb, queue, and tmp. If you look through your nzbget.conf file, you'll see that the nzb directory is where one is expected to place nzb files, though you don't have to, the queue file is for download qunzbget.confeues and the tmp file for temporary files--if you're downloading a large amount of files, you'll see various files in there while downloading, it's automatically cleaned when the download is complete.

Inside the dst (destination) directory, you'll see nzbget.log and and a directory with the name of the nzb file you started with, so in this case, it would be called myfile. Sometimes, nzbget's post-processing scripts will fail but the file can be salvaged. First run par2repair on the par2 file. It might give a response that rar1 is fine, rar2 is fine, rar3 can't be repaired. In many cases, you'll have files like file.rar01, file.rar02, file.rar03, and file rar.03_duplicate (or similar). Sometimes, if one replaces the original with the duplicate, it will work.
mv file.rar03_duplicate file.rar03

Then try unrar e to extract the file again, or par2repair on the par2 file again. You can also back up your original rar03 file before replacing it with the duplicate, but in my experience, if par2repair can't fix it, it's usually not worth saving.

Another thing that will sometimes happen is that you'll see, while running urar e, that almost the entire file unrars without error, but at 98 or 99 percent it fails. Sometimes, the failure might be an included sample file, or other extra that isn't needed. It's worth a try to add the -kb for keep broken option.
rar e -kb myfile.rar

This time, after unrar has completed, even if it fails at 99 percent, you will have your file. It might or might not work. If the breakage was in the main file, it probably won't, but if the unrar failure is do to some extra file, such as the aforementioned sample, you might be able to successfully use the file.

The rar files, these days, will usually be found in your MainDir/intermediate/ under a directory similar to the name of the original nzb file, such as downloads/intermediate/mydowloadedfile.

You can symlink the nzbget binary to /usr/local/bin, ~/bin, or other place you wish to put it. If left at defaults, it will use the nzbget directory created with a sub directory of downloads, but the downloads directory doesn't get created till you download your first nzb. In there, you will see nzb (where you can save nzb files you downloaded), and completed, which is where completed downloads will go by default.

TOC

Using a VPN

Some people prefer to invest in a VPN. Giganews, for example, has a premium account, about $10 more than their other unlimited account, that includes a vpn connection. One can also search around for other VPN providers--some offer free trials, most of the time, you can determine if you are able to use it with Linux--but it's always good to confirm that, and confirm that you can cancel, before you spend your money.

Giganews's VPN is provided by VyprVPN. They have a page on setting it up with Ubuntu and NetworkManager that worked quite well when I tested it on Mint13 and Ubuntu 12.04. That page uses pptp. They have another page for OpenVPN, which did not work for me. It's possible that it's something my provider is doing, but I didn't investigate it very thoroughly.

If using NetworkManager, then one can just follow the instructions given by Giganews. However, pptp can also be set up manually. It can be a bit more time consuming, and as you'll see, I haven't worked out a few details, but this should be enough to get you started.

You will need the pptp-client, and possibly the server. as well. Search for pptp with yum, apt, pacman, or whatever tool your distribution uses. This varies between distribution--some will require both server and client, others, just the client. In Ubuntu, I believe (untested by me) that it's pptp-linux and pptpd.

In CentOS 6.x, one needs ppp and pptp. This will include the pppd daemon and add an /etc/ppp directory. In there, you will see a subdirectory called peers. Assuming we're going to use the Giganews us2.vpn server, located in the Northeast of the US, we will create a file in /etc/ppp/peers, called us2. We can name it whatever we want, but if you do, in each case where I use us2 in the file, use the name you've given the file. Remember, our giganews username is john and our password is 1234. The server's address is us2.vpn.giganews.com

I haven't tested if every line in here is necessary, but regardless, it should work. The reader is invited to read man pppd and improve their own file. Remember, in this case, I am calling the file us2, and so every reference in my file to us2 should be replaced with whatever you name your file. The /etc/ppp/peers/us2 file should read
remotename us2
linkname us2
ipparam us2
pty "pptp us2.vpn.giganews.com --nolaunchpppd"
name john
lock
noauth
require-mppe-128
refuse-eap

Once that's done, go up one level to directory /etc/ppp. Now we edit /etc/ppp/chap-secrets. We want it to read
john  us2 1234 *

In other words, your user name, the name you gave the /etc/ppp/peers server file, in our case, us2, your password, and an asterisk. In the CentOS version, the default file gives headings of client, server, secret and IP addresses.

Now you can test your setup. In CentOS, manually create a symbolic link from /usr/share/doc/ppp-<version>/scripts/pon to /usr/bin. I did the same for poff which is also in there. Most other distributions will, as part of the install, put the scripts into /usr/bin.

Now you can test it with
pon us2 nodetach

The nodetach option runs it in the foreground, so you can be sure that it's working properly. Hopefully, if there are errors, the output to terminal will make them easy to fix--for example, I once put nolaunchppd, instead of pppd (leaving out a p) in my us2 file, and the output was that the nolaunchppd option wasn't recognized.

If all goes well, you will soon see that CHAP authentication succeeded, and then see a local and remote IP address. You can kill it with ctl+c or use the poff command, mentioned above.
poff us2

You should now be able to run it without the nodetach option and, running ip a or ifconfig, be able to see that your ppp0 interface has an address.

There is one problem. Your traffic isn't being routed through the VPN. If you do use NetworkManager, NM does seem to do this automatically, however, if we're doing it manually, and you use one of the many services to view your IP, for example, ipchicken, you will see that your address appears to be the same as it was before invoking pptp. You have to make ppp0 the default route. Note that as of time of writing, I haven't found a consistantly solution to put your default route back to your eth0 or wlan0, so if you're doing all this before finishing the article be warned.

If you try
ip route add default dev ppp0

You will get an error that the file exists. You have to first delete your current default route.
ip route del default
ip route add default dev ppp0

Now, if you once again go to ipchicken.com, you'll see that your IP address is hidden, and shows up as an address provided by the VPN service.

When finished, there are some scripts included in some distributions to try to replace your default route back to where it was, usually eth0 or wlan0. In my experience, they have not always worked, and I haven't yet figured out why. If you try to reverse the process we just did, with ip route del default, ip route add default eth0, you won't be able to get past your router. What does work for me is a bit awkward, but at present it's what I do. So, we're finished doing our vpn stuff and we want to go back to using eth0. First we remove the default route, then turn off ppp0 with poff, and then add the gateway with the ip route command. For those unfamiliar with the ip command, as opposed to ifconfig and route, I have a short page about it. In this example, we're assuming that your router's (or other gateway's) address is 192.168.1.1

ip route del default
poff us2
ip route add default via 192.168.1.1

Once this is done, typing
route

should show that once again all your traffic is going through eth0 or whatever card you were using. It will still show the us2.vpn.gigagnews.com address in there as a destination. I haven't figured out how to get rid of that, but haven't been too concerned about it.

TOC

It is hoped that this little article, despite my lack of knowledge, saves the reader a bit of time.