Running Pi-hole

A few days ago I read a tweet from someone who recounted their experience with Pi-hole, which brands itself as “A black hole for Internet advertisements”. My curiosity being piqued, I read up some more, and I liked what I read.

I’ve run ad blocking extensions in my browsers for years, and it’s made using the web bearable. But if you think about it, what those blockers are doing is simply preventing those ads from displaying; they are still fetched from the internet, using up bandwidth, which slows down your browsing.

Pi-hole takes a different approach, acting as the DNS server for your network. When a request is received, it compares it to a curated list of domains known to serve advertisements and track users, and if it is in that list, instead of forwarding the request to that domain, it forwards it to its own built-in web server, and returns a blank page. In other words, no internet traffic at all is generated!

I had an extra Raspberry Pi on hand, so I figured that I’d play around with it this past weekend. I installed the latest Raspbian operating system on it, and followed the simple instructions to git clone the Pi-hole source code and install it. There are several other pages I found detailing the steps, but as it’s pretty straightforward I didn’t feel that I had anything to add by creating yet another step-by-step guide.

Note that you don’t have to use a Raspberry Pi to run Pi-hole; you could run it on just about any Linux system. There is even a Docker image you can pull and run, so you have plenty of options if you don’t have any Raspberry Pis on hand. If you do want to pick up a Pi or three, I recommend PiShop.us. They have the raw components as well as full kits for the Pi, and also lots of other maker-oriented products.

I use the Google Wifi mesh system in my house, so I was a little concerned that getting it to work with the Pi-hole DNS might be tricky, as the Google Wifi system is rather limited in your ability to customize it. I configured the Raspberry Pi to only use the wired ethernet connection, and plugged that into the output jack of the Google Wifi unit. I set the Google Wifi app to give that Raspberry Pi a static IP address. So far, so good. I first tested it by changing my laptop’s DNS to point to the Pi-hole’s address, and loaded a few web pages. The Pi-hole comes with an admin web server that allows you to not only configure things, but also see real-time stats of the traffic that it’s handling.

Pi-hole Admin Dashboard
Pi-hole Admin Dashboard

Once I saw that it was indeed working and working well, I opened the Google Wifi app to the Settings tab, and then opened the Network and General button. That gives you a page with several options; the one you need is Advanced Networking. The top option on that screen is DNS; open that and change it from the default of Automatic to Custom. Set the Primary server to the IP address of the Raspberry Pi running Pi-hole, and the secondary address to some other server (I used Google’s default of 8.8.8.8). Save that, and you’re in business! (see photo below) Now every device on your local network will experience faster, cleaner internet browsing free of ads!

Google Wifi settings
Configuring the Google Wifi app to use the Pi-hole for DNS. Replace the blacked-out address with your device’s IP address.

If you don’t have a central device acting as a router that you can configure, you’ll have to change each device’s settings to use the Pi-hole for its DNS. A little more work, but once it’s done, it’s done.

As an added bonus, once you’re using Pi-hole, you can disable your browser’s ad blocking software, as it is pretty much redundant. Since I’ve disabled those extensions, I haven’t gotten any of those annoying “Please turn off your ad blocker” popups when I go to some sites. I’m sure that there are some techniques that might flag Pi-hole, but so far I haven’t hit any.

I’ve only been using it for a few days now, but the results were instantly noticeable. The percentage of blocked requests varies slightly, but has typically been around 12%. The Pi-hole project is entirely user-supported, and I was more than happy to donate even after using it for a short time.

Withdrawal

So this week was the big post-op appointment with my surgeon following my total knee replacement. Six weeks: that was the first big milestone, where my progress would be assessed to make sure that I was recovering well. It was also the point where some of the more annoying things that I had to do would end (assuming I had progressed well): no more compression stocking; no more sleeping only on my back with my foot in a foam block to stretch the knee, and no more walker. Full disclosure: I hadn’t used the walker at all since about 2 weeks after the surgery, but the doctors insisted on it as a safety measure, so… 😉

I wasn’t too concerned about the exam, as I had been doing the physical therapy religiously all this time, and had a gotten a good deal of flexibility and strength back. And that’s exactly how the exam went: I was given a proverbial gold star, moving me ahead to the next phase. Joy!

One thing that has always concerned me was my use of pain medication. After surgery they start you on Hydrocodone, a strong opiod painkiller, and boy, did I need it! But as I healed the severe pain diminished, and I really only needed it when doing some of the more painful PT exercises. So two weeks later they switched me to Tramadol, a non-opiod pain medication. Since it’s not an opiod, it is supposedly not as addictive, nor as difficult to stop using once you no longer need it.

So, given my progress on the healing front, and my missing being able to share a glass of wine with my wife at dinner, I decided to stop taking the medication. Sure, it would be uncomfortable for a day or two, but after that I’ll be clean!

So my last dose was this past Tuesday at 11am. Wednesday morning I awoke with what appeared to be a cold: runny nose, congestion, watery eyes, sneezing, and a dry, hacking cough. Oh, great – now I have to deal with a cold on top of everything else!

