Raspberry Pi Catch-All

I've decided I'm going to move my personal vps I pay $15 a month for to my Pi, that I'll have setup at home. Seeing how that goes, may buy a second later this year for another project.

Raspberry Pi DLNA for a Car - This project is to replace a two screen dvd player set up in my wifes car with a raspberry pi and two refurbed/used ipods.

I'm not quite a linux newb but I'm not 31337 either, the following is a post of how I got the PI to do what I wanted, mis-steps and all.
When you first boot your PI you will get dropped to an old school GUI. The first time (or three) I got into this I didn't know how to get out so I rebooted (ctrl-alt-del) and it came back. I then configured the setting for Open GUI on Boot. Now I could get into the windows manager (not sure if it used KDE or GNOME, shoot me) and I configure the wireless card with the GUI. I was able to get the MAC of the WIFI NIC add it to my DHCP server and configure my PSK. Now I didn't want to boot into GUI so I ended up reflashing my drive as I couldn't figure out how to edit the files needed to just boot to command line. Google-fu wasn't helping me either.
This time around I tried something different, in the old school GUI (I'll call this raspi-config from now on for reasons you'll see shortly) I actually clicked on the FINISH item. At this point the menu dropped me to the cmdline login prompt and it takes me there every boot, I figure out along the way that I can get back into that initial GUI via the raspi-config command. So I log in and start working.

Some helpful commands:
startx running this gets me back into the GUI to confgure the WNIC. Sure I could use the cmdline but it hurts my head. Once I'm connected I drop out of the GUI.
sudo apt-get update this command finds out what packages are installed and what updates are available.
sudo apt-get upgrade this command actually installs the stuff from the previous command.

At this point I'm ready to actually start tinkering to see if the pi will do what I want.

Using this guide I set up the PI for joining my home SSID or creating it's on ad-hoc wifi network if it isn't home. Now if I were a dick I could leave it at that but I won't, getting the files onto the PI can be a pain. So here's how I did it:
raspi-config This opens that old school menu from initial boot, I enable SSH and FINISH

On my windows machine I can then use the tools I'm used to to save .txt files of the three scripts that the lcdev page walks through. I edit the files to my network config, for example, change the SSID, WEP Key, and static device names and reserved addresses. I then use SFTP to connect to the pi and save the files to /home/pi/Desktop. Now either via SSH or on the console of the pi I can sudo pico or sudo nano the files, purge the files of their contents and use the CTRL R function to read in the saved text files into the config files. Save the files and reboot. For this phase I was using the console for everything but the saving editing of the .txt files I saved over to the pi. This is because on the desktop of the PI there is a ROOT CONSOLE terminal you can run and not have to 'sudo' everything. Plus, if crap goes bad it's eaiser to have the PI attached to a console (in my case the living room TV) with a keyboard and mouse in case any of those files had a typo and you get a glitch.

When I was done with this my PI was joining my network and the DHCP server wouldn't start if it saw my home network.

Next came the media server. I chose Minidlna for this and the guide I used is here though there are some steps that need to be augmented. Let me do that now.
The guide has you change the the database directory to /home/pi/.minidlna (the . in front means it will be a hidden directory). You will need to create this directory. So from cmdline you can type mkdir /home/pi/.minidlna or use the desktop. You then need to change the permissions on this directory:
sudo chmod 777 /home/pi/.minidlna
I did this before I found the permission fix so I am not sure if it is necessary, someone reading this can let me know. I ended up doing an:
sudo apt-get install sqlite

Now I was having an issue. I could manually start minidlna after the PI booted but it would not start on its own because it was trying to start before it had an IP address and I had a custom script doing that.

To start minidlna:
sudo service minidlna start

To verify it was running:
sudo service minidlna status

