A Self Hosted Blog Nightmare

Self-hosting a WordPress blog on a Raspberry Pi 1 Model B has its share of challenges. Setting up your LAMP stack from scratch, updating the OS regularly, and a variety of other issues force you to learn the nuances of web server administration, sometimes on the fly. One of those necessary duties is regularly backing up the MySQL database. Unfortunately, I failed miserably at this final and crucial task.

Basic web server components        Shmuel Csaba Otto Traian CC BY-SA 3.0

After running an update on my server, I suddenly found that I could no longer login by SSH, forcing me to essentially pull the plug and move it over to my testing area, and reboot with keyboard/monitor attached. Hoping for signs of life, I was initially optimistic as it provided a login prompt. Then all hopes where dashed when said login entered a failed state after entering my password. All kinds of unrecognizable error message threw up on my screen – I was at a loss. With a cry of desperation, I managed to mount the Pi’s SD card onto my development laptop (my ancient Toshiba NB205-N210). I copied over my entire web root directory as well as the raw MySQL database files. I feared for the worst.

Long story short, I had to reload an archived image of my OS (Raspbian Jessie) onto the Raspberry Pi in order to simulate the last operational state, fire up a fresh MySql server, transfer over the raw database files, then run a mysqldump in order to get a compressed single file database backup of my blog. Of course quite a few problems occurred in doing this and I had to make several modifications to MySQL’s config file in order to allow for InnoDB error correction. Finally I was able to make a stable database backup that I could upload onto a new server. I learned how to do this by reading a great blog post “Restore MySQL databases from raw *.frm files” at ailoo.net. Thanks to Mathias Geat’s excellent walk-through, I was finally able to get my blog database into a single, non-corrupted file I could work with.

If that sounds like complete gibberish to you, well you don’t have my sympathies, because all of this was only the initial portion of my own personalized MySQL/WordPress Self-Hosting 101 course, featuring the hellish professors at StackExchange, LinuxQuestions.org, and every web server troubleshooting blog post that mentioned Raspberry Pi web servers. Finding the info I needed to get this blog up and running, in a healthy state, was like looking for a needle in the haystack.

Quad core Pi 3, same size, but should run a bit smoother

Which brings me to my next project – building a new web server on a more powerful Raspberry Pi 3, using NGINX (a more lightweight alternative to Apache), focusing on speed optimization and security. I couldn’t have built my new server without the help of Henry Cheung over at E-Tinkers. His post series “Hosting WordPress on Raspberry Pi – A complete approach” has to be the definitive guide to setting up the Pi 3 as a server for a WordPress blog. Everything from FastCGI caching to back-end MySQL administration/security – this guide has it all. Of course I had my issues, as no LEMP (Linix, NGINX, MySQL, PHP) stack installation goes entirely as planned. Just as I reached the height of my debugging desperation, I reached out to Henry via the comments on his post, and he was happy to give me even further guidance through private chat. The Raspberry Pi hobbyist community is unbelievably gracious with their time. Finally, the site was up and secure.

It’s a never ending debugging rabbit hole once you dive deep into the real nitty gritty of MySQL, WordPress optimization, and PHP configuration. I figure the last few weeks did wonders for my preparation for the LPIC-2 (Linux Professional Institute Certification Level 2: Linux Engineer) and accelerating my understanding of WordPress (always good for future employment). And… the site is running smoother than ever, quicker page loads, super secure, and a better blog. Enjoy!

Memory Lane: South Point, Hawaii and the Monkey Man

It’s September, 2001, two weeks after 9/11, and myself and a friend are off on a 3 month+ trip through Hawaii, Fiji, Australia, and New Zealand. After a couple nights hosteling in Waikiki we flew to The Big Island then headed off via rental car for South Point, prepared to use the tents and sleeping bags that took up way too much space in our backpacks. Ignoring Hertz’s insurance disclaimers, we ended up driving our sedan off road toward the rocky cliffs that would be our camp for the night. What we found there was a handful of fishermen and a suspicious brown van.

The Monkey Man swims while yours truly climbs an ancient ladder back up from the deep.

That van’s occupant was a scruffy 50-ish hippy, milking the government, while house-sitting for a buddy on the island. As the afternoon sun beat down, this bespectacled charlatan espoused his life philosophy to us while convincing us, rather easily, to make the 5 story leap into the Pacific. His life philosophy revolved around one simple question:

What is excellent?