Towards the end of the afternoon, I started to feel lethargic. OK, I thought, this is the drug withdrawal, and I have to tough it out. I was also feeling chilled, but I didn’t know if that was the cold or the withdrawal causing that. My wife took good care of me, and made a delicious ramen to warm me up, with lots of chili to clear my sinuses, and lots of kale and other veggies to keep me strong.

I went to bed, trying to relax enough to fall asleep, but I just couldn’t get comfortable. I had taken some Tylenol to help ease any knee pain, but my knee wasn’t really bothering me that much. No matter how I tried to position myself, I could feel the muscles in my legs twitching, making it impossible to lay still. I didn’t want my constant movement to keep my wife awake, so I got up. Maybe walking around a bit would calm my legs down, so I walked around the house for a while. That helped a little, but I still didn’t feel like I could rest, so I sat down at the computer, and figured I’d see if there were any tips I could find on dealing with Tramadol withdrawal.

Well, it wasn’t hard to find that information! And man was there a ton of it! The first page I read was a message board where different people described their experiences, and it was like a slap in my face! They described everything I had been feeling; even my “cold” wasn’t a cold, but just some of the symptoms of withdrawal!

I continued reading a variety of sites, and it reinforced all of the anecdotal reports of the first site I read. What was worse, though, is the timeline they described for these symptoms: they would peak after 72 hours without the medication, and continue for 10 days or so! I was barely 36 hours into my withdrawal, and I wasn’t going to be able to handle this without locking myself in a padded room for the duration. Every single site recommended the only way to stop is to gradually wean yourself by slowly reducing your dosage, so that’s what I decided to do. I felt defeated: I had been kicking ass on this whole knee-replacement thing since the beginning, and now I finally ran into something that kicked mine. So I reluctantly took a Tramadol pill at 11:30pm, and an hour or so later I was feeling better enough to attempt sleeping. I did manage to get a few hours, so this morning I’m a little sore and grouchy. My (revised) plan is to go with taking it at 12 hour intervals for a few days, then increase it to 16 hour intervals for another few days, and adjust that as needed until I’m off it completely. No heroic cold turkey for me anymore!

Let me close with a current photo of how my knee is progressing. The swelling continues to diminish, but it’s still there. The scar is looking fine, thanks to the Vitamin E oil I rub in it daily.

6 week knee photo
6 weeks after surgery

Dry

One month ago today I had Total Knee Replacement surgery for my left knee. Before undergoing the procedure, I did as much research as I possibly could. I knew the risks. I knew the timeline I could expect for recovery. I knew the range of outcomes. I knew that the more work you do in physical therapy, the better the outcome. I knew that the physical therapy would be very painful. I knew that I would need to rely on pain medication in order to be able to do what needed to be done.

And all of that information has been spot-on. But there was one bit of information that I probably should have known, but didn’t make the connection: while I was recovering from this surgery, I couldn’t drink alcohol. Opioids and alcohol do not mix!

It’s now been a month since I’ve had any sort of alcoholic beverage. Before the surgery, my wife and I would split a bottle of wine with dinner, and then later I’d maybe enjoy a bourbon later in the evening as the day wound down. Not anymore! I feel as though I should get my 1 month sober chip from AA (well, except for the minor detail that I’m taking opiods!).

I know this sounds a little crazy; after all, I have a brand-new knee! But it’s just one of those things that you really don’t think about ahead of time.

knee replacement at one month
Left knee, one month post-surgery

Here’s a shot of the knee today: the staples have been removed, and all but one of the little bandage strips have fallen off. Compare it to the photo I took 2 days after surgery in this post! I’ll have a nice Frankenstein-like scar on it, but other than that it’s amazing that I can walk and move around almost normally already. I still lack some flexibility, but I’m working on that!

So while I’m happy that the new knee is healing well, I’m longing for the not-to-distant future when I can be off pain meds and enjoy a nice glass of wine once again!

A New Ubuntu VM With Your Username

While many of the VMs I create are meant to be short-lived, some are created as working environments for me. For me, it is infinitely easier to have them all have the username ‘ed‘ so that my brain doesn’t have to do too much context-switching, and so I can use muscle memory.

When creating a new VM with an Ubuntu image, though, the default user is ‘ubuntu‘. It’s rather simple to change that to ‘ed’, but to do it correctly requires a series of steps. Note that these steps are for the current 18.04 LTS release; other releases may need some small changes, but the general steps should be the same. And as I found out those steps by searching the web and finding blogs of people who had done similar things, I thought I’d write down the steps so that in the future others can find this posting and find it useful. And it’ll also be easier for me to find all of it in one place!

So start by creating a VM, using whatever tool you prefer. I use OpenStack (surprise!), which gives me the ability to upload my public key and have it available in the VM so that passwords aren’t needed. The one I’m working on today is for deploying my IRCbot using kubernetes, so I named the instance ‘kubeirc‘. I add a line to my /etc/hosts file to point that name to the IP address of the instance. Once the VM is running I can connect using:

ssh ubuntu@kubeirc

