GNU/Linux

Set up OpenWRT to connect and use a PPTP VPN.

Running Linux on a router is just like magic, wouldn't you agree? If not - try it!

The other day I wanted to set up a VPN connection for some of my devices at home. And since I only could have one device connected at the time, I figured it would be simpler to connect my router and then have the VPN connected on any of my connected devices at home.

I run OpenWRT on my TP-Link WR1043ND and i found it to be really easy to set up a VPN connection, and use it to tunnel all of the data by default. Here's how:

(To begin with, you need a router running OpenWRT, a VPN account somewhere (your own server, IPredator, whatever) that has support for PPTP, and access to your router.)

  1. Login to your router.
  2. Click System > Software > Update lists.
  3. Press "Avaliable packages" and search for PPTP.
  4. Install these packages: (you might have to do the search again in avaliable packages, for each package)
    luci-proto-pptp, kmod-pptp and pptp
  5. Once these packages are installed, move on to Network and click "Add new interface".
  6. Give it a name, perhaps the name of the service.
    Set the protocol to PPtP and click Submit.
  7. Fill in the form using the info and credentials from your VPN service. Then press Save.
  8. It is a good idea to let the VPN connection to be set up immediately, so set it to connect during book in Advanced settings. Save.
  9. The new VPN interface should now connect itself, but there is still one thing left to do: add it to a Firewall Zone.
    Editing your VPN interface, click on Firewall Settings and add it to WAN.
  10. Surf! To doubble check if the connection is working you could try a site like this one: ipaddresslocation.org

Time for Linux to go mainstream?

Valve has now confirmed that they are working on a GNU/Linux client for their gaming service, Steam. And not just Steam, but one of their very own games too: Left4Dead.

The Linux community has welcome these news with open arm, since there's been speculation about the Steam client for a couple of years.

Now it seems like Electronic Arts might have something up their sleeve after the news has gone out that they will hold a session during next Ubuntu Developer Summit. Is it a game; Origin; something else thats darn cool for the GNU/Linux desktop? Could Canonical be knowing something more, since they've been working with Valve to make sure that Steam will be optimized?

For two years, it's been said that "this (that) year is the year that Linux will go mainstream". Unfortunately this has not been the case, but what about 2012 - could this be the year?

Since Steam finally is on it's way to the Linux desktop, and that EA is even showing up to Ubuntu Developer Summit, I'd say it's definitely on the right course!

Linux is absolutely becoming a larger competitor among Windows and OS X and with Ubuntu 12.04 LTS out the door, Linux is becoming more and more ready to become a OS for everyday use and for anyone, with any kind of computer knowledge.

Tiden och tekniker bara går och går. (+Bildserie)

Tiden går. Allt utvecklas. Om ett par dagar släpps Ubuntu 12.04 LTS, och det har finslipats. Jag har nu kört Ubuntu som primärt operativsystem i sex år. Och vilken skillnad det är, samtidigt som känslan är densamma. Men inte bara pga. operativet i sig, utan också all teknik runt omkring, eller support för hårdvara i Linux-kärnan.

Jag minns när man fick använda ndiswrapper för att få igång 11Mbit WLAN-kort. Eller när Atheros kort fick installeras med reverse engineered moduler, eller Ubuntu hade en bredare lista med "maskinvara" som man var tvungen att installera moduler med stängd källkod.

Det är onekligen spännande hur allt tar sig framåt. Moores lag står kvar och mina datorer blir allt bättre - även om jag satsar på batteritid. I och med Ubuntu 12.04 LTS, håller nu min laptop i ca åtta timmar på batteritid. Min förra håll på sin höjd i tre timmar. Den innan det i två timmar. Innan det i en. Strömsparfunktioner utvecklas och börjar verkligen ta sig - väntar med spänning på morgondagens batterier.

Hur USB-enheter nu monterar sig själv och man inte behöver köra egna mount kommandon:
$ sudo mount /dev/sdc1 /media/extern

