Wednesday, October 15, 2014

My first commit to Slackbuilds

This is my first commit to Slackbuilds! Not a very big contribution, but very cool nonetheless! Every little bit counts!

Robby Workman commit a2ecf74a7618ecd1341a70006af9d50bbb8bcf05
Author: Robby Workman <rworkman@slackbuilds.org>
Date: Wed Oct 15 16:39:32 2014 -0500

multimedia/flashplayer-plugin: Updated for version 11.2.202.411.

Thanks to Diego Pineda.

Friday, October 10, 2014

Modification to rsync_slackware_patches.sh

On the Slackware docs page, in the beginners_guide--Watching for updated packages section--I noticed a flaw/feature/something I didn't like in the example script provided. Just a simple mod really. The script by default has the arch hardcoded, when honestly it would be better pulled from the system.

There is the option to set the arch to something different, which is fine if you want to rsync for a different arch than whats on your system (say have a local copy for another machine at your employ), but I believe it should have been set to the following:

# What architecture will we be mirroring? The default is 'x86' meaning 32bit.
# Alternatively you can specify 'x86_64' meaning 64bit. The value of SARCH
# determines the name of the slackware directories.
# This value can be overruled via the '-a' commandline parameter;
SARCH=${SARCH:-"x86"}


It should be changed to this:

SARCH=$(arch)

This will set the correct arch according to what your system has. Using the case statement -a switch will also allow you to set it should you need to still.


Links:

http://docs.slackware.com/slackware:beginners_guide

rsync_slackware_patches.sh - original

rsync_slackware_patches.sh - modified

Wednesday, October 8, 2014

Regular Expressions

I suck with regular expressions.

I'm always finding myself in the situation where I am using google to try and find a solution to an answer.

So, today I was trying to figure out an expression to use in a script when, I stumbled upon the following site:

http://www.regexr.com/

The nice feature of this site: it allows you to test your expression on the fly, and show you your results on the site.

Interactive learning at its best. I was actually able to figure out the regex I needed after testing a few combinations.

Diego

Tuesday, October 7, 2014

Updating timestamp across filesystem

So my poweredge 750 still believed it was 2004. After updating the system time, I realized my x86 Slackware 14.1 install had all of the files installed with timestamps from 10 years ago. This is not good, and will make your computer blow up with a bunch of wierd errors. So I had to resolve to the ancient fighting art of bash fu to resolve it:

boot to install disk:

mkdir /foo

mount root partition to foo (in my case R0 array)

mount /dev/md1 /foo

mount dev, proc, and sys via bind mountpoints. First define temporary variable:

a='dev proc sys'


and then apply the following for loop:

for i in $a; do mount --bind /$i /foo/$i; done

I almost forgot to add this; you need to chroot into foo:

chroot /foo

Since we want to update all directories with the exception of dev, proc, and sys, we can make another variable containing all root sub directories except the ones we've mounted via --bind, and update the timestamps on the results.

I wrote the following script to accomplish this task:

#!/bin/bash
# update timestamp.sh


b=$(ls / | egrep -v "dev|proc|sys")
for i in $b; do
cd /$i && find . -exec touch -h {} \;; \
done


exit 0
‪#‎EOF‬


Notes:

It is important to update the hwclock of the system prior to running this script, otherwise it will keep whatever time was on the BIOS. If your system can access the rtc device, you can update via hwclock:

hwclock --set --date "11/23/2014 13:50:30"

at which point you can update the system time via:

hwclock -s

I've tried this script once before w/o the -h switch, but it screwed up my system. It updated all the timestamps on files great, with the exception of the important ones--symlinks. Think vmlinuz.. right. 

With the -h switch however it ran great and everything was good to go.

(I originally shared this in late august on my fb page, but realized it would be better served here since I only have like 4 friend in RL that understand Linux.)

Links:

http://www.linuxquestions.org/questions/linux-general-1/update-time-stamp-during-mount-4175520145/

Notes:

 - November 23, 2014: I realized that the script wouldn't run as it was written. The for loop needs to be changed from:

for i $b; do 
cd /$i \
find . -exec

to:

for i in $b; do
cd /$i && find . -exec touch -h {} \;; \

the 2nd iteration forces the find/touch command to be executed upon completion of the initial change directory command.

Sunday, October 5, 2014

CCISS on Slackware 14.1

So I'm going to fast forward a bit, I want to share this because its important. I needed a decently modern system for work, and this time I was willing to shell out extra for it. I found a Gen5 HP ML 350, a dual proc mobo w/ 1 quad core X5355 Xeon, 8Gb Ram, 2x 15k 3G SAS drives, which I got for 150. I had to use Windows 7 on it for work purposes, but I finally was able to get rid of it and load up Slackware 14.1 x64.

After I bought the system I bought a couple extra SAS drives. I currently have 4x 15k 73.4 GB 3G SAS drives. This system has a HP Smart Array E200i SAS Controller. Although the huge kernel loads both hpsa and cciss, the system auto defaulted to using cciss.

I wanted to try out hardware raid in this install. So in the Smart Array ROM BIOS, I created a single logical array (drive), using all four disks, into a single RAID 0 array. No redundancy at all in this scenario--I know, but thats ok.

(I have a few emulex adapters I'm planning to setup a SAN with and setup a chron to periodically rsync to my storage server throughout the day, so i'm not concerned.)

CCISS is HP's deprecated block driver, which has since been replaced by HPSA which is a SCSI driver.

So, when you see your devices in the system, they are shown under /dev/cciss as such:

bash-4.2# cat /proc/partitions
major minor  #blocks  name

 104        0  286617757 cciss/c0d0
 104        1    8388608 cciss/c0d0p1
 104        2    4194304 cciss/c0d0p2
 104        3  274033821 cciss/c0d0p3