I then found an app on the itunes store to get to test if this project would work at all or not. The app that worked first was 8player Lite, it's free and will play the first five files in a folder so if you put your stuff in separate folders they'll all play I ended up paying the $6 for the full app after my initial tests were showing this project was attainable.
I had ripped a movie to mp4 using ipod touch settings in handbrake and was my test movie. This played fine with the lite player on the home network.
At this point I had proven that I could connect to the PI on my home network from my wife's iPad. Now I had to tackle the minidlna service issue, it was pretty easy. In the /etc/rc.local file where the boot strap script is I added a line before exit 0. I added this:
sudo service minidlna start

Then the service was starting on boot in the right spot. Now I had an issue that the box wasn't updating the database on boot, again I turned to the /etc/rc.local file and added a line after starting the minidlna service that did this:
sudo service minidlna force-reload

Now I could add/remove files from the usb stick and the files would update. I was just about done. Friday night some friends took us to see the house they're buying. I used this road trip to test the ad-hoc setup. I had ripped two short movies and put them on my usb drive. I had both the iPad and an iPod touch and both devices saw the network and connected fine. Both could stream just fine as well. The project was a success.

When I was done tweaking the PI I disabled SSH access once again.

Guides used to assist in my setup:
Wireless DHCP or Ad-Hoc Script
MiniDLNA setup
Ubuntu MiniDLNA Community Page

I was trying to setup a VPN with my Raspberry Pi using OpenVPN but it didn't really work so I just used the one built into my router. I'm hoping I can VPN in from work and funnel all my traffic through my home connection so the firewall doesn't catch it.

http://lifehacker.com/5978098/turn-a...

Eezy, sounds like a success. How's it working out for you outside of the house?

It works great in the car, I've got my 16GB thumb drive just under half full with 14 movies so I'm pleasantly surprised at how well handbrake gets the DVD's down to 350-500GB in mp4. If my home SSID isn't around the pi goes ad-hoc and creates it's own SSID/DHCP server and I have reservations for the viewers.

I've been testing with my wife's ipad and ipod touch so now I've got to score me some cheap ones on ebay that we won't care if the kids destroy. Battery life of the ipods may be an issue on long drives so we'll see.

I have a Volkswagen with a touchscreen radio, but no GPS or anything extra. i wonder if I could splice in a Raspberry Pi into it. That would be fun, if not completely unnecessary. At least it wouldn't have problems running video at 480p or less, whatever that screen might be.

Plus, Linux in my car, that's uber nerd goodness

I order a pi this weekend. We got a few in at work recently, so far we are just using them for displaying server monitoring stats and as cheap terminal server clients on TVs in out meeting room. Even in this simple set-up I have been quite impressed, its been a while since I have had as much fun on a computer as I did getting quake 3 running on these.

I'm planning to use my new one as a home server, primarily for media but I also want to look into things like DNS, DHCP and VPN. As an IT pro this is the kind of set-up I have wanted for a while but it's hard to justify the hardware costs not to mention the power cost of running a full system 24/7 plus the size noise issues with typical pc's makes it a tough sell. We have 2 young kids so my gaming system which acts as the media server now is fairly rarely turned on but our oldest is starting to get to the age where easy, quick access to a variety of videos on different devices is very handy so I expect the media side of things will prove very popular.

I'm hoping I can VPN in from work and funnel all my traffic through my home connection so the firewall doesn't catch it.

Most workplaces will look extremely dimly at you bypassing the firewall, and while they may not know precisely what you were doing, they'll know you're receiving a great deal of information from your home network (and potentially transmitting a bunch, as well.) If your home network is compromised, a hacker can potentially leapfrog over that VPN link into your corporate network, which is a job-loser for sure, even if you have a lax enough environment where the tunnel won't get you fired in and of itself. And, depending on your industry, an employer may think that encrypted transmissions they can't snoop on might be espionage.

