Maintenance reference

From Bitpost wiki
Jump to: navigation, search
general tasks
Flash Drives - Scripts - Add a user

Turn off ubuntu gnome screenlock - Set ubuntu default browser

Add a drive - Back up drive - Check disk - Check disk speed

Bash basics - OS X basics - DOS basics - Update gentoo kernel

SSL certificate instructions - Networking

systemd - udev: Assign unique names to your devices

Automatically mount and unmount your devices

udev: Autorun programs when connecting your devices

master keyboard shortcuts map
See .i3/config.

Typically you can press ctrl-shift-K to open it in editor.

The local file usually points to the common version, here:

Upgrade Ubuntu
To update ubuntu from an i3 terminal:
su -
apt-get update        # Fetches the list of available updates
apt-get upgrade       # Strictly upgrades the current package
apt-get dist-upgrade  # Installs updates (new major versions, i think)
update-manager -d    # kick off the update manager to migrate to new release when available

Or just call the script that does the same thing:


I'm currently migrating everything to 16.04 Xenial Xerus.

Disabling xscreensaver
emacs ~/.xscreensaver
  timeout:	12:00:00    # the max timeout is 12 hours
crontab -e
  # So... I have .xscreensaver set to max delay (12 hours)
  # and I call this every ten hours to restart the idle timer.
  * */10 * * * /usr/bin/xscreensaver-command --deactivate >/dev/null
Test your drives - DO THIS OFTEN
Look at available tests:
smartctl -c /dev/sdf # to peek at available tests and how long they typically take to run

Short test:

smartctl -t short /dev/sdf
watch -n 3 smartctl -l selftest /dev/sdf # you won't see anything until it finishes, takes about 1 minute

Long test:

smartctl -t long /dev/sdf
watch -n 3 smartctl -l selftest /dev/sdf # takes about 5 minutes
Mount an IMG file
You have to peek at the file with fdisk:
fdisk -lu /home/m/bitpost/download/torrents/OpenELEC-Generic.x86_64-5.0.8-efi.img

From that you can tell the "units" and "Start" offsets:

Device                                                                    Start    End Sectors  Size Type
/home/m/bitpost/download/torrents/OpenELEC-Generic.x86_64-5.0.8-efi.img1   2048 526336  524289  256M Microsoft basic data
/home/m/bitpost/download/torrents/OpenELEC-Generic.x86_64-5.0.8-efi.img2 528384 593920   65537   32M Linux filesystem

From there you can mount with a little math. Multiply the units by Start to get offset (512x2048=1048576), and use it to mount that partition:

mount -t auto -o loop,offset=1048576 /home/m/bitpost/download/torrents/OpenELEC-Generic.x86_64-5.0.8-efi.img /media/m/iso


Chroot into gentoo from (say) ubuntu
# These may already be done
mount /mnt/gentoo
cp -L /etc/resolv.conf /mnt/gentoo/etc/

mount -t proc none /mnt/gentoo/proc
mount --rbind /dev /mnt/gentoo/dev
chroot /mnt/gentoo /bin/bash

source /etc/profile
export PS1="(chroot) $PS1"

# GET TO IT!  :-)
Windows symbolic links
Windows symlinks - needed for config files, svn overlay, etc.

I'm setting up hard links from sublime install folder to shared config settings:

mklink [/H /D /J] link_path Target_file/folder_path

We had to use a soft link, hard won't go across drives. And you have to run the cmd window as admin. Don't specify type, and it will create a soft file link:

mklink "C:\Users\Michael\AppData\Roaming\Sublime Text 3\Packages\User\Default (Windows).sublime-keymap" "D:\Michael's Data\development\config\common\home\m\.config\sublime-text-3\Packages\User\Default (Windows).sublime-keymap"
mklink "C:\Users\Michael\AppData\Roaming\Sublime Text 3\Packages\User\Preferences.sublime-settings" "D:\Michael's Data\development\config\common\home\m\.config\sublime-text-3\Packages\User\Preferences.sublime-settings"

Here is another example, setting up a link in an SVN repo folder to point to a git-controlled folder on another drive. SVN is OK with this, cool.