Nu kör Ubuntu på hårt för att revolutionera utseendet i ett grafiskt operativsystem. Unity, HUD, färger, indicatorer. Systemet blir mer enhetligt. Det kunde det vara innan med, med GTK- mot QT-lägret, men ändå en rätt ful enhetlighet. Nu ser saker så mycket snyggare ut med nya versioner av både GTK och QT som ger bättre support för anpassning av färger, eller av generella systemanpassningar.

Säkerheten har också gått så mycket framåt. Bara UFW - det är helt underbart! Leka med IPTables är ingen barnlek och jag ser skillnaden när jag mekar med min Linux-baserade router. SSH, nya Mosh. SHA1, Hash, Salt, RSA, AES.

Och hastigheter! Som sagt, mitt första WLAN var 11Mbit. Idag kör jag 300Mbit och 1000Mbit på LAN. Mitt PS3 är uppkopplad till min filserver. Jag kör redudant backup som automatiskt kör backup på alla mina filer i realtime (BareShare). Mitt internet är ett 4G-USB-modem.

Det är bara gött hur allt utvecklas.

Nyheter i Ubuntu 12.04 LTS - Precise Pangolin

Ubuntus nya långtidsutgåva (LTS - Long Time Support) är påväg ut och jag har installerat det på min laptop för att testa lite.
Denna sida kommer kontinuerligt att redigeras med nya trevligheter som jag kommer över under min användning.

Förutom den vanliga paketuppdateringen så tillkommer en hel drös med nya funktioner och nytt utseende.

Jag fokuserar dessutom på standardutgåvan av Ubuntu - alltså Ubuntu Desktop. Är det något särskilt för Ubuntu Server eller Kubuntu, så tilläggs det.


Smått:

  • Smooth scroll - skrollning med musplattan på en laptop är mycket "vänligare" och mjuk. Ingen mer hackig upplevelse alltså.
  • Fler alternativ och snyggare gränssnitt för användaren i Ubuntus Systeminställningar.
  • Mycket mer enhetligt för meddelandekonton (MSN, Gtalk, IRC, Facebook).
  • Rhythmbox är åter standardmusikspelaren.
  • Ubuntu-ikonen har nu en snabblista med favoriter.
  • LibreOffice 3.5.
  • Unityinställningar är en del av systemets utseendeinställningar.
  • Möjlighet att ha Unity (launcher) på alla skärmar som är inkopplade, inte bara en.
  • Program som installeras via Programcentralen, läggs nu till i Unity.
  • Ny Dash video.
  • Bildvisaren har bytt tillbaka från Shotwells bildvisare till Gnomes egna bildvisare.


Stort:

  • Bättre strömsparfunktioner - min laptop har fått va två timmar längre batteritid.
  • HUD - Läs mer.
  • Bättre hantering av ditt privatliv med en ny systeminställning för att tömma historik efter tid, inte lagra viss programhistorik, osv.
  • Den (näst) senaste Linux-kärnan - 3.2.
  • Buggrapportering sätter nu igång i ett tidigare stadium och ger en bättre överskådlighet.
  • Fortsatt utveckling på ett mer enhetligt systemcenter.

3G modem not re-connecting in OpenWRT?

Since I reflashed my router (TP-Link WR1043ND) I found out that I didn't have to use my own usb_serial script to get my Huwaei E182e modem to work in OpenWRT (still running RC5) - it just worked out of the box!

The thing was though, that the modem sometimes would disconnect, and would not re-connect using "ifup wan" anymore. After authentication, the modem would hangup and I had to reboot the whole router - which could get rather irritating.

Today, I gave myself time to explore this issue, instead of using a ping script that rebooted the router if not answering, and I found this thread:
https://forum.openwrt.org/viewtopic.php?pid=159749#p159749

