Raspberry Pi Ubuntu Server

Ever since the launch of the Raspberry Pi I’ve been a fan. I’ve bought and been gifted many of them over time. It reminds me a little of the NSLU2 (slug), but builds on the amazing hardware advancements driven by smartphones.

I recently bought my first RPi4 – the base model 2Gb version. BuyAPi.ca is local, but I had it shipped. Great prices, and my order was prepped and shipped within 3hrs of submitting it. Even via regular mail, it showed up quickly (days).

What I bought:

I have plenty of micro-sd cards around so there was no need to get another.

The Pi ships in a very cute little box.

The first thing I did was to install the heatsinks. I had to visit the web page to figure out where to put them on the board. Peeling the plastic off the adhesive tape was a little tricky, but a sharp knife blade helped me get under the edge.

There are several choices for the OS to run, and for many of my previous projects I’ve stuck with Raspbian (now known as the Raspberry Pi OS). Since my intended use for this Pi is to run it as a server hosting Pi-hole, I opted to go with Ubuntu server.

Downloading and flashing the image file to the sd-card was straight forward. I connected the Rpi4 to wired ethernet and power, and booted right after the card was flashed. By visiting my main router I could see the DHCP address that the Pi had been given.

By default – the device shows up as hostname ‘ubuntu’ and the default user is ‘ubuntu’. You can ssh directly to the machine, and on first login you are forced to change the password. The password policy requires non-trivial passwords, so it’s not a bad solution to getting going.

At this point I no longer need to access the device physically (or at least very often). I drilled some holes in a bit of wood to accept the brass stand-offs, then mounted the Pi to the stand offs. This let me mount the whole thing to the wall along side my other infrastructure bits (router, modem, voip box, switch).

Based on my server configuration post – I want the new Rpi4 server to be similarly set up.

Stuff I want to do:

  1. Change the username
  2. Change the hostname
  3. Configure automatic updates
  4. Forward email
  5. Fix timezone
  6. Redirect logs
  7. Install Prometheus monitoring

The rest of this post is the details on those steps.

Continue reading “Raspberry Pi Ubuntu Server”

Correct Playlist – Segment Map for Bluray

Before streaming was the primary way to get new content, I collected a lot of movies on DVD / bluray. I still have a large collection, but have been slowly converting it to be hosted on my Plex server. This gives me a Netflix like viewing experience, but for my own personal movie collection.

Handbrake is great for dealing with DVDs. MakeMKV is how I rip bluray disks, then feed the resulting rip into Handbrake to compress it down. I do all of this on my Ubuntu system.

Generally this works really well. Handbrake will automatically select the longest video, and that’s almost always the actual movie itself. With MakeMKV that selection is more manual, but picking 1 title from a list of 10 isn’t all that hard.

When I got to the Hunger Games series, things got a bit more interesting. Starting with Catching Fire the bluray shows you 100’s of feature length titles – all the same duration, but with different segment maps. It seems that all but one of these titles has things shuffled in the wrong order.

Initially I naively picked the 1st and used that one, but upon watching the movie it was obvious there was 1 scene out of place, and thus two weird jump cuts to the flow of the movie. Enough to be annoying.

If you got digging around, you can find advice on which of the many to pick from the list. It turns out that there are multiple versions of the movie: rental, US release, Canadian release, etc. It’s much better to figure it out for the disk you have. The MakeMKV forum has a post about using PowerDVD and Process monitor to figure this out. I struck out here as I didn’t have a Windows machine with the right software combination, and it seems I wasn’t able to get Ubuntu to natively play back a bluray either.

Recently I came across a way to use MakeMKV to do the full process, again thanks to a MakeMKV forum post.

    1. Use MakeMKV to back up the full disk.
    2. Use MakeMKVcon to dump info to a text file

    3. Isolate the segment lists from /tmp/xx.txt. It turns out that “,26,” is unique enough to grab all of the segment lists. For Mockingjay Part 1 there are 550 segment lists on the disk, 519 of these are the length of the movie.

    4. Observations:
      a) All the movie length lists start with the same segment: 519
      b) It seems they all end with 520
      c) There are only 20 chunks in each segment list, and we already know 2 of them. Only 18 to sort into order correctly
      d) The MakeMVK backup has all of the chunks in backup/<disk>/BDMV/STREAM/
    5. Now we just need to play a copy of the movie, I have the DVD as well so VLC can play that back for me. Start at the first chunk, verify it is the start, watch the end to determine the scene break. Then figure out what the next chunk is.
      By building an incrementally specific grep, I can figure out the next chunk options. It is fewer choices than you might imagine. Each one had 2-4 possibilities.
      Hint: as you identify chunks, record the duration – this helps figure out where on the DVD playback you need to review to find the scene break.
    6. Once we identify the correct chunk order – we can go back to MakeMKV and rip the correct stream. A web search can also help verify which one is the right one, as I did for Mockingjay Part 1.

