Saturday, November 26, 2016

Adding Additional Filesystems in Ubuntu Linux AMI with Packer


It took me too long to find all these pieces and figure this out so I thought I would share it to make it easier for the next person.  I needed to have packer create an AMI that includes an additional filesystem that is already formatted and mounted on system boot.  At first I tried using ami_block_device_mappings, but the new ebs volumes were not re-created when an instance was launched.  Then I found launch_block_device_mappings which causes an additional snapshot to be saved with the additional volume information.

In the amazon-ebs builder, I included a launch_block_device_mappings section with the details about the additional volume:

"builders": [
  {
    "type": "amazon-ebs",
    ...
    "launch_block_device_mappings": [
      {
        "device_name": "/dev/sde",
        "delete_on_termination": true,
        "volume_type": "gp2",
        "volume_size": "8"
      }
    ]

  }
],
Then I added a shell provisioner (it was the second one in the list) to format the filesystem and add it to /etc/fstab:
"provisioners": [
  ...
  {
    "type": "shell",
    "inline": [
      "sudo mkfs.ext4 /dev/xvde",
      "sudo mkdir -p /var/www",
      "echo '/dev/xvde /var/www ext4 defaults 1 2' | sudo dd of=/etc/fstab",
      "sudo mount /var/www"
    ]

  },
  ...
],
You may notice that the device names are different between the builder and provisioner.  The builder uses the AWS name for it (/dev/sde), while the provisioner commands are run on the linux box and must user the device names that linux uses (/dev/xvde).  I haven't looked in to this much but my guess is that it is just a matter of how the linux device driver wants to name the device.

When it is finished I ended up with an AMI that has two snapshots attached to it.  One of the snapshots was the root filesystem, and the other was the additional filesystem that we specified.  When I launch a new instance from the AMI I get two volumes... again one for the root and one for our additional filesystem, and the additional filesystem is mounted where I specified at /var/www.

Thursday, December 31, 2015

Viewing LaView DVR Streams in Linux with VLC

I got the idea from the link: Use VLC to view RTSP stream from LaView LV-PB932F4 IP Camerabut the URL he used didn't quite work with my DVR (a LaView 960H series LV-KDV1804B6BP DVR). So I fired up Wireshark and looked at a couple of the streams and found the right URL's.

To view an individual channel I use a URL like this:

    rtsp://user:password@name-or-ip:port/mpeg4/ch01/main/av_stream

Where:
    user is the user ID to log in to the DVR
    password is the password
    name-or-ip is the host name or ip address of the DVR
    ch01 is the channel to view
    port is the RTSP port that the DVR is configured to use

And to view the "Zero" channel I use a URL like this:

    rtsp://user:password@name-or-ip:port/mpeg4/ch00/zero01/main/av_stream

In VLC I select "Open Network Stream" and plug in the URL and viola...


Wednesday, August 29, 2012

Google Music Manger for Linux Finally Plays Nice with Two Factor Authentication

For some time now the Linux version of Google Music Manager has been a pain to use with two factor authentication enabled.  Until now there was no way to enter the two factor verification code, so the only way to log in with two factor enabled was to use an  impossible-to-remember application specific password.   But the problem with that was that there was no way to have Music Manager save the password for the subsequent log-ins... so every time I started it I would have to look up the password to log in.

Today that has all changed after updating to google-musicmanager-beta-1.0.43.6722-0. When Music Manger asked me to log in I took a chance and tried using my "normal" Google password.  To my surprise a window appeared asking me for my verification code.  After entering the code I was in... no more looking up that application specific password to log in!  I also tried stopping and restarting it and it logged back in without asking me for my password again... it finally remembers me!

Thanks Google for showing a little bit of love to us Linux nerds!


Saturday, August 4, 2012

Some of My Girls

Took some pictures of a few of my girls last week.  Here are a few of them:




Back to Blogger

For the past few years I have been hosting this using Wordpress on a Godaddy hosting account that I was using for other purposes.  I no longer need the hosting account so I have moved back to Blogger.

Wednesday, February 13, 2008

Google Apps and External Jabber/XMPP Servers

Background: I have a couple of domains that I am using with Google Apps. Google Apps includes Google Talk, which is Google's Jabber/XMPP based Instant Messaging. I also have a normal GMail account that also includes Google Talk. While experimenting with an IM interface to Twitter I found that although Google Talk in my normal GMail account could talk to other Jabber systems, Google Talk in my Google Apps account could not.

I found the answer in Kavinda Munasinghe's Blog, and in two Google documents (here) and (here).

As I understand it Jabber/XMPP uses DNS entries to find the servers needed to talk to another domain. For example, if you want to talk to joe@example.com, your Jabber server will use DNS to look up service (SRV) records for the jabber/xmpp service in the example.com domain. Here is an excerpt from the ejabberd documentation regarding the SRV records:

There are 3 SRV records that can be created for a Jabberd installation:

     _jabber._tcp.   ->    .:5269
_xmpp-server._tcp. -> .:5269
_xmpp-client._tcp. -> .:5222

The first and second of these specify the host and the port for server-to-server (s2s) communications. There are two listings for this because the new XMPP protocol, regarding SRV records, is replacing the older Jabber standards. The third listing above specifies host and port for unencrypted client communications (c2s).

Putting it all togehter, the records needed for a Google Apps domain (example.com) are:
_xmpp-server._tcp.example.com. IN SRV 5 0 5269 xmpp-server.l.google.com.
_xmpp-server._tcp.example.com. IN SRV 20 0 5269 xmpp-server1.l.google.com.
_xmpp-server._tcp.example.com. IN SRV 20 0 5269 xmpp-server2.l.google.com.
_xmpp-server._tcp.example.com. IN SRV 20 0 5269 xmpp-server3.l.google.com.
_xmpp-server._tcp.example.com. IN SRV 20 0 5269 xmpp-server4.l.google.com.
_jabber._tcp.example.com. IN SRV 5 0 5269 xmpp-server.l.google.com.
_jabber._tcp.example.com. IN SRV 20 0 5269 xmpp-server1.l.google.com.
_jabber._tcp.example.com. IN SRV 20 0 5269 xmpp-server2.l.google.com.
_jabber._tcp.example.com. IN SRV 20 0 5269 xmpp-server3.l.google.com.
_jabber._tcp.example.com. IN SRV 20 0 5269 xmpp-server4.l.google.com.
_xmpp-client._tcp.example.com IN SRV 5 0 5222 talk.l.google.com
_xmpp-client._tcp.example.com IN SRV 20 0 5222 talk1.l.google.com
_xmpp-client._tcp.example.com IN SRV 20 0 5222 talk2.l.google.com
_xmpp-client._tcp.example.com IN SRV 20 0 5222 talk3.l.google.com
_xmpp-client._tcp.example.com IN SRV 20 0 5222 talk4.l.google.com


Monday, February 11, 2008