Category Archives: Linux

Fioptics TV service with Ubiquiti Setup

At this point, these are more notes for fixing it between upgrades. I use this so that I can hook my UniFi Security Gateway 3P directly up to the ONT and allow all video services to work correctly on my network, with VLANs.

There are too many references to remember on how I built this over the years, but a lot comes from multiple articles on DSL reports, along with things friends have done over time.

My Home Setup

I have multiple networks setup at my house, but in this scenario I will be using my “Home” network, which has the following details:

  • Network Name: Home
  • VLAN: 2
  • Subnet: 192.168.1.1/24

I have the following equipment in my home also that will be used for video:

  • UniFi Security Gateway 3P
  • UniFi Switch 24
  • Actiontec 5240 MoCA Adapters
    • One of my STB has access to Coax, but no Ethernet, so I use a MoCA adapter being my switch and another in front of the Cable Box)
  • Amino Cable Box
    • Entone and ZTE Cable Boxes could be used also. Those have MoCA built in, which reduces the need for a MoCA adapter connected to the Cable Box.
    • An additional note. The Amino Cable Box is wireless, but requires WPS to sync up. Ubiquiti does not support WPS, so they will need to be connected up with Ethernet (or a MoCA adapter).
Read more »

Burnt VPN Pi (VPN Hotspot on Raspberry Pi)

Warning: I found this in my drafts and I think it was mostly done.  Enough where I can follow it again.  You might have issues following it word for word though until I can recheck and remove this warning.

Purpose

The purpose of this project is to create an environment where we can use two Raspberry Pi’s to create a temporary VPN tunnel, where the client Pi also has an AP hotspot that routes all traffic through the VPN tunnel.  This is good for those people who are going to countries that have different policies than your current country.  Some of the uses I’ve used it for:

  • Watching Netflix while in another country so that I can view my home countries content
  • Getting around country firewalls that block applications such as Facebook, twitter, Instagram, etc
  • Connecting back to a trusted network when I am in a spot where the network is known to be monitored and trying to steal data.

Install the Required Software

Install the following packages:

apt-get update
apt-get upgrade
rpi-update
apt-get install openvpn hostapd resolvconf dnsmasq cryptsetup libnet-ifconfig-wrapper-perl cryptsetup

Now disable some of the software from starting up, as we will be having these pieces start up triggered by future events such as eth0 up and openvpn up:

update-rc.d openvpn disable
update-rc.d hostapd disable
update-rc.d dnsmasq disable

Load modules

Read more »

Using MAAS on OpenCompute – Setting up PXE for Serial Console

This article is using Ubuntu 13.10 (Saucy) as a base install.  One of the issues with using OpenCompute nodes is the fact that it is headless.  One of the issues that generally comes up with all tools, being it Cobler, Mirantis, or MAAS, is that the pxe config is not setup to actually show the serial information.  While playing with Ubuntu MAAS, I did figure out a way to redirect the console to serial to be viewed of SOL.

The first step is to install MAAS following the directions that are posted.  In this case I actually installed MAAS on a non-OpenCompute platform, in this case a laptop that I generally use as the controller.  The reasoning is that I don’t want to waste a power OpenCompute  node on what can easily be ran on a basic computer.

We are going to need to modify the templates that are located at /etc/maas/templates/pxe so that we can setup the bootloader and the kernel params so everything gets redirected to console.  If this is not setup, the lat thing you should see before funky characters would be:

Loading amd64/generic/saucy/xinstall/linux........
Loading amd64/generic/saucy/xinstall/initrd.gz.......................

We first will need to setup the boot loader on each image to redirect to the console.  This can be done by:

# cd /etc/maas/templates/pxe/
# sed -i '1iSERIAL 0 115200n8' config.commissioning.template
# sed -i '1iSERIAL 0 115200n8' config.install.template
# sed -i '1iSERIAL 0 115200n8' config.local.amd64.template
# sed -i '1iSERIAL 0 115200n8' config.local.i386.template
# sed -i '1iSERIAL 0 115200n8' config.local.template
# sed -i '1iSERIAL 0 115200n8' config.xinstall.template