You can be a little safer than running a full VPN; you can use SSH to connect to a home machine, either turning on its built-in SOCKS proxy, or else forwarding a port to a remote Squid proxy. (I've had mixed luck with the native proxy, but tunneling a port to Squid has worked for me for at least a decade.) This method will only transit web browser traffic that connects to the local port, and note that Firefox does not, by default, tunnel DNS requests, so all your DNS lookups are done locally -- this is an instant giveaway that you're doing something you shouldn't. To fix that, go to about:config in Firefox and set "network.proxy.socks_remote_dns" to TRUE, which will then tunnel all DNS requests over the proxy.

Note that if you're blocked from sites at work, this is typically either to try to keep you focused on your job, or else to protect your machine against viruses. If you end up getting a virus by browsing to sites you're not supposed to be on, that can be another career-limiting move.

Typically, this is just a really bad idea, and you're much better off bringing your own laptop to work, and connecting over a cell network. Never plug that laptop into the work network, ever, and they will have little ground to complain.

We have our own, unfiltered network at work that is free and open by design. I just want access to my music from home mostly and to unblock IRC.

Well, you can tunnel a port for IRC as well, that's pretty easy. You don't need a full VPN for that. If your music streamer is on a TCP port, you could also access that via a port forward, but if you want access to, say, a network share, then you'd want a full VPN.

The weak CPU on the Pi will probably limit your throughput, but unless you have a really high upload limit, it shouldn't be a problem.

Running OpenVPN to a server behind your firewall is harder than running it directly to the firewall, by the way. The routing can get pretty tricky, because you'll suddenly have a separate network showing up behind your firewall. As long as the machine you're connecting to is the only machine you want to talk to, then it will work okay, but if you want to use the Pi as a bridge to hop to some other machine at home, then the setup gets quite a bit more complex; any other machine you want to talk to will need to have a route added, telling it that the gateway for your VPN network is the RPi.

That is, say your main network is 192.168.0.0/24. That's a class C, meaning that all the machines on the local network expect anything from 192.168.0.1 to 192.168.0.255 to be on the local wire. So they'll try to reach those addresses directly, and for every other address, they give their packets to the firewall to handle.

Suddenly, you're adding 192.168.1.0, which is outside your normal network range. Any machine you want to be able to answer a connection from the VPN will need to be given a static route, telling them to forward all packets meant for 192.168.1 to the RPi. (this means you usually want to give your RPi a fixed address, instead of DHCP, so it won't accidentally change IPs and break the routing. )

I just went to see if DHCP had any facility for distributing routes, and it looks like it can be done, but it's exceedingly painful. It looks like it will be much easier to just configure individual home machines with the extra route, unless you have a lot of them.

You'll also need to tell OpenVPN to 'push' a route to your remote machines; when they connect, they'll get an address in, say, 192.168.1.X, and you'll need to push the 192.168.0 route to the clients.

So: remote machines need to be told that the VPN is the gateway for 192.168.0.X, and machines in 192.168.0 need to be told that the RPi is the gateway for 192.168.1.X. If either side is misconfigured, the connection won't work.

When you run the VPN to the router/firewall, you skip most of the extra pain. You may still need to push a route to remote machines for 192.168.0, but you don't have to do anything to the other computers at home. They'll all just work.

edit: Well, they'll all just work as long as your firewall passes the packets back and forth. I imagine consumer-grade routers would do this for you automatically, but I can't promise.

One other thought: port forwarding over SSH doesn't work very well on a lossy connection. You're tunneling TCP over TCP, meaning that both stacks will be running error correction, which you don't notice at all when things are good, but if you start getting any packet loss, both layers start retrying, and you end up with a hell of a mess. The connection can go from just fine to dismal almost instantly, as soon as you start dropping packets.

OpenVPN normally runs on UDP, so it doesn't add an extra error-correction layer. This makes it much, much better on a lossy connection, because only the upper TCP layer will be doing error detection and packet retransmission. The connection will degrade gracefully, instead of going suddenly from just fine to barely or non-usable. This makes it a much better overall solution, if you have the time to get it running.

Yet another thought: earlier, I said "The routing can get pretty tricky".