It took me about 35mins to get through step 5, much shorter than watching the whole movie. During the course of the chunk identification, I came across 3 where I had no choice, the only next chunk was the same one. After walking through 12 chunks, I hit a point where there was only 1 segment list left. I quickly verified the segment end/start matches and then double checked against the web search.

Link Dump

“rusty chains” by Creativity103 is licensed under CC BY 2.0

I’m a horrible abuser of browser tabs, often having many many windows with many many tabs. Until recently I was using The Great Suspender to help cut back some of the memory usage – but using any browser extension is a security risk. You’re allowing random code to run within the context of the browser window, giving it potential access to all the things your browser can do – or that you do with the browser.

While I also use a RSS feed reader, I still often come across some article or start down some path of investigation and want to come back to it so I’ll leave it open. I’ve had tabs open for a year or more, I keep them across reboots and have even gone back into my Chrome history to dig out ones that were closed by accidental reboot/restart. It’s a problem.

Today is housecleaning day – let’s dump some links that I keep meaning to look at and have been eating up system resources.

  1. www.tinyjoypad.com
    I own two production Arduboy units, and one dev model. It’s a really fun platform to play and write code for. I kept meaning to explore some of the games on this website.
  2. The Essential Cyberpunk Reading List
    When Neuromancer came out I was hooked. This list came via Adafruit’s blog,  I’ve read many of them but not all.
  3. 100 SF/F Books You Should Consider Reading in the New Year
    This is a 2018 article, it’s still sitting in a tab waiting for me to use it as inspiration for my next book.
  4. Google Chrome – Forensics Wiki
    A cool write up on how to pull data out of Chrome from configuration files on your machine. When I initially opened this tab, the site was still hosted – now only the archive.org link works. Still very cool if I ever were to build out some scripts.
  5. Hasty Scripts: Capture Google Activity Log
    Another article which has also been saved by archive.org on the same topic of pulling useful information via scripts out of Google.
  6. Make the time to fix your time debt
    Clearly not a lesson I’ve learned. This is a hackaday.com article that I keep meaning to read.
  7. The Way The Future Blogs
    A now defunct blog of Frederik Pohl, a SciFi writer who passed away in 2013.
  8. Comparing IPFS and Dat
    Decentralized peer to peer internet is super interesting. I keep meaning to take the time to learn more about the space.
  9. Aube 240V Relay
    I keep meaning to build out a remote control system to power electric baseboard heaters. This seems like a key building block allowing me to trigger 240V circuits.
  10. Behind the One Way Mirror
    An article by the EFF I’ve been meaning to read about privacy and web tracking.
  11. Smartphone Headset Standards
    I meant to blog about this, maybe I still will. Did you know that the 4 connector headphone jack has two different configurations? OMTP vs AHJ? Of course Apple picked one, and many others the other.
  12. 16 Great Tech Blogs by Women
    This seemed like a great set of feeds to add to my feed reader. More diversity in the information I’m consuming will help me have a more rounded view of what’s happening in technology.
  13. Introducing Flan Scan
    This is an nmap based network scanner. It would be a great thing to add to my nighty scripts that run over my home network.
  14. Advent of Code 2020
    I did most of the challenges and pushed the result out to github, I kept meaning to clean up the solutions and push any remaining work I had on my dev machine.
  15. Size Coding
    Seeing a 256 byte demo on hackaday, I was inspired to go see how it all worked being an assembly programmer at heart. It’s a deep well to fall in, with interesting effects in a handful of bytes.
  16. Wichitalks
    I got here because of the talk EVERTHING IS BROKEN (and we can fix it!) but the whole site seems very interesting.

Amazing how many windows / tabs I had been dragging around, my browser load seems much better now. These also experienced some bit rot since I remember having other tabs which I’d obviously accidentally closed and were part of the group of things I was looking at in the context.