(open ADMIN cmd prompt)
cd C:\CODE\QA\ContinuousIntegration\Trunk
mklink /J scripts "D:\Michael's Data\development\power_analytics\scripts"
  Junction created for scripts <<===>> D:\Michael's Data\development\power_analytics\scripts
Windows route traffic to avoid VPN
You can use "route" to assign paths to specific traffic.

So requests go through eth0 instead of VPN, eg...

C:\WINDOWS\system32>route add

Note that you can do this with [route] in linux too, syntax is a bit diff.

Windows command prompt FULL SCREEN
Type cmd in start search box and right-click on the cmd shortcut which appears in the results. Select Run CMD as administrator.

Next, in the command prompt, type wmic and hit Enter. Now try to maximize it! Close it and again open it. It will open as a maximized window! You may have to ensure that the Quick Edit Mode in the Options tab is checked.

Tips and tricks
NO TEARING on Sony driven by nvidia (currently, case)
It's not really about Kodi settings, you have to set up nvidia settings, and they are HARD to get to stick because it's "automatic" but broken.
  • Ensure nvidia-settings is set to 4k at 60fps refresh rate - YOU HAVE TO DO THIS ON EVERY REBOOT until we set up an xorg.conf FML
  • Ensure Kodi has "sync video to display" turned ON
Copy from linux nautilus to android "Operation unsupported"
Weird assed linux prevents "SMB to USB" copies, FUCKOFF. Workaround is to copy to local drive, then copy to phone. Wow that is sickening.
Fix things after IP changes
Time Warner seems to keep giving the same IP back to my main linux router/server, as long as the NIC card doesn't change. It also happened when they upgraded my service (and started labeling my IP as dynamic to SpamHaus, fuckers...).

If it changes, fix these things:

  • Update the IP at for ALL domains, bleh...
  • mod evasive has a whitelist, it needs the actual IP, bleh...
-rw-r--r-- 1 m m 1.1K Mar 28 22:13 /home/m/config/etc/apache2/modules.d/10_mod_evasive.conf
  • reset cable modem (see specific steps)
Reset 1020 cable modem so it grants a real IP address (not private)
Resetting things sometimes has to be done in this precise order:
  • cable modem -> blue cable -> **ONBOARD** bitpost NIC
  • LAN switch -> yellow cable -> **ADDON CARD** bitpost NIC
  • power off bitpost and cable modem
  • power up cable modem
  • wait 5 minutes
  • power up bitpost
  • verify that you can ping, LAN works, etc.

Maintenance of my music collection

Ubuntu and shitty Seiki

Radeon driver sucks, won't go over 1080p; and Dune (AMD chipset) overscans so you can't see the edge. The only fix I found was to use xrandr. It kinda sucks though bc it's a resize solution that blurs all pixels. Cest la vie.

xrandr --output HDMI-0 --set underscan on
xrandr --output HDMI-0 --set "underscan hborder" 40 --set "underscan vborder" 22

Let's try the binary ATI driver.

lspci -vvnn | grep VGA
[...] Advanced Micro Devices, Inc. [AMD/ATI] RS780 [Radeon HD 3200] [1002:9610]

For 4k video on an nvdia chipset (like wimpy), first get Ubuntu to use nvidia's driver:

  • Go to System Settings-> Software & Updates
  • Select the Additional Drivers tab
  • Select the tested, proprietary NVIDIA binary driver
  • REBOOT - the nvidia driver works at the kernel level so you won't be able to just restart X. fools
  • WHY does ubuntu make you do all this?

Next, here is the "magic super-secret" Seiki 4K goo that should go in xorg.conf (if needed). It's from: See /etc/X11/xorg.conf for the full details:

   # MDM added based on
   # Modeline "3840x2160" 307.00 3840 4016 4104 4400 2160 2168 2178 2250 +hsync +vsync
   # MDM 2015/02/12 A more recent one from:
   Modeline "3840x2160" 296.70 3840 4016 4104 4400 2160 2168 2178 2250 +hsync +vsync
   Modeline "1920x1080" 297 1920 2008 2052 2200 1080 1084 1089 1125 +hsync +vsync

To get a full output of what the hell X is doing:

scite /var/log/Xorg.0.log &
# Or create one if needed
X -logverbose 6 :2 # this crashed my machine but did produce a log first
scite /var/log/Xorg.2.log &
BOX: bitpost
Update gentoo kernel
My primary server at Peace Street

I had to stuff the goddamned drives right into the case since the rosewill was giving me such shit. In hindsight, it might not have been the rosewill at all... I am considering restuffing the box with the drives... but for now, i have this:

sda  root
sdb1 tvmind
sdc1 film
sdd & sde softraid
sdf1 spicey
sdg1 reservoir
sdh1 plethora
sdi1 win

Before it was like this:

   BAYS of the Rosewill

       To figure this stuff out, it was easiest to mount/umount drives and/or just access the mounted files
          (and watch the bay lights, of course)

        Disk layout:

            8 7 6 5
            4 3 2 1

        1) spicey-3g-mel
        2) reservoir-3g-mel
        3) tvmind-4g-mel
        4) newraid1-4tb-bp WD Black installed 2014-10-05

        5) plethora-3tb-bp i hope this was not being used - 3GB Seagate barracuda - mount says some ntfs looking thing with no partitions and unable to mount - so i reformatted ext4
        6) win-pax09 some old windows drive with lots of game goodies; also has sdf2 swap partition (kill it some day)
        7) film-6tb-bp WD Green installed 2014-10-05
        8) newraid2-4tb-bp WD Black installed 2014-10-05


Before THAT, it was this... 8 bay SATA tower houses these drives:

  1. 2.0tb archive (sdb right?)
  2. 250gb landofthelost circa ABB timeframe /dev/disk/by-label/LandOfTheLost /dev/sdc1
  3. 1.5tb raid drive #1 /dev/disk/by-label/d-sp-raid -> ../../sdd1
  4. 2.0tb latest /dev/disk/by-label/d-sp-20newmovies -> ../../sde1
  5. 1.5tb raid drive #2 (needs label change maybe)
There are also these drive partitions:
  • / /dev/sda4
  • ubuntu root ub_root -> ../../sda5
  • /vista /dev/sda3
rtorrent keys
rtorrent CAN actually work pretty well, IF you pay attention to these basic keys:
  • enter - specify a torrent file to load - USE TAB COMPLETION
  • ctrl-d - STOP torrent, smack that shit, delete it forever
stty stop undef
stty start undef
  • ctrl-o - change download dir
  • ctrl-k - close files - needed before ctrl-o, usually
  • ctrl-r - recheck hash

NOW GET rutorrent going!  :-)

rtorrent fix torrents that didn't move into place properly
* if the torrent is archived properly, use move_and_resymlink to move it:
cd ~/download/torrents/archived/symlinks
move_and_resymlink [symlink] [destdir]
  • if things are a mess due to hard drive failure (etc), you should do this:
    • use r(u)torrent to see where rtorrent thinks the files are
    • copy the files, if available, to the final destination (under a .* dir in symlinks)
    • create a symlink: ln -s .music/Fresh/ELO-Secret\ Messages ELO-Secret\ Messages
    • close the torrent files (ctrl-k), move the destination (ctrl-o), start again (ctrl-s)
Creating a new ssh key pair for no-password access to a remote system
Say you've got a new machine with user [m] and you want to connect to it, do this:
  • install sshd, make sure it's running
  • get on the new machine - ssh to the new machine by typing the password if you don't have direct access
  • $ scp m@tdm:.ssh/id_rsa .ssh/
  • $ scp m@tdm:.ssh/authorized_keys .ssh/
wow I just had serious issues with basic ssh usage, so i'll put a summary on the wiki
   basically most misunderstandings stem from describing these two:
       client: machine that is trying to ssh into the server
       server: machine that the client user wants to get to
   most poor sots are just sitting on the client
   and they create a pair and push their public key to the server
   but in my case, more often, i want to create a pair on the server
   and push the private key to the multiple places i need to connect FROM
   when doing that, you have to push the public key into the server's authorized_keys
   and configure the client to juggle multiple private keys

       create a key pair:
           ssh suser@server
               use defaults
               will create:
                   .ssh/id_rsa (private key)
                   .ssh/ (public key)

       put the public key in place:
           cd .ssh
           cat >>authorized_keys

       put the private key on the client and configure:
           scp id_rsa cuser@client:.ssh/id_rsa_server
           ssh cuser@client
           em .ssh/config
               Host tdm
                 IdentityFile ~/.ssh/id_rsa
                 User m
               Host server
                 IdentityFile ~/.ssh/id_rsa_server
                 User suser

   all is full of light
