Installing LineageOS on a Samsung Device

LineageOS is an alternative operating system for your phone. It’s what Android looks like before the device manufacturers and phone carriers start adding software. Installing it is also an interesting exercise in how taking more control of technology often means taking more responsibility and risk.

Note: Installing alternative operating systems like LineageOS on your phone is a great way to learn more about how it works. You are going to make mistakes. You may brick your phone. If you are interested in attempting it, use an outdated phone you already have on the LineageOS list or get one from eBay to learn on. It’s okay to mess up, just don’t attempt it on a device that is important to you until you know what you are doing.

Installing LineageOS on your phone is relatively painless. The major difficulties are twofold: 1) being careful about installing the right files for your device and 2) getting Heimdall, the software on Linux to flash the bootloader TWRP to your phone, to work. Heimdall doesn’t work out of the box when installed with a package manager like apt-get on Debian.

Note: If you are on Windows, Odin sounds easier to use than Heimdall. I didn’t use it, so I do not know if this is true. I can say Heimdall does not work as expected on Linux.

  1. Download TWRP (most recent), LineageOS (nightly for the device) & OpenGAPPS (ARM, same version as LineageOS, pico) for your device and put them on the root directory of your phone’s sdcard. To transfer to your sdcard, enable developer mode for your device (in my case, going to Settings, About Device, and tapping on Build Number 7 times) then select USB Debugging in developer options. You will then be able to connect your phone to your computer, agree to connect on your phone and use any file utility to transfer the three files transfer rather than ADB, the android debug bridge. USB Debugging also needs to be enabled for the next step.
  2. Install Heimdall from source. There is a bug in the version v.1.4.1, which is what currently installs from apt-get. That version always throws off error messages when trying to flash the bootloader TWRP using software from apt-get. Try an apt-get install.
    $ sudo apt-get install heimdall-flash

    Then, check your version with:

    $ heimdall version 

    If you get v.1.4.1 (or if you cannot get Heimdall to work), try compiling from source.

    Compiling from source and using the heimdall-frontend solves that problem. I never got it to work from the command line. Install the required software to compile from source.

    $ sudo apt-get install build-essential cmake zlib1g-dev qt5-default libusb-1.0-0-dev libgl1-mesa-glx libgl1-mesa-dev 

    Make a bin directory in your home directory and enter it.

    $ mkdir bin
    $ cd bin

    Clone the source.

    $ git clone

    Make a build directory and enter it.

    $ mkdir -p Heimdall/build
    $ cd Heimdall/build

    Build the software from source.

    $ cmake -DCMAKE_BUILD_TYPE=Release ..
    $ make

    Transfer Heimdall to the system directory.

    $ sudo cp bin/* /usr/local/bin 
  3. Start the Heimdall-frontend.
    $ heimdall-frontend

    Turn off your device. Boot into download mode, on my device (SAMSUNG) download mode was started by holding down Volume Down, Home and Power. Then connect to your computer using the USB cable.

    1. Go to Utilities tab in the Heimdall frontend.
    2. Detect Device.
    3. You will see Download PIT, which stands for Partitions Information Tables. Go Save As and save it on some location.
    4. Go to Flash tab.
    5. In PIT category, click Browse and select PIT file you downloaded from device in step 3.
    6. Click Add button.
    7. For partition name select where you want to flash it. BE CAREFUL! If you flash it on wrong partition you can perma-brick device. For most devices, the recovery partition is RECOVERY.
    8. Go Browse for file and select twrp.img file you downloaded in step 1. In Session, check No Reboot.
    9. Click Start.
    10. When complete, disconnect device from the USB cable, pull the battery and immediately restart into recovery. On my device, you can boot into recovery by holding down Volume Up, Home and Power. If you don’t, your phone will likely write over the TWRP file you have flashed, and it will look like nothing has happened.
  4. From here, it was straight-forward per the instructions on the LineageOS Installation Instructions for my device.
    1. Backup your device, so you can recover in the event you bork it.
    2. Wipe the Cache, System and Data partitions.
    3. Install first, then (optional, but if OpenGAPPS is not there a lot of apps might not work as expected, or at all) second.

When done, TWRP will ask you to reboot. That’s it.

Good luck!

5k Math

Over the last several years, I’ve taken my weight before a 5K race and logged the time. After 12 measurements, it looks like I can get a good, conservative prediction of my time from my weight: weight x 7.5 = seconds to complete 5k. To put it another way, for every 8 pounds lost, there is a corresponding decrease of ~1 minute of time to run the 5k. Once a sub-10% body fat weight is achieved, it may be possible to bring down the 7.5 number to ~7, but prior to that I think the best way to get faster is to lose weight.

Postcard Friday

“…I resolved to send a postcard every Friday. I called it Postcard Friday…

Just as formal poetry shapes what the poet can say, the space on the back of the card constrains how I write. There’s room for four or five good sentences, maybe six if I write small…

…Since the back of a postcard is open to all, I figure my mail carrier may read it, as could anyone along its way, and once it reaches its destination, I can only assume the intended recipient won’t be the only one to read it. Other family members might; if it’s out on the coffee table, house guests too. This creates another problem writing a postcard: how to write something personal enough so the postcard isn’t fluff but not so personal as to be embarrassing when read by prying eyes.

My postcard writing has evolved from asking a series of questions to what I now think of as the snapshot postcard—a paragraph about the local barbershop, a few sentences about tasting aquavit at a Norwegian distillery, a story about sitting on the beach over the weekend. The snapshot shares a bit of life with the “wish you were here” implied. These snapshots are, of course, a fiction. They are constructed representations of life, not unlike a Facebook status update.”

Peter Wayne Moe, “Why I Write Postcards.” January 19, 2018.

Postcard Friday sounds like an idea worth trying.

The Fallacy of Calories In / Calories Out as a Mental Model for Weight Control

One of the common comments people make about weight control is: “It’s just calories in / calories out.” It’s true, but it’s also wrong in important ways.

For example, one of the things that we know happens once people reach their thirties is that they start to lose 3-5% of their muscle mass per decade. In medical terms, this process is called “sarcopenia with aging”, and it accelerates further when most people reach their seventies.

So, “sarcopenia with aging” is slowly reducing “calories out” for most people older than 30, and this subtly shifts the equation of “calories in / calories out” over time. It’s a force that requires that we either:

  1. Consciously change our eating habits to reduce calorie intake as we age
  2. Work to reduce sarcopenia through a program of strength training

But, doesn’t the human body’s homeostatic mechanisms guide us to reduce intake as we burn fewer calories? Yes, it does. Except we live in a cultural environment that makes every effort to disconnect eating from feelings of hunger. Make sure to eat three square meals a day is an idea that puts food consumption on a predictable schedule. From there, the concept has evolved further, where food has become primarily a recreation for many people.

Consider the ever expanding “holiday” and spectacle seasons. Is it a coincidence that the Super Bowl (or pick your holiday/spectacle of choice) party is an excuse to eat and drink in ways that make weight control difficult, if not impossible?

The same dynamic is in play with ever increasing portion sizes and richer, more calorie dense food.  Movie theaters sell large tubs of popcorn, soda and candy to justify increased prices, which offset decreased ticket sales. Whether you are talking about eating out in restaurants or convenience food, there are billions of dollars being spent delivering just one message: “Eat more.”

Why? Imagine if everyone in the United States cut their calorie intake by 100 calories a day, how many billions of dollars of revenue would that cost food companies in a year? Conversely, the opposite is also true. More calories equals more revenue.

In the context of this dynamic, the “calories in / calories out” argument is problematic. On one level, it suggests that weight is an individual problem. It is as if the billions spent on food marketing, the dearth of sound nutritional advice available to most people, the socio-economic constraints of food availability, etc. are all irrelevant. On another level, the idea of an “equation” implies that “calories out” is a viable approach to a weight problem, and it is why exercise is so often offered as a solution.

But, the treadmill, the elliptical machine, the stationary bike, the aerobics class or other cardio exercise is not how you address the problem of “sarcopenia with aging”. And cardio exercise, by itself, is not enough. There is a saying, “You cannot outrun a bad diet.” Unless you are someone like an elite endurance athlete logging +100 miles of running a week, the only way to bring weight under control is to eat less, not more. Exercise can be an important catalyst for changes, making them happen faster. But, exercise can also undermine weight control as it drives increased appetite and can make it more difficult to eat less.

We need to eat less in an environment where we are always incentivized to eat more. Saying “it’s just calories in / calories out,” is like saying, “Just eat less.” It’s correct, but it’s missing taking into account many of the factors that make that so hard.


Something Strange at the Insane Asylum


Nightmare fuel: You are a journalist visiting a mental hospital that has closed down due to a lack of funding. Former patients are squatting in the run down facility. One of the former doctors is still trying to help and is providing a kind of pro bono treatment. You are wandering around the facility, interviewing subjects as best you can, and you have an increasingly uneasy feeling that you are not being told the whole story. There are uneasy glances. The interviews reveal that there is something not being told, and you can’t quite figure out what it is. Then, you start getting momentary flashes: a glimpse in the mirror, a reflection in a pane of glass, etc. You start to think that maybe there is some supernatural element in play. You start hearing a low background sound. You are alert, trying to get a better look at the images that sit, right on the outside of your peripheral vision. Finally, after weeks of interviews with the residents, of wandering the grounds, you are sitting in one of the old patient rooms, thinking, and in the mirror you see someone dressed strangely, with clothing that is incredibly informal, a fabric that is light and unlike any you have seen before. But, you recognize their behavior. The looking around, the speaking into a device…and it slowly dawns on you that you may have been haunting this place for a very long time.

Book Review: Three Masquerades by Rachel Ingalls

“And perhaps the girl had also meant exactly what she’d said about love–that it was from heaven, freely given and necessary, but rich people never had to feel necessity; if a friendship broke down, or a marriage, or a blood relationship, they somehow always managed to buy another one. Life could be made very agreeable that way. But love was what the goddess has said it was–not pure: poor.”

–Rachel Ingalls, “I See A Long Journey” in Three Masquerades. (Berkeley, CA: Pharos Editions, 2017), 76.

Recommended. Comprised of three novellas: I See a Long Journey, Friends in the Country, and On Ice. In these three tales, Rachel Ingalls starts with a female character and situating her in a domestic relationship. The first part conveys a sense of the protagonist — her hopes, dreams and fears. And then, in each of these stories, everything goes sideways in a strange, possibly even supernatural way. Reading each was like watching a magician doing something unanticipated, like opening a coffin and having a swarm of locusts emerge that devour the audience. Lovely and weird.