That was a poor choice of words. It's not tricky routing. It's just one additional static route, which isn't that hard. But you have to start thinking about routing for the first time, where normal home networks don't think about it at all.

So, it's tricky in the sense that you have to do it, but as routing goes, it's a baby step.

So I ordered a monoprice wifi dongle, power adapter, and cable. Everything works great, the wifi dongle was plug and play in Raspbmc. As soon as I configured the ssid, and password I was connected to my network.

The unfortunate thing with Raspbmc, that I only just noticed, is that you need to select whether or not you are using a wired or wireless connection, and when you are using the wifi option you seem to be able to only add one SSID and password.

Ultimately what I would love to have the thing do is look for a network connection and if it doesn't find one create it's own ad hoc network so I can use my iphone to connect to it when I bring the thing over to a friends place. This way I don't have to worry about connecting a mouse to it everywhere I go. There is an adhoc setting in raspbmc but when you turn it on it takes over.

Tag.

I think I would really like one of these in my car. I know lots of people are using them that way. I need to look into it and see if someone has figured out a way to have it integrated with a standard head unit for controlling playback.

Probably the only thing you'd find for that is if your head unit has either controls for a CD changer or steering wheel controls. Those are really the only things that are exposed for any sniffing or hacking.

Gaald wrote:

The unfortunate thing with Raspbmc, that I only just noticed, is that you need to select whether or not you are using a wired or wireless connection, and when you are using the wifi option you seem to be able to only add one SSID and password.

Ultimately what I would love to have the thing do is look for a network connection and if it doesn't find one create it's own ad hoc network so I can use my iphone to connect to it when I bring the thing over to a friends place. This way I don't have to worry about connecting a mouse to it everywhere I go. There is an adhoc setting in raspbmc but when you turn it on it takes over.

I used the bootstrapper script and files here as the starting point for my config. It seeks for known wifi network(s) and if it sees any (in the script as 'MyWlan' 'MyOtherWlan', etc) it will join them otherwise it will start in adhoc mode and then start a DHCP service for giving out addresses to any clients.

I had an issue with MiniDLNA in that it was trying to start before the bootstrapper script had executed. Since MiniDLNA needed an IP before it started I was in a situation similar to yours. I got rid of the minidlna startup in boot and added the following to the rc.local (where you are to put the bootstrapper script) for that, you could probably do something similar for xbmc:

if ! $connected; then
createAdHocNetwork
fi

sudo service minidlna start

sudo service minidlna force-reload

exit 0

Of course you'll want to change the SSID and WEP key you give your own RaspPi if you use the script. The page also walks you through making sure DHCP only sends out/listens on the wireless interface and stopping the DHCP server from starting if it's on a known network. Be sure to read it fully before mucking about.

Spent the better part of my night setting it up, but I finally got my Raspberry Pi running nginx & php5 thru fast-cgi.

Ended up having to log into my cable modem and change to Bridge mode, set up a few ports for handoff on my router to the Pi, and voila!

Now it's running ddclient to monitor my IP, updating multiple domains on my namecheap account (and 1-2 others). Setting iptables and fail2ban next, as well as considering putting a sql server on it... maybe.

Considering my hosting history, I'm really enjoying this. You can visit http://rpi.trueheart78.com if you want to see what I originally setup as my testing site.

Off to cancel my VPS, then I'll be looking at setting up backups to either a network (or USB drive, the SD card I'm using is only 8GB) or Amazon.

Wee!

trueheart, that sounds like everything I should do with it. I'm going to have to take a look.

Eezy_Bordone wrote:
Gaald wrote:

The unfortunate thing with Raspbmc, that I only just noticed, is that you need to select whether or not you are using a wired or wireless connection, and when you are using the wifi option you seem to be able to only add one SSID and password.

Ultimately what I would love to have the thing do is look for a network connection and if it doesn't find one create it's own ad hoc network so I can use my iphone to connect to it when I bring the thing over to a friends place. This way I don't have to worry about connecting a mouse to it everywhere I go. There is an adhoc setting in raspbmc but when you turn it on it takes over.