bitpost LAN IP addresses
All IP address management happens on bitpost, via dnsmasq, which, rocks.
  • Set up machine names in /etc/hosts
  • Set up IP leases by MAC address in top of: /etc/dnsmasq.conf

Initially set up bitpost with DHCP as follows:

  • emacs /etc/conf.d/net

Turn DHCP-assigned IP into static as follows:

  • /etc/init.d/net.eth0 restart
   dhcpcd[3867]: eth0: carrier acquired
   dhcpcd[3867]: DUID 00:01:00:01:1a:c3:6f:da:e0:3f:49:a3:4b:d9
   dhcpcd[3867]: eth0: IAID 49:a3:4b:d9
   dhcpcd[3867]: eth0: rebinding lease of
   dhcpcd[3867]: eth0: leased for 86400 seconds
   dhcpcd[3867]: eth0: adding route to
   dhcpcd[3867]: eth0: adding default route via
  • emacs /etc/conf.d/net
routes_eth0="default via"
  • /etc/init.d/net.eth0 restart

We will monitor and log success here to see how it goes.

  • 2014/05/05 set to static, gateway
view dnsmasq IP leases
cat /var/lib/misc/dnsmasq.leases
BOX: viper
2016 ASUS Republic of Gaming laptop
  • Adjust it so that palms do not interfere! Ideally, require start with finger in center, then use full pad
# configure trackpad of asus
   su -
   xinput --list
   xinput disable 12 # to turn it off
# to dynamically test the settings...

BOX: wimpy
My main gaming machine

P8P67LE mobo Intel i5 quad core website

    • Plug keyboard/mouse hub into TOP USB SLOT in back or BIOS won't recognize it
    • Make sure you plug Vive usb into a USB 3.0 slot
  • ON BOOT:
    • REMOVE USB KVM or the keyboard won't work - most of the time that's ok because we let it go through
    • IF you boot into ubuntu, the USB hub didn't seem to work, i had to plug right into mobo
  • had to install from iso after windows update got stuck FUCK OFF
	my 148GB drive was only using 34GB AFTER the install and cleanup
		WAY better than before
took the time to move EVERYTHING I COULD to fatboy
	steam base install, plus games
	origin base install, plus games
	visual studio ce, plus mobile, c++, game dev
		but it sucked up 36GB on "system drive", assholes
		they dump android stuff, ios stuff, all this bullshit there
		cest la vie
	chrome (like pulling teeth to get it set as default)
	steam, games
	origin, games
	vs ce 2017 edition w/xamarin,c++,games,unity


drives and partitions:

  • sda HDD, OLD OSes, need to wipe and reformat to ntfs; sda2 ntfs 1.1TB old??
  • sdb
    • sdb1 fat32 300MB wimpy-efi
    • sdb2 ntfs 147GB windows10???
    • sdb3 fat32 287MB /boot/efi
    • sdb4 linux-swap 7GB
    • sdb5 ext4 wimpy-ubuntu-ssd 216GB
    • sdb6 ext4 wimpy-gentoo-ssd 54GB
    • sdb7 ext4 wimpy-openelec 19GB
    • sdb9 fat32 "boot, esp"

check in windows:

 wmic baseboard get product,Manufacturer,version,serialnumber

boot is in /ubuntu/boot

BOX: case

Fixing boot

Windows Updates tend to clobber the EFI boot setup.

THen you have to set BIOS to boot with "UEFI+Legacy", and put the UEFI "USB" drive first in front of the "Windows Boot Manager" one.

THen reboot, you should get grub.

Go into Ubuntu and reinstall refind.

Boot back into bios, and set back to UEFI boot. Leave the USB drive first. Reboot and yhou should get refind again. FU Bill.

Install Ubuntu

To originally install ubuntu, I had to add [... --- nomodeset] to the boot line in the grub booter.

Then I had to use a desktop 1080p monitor - the 4k Sony would not come up for some reason.