According to our new guru everyone, rich or poor, young and old, even the President of The United States (George W. Bush at the time) cared about this single question above all. Thus, as we each leaped into the ocean entrusting our lives to this possible ex-con, and climbed back up the rickety metal ladder (which was possibly more frightening than the jump), I kept thinking about that word – excellent. This is all there is. This feeling is all anyone wants.

That jump was frightening. I was temporarily in shock after my first dive, floating on my back as the swell pushed me dangerously close to the rocks. I may have lost a sandal in the chaos of coming to the surface. But it all turned out fine, as our unemployed van dwelling guide ensured us it would.

South Point (Ka Lae) from the water. Photo by Eli Duke CC2.0

Later our shaggy friend convinced us to make a more harrowing jump into a inland lava tube. He told us we had to get in touch with our “inner monkey”, and for some reason we implicitly trusted his advice. I jumped into a lava tube several stories high, timing the incoming tide to provide enough depth so as to not fatally injure myself. Because the Monkey Man said I could, and because I knew it would be excellent. And it was. Later we sat around his creepy van, ate steaks bought on food stamps, and discussed the good life.

These days you can go on YouTube and watch others take this plunge. Nowadays, I couldn’t imagine myself doing anything that risky. But back in the day I thought nothing of it. Oh…the adventures of youth!

5 Apps for Meditative Commutes

In recent months I have really streamlined my phone, but there are some apps that I use regularly that make the humid summer days of no-aircon Sapporo pass a little more smoothly.

First, the phone: the Samsung Galaxy S6 Edge. I know it’s not the latest model, but until NTT docomo or a competitor offers a free upgrade I will be rolling with this. The ‘edge’ model was a gimmick I fell for, as it adds little to no functionality and can even be a hindrance. But it runs smoothly enough so I can’t complain too much.

Castbox

This app is pretty much my lifesaver. Castbox is a free podcast player, and a fairly decent one. Podcasts are kinda my obsession; they allow me to keep up with my hobbies (Destination Linux, Late Night Linux, The Orvis Fly Fishing Guide), listen to some interesting music (Deep Energy 2.0, Irish and Celtic Music Podcast, Pixelated Audio), and indulge in Star Trek geekdom (Mission Log, Earl Grey, Transporter Room 3). It’s got all the bells and whistles of some of the best paid podcast apps. I zone out pretty regularly on my hour+ commutes via Castbox.

ColorMe

This one is a pure guilty pleasure. An app that gives you beautiful coloring book style patterns and a series of palettes to do with as you please. Just paint by finger! It’s simple, mindless, and the perfect activity for killing a few minutes or a even several hours. I’ve often got some creative inspiration just by filling in a few designs waiting for the tram.

Libby

Libby is a client for the OverDrive electronic library loan system. The OverDrive app works great too, but Libby has a Windows desktop app that syncs with your Android app pretty seamlessly, so you can quickly pull up your book on your desktop and pick up right where you left off. If you can maintain a library card at a foreign library that participates in the OverDrive system, you have instant access to tons of eBooks. Japan has great public libraries, and my main branch has a huge English language section that is severely underused. Unfortunately, Japan is behind the curve when it comes to eBook lending, and the website for the Sapporo Library looks like a Geocities page from 1997. (Side note – Geocities is actually still alive and kicking as Yahoo! Geocities, and is defunct everywhere in the world except…you guessed it… Japan!)

Pocket

I read a lot on my phone, but web advertising often ruins the experience. Plus 4G use drains my battery and even can cause unwanted data charges if I am not careful. That is where Pocket comes to the rescue. When I have WiFi in my apartment I can go scan the web for interesting articles, share them to my Pocket app, then read them on my phone offline with all the ads removed. There are extensions for Chrome and Firefox that puts a Pocket button right on your toolbar, so you can store your articles in one easy click.

Ekitan 駅探