The second piece we have to fix then is having the kernel direct to console also.  This is good for when MAAS does the automated install. This step is easier and what you need to do is go to the MAAS webpage, click on the gear on the top left, and scroll down to the “Global Kernel Parameters” section. Add “console=tty0 console=ttyS4,115200n8” in the text box and click the “Save” button.
MaasGlobalKernelParameters

RocketRaid 622 Driver (rr62x) for Ubuntu Linux Kernel 3.8

More of a reference for myself so that I don’t have to go through this again, but I put together the patches people had in multiple places so that I can install rr62x-dkms on my 12.04 system. Probably a better way to do this, but I’m tired and just wanted to get the system up.

File: rr62x-dkms_1.1_all-3.8.deb

Resources Used

Sound on Dell XPS L702X in Linux

After getting the sound working on the laptop, I was still running into issues with distorted sound and the sub woofer not working. The sound chipset that is in it is Intel, as can be seen by:

00:1b.0 Audio device: Intel Corporation 6 Series/C200 Series Chipset Family High Definition Audio Controller (rev 05)

The fix was by adding some additional commands to the snd-hda-intel module:

echo "options snd-hda-intel model=ref index=0" >> /etc/modprobe.d/sound.conf
echo "options snd-hda-intel model=6stack-full" >> /etc/modprobe.d/sound.conf

Accessing your eBook collection managed by Calibre without Calibre Server

This post is about how I’ve been going about enabling access to my eBook purchases that are managed with Calibre without actually using the built in Calibre Server.  All of this is running on Linux, with my eBooks and Calibre Library sitting on a remote Linux File Share.

The reason that I’m not using the Calibre Server to do the distribution is because:

  1. I actually store all the eBooks and the Calibre database on a Linux file share that is then shared on my network using Samba.
  2. I use multiple computers to interact with that Calibre database (not at the same time).  They are all setup to open the database on the samba share.
  3. The file share is headless and does not have X installed

So to do this, the first thing I had to do was setup the directory on my file share and then setup samba to share it out to the network.  Once that was done, I then mounted the share on my client computer.  With that done, when I started Calibre for the first time, I just change the configuration to use the samba share directory.  Now whenever I open Calibre, all the eBooks and database files are now stored and shared internally on my file share.

Read more »

Ubuntu 10.10 Grub Update for OS X

This article builds upon Triple Booting Windows 7, OS X (Chameleon), and Ubuntu 9.10 (Grub2).

I recently updated my desktop to Ubuntu 10.10 and noticed that the grub commands have changed ever so slightly. With the new installation, I just needed to create the /boot/chameleon/ directory again and copy the boot0 from Chameleon 2.0-RC4 into the directory.

One thing that I noticed is that the new grub script also presents 32-bit and 64-bit options for my OS X installation now, which I’m up to 10.6.3. I take care of loading 64-bit through chameleon though. Here is my new entry for loading OS X through Cameleon.

 menuentry "Mac OS X Chameleon (on /dev/sda2)" {
     insmod hfsplus
     set root='(hd0,msdos2)'
     search --no-floppy --fs-uuid --set 62d3496cb25b59d8
     parttool (hd0,2) boot+
     chainloader (hd0,msdos4)/boot/chameleon/boot0
}

Sometimes it doesn’t copy correctly, but it should be two hyphens in front of no-floppy, fs-uuid, and set

You can find your uuid of your partitions by running blkid.

My current partition setup is:

  • /dev/sda1: Windows 7
  • /dev/sda2: OS X
  • /dev/sda3: Swap
  • /dev/sda4: Ubuntu Linux 10.10

Triple Booting Windows 7, OS X (Chameleon), and Ubuntu 9.10 (Grub2)

So wouldn’t you know it, my video card died and I decided to get around to installing Windows 7 and Ubuntu 9.10 at the same time.  Of course, installing Windows 7 took over the booter, then installing Ubuntu 9.10 took over the booter and did a great job at identifying Windows 7 and OS X.  In fact, it did too good identifying OS X.

