Reinstall GRUB When Your System Isn’t Bootable

Background
From time to time, I have encountered a system where due to some conditions the GRUB installation has become corrupted.  It is a fairly simple matter to reinstall GRUB, and sometimes this can quickly salvage a broken installation.

This is not meant to be a comprehensive guide, but is a compilation of information I found online ([1], [2]) that was useful to me in repairing a few problematic GRUB loaders.  Please feel free to contribute in the comments section if you have something to add.

Setting Up The Environment
The first thing you will want to do is locate a live CD as close to the version of Linux you have installed as possible.  Boot into the Live CD.

You need to set up a functional chroot.  For the purposes of this guide, I will assume /dev/sda1 is your partition on your installation.  We will make a chroot in /mnt/chroot/.

Next, you need to bind the directories that GRUB needs to access.

Finally, chroot to your environment.

Reinstalling GRUB Automatically
You can try a simple reinstall of GRUB automatically first, see if any insightful errors are produced.

Failing that, try the following which will rescan the BIOS drives and update information in the GRUB configuration.

Reinstalling GRUB Manually
If the automatic reinstall does not work for you, try reinstalling via the GRUB shell.

How To Easily Create A DVD From Just About Any Video Format (Linux CLI)

Background
Encoding DVDs seems to be a task which is often overcomplicated.  If you have a video file you would like to convert into a DVD, it turns out it is very easy to do it from the Linux command line.

I was looking for a quick way to encode video to DVD, and I found this fantastic post by vmiimu on the ffmpeg forum. His post was fantastic and gave me the basis to create this guide, so props to vmiimu!  I thought the post was a bit crowded and might be difficult for some people to follow, so I have distilled its essence into this post.

This guide will allow you to convert a wide variety of common video formats into a video DVD.  The scope of this guide is to encode 1 video to 1 DVD with no menu.   The source file can be much larger than a DVD, it will be reduced in size automatically.

Prerequisites
For this guide, you will need the following programs \ commands available.  You may need to install the package from your distribution’s package library.

  • ffmpeg (usually available as a package called ‘ffmpeg‘).
  • dvdauthor (usually available as the package ‘dvdauthor‘)
  • genisoimage (usually available as the package ‘genisoimage‘)
  • growisofs (usually available in the package ‘dvd+rw-tools‘)

Installing these programs is beyond the scope of this guide.  You are assumed to already have them installed.

Hint: If you are using a Red Hat based distro, you may need EPEL and NUX Desktop.

Filenames & Paths Used In This Guide
For ease of understanding, I will be using the following filenames in this guide.  Please substitute your own filenames as you choose.
source.mkv – The original source video file you want to burn to DVD.  This is the only file you must supply, the rest will be created.
temp.mpg – The mpeg encoded video file which will be actually burned to DVD.
dvdmovie – The directory which will store your DVD files during encoding (AUDIO_TS, VIDEO_TS)
dvd.iso – The final .ISO image which you will burn to your DVD.
/dev/dvd – The device path for your DVD burner.


The Process:
Convert the source video to an MPEG video file <4.7GB.
(This may take a long time, and is the most CPU intensive part of the process.)

For videos with 4:3 aspect ratio, use this command:

For videos with 16:9 (widescreen) aspect ratio, use this command:

Assemble a DVD file structure.

Generate an ISO image file.

Burn the ISO to a DVD disk.
Now would be a good time to insert your blank DVD.

That’s It!
Hopefully that went smoothly for you.  Please feel free to post in the comments section if you have any questions or suggestions for improvement of this guide.

Comcast’s Awesomely Accurate Progress Bar

One of my favorite parts of being a Comcast customer is getting to login to my client portal and see my data usage.  (Of course I will enjoy this much less if they eventually decide to enforce their 250GB cap in my area, that will require me to find another ISP or pay their unlimited usage charge or a business class tier).

What I do get a good laugh out of is their ridiculously arbitrary progress bar.

Here is my data usage for January 2016:
comcast-meter-january

As you can see, I used 560GB of data… which although their (non-enforced) cap is 250GB, this appears to be roughly 60% of some arbitrary maximum?

 

I was quite surprised to login today on February 2nd and see this fantastic usage meter appear:
comcast-meter-4gb-off