Some people feel that using a password-less sudo reduces security, but if someone has access to your user in your VM, you are probably already pretty hosed. So I change sudo to not require passwords. To do this, run sudo visudo, and change the line beginning with ‘%sudo’ to read:

%sudo   ALL=NOPASSWD: ALL

One of the problems to overcome is that you cannot rename the user you used to SSH into the instance. So I create another user, and give them sudo powers:

sudo adduser temp
sudo usermod -a -G sudo temp

My cloud doesn’t allow SSH with passwords, so the next thing to do is copy the public key from the ubuntu user to the temp user:

sudo cp -R .ssh /home/temp/
sudo chown -R temp:temp /home/temp

Once that’s done, I disconnect the SSH session, and the re-connect as the temp user:

ssh temp@kubeirc

If that doesn’t connect you, go back in as the ubuntu user and re-check the permissions on the /home/temp/.ssh directory and its contents – that’s usually the problem. Once I’m connected as temp, I can then get to work on switching the ubuntu user.

# Change the ubuntu username to 'ed', and change the home directory
sudo usermod -l ed -d /home/ed -m ubuntu
# Rename the 'ubuntu' group
sudo groupmod -n ed ubuntu

That’s it! Now to verify, disconnect the current SSH session, and re-connect with the new name. Since my username on my home system is ‘ed’ (I told you I like muscle memory), I can just run:

ssh kubeirc

…and I’m in! The only thing left is to remove the ‘temp’ user. It’s not critical that you do so, but I like to clean up after myself. To do that, run the following:

sudo deluser temp

That will delete the user and group named ‘temp’, as well as the ‘/home/temp’ directory.

Now I can continue using that VM with the same username as my other development environments. And while this isn’t a large amount of work to do each time, I’d rather not do such repetitive work if I don’t have to. So I add my standard stuff, such as git and vim configuration files, and then take a snapshot of the instance at this point. In the future, whenever I need an Ubuntu 18.04 instance, I can create it from this snapshot, and I’m ready to go.

Post-op

As I mentioned earlier, on Monday I had surgery for a total replacement of my left knee. Long story short: it went better than I could have ever imagined.

The first thing I was to say is how wonderful the staff at the hospital was. Everyone there seemed to focus on making sure that a) I knew what was going on around me and b) that I was feeling OK. To illustrate this, I took a pano of my view from my bed:

Hospital wall charts
Hospital wall charts at the foot of my bed

The charts have most of the information I needed. The leftmost chart shows what I should expect for my progress after the surgery until I am discharged; the center chart has the name of my doctors and nurses, along with notes on what I had already done; and the chart of the right lists all the medications I was on, what they were for, and what other effects they might have. When a new shift came on, the first thing the nurses did was introduce themselves and write their names down. This was very helpful to my drug-addled brain!

Speaking of drug-addled, I don’t remember anything from when they wheeled me into the operating room until when I was back in my room. However, my wife spoke with me as soon as I came out of recovery, and said I told her about several things that happened as they were prepping me for surgery, as well as some comments about waking up in the recovery room. I don’t remember any of that! Apparently whatever sedative they gave me didn’t interfere with short-term memory, but prevented long-term memories from forming. It’s so odd to have someone talk about things that you told them, and you have no clue!

I got precious little sleep that night. First, there is the problem with being awakened every few hours for blood pressure / heart rate measurement. But the main problem was that I had to put my surgical leg into this foam block that elevated my heel an inch or so above the bed. That may not sound like much, but the effect is to force my leg to stretch, as there was nothing supporting my knee. That constant stretching is essential to getting the full range of motion back, but oh man was it painful, even after taking the opioid painkillers! However, after 3 nights of using the block, it feels fine. Making progress like that is always encouraging.

The day after surgery they got you out of bed early to do some physical therapy, and then later had classes for “The Joint Club”: all the people who had had joint replacements the previous day. The nurses and physical therapists went over all of the exercises we would need to do for the next 6 weeks, making sure that everyone was doing them correctly. They also answered all the questions people had about what they should expect. I left there feeling that I knew just how things would progress. Boy, was I wrong! But in a good sense – my progress has been even better!

I’ve gotten a good range of motion back, although I still have a ways to go. I can walk without using my walker, but always use it for safety reasons: one fall and I could undo everything. I do the physical therapy exercises 3 times a day, and they can be very painful! When I’m doing them I keep reminding myself that this short-term pain will result in a much healthier knee in the long run.

And no post-operative report would be complete without a shot of the scar! Well, it’s not a scar yet, but yesterday when the nurse came to inspect the wound and replace the dressing, I managed to get a shot of it: 32 meticulous staples that look like I have a zippered knee!

Post-surgery knee with staples

You can also see the compression marks on my skin. Apparently blood clots are a potential complication of this type of surgery, so besides exercises to keep the blood flowing, I have to wear compression stockings on both legs for 6 weeks. It ain’t pretty, but if it keeps me healthy, so be it.

I’ll try to post one more follow-up in a few weeks with my continued progress. Until then, back to the PT!