The Seiki is working fine now, go figure.

BOX: Raspberry Pi 2 and 4k
You can override settings in /flash/config.txt; here's how, from here:
mount -o remount,rw /flash
nano /flash/config.txt
# Make your changes, then ctrl+x to save.
mount -o remount,ro /flash

Settings for 4k (from here)...

hdmi_cvt 3840 2160 30

I couldn't get 4K to stick in OpenELEC tho (except for the splash screen(!))...

(it won't come up, just drops back to 1080p.. just as well, video at 30fps sucks...)

And to overclock the Pi 2 (from here):

# default is 700
# this will NOT void the warranty :-)
temp_limit=80 #Will throttle to default clock speed if hit.
# there is also the "turbo" thingee (that "voids warranty", hot!!)
BOX: melange
My primary dev box

90% ubuntu for development 10% gaming machine, has steam, low end half-height video card that works fine for Risk of Rain etc. It has a mid-range video card, enough to drive 1080p x 2 for development. This used to be the primary Kodi box up until 10/2015, should still be current. It has the same high-end i5 or i7 of other 2015 boxes, fast.

  • /dev/sda contains ubuntu, kodi, windows - using ubuntu 90% of the time
  • /dev/sdb melange_data
    • formatted as exfat
used gparted to remove existing partitions
used gdisk to create an EFI partition table and an 8300 "linux file system"
mkfs.exfat /dev/sdb1
exfatlabel /dev/sdb1 melange-data
emacs /etc/fstab
  /dev/disk/by-label/melange-data /melange_data exfat noatime 0 0
BOX: wallee
My 2009 MacbookPro 5.3 multi-boot laptop (see blog for multi-boot howto)

Ubuntu Install all hardware-specific packages in one shot:

sudo apt-get install firmware-b43-installer xserver-xorg-input-mtrack

Post-install MUST-DOs:

  • broadcom "b43" wifi driver:
sudo apt-get install firmware-b43-installer
  • synaptic driver (for trackpad)
sudo apt-get install xserver-xorg-input-mtrack
# use synclient to determine what works best
su -
synclient -l # lists all params
synclient PalmDetect=1 # temporarily change settings
# save what you like, here:
root@wallee:~# emacs /etc/X11/xorg.conf.d/60-synaptics.conf

Windows 10

    • Upgraded existing Windows 8.1
    • Hack the INF file of the nvidia driver to get it to install - runs PERFECTLY
      • TODO add details
    • Add bluetooth stack - or not - i think i ended up back at the default Windows
    • keyboard driver to get function key working: /spiceflow/softraid/software/OS/windows/macbook_windows10_drivers/AppleKeyboardInstaller64.exe


BOX: tdm
My primary server that does just about everything internet-related

P8P67LE mobo Intel i5 quad core

names that are hosted:

BOX: dune
Follow the ubuntu install.

We also use a StarTech AC600 ac wifi adapter. The chipset is specified here. It's a Realtek - RTL8811AU. It is not supported with the vanilla 15.04 kernel, but it's easy to build a module from sources available on github:

sudo apt-get update
sudo apt-get install linux-headers-generic build-essential git
git clone
cd ~/rtl8812au
sudo make install
sudo modprobe 8812au

Then, run NetworkManager and nm-applet, and as soon as you plug the USB dongle in and remove the wired connection, you'll get a running wifi applet, YES.

We also want to drive the crappy Seiki at 4K. A 4k mode shows up in our X probe, but ubuntu is not picking it...... yet...

OLD gentoo NOTES

My XMBC media center and samba-based storage server


post-kernel tasks:

 make sure you update /etc/conf.d/modules for any new modules added
 module-rebuild populate
 module-rebuild rebuild (if you feel brave)
 module-rebuild list (if you want to do it manually)
 # NOTE: NO MORE ATI-DRIVERS they no longer support my old-ass onboard HD 3000 graphics chip
 # But the open-source radeon driver does, oh yeah!
 emerge lirc # etc
 emerge -a1 $(qlist -IC x11-drivers/)
 # NO! eselect opengl set ati
 #     aticonfig --ovt opengl # "no supported adapters"?
 eselect opengl set xorg-x11