The user, mforkel had a solution that I think would resolve my issue (I'm actually posting this before I've tried it, since I'm not at home at the moment).

  1. Logon to your router using SSH or Telnet.
  2. Edit /etc/config/network. eg:
    $ nano /etc/config/network
  3. Now locate the wan interface, which is using your modem:
    config 'interface' 'wan'
            option 'ifname' 'ppp0'
            option 'proto' '3g'
            option 'service' 'umts'
            option 'apn' 'data.cell.com'
            option 'pincode' '1234'
            option 'device' '/dev/ttyUSB0'
            option 'username' 'danielholm'
            option 'password' 'inspire;)'
  4. Now add this row:
    option 'pppd_options' 'debug noipdefault'
  5. Save and reboot. Good to go!

Review: SparkleShare.

I have a lot of images, code projects, documents, game saves and such, and I want to take good care of them, especially my images - they are the most valuable possession I've got. That's why I need a simple and safe backup solution. Earlier I just had an external harddrive, but thats not simple, nor have the security that I need. That's why I used Dropbox for a while. It was rather cheap and had everything that I needed, except encrypted transfer and I didn't know what happened with them across the Atlantic Ocean. So I started to look for alternatives - safe, secure, encrypted and I also wanted them to be Open Source so that I could have it running on my own server. GNU/Linux support and a client for Android was also needed.

I found SparkleShare that seemed to be a great solution and had pretty much all that I needed: Open Source, using SSH, rather simple to set up on my own server, webui and an Android client. I started to use it and have been using it since late september, 2011. But...

SparkleShare uses Git to store files and keep a history of changes made to my files. Git is created by the same author as of the Linux kernel, Linus Torvald, and were created for the development of the Linux kernel. Keep revision history, a linear development with the possibility to maintain paralell development branches - version control. For this, it's perfect! I use Git for my project nowdays (I used Bazaar before). The company I work for has started to use it, too.

That Git is created to development of software does, however, not make it capable as storing files, in my opinion. Now I have 60GB+ of images from the past ten year of my life - that is not optimal for Git and it's version control. For the everyday user that want's a Dropbox alternative, this is really not the best solution. Perhaps for a person writing his/her Ph D, it would be great. But with a lot of files, which itself creates much data and uses a lot of storage, you dont need to have a history larger then the files/directory itself.

Installation
Installing SparkleShare (server) is pretty straight forward (I'll post a guide soon). Just install SSH, Git and a few other packages on your server, and you're good to go. This is a real plus. Also the client is also very easy to install. It comes with packages for most of the well used GNU/Linux distros, and also Mac OS X - not Windows yet. It's also to build from source. You just install the client, copy the SSH key to your server and start a guide to add your share.

But I'd say this is too hard for new users. Well, if you're already running your own server, I suppose it's not that hard, but using its own SSH keys - without a password - is not something I like to do. But that can also be taken care of, altough it also might be a little to hard for the faint of heart.

Installing the WebUI - that is necessary for the Android client - is a little harder. It has a strict dependancy of package version, which I've had som issues with. Once up and running, it is incredibly easy to add your Android device, just by scanning a QR code.
The Android client is somewhat a different project - the WebUI too - then SparkleShare. It works to download your stored files, not anything more. You can't upload any files, which I very much would like. Perhaps in an later version.

Usage
Once installed and up and running, SparkleShare takes care of your files. By using Git the files are compressed before uploaded, and the transer is safe by it's usage of SSH. But I'm not satisfied. It's hard to upload a lot of files. I wanted to upload all of my 60GB+ images at once, but SparkleShare didn't seem understand that I added the files. Instead I had to remove them and upload them seperately. It worked, but the compression takes a long time, and if the connection between server and client gets broken during upload, the compression has to be restarted. Also, as I was saying, having a history copy of the files on the client, takes of a LOT of storage space.
Smaller files, like my documents is no problem - of course since the're smaller.
With the Nautilus addon, it is easy to get back an old version of an edited file just by right clicking on it.

SparkleShare is just a indicator applet, which is simple and works great. Altough I would like to see some info about the sync, like transfer speed, which files, just like the Dropbox indicator. Also I miss sync over LAN, bandwith limit and being able to pause specific shares - ie. so that I can start SparkleShare to only sync my documents while in school, when I don't want to use up my battery and all of my CPU to compress my images.

Besides that, SparkleShare runs fine in the bakground. If I were to already have uploaded all of my images, the compression wouldn't take so much time, nor would it be as big of a problem, but the local Git history copy, and Git itself, makes it a little less of "fun".

Conclusion
SparkleShare is great for easy sync of small files, not for bigger ones. It's also great if you're developing some small software, which you don't really use Git for yet, but still want's the version controll and being able to upload it - automatically - to GitHub or perhaps your own Git server.

I would say that SparkleShare is not yet ready for daily use and to drop out of you Dropbox use, or alternative.

Git is simply not the best way to get people from the closed, you-dont-know-where-or-what-theyre-doing-with-your-files, clients like Dropbox, and start to use free and open source ones. For me, version controll is not as important as a simple and secure backup solution. I'd say SparkleShare using Rsync would be a better way of doing this.

Perhaps Rsync could be used together with a simple script that saves a deleted file for a while, before it's completely deleted. And perhaps having preferences to set which files/dirs needs to have version control.

I'm sorry to say that I'm leaving SparkleShare to find, or develop, a new backup solution not using Git.

Dagens Kommando: Hantera skärmar enkelt med Disper Indicator.

För ett par år sedan skrev jag om Disper, som jag använde för att få igång min HDMI port på min gamla laptop, och hur man enkelt kunde hoppa mellan skärmar med ett skript jag skrev som använde Disper: Enkelt skärmbyte med Disper + ett tillhörande skript.

Sedan dess har Ubuntu lagt på sig en hel del sk. Indicator applets, och tanken slog mig att jag skulle vilja hoppa mellan skärmar igenom att ha en sådan applet. Men man ska gärna inte återuppfinna hjulet, därför tog jag mig en titt på the internets och fann att det, inte helt oväntat, fanns. Och vet ni vad? Den använder Disper.
Not: Initalt användes bara Disper dör nVidia-kort. Det ska dock funka på flera kort och det funkar med min Intel-grafik.
Såhär lägger du till den:

Vi behöver lägga till två PPAs (förråd) och sedan installera två paket:

$ sudo add-apt-repository ppa:disper-dev/ppa
$ sudo add-apt-repository ppa:nmellegard/disper-indicator-ppa

$ sudo apt-get update
$ sudo apt-get install disper disper-indicator

Kör nu Disper Indicator och där är den nu i indicatorfältet.

Thanks to Ubuntu Vibes for the info!

Humble Indie Bundle 4!

Humble Indie Bundle 4 logo

Något som jag tidigare har skrivit om flera gånger är Humble Indie Bundle, som nu har släppts i sin fjärde upplaga lagom till jul - kanske en grymt bra julklapp för någon eller några.

I Humble Indie Bundle 4 så ingår hela fem spel till en början, och ytterligare två spel om du slår medelpriset:

  • Nightsky HD
  • Shank
  • Super Meat Boy
  • Bit.Trip Runner
  • Jamestown
  • Cave Story + *
  • Gratuitous Space Battles*

* Ingår endast om man betalat mer än medelpriset.

I vanlig ordning är spelen DRM-fria och tillgängliga för alla plattformar. Plus på Steam (redeemable). Alltså Mac OS X, Windows och GNU/Linux!

Spelen skulle vanligtvis kostat omkring 100 dollar, men i denna bunt får man dem alla för ett helt valfritt pris(!). Något som är nytt för denna utgåva är dessutom att man kan välja att skänka pengar till det amerikanska Röda korset. Man kan, som vanligt, dela upp hela sin summa mellan utvecklare och dyl. eller köpa spelen och ge hela summan till Röda korset.

Och med tanke på julen så skulle man kunna sätta en rejäl slant på bunten, och sedan ge bort nedladdningslänken till sina vänner och på så sätt dela glädjen med många fler.

Howto: Re-connect 3G modem automatically using Cron.

I love GNU/Linux and what you could to with it - run it almost everywhere. I'm running GNU/Linux on my router (OpenWRT), which has a USB port and connected to it, a 3G modem.
Using that I share my internet connection with all my devices and it works great - except when it disconnects by itself.

Thats why I wanted to create a simple script that Cron could run and get the connection up again, without me having to do it, or even be at home.

Here's how you do it!
( I want to thank Ubot @ Ubuntu-se.org forums for the help )

This scipt pings Google four (4) times, and if it recives less then four of the pings (or, most probably: none) it re-connects the interface.
My interface' name is wan and I'm using the command ifup to get the interface back up. You should edit this based on your own system.

Copy the text below into a text document - its the script that we'll use:

#!/bin/sh
# 111204 - Daniel Holm <admin@danielholm.se>

# Ping set host too see if there is an internet connection or not. If not, do command
count=$(ping -c 4 google.se | grep 'received' | awk -F',' '{ print $2 }' | awk '{ print $1 }')

if [ "$count" != "4" ]; then
        # 100% failed
        echo "Connection down, setting up."
        ifup wan
else
        echo "Already up."
fi

exit 0

After that, save the file and add a new row to Cron.

If you, like me, are adding this to a router, or alike, and are just using the command line, here's how you do it: (as root)

  1. Create the file you'll be using:
    $ touch check-if.sh
  2. Edit the file and paste the script's code from above:
    $ nano check-if.sh
  3. Now make it executable:
    $ chmod +x check-if.sh
  4. We'll be adding it to Cron using crontab and it'll be run on the hour, every hour:
    $ crontab -e
    Add this row:
    0 */1 * * * /root/./check-if.sh
  5. Enjoy!

 

EDIT: Updated script coming up!

Back to nerd table.

Senaste tiden - sedan mars eller så - har varit brutalt fylld av så mycket jobb, skola eller privatliv, att jag inte funnit tiden till att nörda. Och vet ni vad? Jag vill/behöver få nörda. Koda lite eget, testa lite nya program som kanske kan ersätta ett tidigare (testar nu Tomahawk som erstättare till Banshee och Spotify).

Dels känns det som att man bara följer med i flödet - mainstream - och det är inte riktigt jag. Nu är ju förvisso LIbreOffice standard i Ubuntu, likaså Banshee. Men jag är inte helt okej med andra förändringar - Unity har jag inte ens skapat mig en ordentlig uppfattning om.

Sedan så förlorade jag kod till några av mina småprojekt som jag kodat på; bla. ett pythonskript som postar en bild till Twitter direkt ifrån Nautilus (eller stand-alone). Nu måste jag koda om den, eller göra något nytt. Eller måste - jag VILL!

Häromdagen - dagen innan jag skulle skriva en tenta - fann jag just Tomahawk och ville testa det. Det kommer mer test av det, men det finns ett plugin för bla. Spotify, som jag då ville testa. Som ett barn på julafton laddade jag ner koden och försökte kompilera, gick inte. Kollade beroenden igenom felmeddelanden och apt-cache search, försökte igen; gick inte. Gjorde om proceduren en gång till och fick igång kompileringen och lade in "resolvern" i Tomahawk; gick inte... Visade sig vara en bugg med nyare libspotify som nu ska fixas - jag blir sugen på att fixa det själv.

Jag ljög lite nu förresten... jag har faktiskt satt upp Sparkleshare på en egen server för att ersätta Dropbox och det kommer snart en review av detta.

Det är gött att nörda.

Sidor