10 August 2021

Rasberry Pi 4 Print Server: Part 2

These are the steps that I went thru to update the firmware and get Ubuntu Server 20.04 LTS installed on my Raspberry Pi 4 2GB from my Chromebook

Prerequisites:

Firmware Update Steps:
  1. Download the latest firmware from: https://github.com/raspberrypi/rpi-eeprom/releases
  2. Insert your SD Card into your Chromebook
  3. Copy the Contents of the Zip file onto the SD Card
  4. Uses Files to eject your SD Card and then remove from Chromebook
  5. Boot your Raspberry Pi using the SD Card
Ubuntu Steps:

  1. Download 64-bit Ubuntu Server for Rasberry Pi from here: https://ubuntu.com/download/raspberry-pi
  2. In Files: Move it from Downloads to your Linux Files
  3. On the Linux Command Prompt run:
    • xz -d ubuntu-20.04.1-preinstalled-server-arm64+raspi.img.xz
  4. In Files: Right click the IMG file and click Zip selection
  5. Insert your SD Card or USB Drive you want to use
  6. Write the image to your removable media:
    1. Open Chromebook Recovery Utility
    2. Click the Setting Wheel next to the close window button
    3. Click "Use local image"
    4. Use files to select the zip file you just created
    5. Wait for the progress bar to complete TWICE (once for unpacking, once for writing)
    6. Exit Chromebook Recovery Utility
  7. Ubuntu 20.04 preinstalled servers uses cloud-init on first boot, you can find out more here:
  8. Setup your WiFi
    1. Open /system-boot/network-config in a text editor
    2. Uncomment (remove the # from the front of the line) the wifis section and update it with your wireless network and password
    3. wifis:
        wlan0:
          dhcp4: true
          optional: true
          access-points:
            "YourWifiNameHere":
              password: "YourPasswordHere"

    4. Or for a fixed IP
    5. wifis:
        wlan0:
          addresses: [192.168.1.XX/24]
          gateway4: 192.168.1.1
          nameservers:
            addresses: [192.168.1.1]
          dhcp4: false
          optional: true
          access-points:
            "YourWifiNameHere":
              password: "YourPasswordHere"

    6. Save the File
  9. If you are using a SD Card, you are finished and can:
    1. Eject the removable media using the Files app
    2. Remove it from the laptop
If you are using a USB Flash Drive, follow these additional steps:
  1. Decompress vmlinux
    1. Share the system-boot partition with Linux
      • In the files app, right click it and click "Share with Linux"
    2. Open the terminal
      1. cd /mnt/chromeos/removable/system-boot
      2. zcat vmlinuz > vmlinux
  2. Update /system-boot/config.txt to have the pi4 section look like:
    • [pi4]
      max_framebuffers=2
      dtoverlay=vc4-fkms-v3d
      boot_delay
      kernel=vmlinux
      initramfs initrd.img followkernel
  3. Install a script that will do this after installing updates (currently this cannot be done on a Chromebook because the writable partition is mounted read-only --oh the irony--)
    1. Create a file on /system-boot (/system-boot/firmware if logged into the pi) called auto_decompress_kernel and paste the code that is at the end of the blog
    2. Create a file in /writable/etc/apt/apt.conf.d called 999_decompress_rpi_kernel and paste the following single line into it:
      • DPkg::Post-Invoke {"/bin/bash /boot/auto_decompress_kernel"; };
    3. Share the writable partition with Linux
      • In the files app, right click it and click "Share with Linux"
    4. Open the terminal
      1. cd /mnt/chromeos/removable/writable/etc/apt/apt.conf.d
      2. chmod +x 999_decompress_rpi_kernel
You can now install the SD card or USB drive into the Raspberry Pi and start it up. You will need to login and change the password and then reboot (sudo reboot now) before it will connect to WiFi


auto_decompress_kernel
#!/bin/bash -e

#Set Variables
BTPATH=/boot/firmware
CKPATH=$BTPATH/vmlinuz
DKPATH=$BTPATH/vmlinux

#Check if compression needs to be done.
if [ -e $BTPATH/check.md5 ]; then
    if md5sum --status --ignore-missing -c $BTPATH/check.md5; then
    echo -e "e[32mFiles have not changed, Decompression not needede[0m"
    exit 0
    else echo -e "e[31mHash failed, kernel will be compressede[0m"
    fi
fi

#Backup the old decompressed kernel
mv $DKPATH $DKPATH.bak

if [ ! $? == 0 ]; then
    echo -e "e[31mDECOMPRESSED KERNEL BACKUP FAILED!e[0m"
    exit 1
else    echo -e "e[32mDecompressed kernel backup was successfule[0m"
fi

#Decompress the new kernel
echo "Decompressing kernel: "$CKPATH".............."

zcat $CKPATH > $DKPATH

if [ ! $? == 0 ]; then
    echo -e "e[31mKERNEL FAILED TO DECOMPRESS!e[0m"
    exit 1
else
    echo -e "e[32mKernel Decompressed Succesfullye[0m"
fi

#Hash the new kernel for checking
md5sum $CKPATH $DKPATH > $BTPATH/check.md5

if [ ! $? == 0 ]; then
    echo -e "e[31mMD5 GENERATION FAILED!e[0m"
    else echo -e "e[32mMD5 generated Succesfullye[0m"
fi

#Exit
exit 0

Sources and Thanks to:


Raspberry Pi Print Server: Part 1

As I still have our perfectly functional Samsung SCX-4623f laser printer and scanner, but wanted to be able to place it away from my server. I looked at a few different options, but decided on a Raspberry Pi to be my best option. Below are the several options that I considered.

The Choices

IOGear GPSU21 or other print server

  • Price: $40-50
  • Does not list SCX-4623f as compatible
  • Requires Ethernet connection so not as flexible
  • Printer Only, No Scanner function

Raspberry Pi

  • Price: Varies based on options
  • Requires more time to setup
  • A learning experience/project
  • Wouldn't need to find new owner for existing printer

Repurposing an old laptop

  • Price: Free*
  • Not power or space efficient

Hooking a laptop up every time we want to print

  • Inconvenient
  • Can't print from phones

New Printer/Scanner with built-in wireless

  • Price: ~$200

Parts


Here are the parts that I went with:
  • Raspberry Pi 4 2GB ($30-35 at Microcenter)
    • Another option was the Raspberry Pi 3 B+ ($25-30 at Microcenter), but I wanted the faster processor and more memory
  • Raspberry Pi Power Supply ($7-10 at Microcenter)
  • GeeekPi Raspberry Pi 4 Aluminum Heatsinks 20PCS ($8 Amazon)
    • This is 5 sets of 4 different sized heatsinks, so i now have plenty of spares
  • Argon One v2 ($20-25 Amazon)
  • Samsung Fit 64GB USB ($11-12 Amazon)
Total price before tax: $82

Raspberry Pi 4 with 2GB of RAM because it was not much more than either the 1GB version or Raspberry Pi 3B.

You can get cheaper cases, but I liked the Argon the best. I considered many full coverage heatsink cases, but those left the GPIO pins and the sides of the board exposed and I didn't want the chance of those getting shorted or something getting in. There were other full aluminum housing, but I couldn't find any reviews about whether those affected the wifi range. So it was basically between the Argon One and Flirc. I chose the Argon over the FLIRC because it redirects all the connections to the back and has a fan with a controller.

Even though the Argon One has heatsinks for the CPU and RAM, it did not have any for the Ethernet, USB, or Power Chip. Since the Argon One applies the power thru the GPIO headers and not the USB C port on the Pi, I figured that the power chip would not need cooled. However, since I am unsure about how much of a load scanning might put on the USB chip, I wanted a heatsink for that. Several other brand of heatsinks that I looked at had questionable reviews about how strong the thermal adhesive was.

I went with a USB drive over a SD card because of the faster speed and increased reliability, but looking back I think I would change that. The USB boot feature of the Raspberry Pi and Ubuntu 20.04 aren't quite there.

Assembly

First take the top of the Argon and see the exposed underside of the GPIO pins along the back (top of pic)

I used electrical tape to cover the underside of the GPIO pins so my additional heatsinks will not accidentally short them

Install the Argon daughter board onto the Pi

I then placed the heatsinks on the ethernet and USB controller

Place the thermal pads on the Argon lid and then place the Pi and daughter board into the top of the Argon case

Use the short screws to keep them in place

Install the long screws and the rubber feet


16 January 2021

Brother MFC-7360N and Windows 10 64bit

A friend of mine recently got a new Windows 10 laptop and was trying to install the drivers for their Brother MFC-7360N from Brother's website (https://support.brother.com/g/b/downloadlist.aspx?c=us&lang=en&prod=mfc7360n_all&os=10013), but the setup would always get stuck saying to connect the printer with USB when they already had.

First step was to check Device Manager, which had a USB Composite Device with a yellow triangle that said something about an "operation failed". I immediately thought this was the problem and had them uninstall it. However, it always came back with the same yellow triangle no matter what we did.

I then googled "install brother printer on windows 10 usb composite device" and came across this post (https://appuals.com/brother-printer-usb-composite-device-error-code-10/) and it said that the printer required a firmware update to work with Windows 10 via USB. The other option would be to strictly use it as a network printer.

We then used their old laptop with Windows 7 on it to install the updated firmware from the same brother site.

After the printer was updated, installing the driver in Windows 10 worked like normal!

30 July 2020

Let's Encrypt SSL Certificate for Dynamic DNS Host

As I was tired of having to add an exception when wanting to visit my personal website, I decided it was time to use Let's Encrypt to get a signed SSL certificate. Luckily it was easier than I thought. Here are the simple steps that I followed.
  1. Add the ppa repository
    • sudo add-apt-repository ppa:certbot/certbot
  2. Install the cli tool
    • sudo apt install python-certbot-apache
  3. Run the cli tool
    • sudo certbot --apache -d <dynamic dns host name>
  4. Answer the questions that included:
    • Email Address
    • Select which conf file to add to (For me it was /etc/apache2/sites-available/default-ssl.conf)
  5. Check that my SSL certificate was now signed

TODO: Automate the renewal

12 July 2020

Removing phantom tuner in MythTV

I had a tuner that did not appear on the tuner screen in setup, but would always throw an error about the default channel for it not being available when saving and exiting.

In order to resolve this, I followed the suggestion here: http://lists.mythtv.org/pipermail/mythtv-users/2010-March/284826.html

  1. manually login to the database
    1. mysql --user mythtv --password mythconverg
  2. find the phantom cards id
    1. select * from capturecard ; 
  3. delete it from the 'capturecard' table
    1. delete from capturecard where cardid = ;

02 July 2020

Refurbished Fossil Sport Review

As my Pebble Steel was beginning to annoy me with its inaccurate battery life and bad mms support, I recently purchased a refurbished Fossil Sport 43mm for $50 plus tax to replace it.

Hardware

The included magnetic charger makes it easy to ensure proper alignment for charging. However, the puck itself is very light and prone to being pulled off the table by the weight of the cord. It would have been nice for it to have some sort of non-slip rubber bottom.

The silicone strap is extremely soft and very comfortable. There are 10 different holes for size adjustment and 2 loops to hold down the extra strap. On the downside, it is quite small. My wrists are not very big, and yet I have to use the 4th to last hole.

The watch case is the crown jewel. It is well constructed. The two tone design makes it look smaller than it actually is. The buttons have a satisfying feel to them. The rotating crown has a smooth rotation with no click.

The GPS works well and is pretty accurate on a Google Fit workout.

There is no speaker for interacting with the Google Assistant or taking calls on.

Initial Experience

The first two days the battery life was awful as it was seemingly constantly downloading updates (and of course I was messing with it more trying out different watch faces). The updates would pause when the battery dropped below 30%, so the watch was on the charger ... a lot.

Watchfaces

I am disappointed by the seemingly lack of watchfaces on the Play Store. For any kind of variety, I had to install Facer. Facer has lots of options, but none of them were exactly what I wanted. Luckily, I was able to use their editor to create my own. However, Facer does have seemingly daily notification spam.

Software

The watch does seem to lag when interacting with apps specifically. Interacting with notifications is generally good, but does occasionally lag. This would probably be fixed by moving to 1GB of RAM in the Gen 5.

Battery Life

I charge my watch while in the shower every morning and typically have 30-50% left when I take it off overnight. It will then lose another 7 or so percent overnight. The settings that I use are: always-on time, tilt to wake, tap to wake, background heart rate, "ok google" detection off, and Wi-Fi off.

26 June 2020

Adventures in a Graphics Card Upgrade

Decision Time

As my HIS IceQ Radeon HD 7850 2GB was getting on in age, I decided it was time for an upgrade. I was trying to stay around the 130W TDP of the current card so that my folding did not increase my electric bill. The main options that I was considering was:
  1. Used GTX 1060 ~$135-150
  2. GTX 1650 ~$159
  3. GTX 1650 Super ~$200
  4. GTX 1660 ~$215
  5. GTX 1660 Super ~$230
  6. RTX 2060 KO ~$300
  7. Used RX 470 4GB (avoid mining only) ~$75
  8. Used RX 480 4GB ~$90
  9. RX 570 4GB ~$120
  10. RX 580 ~$155
  11. RX 5500 XT 4GB ~$159.99
My first elimination was anything over $200 as that was just too expensive to pair with my old Core2 Quad Q6600. I then eliminated the RX 570 and GTX 1060 as it was just overpriced compared to the RX 480 and RX 5500 XT. The RX 580 and GTX 1650 were also overpriced compared to RX 5500 XT. This narrowed my choices to:
  1. Used RX 470
  2. Used RX 480 4GB
  3. RX 5500 XT

The Purchase

I then scoured ebay for the used graphics cards. I placed the following price guidelines (including shipping) RX 470 for $70, RX 480 4GB for $80, RX 480 8GB for $90. It seemed that the 8GB models were pulling a large premium and the 470 and 480 4GB models seemed to be about the same price. I also wanted a backplate on the GPU to try to avoid GPU sag.

I was able to score a MSI RX 480 Gaming X 4GB model for ~$81 with shipping. When it arrived, it was in great physical shape and looked clean. I gave it a blast of compressed air to ensure maximum airflow. I installed the GPU after having to remove a fan mount in my old Antec 900 to increase the room for it. It then booted up without any issue. When I went to run benchmarks is when the bad news came. Under any kind of load the GPU spiked to 90C under 100% fan.

The Fix

To try to resolve this I tried:
  1. Reducing the Core Voltage
  2. Checking for a firmware upgrade
  3. Tightening the 4 screws that maintained mounting pressure between the cooler on the card a quarter turn (be careful as over tightening can damage the chip)
However, none of those helped. It was finally time to try the last thing that I could think of, replacing the thermal paste. Here are the steps that I followed:

  1. Removed the back plate taking care to keep track of which screws came out of where
  2. Removed the two screws on the pcie bracket
  3. Removed the 4 spring loaded screws that maintain the mounting pressure
  4. Unplug one 4 pin connector between the PCB and cooler which allowed me to open it up like a book
  5. This gave me a good look at the largely dried and cracking gray thermal paste
  6. Carefully cleaned this off the GPU and the heatsink
  7. Applied some Silicone thermal paste that I had leftover from my Q6600 build
  8. Reattached the 4 pin connector
  9. Put the 4 spring loaded screws back in, in a X pattern slowly tightening each one to maintain even pressure
  10. Screwed the 2 screws on the pcie bracket back in
  11. Screwed the back plate back on
Then the for the test. I reinstalled the graphic card and booted up the system. Thankfully, the card now worked like new!

Undervolting

The card's defaults are 1303MHz at 1150mV. I turned this down to 1250MHz at 1065mV using MSI Afterburner. This cost me about 4% theoretical performance for a savings of ~15% power (because Voltage is squared), which put the max GPU core/memory power usage at about 105W. This should keep me in the ~130W total board power range that I was looking for. The card is now doing about 65C with 40% fan.

I am still verifying the stability in folding, but at 1060mV it was just barely coming across an occasional error. I am hoping that bumping to 1065mV will eliminate those errors.

Update 2020-07-01: The additional 5mV have resolved the occasional error. I have seen some work units spike to 110W and hit 67C with 50% fan.

Update 2020-07-12: I still saw an infrequent error. I pushed to 1070mV in state 7 and 1055mV in state 6.

Update 2020-09-11:
Here are the default clock speeds and voltages:
1303MHz @ 1150mV
1235MHz @ 1143mV
1191MHz @ 1087mV
1145MHz @ 1037mV
1077MHz @ 973mV
910MHz @ 850mV

Default Memory: 1750MHz @ 975mV

Here is what my final stable underclock is:
1250MHz @ 1077mV
1235MHz @ 1075mV
1191MHz @ 1075mV
1145MHz @ 1037mV
1077MHz @ 973mV
910MHz @ 850mV

Memory Clocks/Voltages unchanged

GPU power usage (not total board power) drops from ~120Watts to ~100Watts
 
Update 2023-05-23:
I repasted using Arctic MX-4 thermal paste and saw a  temperature reduction. I also found this post and used it as a base for a new underclock: https://forums.tomshardware.com/threads/frequency-and-fps-drop-stuttering-on-rx-480.3624457/

1191MHz @ 990mV
1145MHz @ 980mV
1077MHz @ 975mV
910MHz @ 850mV
 
I have it capping out at 1191MHz to keep it nice and quiet at under 55C at 30% fan speed under load.