The new version of grub2 is able to work directly with OS X to start it up natively.  Unfortunately,  I like to try to not patch OS X as much as possibly, so I use Chameleon, which grub2 was bypassing.  I don’t know what a beautiful solution is, but I do know what a working solution is.

OS with Loaders:

  • Windows 7 (Default Boot Loader)
  • Ubuntu 9.10 (Grub2)
  • OS X 10.5.6 (Chameleon 2.0-RC4)

The first step is to install OS X however you usually do it.  Once it is installed, I chose to upgrade to the latest version of Chameleon for some of the additional video card identification that it was able to provide.  All that requires is downloading from the link above and following the directions.  Before you reboot, copy the boot0 file to removable media.

The next step is to install Windows 7.  Once this is done, Windows has now taken over the boot system and you can no longer start OS X.

Finally, it is time to install Ubuntu 9.10.   Once the install has finished, it has taken over the boot screen and you will see entries for Ubuntu, Windows, and OS X.  The only issue is, if you try to start OS X, it will bypass Chameleon and start the kernel directly.

To fix this issue, make the directory /boot/chameleon and then copy the boot0 from the removable media into that directory.  Then add or update the OS X section to the following:

menuentry "Mac OS X Chameleon (on /dev/sda2)" {
        insmod hfsplus
        set root=(hd0,2)
        parttool (hd0,2) boot+
        search –no-floppy –fs-uuid –set 88e76bb6d81f12fb
        chainloader (hd0,4)/boot/chameleon/boot0
}

The “88e76bb6d81f12fb” is the uuid of the partition. You can find the uuid by:

# user@teh-lunix:~$ ls -l /dev/disk/by-uuid/

MSI Wind and Triple Booting

So I just purchased an MSI Wind from Microcenter and have already removed all the OS’ from it. I’m planning on installing Windows XP, Mac OS X, and Ubuntu Linux. Like most of my laptops, things are just plug and play to get it working, so I have a page to help me remember how I did it at: http://192.168.1.2:85/setting-up-msi-wind-to-triple-boot-windows-mac-os-x-linux

So far it looks like it’s perfect for what we need. A nice little laptop that will fit in Kristin’s purse and that will fit in little safes on vacation. Luckily my friend had a usb to ide adapter, so I didn’t have to purchase an external hard drive. I had looked into making a usb boot disks for all three os’s and even looked at using netboot to install. Netboot would have been cool, but I don’t have that much time to get it setup for all three OS’s.

One important note, you need to install Windows XP before anything else.

Using regex on Syslog-ng to save to specific file locations

I had the problem of taking an external syslog feed (through UDP or TCP) that came from multiple devices and then separating them into folders that identified the feeds by customers / device type / host. The one thing I had on my side was that the hostname of the devices were broken up into three parts to help me get this information.

In the old Syslog-ng (1.6.x), there was not a way to regex out this information and then use it in the destination section. Each time we had a new combination, it required writing additional lines with additional regexs. Started to really feel it on performance. With the new branch of syslog-ng (2.0.x), this feature is now available.

You can use up to 256 different $NNN ($1 … $256) macros, but you can only use one regexp expression. This will be done using a filter.

Here’s a full example of what I had done then. What I wanted to do is put the line in a specific file based on part of the hostname. For example:

Hostname: subdomain.domain.tld
Save the log files for that device at:
/logs/$TLD/$DOMAIN/$SUBDOMAIN/$R_YEAR-$R_MONTH-$R_DAY.log

WHERE $TLD is the tld of the hostname, $DOMAIN is the domain from the hostname, and $SUBDOMAIN is the subdomain from the hostname.

I would like to be able to regex this information out of the hostname to use in the destination.

To accomplish this, I was able to use this configuration:

filter f_filter { host(“^([0-9a-zA-Z\-]+)\.([0-9a-zA-Z\-]+)\.([0-9a-zA-Z\-]+)$”); };
destination f_logs { file(“/logs/$3/$2/$1/$YEAR-$MONTH-$DAY.log”); };
log {
     source(external);
     filter(f_filter);
     destination(f_logs);
     flags(final);
};