I used the bootstrapper script and files here as the starting point for my config. It seeks for known wifi network(s) and if it sees any (in the script as 'MyWlan' 'MyOtherWlan', etc) it will join them otherwise it will start in adhoc mode and then start a DHCP service for giving out addresses to any clients.

I had an issue with MiniDLNA in that it was trying to start before the bootstrapper script had executed. Since MiniDLNA needed an IP before it started I was in a situation similar to yours. I got rid of the minidlna startup in boot and added the following to the rc.local (where you are to put the bootstrapper script) for that, you could probably do something similar for xbmc:

if ! $connected; then
createAdHocNetwork
fi

sudo service minidlna start

sudo service minidlna force-reload

exit 0

Of course you'll want to change the SSID and WEP key you give your own RaspPi if you use the script. The page also walks you through making sure DHCP only sends out/listens on the wireless interface and stopping the DHCP server from starting if it's on a known network. Be sure to read it fully before mucking about.

All of that right there, just flew right over my head! I have no idea where I would start with this. I'd love some help if you were at all interested in? Maybe over teamspeak one day?

Citizen86 wrote:

trueheart, that sounds like everything I should do with it. I'm going to have to take a look.

I'm used to using Apache, so learning the basics about Nginx was interesting. Definitely the better choice in this instance, for me, anyway. Still haven't installed a Postgres yet, but again, I will when i need to, or maybe I'll just use SQLite.

The ddclient setup was the most trying, as there is an issue with the caching matching subdomains across different domains (e.g. test.example.com, test.example2.com), but once I realized I could just open it up in an editor, the code to change was straightforward (once I enabled line numbers and knew where to look, it wasn't so bad).

Any desire I had to migrate from using NameCheap as a registrar went away after I setup my domains through ddclient using their DynamicDNS capabilities. Looks like everywhere I went, there was a surcharge to set it up for a domain you owned. I know there used to be many free accounts that let you do this, but now, you're relegated to subdomainchoice.dyndns.com in many instances.

If you don't have them as your registrar, you can use their name servers and still benefit from the Dynamic DNS capabilities.

So pleased to see a Raspberry Pi thread. I've been reading about them since they were released, and I'm planning on ordering one or two next month. Also, XBMC 12 came out a couple of days ago with official Raspberry Pi support. I'd like to make a HTPC, a dedicated emulator box or a jukebox to sit in my kitchen for streaming music. Lots of possibilities.

For those looking to order a Raspberry Pi, instead of trying to deal with Element 14 (site is very slow, stock may not be there), I found MCM Electronics to have them in stock, with a current promo of $5 shipping (+ tax, tho).

Should have my second one in next week sometime

Do I need another Pi? Probably not.. but they're so cool...

I wonder if anyone has a comparison between the 256mb and 512 versions. I know when I use Raspbian, opening more than one tab in the browser would bring it to a halt, taking a minute + to get anything loaded. It very well may be the ridiculously slow CPU, but I would assume RAM plays a large part in that as well.

My understanding is that the usable memory was nearly tripled in the bump to 512, as the core OS and shared GPU eat up about 128ish, by default.

To be fair, using the GUI on my 512 was still dog slow, so.... Yeah...

Yeah, unfortunately I think if you will be using a graphical OS with it on a regular basis you might be better picking up one of these other dual or quad-core type boards for +/- $100.

Just an FYI, my web server setup with the GPU paired down to 16mb is using about 220mb total, so a 256 setup definitely still has uses.

Is anyone using RaspBMC?

I hear the menus are a little sluggish and 1080p playback isn't that great. Is that the case or have any kinks been worked out?

Not sure, it's been a few months since I tried it, and it was still a little clunky. Stauf7 pointed out earlier that apparently XBMC 12 officially supports the Pi now though, so I assume it's gotten better.

Lifehacker did a week of Pi - In their XBMC setup, they don't recommend above 720p for output.