Making clean connections on public train networks is pretty much the name of the game here in Old Nippon, where being at work is much more important that what you are actually doing at work. So getting to work on time and with minimal fuss is my number one priority. Ekitan is one of those apps that I have used consistently since I began work here (It actually came pre-installed on my old Galaxy S2). It works for all train networks nationwide and even is in sync with Sapporo`s streetcar loop, so every part of my rail journey is covered. I can get train times, best connections, walking distances between stations, and fares. It remains up to date, so filling out my monthly transportation reimbursement is a breeze. One drawback for newcomers and visitors to Japan is that you have to input your station names in Hiragana, but if you can manage that then Ekitan should be on your phone.

Of course I sometimes get swallowed into the abyss of Twitter and Instagram but those feeds (who to follow) I’ll save for another post. Happy commuting to wherever you are in the world. Hope it goes smoothly.

Breaking the Rules

My daily commute consists of taking a tram(streetcar) for approximately 15 minutes, followed by a 10 minute subway ride, and then culminating in a 20-25 minute bus ride. It’s a thing of absolute precision. Rarely have I had a delay, even on the buses – traversing some tough snowstorms in the early morning – usually getting to my destination on or around the expected time. These commutes are quiet, orderly affairs. Order and rule following is really the name of the game here in Old Nippon, and this is never more obvious than on public transportation.

No talking on cell phones. Keep your cell phone on silent/manner mode. These are two of the most well known and well followed rules. Trains and buses are pretty much silent. Conversations are kept to a hush. It makes for a rather pleasant journey, but I can only fathom the amount of social engineering that the populace has been exposed to that keeps them so unwilling to break such rules. Travel to South Korea or China and take the subway and sit back and enjoy the chaos.(Just take a look at the Tokyo Metro “Things to Consider When Riding the Subway” to get a feel for what I am talking about.)

But the real social engineering isn’t inside the trains, it’s on the platform at each station. There you will find very clear lines painted in front of each carriage door entrance, showing passengers where they must line up (usually in two lines on either side of the entrance. Japanese people dutifully follow these cattle chutes, always waiting for the passengers to exit the train, before sardine-ing themselves in for their journey to salaryman hell.

I have always been thankful for this sense of order. I’ve elbowed one too many Korean grannies, trying to gain a seat in my journeys in Pusan. It’s a rule based commuter culture here in Japan, and no deviation from the rules is excusable. Which leads me to a rather bizarre occurrence that repeatedly keeps occurring to me…

Each evening, on the final leg of my journey, I take the stairs up from the subway and directly to the above ground platform to the tram. Sapporo’s tram runs in a loop around Sapporo’s city center. In the rush hours it can be packed to near unbearable levels. It really gives my daily transit a taste of Shibuya.

route_recommend_map_en
The Sapporo streetcar route can take you to some interesting places around town

The tram makes its stops on platforms that usually sit on concrete islands in the middle of some rather busy roads. These platforms are pretty narrow, and only allow for a single file line. One line that leads to the one entrance of the single car tram. Pretty simple. But a few years ago Sapporo revamped its Nishi 4 Chome (Odori) platform, placing it along the main sidewalk, and installing a large overhead canopy to protect the increased passenger traffic. This precipitated a change to the single file rule that exists on the other stops. So, clearly painted on the ground, two rows lead passengers in an orderly fashion to the entrance of the tram. There are signs in clear Japanese informing everyone of the two lines. There are even painted footprints to drive the point home even harder. But to change the rules, the routines, of a Japanese commuter is tantamount to a break in their collective psychic reality.

Each evening I arrive at the Nishi 4 Chome tram stop and encounter the same scene each and every time. Anywhere from five to twenty passenger lined single file, completely oblivious to the second line painted at their feet. Sometime this single file line will stretch outside the canopy and wrap around the sidewalk.

At first, I played along with my fellow Japanese in there delusional avoidance of the second line and begrudgingly followed suit. But after a few days of this I decided to take matters into my own hands and lead a commuter line revolution! I approached the single file line fifteen deep, shuffled to there left, and walked right on by to the very front, careful to follow the painted footprints. I actually felt guilty for following the rules, just for a little bit.

But then a remarkable thing happened. I heard some whispers of “So Desu ne…” as the stares locked in on the rebel gaijin who decided to follow the rules! And then one by one, some recruits made there way behind me. That first day I managed to sway only three or four over to the dark side of two line freedom. But throughout the next week I led a full blown defection from the nation of single file heathen. Finally, two even lines, everyone following the rules.

Was it my foreign presence that initiated this behavioral shift? Sometimes it seems that way. I’ll need more experimentation to see if my theory holds any weight.

Minimalism Gone Wild

I had been a ruthless accumulator of things. Everything was piling up, especially books. Though our apartment is fairly well organized and generally clean, I couldn’t help but notice a kind of burden my pack-rat lifestyle was reeking on my mind. I also wondered if there were other unforeseen benefits that might occur if I took the plunge into a more minimalist lifestyle, purge myself of all my “just in case” items, and put an end to the distraction they cause.

This train of thinking began a few years ago after reading Marie Kondo’s The Life-Changing Magic of Tidying Up:The Japanese Art of Decluttering and Organizing, but really came into focus when I recently read Goodbye, Things: The New Japanese Minimalism by Fumio Sasaki. Whereas Kondo is well known for her “Spark Joy” approach to discarding clutter, Sasaki takes her approach much further. What if we got rid of even those items that do “Spark Joy”? What if we break down everything to the bare necessities?

I started at the most difficult location for me: the bookshelf. Books are like babies to me, and a book culling is pretty much an affront to everything I believe in. Books, read and unread, represent knowledge. Discarding one is like purposely denying yourself some necessary wisdom. If I could only read and reread every book in my collection, I could gain some kinda of insight into the meaning of life! Or so I thought. The reality is that there were many books on my shelf I had ignored for almost a decade and the chances of me rereading a paperback I hated the first time was highly unlikely.

So I started a full-on purge of my collection, thinning out my shelves considerably. Over 30 books were whisked away, ready to be sold to Book Off for little to no financial gain. I felt lighter, and my bookshelf could breath again. I haven’t yet regretted parting ways with any of those books.

This unwanted accumulation had begun to spill over into my digital world as well. Apps filled my life and my phone to the brink, so much so that even the folders I was separating them into became too cumbersome. I started with the biggest distraction in modern life: social media.

Twitter had become an obsession with me. Not tweeting itself, but just the constant threat of my Twitter feed accumulating while I slept. I would wake in the morning and spend nearly an hour scanning through every tweet. I was a tweet accumulator, my attention span becoming more akin to a moth fluttering between two lanterns. It had to end.

I opted for app deletion rather than full scale account termination. My blog posts and the occasional Instagram pic still get redirected to Twitter. But it’s available on my desktop as a kind of guilty pleasure, one that I have yet to indulge in 2 months after the fact. Twitter joins Facebook in my app dustbin. This also keeps me from overreaching on my data plan.

It didn’t end with my smartphone. I took my minimalism even one step further on my already sparse Linux netbook. I removed so much bloat and stripped this machine to its core. Basically, I run everything out of the terminal. Everything! I removed my graphical file manager. It’s no longer an option. I don’t need a bloated third wheel like Firefox, especially when this old netbook barely has the specs to load a java applet. If I need to browse the web, I do it 1989 style, text only, with w3m. In fact, I am writing this post in the terminal, on WordGrinder, and uploading to my site via WP-CLI (a command line interface for WordPress).

Basically, I turned my Toshiba NB205-N210 mini notebook (purchased for 300 USD a decade ago) into the ultimate Linux learning machine. Almost everything has to be done through the terminal. No shortcuts.

So my bookshelf is more sparse, my smartphone addiction less pronounced, and my Linux laptop ready to guide me to the LPIC-2 certification sometime next year. Happy spring and happy minimalism!

What I Be Doing…

A school year is winding down. The snow is getting slushy. The muddy days of spring await. It’s time to recharge, finish some projects, start some new ones, and find ways to improve upon some latent hobbies. So what have I been up to? As Whitman once wrote, “I contain multitudes”.

Visual Media:

Continuing on from my recent full re-watch of Star Trek: The Next Generation, and now moving on to Star Trek: Deep Space Nine. Of course this is accompanied with the audio podcast Mission Log. About one episode a week, for the next 3 years. Next Gen was my Star Trek growing up, DS9 was only casually watched due to the rigors of college life. So I am excited to rediscover this series. Additionally, I am in the middle of a re-watch of Northern Exposure, one of my guilty pleasures.

Another project I am slowly progressing with is attempting to watch all of Sight and Sound’s 20 Greatest Films of All Time – The Director’s List. Of these films, I surprisingly have only seen one on the list, 2001: A Space Odyssey. So I’ve been whittling away at some of the foreign films that I should have watched long ago. I started a few weeks ago with Tokyo Story, moved on to the French film Breathless, and most recently was entranced by Bergman’s Fanny and Alexander. I tried unsuccessfully to sit down for Seven Samurai but could only muster about an hour of that epic.

Technology:

Over the past several months I have been forcing my way through Beginning Programming with C for Dummies. It’s slow going, and I am only maybe halfway through the exercises. But it seemed like a necessary step. Even if I only retain a little of the programming skills, I think knowing some C as a foundation language is vital to understanding Linux, as well as most other programming languages.

Eventually, hopefully with not much more procrastination, I will begin training myself for the LPIC-2, hopefully taking the test sometime next spring. Not entirely optimistic of my chances, as the leap from LPIC-1 to level 2 is pretty great, even for someone who might work in the tech world. For a Linux hobbyist like me, it might be beyond my skill set. But these certifications are really just for me, just a way to challenge myself – so there is no fault in trying.

Health and Fitness:

This past winter I combined my need for daily aerobic fitness with my obsession with snowshoeing. So aside from a few weeks when the snow slowly started to accumulate in mid December, I’ve been able to continue my afternoon, evening walks up nearby Asahiyama, albeit with snowshoes on. I’ve managed get in a quick snowshoe at least twice a week after school, and once on the weekend. I supplement any non-snowshoeing days with 1,600 jumping jacks. Add to this my daily Perfect Pushup regimen and I pretty much have found my daily balance necessary to keep the pounds off, no easy task in the dark days of winter.

Books:

I’ve been kinda on a self help binge. Everything from minimalism to anxiety control. Some has been helpful. Some have been rather tedious (Tim Ferris anyone?). Eventually I plan on diving back into Finnegans Wake. Maybe St. Patrick’s Day could serve as an impetus to that linguistic boondoggle.

With spring break ahead of me, it’s time to get to it!

Guinness, Japanese Style

I love Guinness. Unfortunately, here in Japan, a Guinness habit could bleed you dry of your hard earned yen. I’ve seen pints of Guinness selling for ¥900+ in bars, which probably is what turned me off bars in general in the country. A 330 milliliter can also sells for ¥300+ in supermarkets and convenience stores. Although it isn’t hard to find, I usually only indulge on special occasions or due to the generosity of others.

Luckily for me, my Japanese in-laws seem to think I require Guinness to make it through a day (not that bad, yet). So they habitually gift me a six pack on Christmas and birthdays, as well as provide it during other festivities. This year, the final year of my thirties, they dropped off a a Guinness “Winter Special Box”, featuring a rather unique “slim pint” glass.

I was a bit suspicious of this “slim pint”, but finding a traditional pint glass here has proved difficult so I’ll take what I can get. This particular glass is more accurately a narrow half pint glass, and one 330 milliliter can pours perfectly into this lovely compact vessel. It features a engraved harp on the back and the Guinness seal on the front. Somehow, in micro-loving Japan, this “slim pint” seems wildly appropriate.

Cheers!

Year of the Dog

If you aren’t aware, 2017 is the year of the dog. So let’s take a moment to revel in my dog Sunny’s ridiculous wardrobe. He has an outfit for every single situation, both real and imagined, so this is just a sample.

From top left clockwise: hand-knitted hat, flannel pajamas, chan-chan ko (wan-wan ko), summer sunglasses
Philadelphia Eagles jersey, walkabout hat, summer cooling tank-top (by ALPHAICON), o-pajama (by ALPHAICON), fall blanket
Philadelphia Flyers jersey, summer cooling parka (by ALPHAICON)
fall hoodie, Christmas hoodie (by Pinkaholic), winter down jacket, Halloween bandana
snow dog guard (by ALPHAICON), shima-shima pinstripes, lighted Christmas sweater, dog guard air (by ALPHAICON)

New Year, New Theme

Finally completed the arduous process of backing up and upgrading my server. For you Linux nerds that meant shuffling from Debian “Wheezy” to “Jessie”, giving me a couple more years of security updates until I have to do it all over again. Considering I did this without using the recommended fresh install method (instead I updated my repositories and hoped for no breakages), we were lucky to get the site back with minimal downtime. Just a few fixes to my apache2, php, and wordpress config files and things were back online. It was a learning process – mysqldump, tar, and a variety of Linux commands I needed a refresher on were implemented. (If none of that makes any sense, don’t worry, it was jibberish to me until a few years ago.)

The hard work done, I then set out to revamp my theme. The decode theme I have employed for several years doesn’t allow for background color changes, so I took that as a challenge to dig deep into the CSS code and do it manually. I love the retro green on black, plus it’s better on the eyes.

Hopefully this year I’ll be able to write more frequently. No topic is off limits, whatever strikes my fancy, so be prepared!