It would seem that 4GB is almost as much usage as 560GB, who’d have thought?!

I checked on the other page as well and found the same ridiculousness:
comcast-meter-february

I would love to know what’s going on in Comcast’s heads sometimes!

Installing Munin Node on XenServer 6.5

I recently was working with XenServer 6.5 and I wanted to install a Munin Node for graphing system vitals.

Getting Yum working properly to do the install required a bit of Googling, so I wanted to document these commands in case this is helpful to anyone else.

First, you’ll need to install the EPEL repository:

Then, you’ll need to install munin-node using both base and epel repositories.

If you are monitoring with a remote Munin server, don’t forget to add an allow rule in /etc/munin/munin-node.conf, using your favorite text editor.

You can put it somewhere by this line:

Do not fear the regex, that rule allows connections from “127.0.0.1”.  Just replace the digits and leave the other characters alone, and you can use this regex to allow any IPv4 address easily.

Now, we want to go ahead and add the Munin Node to the system startup, and start the process.

Don’t forget to allow incoming port 4949 TCP in your firewall if you are using a remote server to monitor the connections.  Munin shouldn’t talk to unauthorized IPs, but it wouldn’t hurt to only allow connections from the Munin server on that port.  That will not be covered in the scope of this guide, as I don’t know what firewall solution you are using.

Of course, the last step is to add the node in your /etc/munin/munin.conf on your monitoring server.  That config would look something like this, where 123.45.67.89 is your Xen server.

From here, I assume you know the drill with Munin, the server should appear on your HTML pages in 5-10 minutes.  If you’re impatient, you can nudge the cron job that does this by running this:

Have fun!  As always, please feel free to post any questions you have in the comments section, and I will do my best to assist.

Digital Signage with a Raspberry Pi and Google Slides

I have been looking at an easier way to Digital Signage and I just got my first Raspberry Pi.  I figured the low and High def inputs would allow me to strap a rPi on the back of a TV and provide rich content.

I am looking for a opensource, free/very low cost solution that is easy to manage and simple for the people updating it.  I foresee about 10 devices in my future.

I did a lot of reading and found that there are plenty of projects out there already that enable digital signage for the rPi.  I found this site and started down the list.

I tried a few applications and liked Screenly the best.  It is simple, performs well, and overall just works.  See their online demo for their interface. They provide their own rPi image or allow installation onto raspbian if you want to further customize it.  SSH is available on the Screenly image out of the box.  Screenly allows web pages, images, and videos (MP4) to be streamed to the rPi which gives me plenty of flexibility to mix and match what I like.  They have 2 versions; a centrally managed model or a free, per device management model.

My immediate thoughts were to convert our ancient overused powerpoint into something more rich, but to get users to buy into this solution I would first convert them over to Google Slides which would provide an easy to use, collaborative, updating presentation to all devices without actually touching any of the devices.

I created a simple Google Slide presentation with four or five slides and random comments on it.  I followed these instructions to make it automatically full-screen and play right in the browser.  I took that link and threw it right into Screenly-OSE and viola!

Caveats…

  • Google sets a single time for all slides…  Therefore you cannot make one slide longer than the others (as far as I can tell).  Transitions can be set differently though.
    • You could leverage second presentation and set the delay longer, or use the Screenly interface to get more specific in necessary.
  • One issue I ran into was that if you have Google loop the presentation rather than Screenly, the content never updates.  Obviously this defeats the purpose of using Google Slides in the first place.  Let Google finish the presentation and let Screenly reload the presentation and it will be fairly straightforward.
    • Related to the above post, then timing becomes an issue.  Some simple math should work to fix that though.
      • 5 seconds a slide (as per when publishing within Google) plus 3 seconds for transition time (as set in presentation) times 5 (number of slides) should come out to be about 40 seconds.  Tweak as needed.

Things to investigate:

It appears the database being used is simply for the ‘Playlist’.  I would imagine that the application would refresh the playlist frequently.  That being said, would placing the /home folder in a shared NFS location make management easier?  This could also lessen the wear and tear of the SDcard.  If all clients pointed back to this NFS share, would this update all of the clients or would this require a reboot/restart on the clients to apply any updates?  I do not know how the software is triggered or written… So more experiments to come when I get more Pi’s!