So c0d0 is the 1st logical drive the controller sees, and the partitions are listed as such.

bash-4.2# fdisk -l

Disk /dev/cciss/c0d0: 293.5 GB, 293496583168 bytes
255 heads, 32 sectors/track, 70249 cylinders, total 573235514 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x73841e94

           Device Boot      Start         End      Blocks   Id  System
/dev/cciss/c0d0p1            2048    16779263     8388608   82  Linux swap
/dev/cciss/c0d0p2        16779264    25167871     4194304   83  Linux
/dev/cciss/c0d0p3        25167872   573235513   274033821   83  Linux




So when I run through the installer, I used the partition layout shown above, and thought everything was peachy until I got to the end, after rebooting, was stuck in an infinite loop where my system didn't know what to boot.

This comes down to a lilo configuration issue.

I essesntially followed the directions given by Nasser here:
http://linax.wordpress.com/2009/09/26/slackware-boot-on-cciss-dev/

but, the layout he describes didn't work for me. In his directions, he designates the boot= directive to a partition.

I found you have to designate the boot directive to the logical disk. In other words:

boot = /dev/cciss/c0d0

Afterwards simply follow the steps as given by Nasser. Here is a step by step:

1. Run through setup as normal. Partition disks as you see fit.
2. Setup Lilo as normal. We will edit it after installation is complete.
3. Post Install--Modify Lilo:

chroot /mnt

and edit lilo.conf to ensure boot designates the logical disks your partitions reside on, i.e. 

boot = /dev/cciss/c0d0

4. Install Lilo

lilo -M /dev/cciss/c0d0 mbr
lilo

Here is my lilo.conf which got my system to finally boot (I am in fact using this system to make this very post):

# LILO configuration file
# generated by 'liloconfig'
#
# Start LILO global section
boot = /dev/cciss/c0d0

#compact        # faster, but won't work on all systems.

# Standard menu.
message = /boot/boot_message.txt

# Append any additional kernel parameters:
append="root=/dev/cciss/c0d0p3 vt.default_utf8=0"
#prompt
#timeout = 5
# Normal VGA console
vga = normal
# Ask for video mode at boot (time out to normal in 30s)
#vga = ask
# VESA framebuffer console @ 1024x768x64k
# vga=791
# VESA framebuffer console @ 1024x768x32k
# vga=790
# VESA framebuffer console @ 1024x768x256
# vga=773
# VESA framebuffer console @ 800x600x64k
# vga=788
# VESA framebuffer console @ 800x600x32k
# vga=787
# VESA framebuffer console @ 800x600x256
# vga=771
# VESA framebuffer console @ 640x480x64k
# vga=785
# VESA framebuffer console @ 640x480x32k
# vga=784
# VESA framebuffer console @ 640x480x256
# vga=769
# ramdisk = 0     # paranoia setting
# End LILO global section
# Linux bootable partition config begins
image = /boot/vmlinuz
  root = /dev/cciss/c0d0p3
  label = s14164
  read-only  # Partitions should be mounted read-only for checking
# Linux bootable partition config ends


Further reading:

http://cciss.sourceforge.net/


Adventures in 2014

So when I decided to move back into my folks place, it was the smartest move I've made at that point in 2014. Its expensive living on ones own. Furthermore I've been making plans on finally making use of my A.S. degree and transferring to a 4 year degree program. I've already hashed out the details with a guidance counselor at ASU's Ira A. Fulton School of Engineering. Basically I'm going to go for a B.S in Computer Science, or a B.E in Computer Engineering, or both. Really its the difference in the theory of computer science or a few applied courses in microcontroller programming. Honestly both sound awesome. (Thats been my biggest problem in school--I want to learn everything.)

In light of my plans of continuing my education, living off of my folks--I meant, living with my folks! Makes plenty of sense. Ahem.

While mosing about on my travels unfortunately I had to sell most of my possesions just to get by (its expensive living on ones own, and especially hard when your unemployed). So, first item on my agenda was obtaining a decent computer of sorts. So I hit craigslist with a bloodthirst.

(Up to this point I had been doing my programming stuff via a shell account I purchased at xshellz at Tempe Library via putty. This actually worked out quite well. The shell account cost 4 buckaroos.)

I've been hooked on the idea of getting a server since I first purchased a Gen3 HP ML350. The thing was a monster, it had dual core 32 bit Xeon processors (it was the last line of processors Intel made prior to including emt64), but it supported up to 12 GB of ram (which I maxed out--and made use w/ PAE). It also had a 6 bay SCSI bay. The system I bought actually came loaded w/ 6 SCSI drives. I bought it at the time (2010-11ish?), for a whopping 50 bucks. The dude I bought it from was some 20 year old kid who was most likely was cleaning old stuff out of his parents garage and was eager to figure out how to afford his next 8th of kind buds. I've seen the same server, and ones w/ similar specs, being sold for up to 200 bucks on craigslist. After spending 50 on the Gen3, I'm looking at their asking price thinking, "these guys are nuts."

I was hoping to get an HP. However after my stint at GoDaddy I had some hands on experience w/ Poweredge servers. So I decided to widen my horizens and look into Dell's stuff. My price range: 50-100 bucks.

I finally found a guy that had an awesome deal: Poweredge 1850, dual proc, 4Gb Ram, $75. That is a great deal. However I only had 50 bucks to spend. I sent the guy an email, and thankfully he was willing to work with me. But get this, that wasn't even the coolest part. I bought the server, and it came fully loaded w/ 6 10k7 SCSI drives! Before I left he also threw in a Poweredge 750!

So I got two servers, at the discounted price of 50 bucks! I don't think I can ever beat that! Thanks to the awesome dude who shall remain anonymous, rest assured he is indeed awesome!