Showing posts with label xubuntu. Show all posts
Showing posts with label xubuntu. Show all posts

13 December 2023

Adventures with ZFS

As part of plan to improve my backup strategy, I was testing out different zfs configurations to see what might be the best option.


The Problem

I was having trouble testing out using native zfs encryption

  • sudo zfs create -o encryption=aes-256-gcm -o keylocation=prompt -o keyformat=passphrase test-pool/test-encrypt
  • invalid property 'encryption'


Checking zfs version

So first I checked the zfs version:

  • sudo modinfo zfs | grep version
    • version:        0.8.3-1ubuntu12.15
  • zpool version
    • returned an error, which I found weird
  • zpool upgrade -v
    • returned a maximum version of 23
    • expected a maximum version of 28
  • Did some googling and found out that I may have the older zfs-fuse installed
  • dpkg -s zfs-fuse 
    • confirmed my suspicion and told me that I had 0.7.0 installed


Replace zfs-fuse with zfsutils-linux

  • * Unmount all zfs datasets*
    • I didn't do this step, but you definitely should to prevent data errors
    • sudo zfs unmount <zpool>/<dataset>
  • sudo apt remove zfs-fuse
  • sudo apt install zfsutils-linux
  • Here I rebooted the system
  • sudo zpool status
    • no zpools available
  • sudo zpool import -a
    • listed my zpool with its last use
  • sudo zpool import -f <zpool>
  • sudo zpool status
    • now correctly showed my zpool


Test setup

  • I am using 2 disks that have a raw speed of 150 MB/s (benchmarked using dd on a single disk)
  • Creating the test pool
    • sudo zpool create test-pool mirror /dev/disk/by-id/ata-WDC_WD30EFRX-68EUZN0_WD-<serial_number> /dev/disk/by-id/ata-WDC_WD30EFRX-68EUZN0_WD-<serial_number>
    • or
    • sudo zpool create test-pool -o ashift=9 mirror /dev/disk/by-id/ata-WDC_WD30EFRX-68EUZN0_WD-<serial_number> /dev/disk/by-id/ata-WDC_WD30EFRX-68EUZN0_WD-<serial_number>
  • Creating test dataset
    • sudo zfs create test-pool/test
    • sudo zfs create -o encryption=aes-256-gcm -o keylocation=prompt -o keyformat=passphrase test-pool/test-encrypt
  • Disable caching
    • sudo zfs set primarycache=none test-pool/test
    • sudo zfs set secondarycache=none test-pool/test
  • 10 back-to-back copies of a 5GB file and waiting for the numbers to stabilize
    • sudo rsync --progress Downloads/Win11_22H2_English_x64v1.iso /test-pool/test/
  • Deleting the zpool when done testing
    • sudo zpool destroy test-pool


Results of the upgrade and test

The good news is that I am seeing a 2-3X speed up on my existing zpool setup with ashift=9 from doing the upgrade. It also appears that native encryption has a minimal impact (as long as your processor has AES-NI). Here are the numbers that I was seeing

  • zfs-fuse 0.7.0:
    • ashift=9, no encryption: 35-45 MB/s
    • ashift=12, no encryption:  70-72 MB/s
  • zfsutils-linux 0.8.3:
    • ashift=9, no encryption: 108-117 MB/s
    • ashift=9, native encryption: 105-117 MB/s
    • ashift=12, no encryption: 134-141 MB/s
    • ashift=12, native encryption: 133-139 MB/s

Appendix

Article on setting up native zfs encryption:

checking zfs version:

zfs-fuse being super outdated:

Importing missing zpool:

More about ashift:

09 December 2023

Updating Crucial MX500 Firmware in Linux

On my Crucial MX500, I was noticing a high level of write amplification, which is when you tell it to write 1GB of data, but it actually uses 10GB of writes to the nand flash.  To try to fix this, I decided to see if a firmware update would help with this. 


Identifying the Problem

Substitute /dev/sdX with you drive
  1. Get the smart attributes
    • sudo smartctl -A /dev/sdX
  2. write down the values for 247 and 248, I will refer to thus as A
  3. wait a few days and repeat steps 1 and 2, I will refer to this as B
  4. Now lets calculate
    1. 247C =247B - 247A
    2. 248C = 248B - 248A
    3. (247C + 248C) / 247C
  5. I was seeing values ranging from 10-100, when I believe the typical range should be 1-2.5

    Performing the Update

    Caution: Before doing any of this be sure that you have up to date backups!

    Substitute /dev/sdX with your drive

    • Use smartctl to check what firmware version you currently have installed so you can download the correct version
      • sudo smartctl -i /dev/sdX
      • Example line: Firmware Version: M3CR020
    • Download the correct firmware for your device:
    • Mount the iso
      • sudo mkdir /mnt/iso
      • sudo mount -o loop,ro MX500_M3CR023_update.iso /mnt/iso
    • Create a directory to extract the files to
      • mkdir mx500
      • cd mx500
    • Do the extraction
      • gzip -dc /mnt/iso/boot/corepure64.gz | cpio -idm
    • List the drives
      • sudo ./sbin/msecli -L
    • Perform the Update
      • sudo ./sbin/msecli -U -v -i ./opt/firmware/ -n /dev/sdX

    Conclusion

    It seemed to help but has not completely resolved the problem


    Appendix

    Sources:

    Others experiencing a similar write amplification issue:
    Guide for calculating Write Amplification:

    07 April 2023

    Hiding mount icons for ZFS disk

     

    As I was tired of seeing mount icons for my zfs drives on my desktop, it was time to add some more udev rules. This time i chose to set the rule by ID_SERIAL instead of KERNEL to be more confident about which drive will be ignored in case of moving them around on SATA headers.

    Determine the ID_SERIAL for each of the drives:

    • udevadm info /dev/sdb | grep ID_SERIAL=
    • udevadm info /dev/sdc | grep ID_SERIAL=

    Add to /etc/udev/99-hide-disks.rules (a single line for each rule):

    • ENV{ID_SERIAL}=="WDC_WD60EFZX-68B3FN0_WD-XXXXXXYK", ENV{UDISKS_IGNORE}="1"
    • ENV{ID_SERIAL}=="WDC_WD60EFZX-68B3FN0_WD-XXXXXX7K", ENV{UDISKS_IGNORE}="1"

    Then have udev read from the files:
    • sudo udevadm control --reload


    Sources:

    02 September 2022

    Saving data off a scratched DVD

    I had a DVD with files on it that I needed. Unfortunately, it was giving me errors when trying to pull them off. Here is what I did to try to recover as much data as possible.

    • Install ddrescue and a gui for visualizing its progress
      • sudo apt-get install gddrescue ddrescueview
    • Run a first pass with no retries to get as much info as possible
      • ddrescue -dn -b2048 /dev/sr0 disk.img disk.mapfile
    • Retry failed blocks
      • ddrescue -d -r5 -b2048 /dev/sr0 disk.img disk.mapfile
    • Description of the options:
      • /dev/sr0: the dvd drive
      • disk.img: the file to create
      • disk.mapfile: the mapfile that keeps track of the status of the recovery
      • -d: Use direct disc access for input (aka, no caching)
      • -n: Skip the scraping phase
      • -b2048: block size of 2048, use for cdroms and dvd
        • defaults to 512
      • -r5: retry 5 passes
        • -1 for infinite passes

    Sources:

    12 March 2022

    Cleaning up old vmlinuz and initrd files in /boot

     I noticed that updates were taking a long time on the kernel step. So I expanded what it was doing and it was attempting to build really old versions (3.13)

    Purge from apt-get

    • Figure out which package to remove
      • dpkg -S /boot/vmlinuz-3.13.0-36-generic
    • Remove the package
      • sudo apt-get purge linux-image-3.13.0-36-generic
    • If you have many to remove, you can use bash expansion like so:
      • sudo apt-get purge linux-image-3.13.0-{36,37,39}-generic
    • Regenerate initrd
      • sudo update-initramfs -u -k all
    • Update grub
      • sudo update-grub
    • If initramfs is still generating stuff for old kernel, you can remove like so
      • sudo update-initramfs -d -k 3.13.0-36-generic
      • Note: bash expansion does not work for this command

    Sources

    Replacing drives in ZFS

     As my two 3TB WD Red drives (purchased before the SMR controversy) in Raid 1 were starting to fill up and the price of bigger drives came down, it was time for an upgrade. I purchased two 6TB WD Red Plus drives to replace them (~$105 each before tax). I went with this particular drive and size because of the speed (5640 rpm) to keep the drives quiet and cool. Most NAS drives are going to the higher rpm of 7200.

    Checking the drives

    I used an external enclosure to test each of the drives before adding them to the ZFS Pool
    • Determine the drive
      • For these examples I used /dev/sdX, but you need to use the device letter applicable to you
      • ls /dev/sd*
    • Check initial SMART attributes
      • sudo smartctl -A /dev/sdX
    • SMART short test
      • sudo smartctl --test=short /dev/sdX
    • Check SMART test status
      • sudo smartctl -c /dev/sdX
    • Check SMART attributes
      • sudo smartctl -A /dev/sdX
    • Write Zeros to the entire disk
      • Warning: This will erase the entire disk and you will lose anything stored on it
      • sudo dd if=/dev/zero of=/dev/sdX bs=1M status=progress
    • Check SMART attributes
      • sudo smartctl -A /dev/sdX
    • SMART extended test
      • I had problems with this test being stuck at 90% remaining due to the drive stopping spinning
      • The solution it to make sure the drive is spinning and then kicking off the test and a command to keep the drive active
      • sudo dd if=/dev/sdX of=/dev/null count=1  # Read one 512 byte block from drive
      • sudo smartctl --test=long /dev/sdX  # Kick off the test
      • sudo watch -d -n 60 smartctl -a /dev/sdX  # Make sure the drive doesn't spin down. Will also show test status
    • Power Off the drive
      • sudo udisksctl power-off -b /dev/sdX
    • Disconnect the drive
    • Repeat for the next drive

    Adding the drives to the pool

    At this point I hooked both drives up to the SATA connectors inside the server, but had to disconnect the front panel USB to access the open SATA port and disconnect the DVD drive. Now it was time to add them to the pool to get data replicated to them.
    • Get current status
      • sudo zpool status
    • Get the drive ids
      • ls -l /dev/disk/by-id/
    • Attach them to a current drive to put them in the same mirror
      • Run this command with the values substituted for both drives:
        • sudo zpool attach [poolname] [original drive to be mirrored] [new drive]
      • If you get an error like: devices have different sector alignment
        • than add: -o ashift=9 
        • There are performance penalties for running a 4K drive as a 512B one, but supposedly there are storage size advantages
        • Update 2023-12-10: Apparently it is a quite large performance difference: 35-45MB/s vs 70-72MB/s
      • Here is what I ran (serial 1 and 2 are the existing drives while 3 and 4 are the new ones:
        • sudo zpool attach storage /dev/disk/by-id/ata-WDC_WD30EFRX-68EUZN0_WD-SERIAL#1 /dev/disk/by-id/ata-WDC_WD60EFZX-68B3FN0_WD-SERIAL#3 -o ashift=9
        • sudo zpool attach storage /dev/disk/by-id/ata-WDC_WD30EFRX-68EUZN0_WD-SERIAL#2 /dev/disk/by-id/ata-WDC_WD60EFZX-68B3FN0_WD-SERIAL#4 -o ashift=9
    • Check on the status:
      • sudo zpool status
    • Wait for the resilvering to complete
      • Estimated time was ~33 hours
      • Actual runtime was ~18 hours copying around 2TB of data
    • Optional scrub to verify all data
      • sudo zpool scrub [POOLNAME]
    • Wait for it to finish
      • Estimated time was ~13 hours
      • Actual time was ~10 hours

    Remove the old drives

    • Remove the old disks from the pool:
      • sudo zpool detach [POOLNAME] [DISKNAME]
    • What I ran:
      • sudo zpool detach storage /dev/disk/by-id/ata-WDC_WD30EFRX-68EUZN0_WD-SERIAL#1
      • sudo zpool detach storage /dev/disk/by-id/ata-WDC_WD30EFRX-68EUZN0_WD-SERIAL#2
    • Check on the status
      • sudo zpool status
    • Shutdown the server and remove the drives

    Expand the Quotas

    • Check current usage and quotas
      • df -k /storage/mythtv /storage/.encrypted
      • sudo zfs get quota storage/mythtv
      • sudo zfs get quota storage/.encrypted
    • Set new quotas, total storage available was 5.45T
      • sudo zfs set quota=1.5T storage/mythtv
      • sudo zfs set quota=3.9T storage/.encrypted
    • While editing my zfs containers, I decided to turn off compression since i wasn't seeing any gains
      • sudo zfs set compression=off storage/.encrypted

    Sources

    23 December 2021

    Copying Linux HDD to a new SSD

    I wanted to upgrade my old 250GB WD Blue HDD to a newer 512GB Crucial SSD, but was having problems getting the data transfered over. I tried clonezilla to no avail probably probably because the HDD had sector size of 512 bytes and the SSD uses 4k bytes. In the end, I resorted to copying everything over manually. Here are the steps that I used For these steps /dev/sdX is the existing drive and /dev/sdZ is the new one, which became one letter less after the existing drive is removed (sdY).

    Prequisites

    • Have a linux live USB to be able to boot with
    • Install grub-efi-amd64:
      • sudo apt-get install grub-efi-amd64


    Linux Live USB Steps

    Boot off of your linux live USB so that the data on the drive you are copying is static.


    Existing Partition Formats

    Here is what my existing drive looks like, and I was going to keep the same structure.

    • sdX1 - EFI - 512MiB - flags hidden
    • sdX2 - root - 95.37GiB
    • sdX3 - home - 129.48GiB
    • sdX4 - swap - 7.54GiB


    Create new partitions using gparted

    Using gparted I created the following partitions. Description is not a field in gparted, but I listed it below for clarification.
    • sdZ1
      • description: EFI
      • Free space preceding: 1MiB (This is the default that came up for me and from what I read should be used for aligning the physical sectors)
      • size: 512MiB
      • type: fat32
      • flags: hidden, esd, boot
    • sdZ2
      • description: root
      • size: 153,600MiB
      • type: ext4
    • sdZ3
      • description: home
      • size: 257,291MiB
      • type: ext4
    • sdZ4
      • description: swap
      • size: 65,536MiB (I went with 64GiB as the server has 20GiB of RAM and I am thinking of upgrading to 32GiB and this would put me at 2x of that)
      • type: linux-swap


    Mount

    Mount all the drives to get ready to copy them

    • sudo mount /dev/sdX1 /mnt/hdd1
    • sudo mount /dev/sdX2 /mnt/hdd2
    • sudo mount /dev/sdX3 /mnt/hdd3
    • sudo mount /dev/sdZ1 /mnt/ssd1
    • sudo mount /dev/sdZ2 /mnt/ssd2
    • sudo mount /dev/sdZ3 /mnt/ssd3


    Copy the data

    Description of rsync options:
    • a - archive mode; equals -rlptgoD (no -H,-A,-X)
    • A - preserve ACLs (implies -p)
    • H - preserve hard links
    • X - preserve extended attributes
    • x - don't cross filesystem boundaries (this is very important)
    • v - increase verbosity
    Perform the actual copies, depending on file size this can take a while.

    • cd /mnt/hdd1
    • sudo rsync -aAHXxv --stats --progress . /mnt/ssd1
    • cd /mnt/hdd2
    • sudo rsync -aAHXxv --stats --progress . --exclude={"dev/*","proc/*","sys/*","tmp/*","run/*","mnt/*","media/*","lost+found"} /mnt/ssd2
    • cd /mnt/hdd3
    • sudo rsync -aAHXxv --stats --progress . /mnt/ssd3 --exclude={"lost+found"}


    Edit the UUIDs copied

    Determine the new UUIDs to use

    • sudo blkid /dev/sdZ2  # for /
    • sudo blkid /dev/sdZ3  # for /home
    • sudo blkid /dev/sdZ4  # for swap
    Replace the UUIDs in fstab (NOT PARTUUID) for / and /home and swap
    • sudo vi /mnt/ssd2/etc/fstab

    Replace the UUID for swap in initramfs resume

    • sudo vi /mnt/ssd2/etc/initramfs-tools/conf.d/resume


    Change booting to use new drive

    GRUB

    • boot using old install
      • sudo update-grub
      • check /boot/grub/grub.cfg to ensure it is using the correct UUID for sdZ2
    • boot using new install
      • sudo mkdir /boot/efi
      • sudo mount /dev/sdZ1 /boot/efi
      • sudo grub install --target=x86_64-efi /dev/sdZ
      • sudo update-grub
    • shutdown
    • remove old hd
    • boot using new install
      • sudo update-grub


    Bonus Section

    Because I did not get grub installed on the new drive before removing the old one, I got stuck at the grub prompt so the steps that I used to boot were:

    • ls
    • set root=(hd2,2)
    • linux /boot/vmlinuz<tab complete to most recent version> root=/dev/sdY2
    • initrd /boot/init<tab complete to same version as above>
    • boot

    TRIM

    Ensure that trim is enabled and works:

    • Check that it is enabled to run weekly
      • systemctl status fstrim.timer
    • Check that trimming actually works
      • sudo fstrim -v /

    Update 2022-07-26: NOATIME

    As the ssd was seeing more writes then I would like, I realized that it was writing the access times, which I really didn't need. To fix this we add it in /etc/fstab to this line and then reboot:
    • UUID=XXXX   /   ext4   defaults,noatime   0   1

    Update 2023-02-03: Swappiness

    Updated the swappiness setting to hopefully save more ssd writes
    • in /etc/sysctl.conf add:
      • vm.swappiness = 10
    • reboot
    • check the setting:
      • cat /proc/sys/vm/swappiness

     

    Sources

    03 December 2021

    Xubuntu Server Ubgrade 16.04 to 18.04 to 20.04

    As I have been busy the past few months, I failed to notice that 16.04 went past it's support window and hasn't been getting updates. Here are the steps that I went through to get current and fix the issues that I encountered

    Perform the Upgrade

    I upgraded using the GUI to walk me thru the steps
    • upgrade to 18.04
      • sudo do-release-upgrade -f DistUpgradeViewGtk3
    • reboot
    • upgrade to 20.04
      • sudo do-release-upgrade -f DistUpgradeViewGtk3
    • When prompted for debian-sys-maint password find it here:
      • sudo cat /etc/mysql/debian.cnf


    Getting Unifi Web working again

    127.0.0.1:8443 was giving a 404 error

    • Check the logs
      • tail -n 50 /usr/lib/unifi/logs/server.log
        • [2021-10-24TXX:XX:XX,XXX] <db-server> INFO  db     - DbServer stopped
      • tail -n 50 /usr/lib/unifi/logs/mongod.log
        • 2021-10-24TXX:XX:XX.XXX-XXXX F CONTROL  [initandlisten] ** IMPORTANT: UPGRADE PROBLEM: The data files need to be fully upgraded to version 3.4 before attempting an upgrade to 3.6; see http://dochub.mongodb.org/core/3.6-upgrade-fcv for more details.

    So I needed to upgrade the mongo data files, but can't do that in version 3.6 so I used a combination of the following posts

    Here are the actual steps that I used:

    • sudo apt-get install docker.io
    • sudo docker run --name mongo-migrate -v /var/lib/unifi/db:/data/db -p 127.0.0.1:27888:27017 -d mongo:3.4
    • mongo localhost:27888
      • db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )
      • db.adminCommand( { setFeatureCompatibilityVersion: "3.4" } )
      • exit
    • sudo docker stop mongo-migrate
    • sudo chown -R unifi:unifi /var/lib/unifi/db
    • sudo systemctl restart unifi


    Fixing MythTV

    I was seeing the following Fatal Error when accessing mythweb:

    !!NoTrans: You are missing a php extension for mysql interaction. Please install php-mysqli or similar!!

    I solved this error with the following steps:

    • apt-get install php7.4
    • sudo a2dismod php7.0
    • sudo a2enmod php7.4
    • sudo systemctl restart apache2

    It then became this error:

    !!NoTrans: MasterServerIP or MasterServerPort not found! You may need to check your mythweb.conf file or re-run mythtv-setup!!

    I determined this to be an error with mysql

    • tail -n 100 /var/log/mysql/error.log
      • 2021-10-24TXX:XX:XX.XXXXXXZ 0 [ERROR] [MY-000067] [Server] unknown variable 'query_cache_limit=1M'.
      • 2021-10-24TXX:XX:XX.XXXXXXZ 0 [ERROR] [MY-000067] [Server] unknown variable 'query_cache_size=16M'.
    • sudo vi /etc/mysql/my.cnf
      • commented out the 2 lines regarding query_cache
    • sudo systemctl restart mysql

    This got mysql running but, mythweb still had the same error. I tried a reboot of the server, but that didn't seem to help. It turns out that I needed to change the bind_address

    • sudo vi /etc/mysql/my.cnf
      • bind-address            = 127.0.0.1,192.168.X.X


    VNC

    I needed to fix my vnc setup and came across this:

    • vnc4server is no longer in the repo
    • tightvncserver works with the exception of window buttons. This is due to it not supporting Render: https://bugs.launchpad.net/ubuntu/+source/xfwm4/+bug/1860921
    • Solution: Use tigervncserver

    Here are the steps that I used:

    • sudo apt-get install tigervnc-standalone-server
    • touch ${HOME}/.Xresources
    • tigervncserver :1 -geometry 1366x768 -depth 24 -localhost no


    Let's Encrypt

    Update 2021-12-14: Apparently, the upgrade broke my Let's Encrypt certificate, but fixing it was easy enough, I just needed to install 2 packages: sudo apt-get install certbot python3-certbot-apache


    23 September 2019

    Installing Unifi Controller on Ubuntu 16.04

    Here are the steps that I had to do to get Ubiquiti Unifi Controller software installed on Ubuntu 16.04


    1. Add the gpg key:
      • sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 06E85760C0A52C50
    2. Add the repo:
      • echo 'deb http://www.ui.com/downloads/unifi/debian stable ubiquiti' | sudo tee /etc/apt/sources.list.d/100-ubnt-unifi.list
    3. Update Sources:
      • sudo apt update
    4. Install the software:
      • sudo apt install unifi
    Unfortunately, this resulted in JAVA_HOME not found errors in /usr/lib/unifi/logs/server.log. This is because the unifi software requires Java, but it couldn't find it. I tried to point to the Java 9 path, but that just resulted in errors like: /usr/lib/unifi/data/keystore (Permission denied). Apparently, the software only works with Java 8. To resolve this issue, I installed Java 8 and restared unifi with the following commands:
    • sudo apt-get install openjdk-8-jre
    • sudo service unifi restart
    Then head over to https://localhost:8443 to complete the setup

    03 August 2017

    Installing Google Cloud Print Connector in Ubuntu 14.04 LTS

    As I wanted to be able to print from my phone, I thought the easiest way would be to install Google Cloud Print. Here are the various attempts that I made.

    Attempt 1: apt-get

    My first attempt was to simply run:
    • sudo apt-get install cloudprint
    However, when running it and giving it your user/application pass, it fails with this message:
    • UnboundLocalError: local variable 'auth_response' referenced before assignment
    I believe it is because it (v0.5) is trying to hit an api/url that no longer exists.

    Cleanup:

    • sudo apt-get remove cloudprint

    Attempt 2: Compile with gccgo

    I then found this wiki about installing a newer version: https://github.com/google/cloud-print-connector/wiki/Build-from-source

    So I then installed:
    • go: sudo apt-get install gccgo-go 
    • dev packages: sudo apt-get install build-essential libcups2-dev libavahi-client-dev git bzr
    Set your gopath:
    • export GOPATH=$HOME/workspace/gocode
    I then attempted to compile the source:
    • go get github.com/google/cloud-print-connector/... 
    However I was greeted with two errors:
    • error: unknown field ‘KeepAlive’ in ‘net.Dialer’
    • error: reference to undefined field or method ‘Timeout’
    It turns out that the go version that apt-get installs is outdated:
    • go version xgcc (Ubuntu 4.9.3-0ubuntu4) 4.9.3 linux/amd64
    • which is not greater than or equal to version 1.5.2

    Cleanup:

    • sudo apt-get remove gcc-go

    Attempt 3: The correct way

    You will still need the dev packages and gopath from attempt 2:
    • sudo apt-get install build-essential libcups2-dev libavahi-client-dev git bzr
    • export GOPATH=$HOME/workspace/gocode
    Additionally, we will need an updated version of go:
    Now we compile again:
    • go get github.com/google/cloud-print-connector/...
    The command should complete with no output.

    Configuring

    $GOPATH/bin/gcp-connector-util init

    Running

    $GOPATH/bin/gcp-cups-connector

    20 December 2014

    Blank Kodi/XBMC MythTV channel icons

    When mapping channel icons in my MythTV, they were showing up as blank! After some research, I determined this is the result from the removal of absolute paths from icon path in MythTV. Fixing this is a simple 2 step process.

    1. Create a new storage group in MythTV called "ChannelIcons" and map it to the directory with all the icons, Typically: /home/mythtv/.mythtv/channels
    2. Delete the cached empty icons off XBMC. On the firetv, they were located here: /storage/sdcard0/Android/data/org.xbmc.xbmc/files/.xbmc/userdata/addon_data/pvr.mythtv.cmyth/cache/channels
    I used adb to remove the files:
    adb kill-server
    adb connect 192.168.1.XXX
    adb shell
    cd /storage/sdcard0/Android/data/org.xbmc.xbmc/files/.xbmc/userdata/addon_data/pvr.mythtv.cmyth/cache/channels
    ls
    rm *.jpg *.png


    Software versions:
    Ubuntu 14.04
    MythTV 0.27
    XBMC Kodi 14 release candidate

    Xubuntu adb sideload Lollipop onto Nexus 5

    As I was tired of waiting on the OTA to download directly to my phone, I decided to sideload it myself. Luckily, sideloading does not require root or an unlocked bootloader.

    I followed this guide by Droid Life, but had to preface all adb commands with sudo as I was running it from my linux box. http://www.droid-life.com/2013/02/12/guide-how-to-use-adb-sideload-to-update-a-nexus-without-root-or-custom-recovery/


    Fixing Tab in Xubuntu 14.04

    One thing that was really annoying me was that on my Xubuntu 14.04 server, tab would switch windows by itself without holding alt. This was messing up my tab completion and putting tabs in files when using one of my VNC sessions.

    After a bit of googling, I came across this forum which had other users experiencing the same problem: http://ubuntuforums.org/archive/index.php/t-1771058.html

    The solution was simple.
    1. Edit this file: ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml
    2. Find this line:
    3. Change it to this:
    4. Restart any session including VNC ones

    13 October 2014

    Hiding partitions in Xubuntu 14.04

    Hiding partitions in Xubuntu 14.04


    After installing Xubuntu 14.04 LTS, it put an sda1 icon on my desktop, which was my boot drive, and I did not want it to keep showing up. Here are the steps that I went thru to prevent it.


    1. Create or edit the udev rules:
    sudo vi /etc/udev/rules.d/99-hide-disks.rules

    2. Add the following lines where sda1 is the drive you want to hide:
    KERNEL=="sda1", ENV{UDISKS_PRESENTATION_HIDE}="1"
    KERNEL=="sda1", ENV{UDISKS_IGNORE}="1"

    3. Then reboot the system.

    21 September 2014

    Update to VNC: tightvncserver instability

    Update to http://zmodemz.blogspot.com/2010/03/ubuntu-vnc.html


    tightvncserver was crashing on me when doing simple things like opening file manager. I was getting the following error:


    /var/log/syslog
    Sep 14 00:21:45 servername kernel: [440445.907880] Xtightvnc[12447]: segfault at 7fffaf355000 ip 0000000000448a2e sp 00007fffaf352c80 error 6 in Xtightvnc[400000+178000]


    Turns out that the instability is just in this version of tightvncserver, should be fixed in 1.3.10. So for the time being, I swapped out tightvncserver for vnc4server. The commands are identical as far as I can tell, so the switch was easy.


    Software Versions:
    Xubuntu 14.04.1 LTS (Trusty Tahr)
    tightvncserver 1.3.9
    vnc4server 4.1.1

    20 September 2014

    MythTV 0.27 backend setup

    As I wanted my new server to act as a DVR, I decided to go with MythTV as my backend.

    Install MythTV (server only, I will have separate frontends):


    1. Install htdigest (for password protecting MythWeb):
      • sudo apt-get install apache2-utils
    2. Install mythtv-backend-master (and all dependencies)
      • sudo apt-get install mythtv-backend-master
      • Answered yes to password protect MythWeb
      • Told it that MythWeb would not be the only thing running on Apache
      • Told it other computers would be connecting to it (remote frontends)
    3. Ran mythtv-setup
      1. Changed database password to match the one in /etc/mythtv/config.xml
      2. Changed it to listen on 192.168.1.XXX instead of 127.0.0.1
      3. Also change the backend ip to the same (learned this the hard way)
      4. Added my HDHomeRun Dual tuner (must do twice once as tuner 0, second as tuner 1)
      5. Created an OverAir video group (use EIT)
      6. Put both tuners in this group
      7. Scanned for channels
    4. Enable remote connections in mysql (learned this the hard way):
      1.  Change the bind-address in /etc/mysql/my.conf
        • bind-address            = 192.168.1.XXX
      2. Restart mysql
        • sudo service mysql restart

    Software Versions:
    Xubuntu 14.04.1 LTS (Trusty Tahr)
    MythTV 0.27

    Troubleshooting:



    Make sure MythWeb password protection is on. In /etc/apache2/sites-enabled/mythweb.conf the following lines should be un-commented:
            AuthType           Digest
            AuthName           "MythTV"
            AuthUserFile       /var/www/htdigest
            Require            valid-user
            BrowserMatch       "MSIE"      AuthDigestEnableQueryStringHack=On
            Order              allow,deny
            Satisfy            any


    Restart apache: sudo service apache2 restart
    For more info see: http://www.mythtv.org/wiki/Securing_MythWeb



    Error: "mythtv cannot connect to database":

    My remote frontend was unable to connect to my backend mysql database until I changed /etc/mysql/my.cnf to allow remote connections by changing bind-address from 127.0.0.1 to 192.168.1.XXX (server ip)



    Mythfilldatabase returning an error about no version response, really slow backend connections, and constant backend crashes:

    Turns out that when changing the ip to listen on from 127.0.0.1 to 192.168.1.XXX, you HAVE to make sure to also change the backend ip from 127.0.0.1 to 192.168.1.XXX





    13 August 2014

    ThinkServer TS140 Build

    As my old server is 5 years old (2008-12) and been showing its age, I decided it was time for an upgrade.

    Hardware:

    1x Lenovo  ThinkServer TS140 70A4001LUX  -  $399.99 - $50 rebate (newegg)
    • Intel Xeon E3-1225v3 3.2GHz
    • 4GB DDR3 1600
    • No Hard Drive
    • Gigabit Ethernet 
    2x Western Digital Red 3 TB  -  $114.99 a piece (newegg)
    1x Old Western Digital Caviar 250 GB w/ sata cable  -  Already had
    1x 18 inch Monoprice Sata III cable with 90 degree angle plug  -  $2.66 (amazon)
    1x Trendnet USB to PS/2 adapter (TU-PS2)  -  $8.99 (amazon)
    1x Small zip tie  -  Already had

    Software:

    Xubuntu 14.04 LTS 64bit  -  Free (xubuntu.org/getxubuntu/)

    Total Cost: $591.62 + tax



    Hardware Installation:

    1. Opened up the case
      1. Removed Thumb screws (had to use screwdriver to get it started)
      2. Pressed in the side release button
      3. Removed side panel
    2. Installed the 250GB primary drive (in what Lenovo calls the tertiary drive slot)
      1. Pressed the quick release button
      2. Pushed the 5.25 to 3.5 adapter out from the inside
      3. Be careful as the fan power cord is not long!
      4. Placed the hard drive in the adapter
      5. Flipped over while supporting hard drive
      6. Aligned screw holes and fastened screws (make sure to use included screws as they are longer due to anti-vibration gaskets)
      7. Pushed adapter back into place and assured that quick release snapped back into place
      8. Attached Sata
        1. Removed front USB motherboard connector
        2. Moved existing Sata cable from Sata0 to Sata1
        3. Reattached front USB motherboard connector
        4. Attached Sata cable to Sata0 ran thru cord fastener on motherboard side and attached to HD
      9. Attached Power
        1. Clipped zip tie holding power cable in place
        2. Un-did loop in power cable so it could reach HD
        3. Attached power cable to HD
        4. Zip tied all cables back into place
    3. Installed the 2x 3TB drives
      1. Pulled out the drive caddy
      2. Installed pegs into one side of the HD
      3. Stretched caddy so that pegs would go into other side of the HD
      4. Pushed HD + caddy back into place
      5. Attached sata (Sata1 and Sata2) and power cable

    Testing:

    I wanted to do an extended drive test on all the drives to ensure they were in good working order before proceeding with my software install. I used the Western Digital DOS diagnostic tool (wdc.com). It took about 7 hours for each of the 3TB drives and just over an hour for the 250GB drive.


    Software Installation:

    1. First I created a linux live USB from the ISO
    2. Booted from the USB in Try Xubuntu mode
    3. As I was recycling a drive from an old FakeRaid array, I had to delete the raid metadata. I opened up a terminal window and ran:
      • sudo dmraid -E -r /dev/sdX
      • where X is the letter of the old raid array drive
    4. Ran the install Xubuntu icon on the desktop
    5. Followed the prompts to install to the 250GB drive
      • Used advanced partition setup:
        • /boot: 537MB
        • /: 100GB
        • /home: 139 GB
        • swap: 8GB
    6. Remove USB and Reboot 
    7. Installed Updates
      • sudo update-manager
    8. Reboot 
    9. Made sure Red Drives had WD Load/Unload update installed
    10. Setup the ZFS mirrored raid 
      1. sudo apt-get install zfs-fuse
      2. ls /dev/disk/by-id/
      3. sudo zpool create storage mirror /dev/disk/by-id/ata-WDC_WD30EFRX-68EUZN0_WD-SERIAL#1 /dev/disk/by-id/ata-WDC_WD30EFRX-68EUZN0_WD-SERIAL#2
      4. sudo zpool status

    Thoughts:

    • The server is dead quiet which is one of the major reasons I bought it
    • With the Trendnet for some reason the scroll on the mouse causes the mouse to jump instead of scrolling, but as I plan to use this as a mainly server this is a small issue


    03 November 2012

    Windows X11


    To install a X11 window manager in windows, I used Cygwin and made sure to check the X11 options when installing.

    To start the X11 window manger open a cygwin terminal and type:
    xwin -multiwindow

    You can then use X forwarding in PuTTy to open Linux Guis on windows! Each window will have windows native minimize, maximize, and close buttons.

    28 October 2012

    Upgrade from Xubuntu 10.04 LTS to 12.04 LTS


    Here are the couple things that I found that I had to fix when upgrading from Xubuntu 10.04 LTS to 12.04 LTS:

    1. I was not getting DNS resolution
      • sudo vi /etc/resolv.conf
      • add:
        nameserver 192.168.1.1 
      • UPDATE: the above does not last you should instead:
        • sudo vi /etc/network/interfaces
        • add:
          dns-nameserver 192.168.1.1
    2. My VNC session was not loading a window manage (giving a failure to load gnome message -- I also got a trash not supported error and application crashes when starting xfce4-session)
      • vi ~/.vnc/xstartup
      • make sure it has:
        startxfce4 &
    3. When running synaptic from the application menu, it would ask for a password then fail to load 
      • xhost +localhost
    4. noip2 was removed and not in the package list
      • cd /usr/local/src
      • sudo wget http://www.no-ip.com/client/linux/noip-duc-linux.tar.gz
      • sudo tar xf noip-duc-linux.tar.gz
      • cd noip2-2.1.9-1/
      • sudo make install
      • sudo /usr/local/bin/noip2 -C
      • sudo vi /etc/init.d/noip2
        • change:
          DAEMON=/usr/local/bin/$NAME
          CONFFILE=/usr/local/etc/noip2.conf
      • sudo /etc/init.d/noip2 start

    16 March 2010

    Firefox 3.6 on Ubuntu Intrepid Ibex (8.10)

    Here are the steps to install Firefox 3.6 on Ubuntu Intrepid Ibex (8.10)

    1. sudo vi /etc/apt/sources.list

    2. Add the following:
      deb http://ppa.launchpad.net/mozillateam/firefox-stable/ubuntu intrepid main
      deb-src http://ppa.launchpad.net/mozillateam/firefox-stable/ubuntu intrepid main

    3. Get the gpg key: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE49EC21

    4. Update apt-get: sudo apt-get update

    5. Install firefox 3.6: sudo apt-get install firefox


    For other versions of Ubuntu check here:
    Ubuntugeek