Skip to content

Space Rail – The coolest “Suit-toy” in the world, SOME assembly required…

While visiting Stratford for our annual Stratford Festival vacation this year (in which we saw Much ado about nothing, A Word or Two, and The Pirates of Penzance) I happened to convince my wife to go into a cool shop that caught my eye.

Quark Soup

This was my kind of shop, it appealed to the child and the adult in me, and if not for the hunger that had gripped my tummy I would have spent much more time and money in there.  Although there was a plethora of awesomeness I was drawn immediately to a section of the store dedicated to marble track engineering kits.   The product was called Space Rail which only furthered my interest.  

Image

The owner Sean, seeing my interest, told me the description of the toy was best described by the box, so I went in for a closer look.

Image

Wow best Chinese/English google translation ever!  I was hooked!  Now I just needed to decide which one to buy.  The prices ranged from $40-120 and the difficulty levels went from 1-8, 8 being the hardest.  Thankfully I was with my wife so I only purchased one box and went for a medium difficulty of 4 which was around $50.

Then off to satisfy my hunger with the Best Sandwiches hands down at the York Street Kitchen.

Ok, so now the trip is long over, I’ve cleared away everything on my kitchen table, started this blog and it’s time to get to work.  I’ve opened the box and looked at the manual. I’m scared.  What have I gotten myself into.  More hilarious translations to follow in what will be surely be an interesting struggle to build a rail in space…

 

Signing RPM packages/Creating YUM repositories

First do a couple yum installs:

yum install rpm-sign

yum install createrepo

Signing RPM packages:

Then we need to create a gpg key: gpg –gen-key

I entered the default options and then specified my name, email, comment, and passphrase.

Now we need to add the email to the following file:

vi ~/.rpmmacros  and then add the email you used in the line %_gpg_name “jfulton@learn.senecac.on.ca”

Now we can sign a package which I will do to my macchanger package.

rpm –addsign ../RPMS/x86_64/macchanger-1.5.0-3.fc16.x86_64.rpm

Creating YUM repositories:

First I created a directory to be used for my repo and copied my macchanger package into it.  Then I ran: createrepo .

Spawning worker 0 with 1 pkgs
Workers Finished
Gathering worker results

Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete

Testing

In order to test we need to create a new repository file in /etc/yum.repos.d and in this case we are going to comment out the gpgkey file line.

Try using the repo with yum and see if you can install.  You should not be able to.

Then uncomment the gpgkey file line and point it to the new file you will create to the directory /etc/pki/rpm-gpg/

Use this command to create the needed file: gpg –export –armour jfulton@learn.senecac.on.ca > jfultonrepo-gpg-key

Now we are able to install the (currently one) signed package from the yum repository.

Koji

After my last ‘disasters’ I’m hoping things will go a little smoother this time round…

I’ve already set up my FAS account and installed the appropriate packages. I had not however set up my Fedora packer environment on my computer.

Run the command: /usr/bin/fedora-packager-setup to set up a link to Fedora’s Account System.  Thankfully I hadn’t forgotten my FAS credentials!  I’m not using the browser GUI to do my builds because I heard that was a painfully slow process.  I’m going to test my macchanger package on 4 architectures: AMD/Intel, ARM, s390, and PowerPC.

Primary Architectures:

The first koji build I tried was: koji build f17 –scratch ../SRPMS/macchanger-1.5.0-3.fc16.src.rpm

After about 2-3 minutes I got the result of:  0 free  0 open  3 done  0 failed

ARM Architectures:

arm-koji build f17 –scratch ../SRPMS/macchanger-1.5.0-3.fc16.src.rpm

749670 build (f17, macchanger-1.5.0-3.fc16.src.rpm) completed successfully
real    17m32.383s
user    0m1.395s
sys    0m0.685s

s390 Architecture:

s390-koji build f17 –scratch ../SRPMS/macchanger-1.5.0-3.fc16.src.rpm

0 free  0 open  3 done  0 failed
643053 build (f17, macchanger-1.5.0-3.fc16.src.rpm) completed successfully
real    2m42.085s
user    0m0.397s
sys    0m0.131s

PowerPC Architecture:

ppc-koji build f17 –scratch ../SRPMS/macchanger-1.5.0-3.fc16.src.rpm

0 free  0 open  3 done  0 failed
507102 build (f17, macchanger-1.5.0-3.fc16.src.rpm) completed successfully
real    2m38.768s
user    0m0.400s
sys    0m0.127s

So all my Koji builds completed successfully!  This is good.

Mock

Now to try Mock.

While running the command on my SRPM for macchanger I got the following error:

ERROR: Could not find required config file: /etc/mock/fedora-26-x86_64.cfg

After a quick search I realized I was specifying a cfg file that didn’t exist in the /etc/mock/ directory.  This is the mock command I tried next:

[dukeboy@fedora16 rpmbuild]$ mock -r fedora-17-i386 ~/rpmbuild/SRPMS/macchanger-1.5.0-1.fc16.src.rpm

This went through Mock with no errors.  I checked the three log files in the result directory.

Next I ran mock on the spacechart package: [dukeboy@fedora16 SRPMS]$ mock -r fedora-17-i386 ~/rpmbuild/SRPMS/spacechart-0.9.4-2.fc16.src.rpm and I got this error:

ERROR: Exception(/home/dukeboy/rpmbuild/SRPMS/spacechart-0.9.4-2.fc16.src.rpm) Config(fedora-17-i386) 3 minutes 30 seconds
INFO: Results and/or logs in: /var/lib/mock/fedora-17-i386/result
ERROR: Command failed. See logs for output.
# [‘bash’, ‘–login’, ‘-c’, ‘rpmbuild -bb –target i686 –nodeps builddir/build/SPECS/spacechart-2.spec’]
After looking a little deeper into the log file the error breaks down like such,

checking lex output file root… ./configure: line 1334: lex: command not found
configure: error: cannot find output from lex; giving up
error: Bad exit status from /var/tmp/rpm-tmp.2chBwX (%build)
Bad exit status from /var/tmp/rpm-tmp.2chBwX (%build)

After taking a couple days break from this lab (due to exams and such) I ran Mock again and I was surprised when I got a completely different error:

DEBUG util.py:307:  Executing command: [‘tar’, ‘–use-compress-program’, ‘pigz’, ‘-xf’, ‘/var/cache/mock/fedora-17-i386/root_cache/cache.tar.gz’, ‘-C’, ‘/var/lib/mock/fedora-17-i386/root/’] with env {‘LANG’: ‘en_US.UTF-8’, ‘TERM’: ‘vt100’, ‘SHELL’: ‘/bin/bash’, ‘HOSTNAME’: ‘mock’, ‘HOME’: ‘/builddir’, ‘PATH’: ‘/usr/bin:/bin:/usr/sbin:/sbin’}
DEBUG util.py:257:  pigz abort: corrupted gzip stream — crc32 mismatch: <stdin>
DEBUG util.py:257:  tar: Child returned status 1
DEBUG util.py:257:  tar: Error is not recoverable: exiting now
DEBUG util.py:347:  Child return code was: 2
DEBUG util.py:111:  kill orphans

I’m currently working on fixing this issue and once I have it solved I will post an update to this posting.

<NOTE>  Please read comment below as I have an update regarding the progress(?) I’ve made <NOTE>

RPM Writing

Now for the next part of the build process.  I have my two source files (spacechart and macchanger) and now I’m going to build the packages.

The tarball files are already in the ~/rpmbuild/SOURCES directory. I’ve also created the .spec files by running the command rpmdev-newspec nameOfPackage.  I filled in the .spec files with the relevant information after following some examples.

Here are the spec files: spacechart.spec & macchanger.spec

They both built without errors.

rpmlint on spacechart revealed my source url to be wrong.  rpmlint on the source rpm had no errors but the binary rpm diplayed 3 warnings:

spacechart.x86_64: W: non-conffile-in-etc /etc/spacechartrc
spacechart.x86_64: W: no-manual-page-for-binary spacechart
spacechart.x86_64: W: file-not-in-%lang /usr/share/locale/es/LC_MESSAGES/spacechart.mo

I got a few errors for macchanger when I did an rpmlint on the binary rpm, they were:
macchanger.x86_64: E: info-files-without-install-info-postin /usr/share/info/macchanger.info.gz
macchanger.x86_64: E: info-files-without-install-info-postun /usr/share/info/macchanger.info.gz
macchanger.x86_64: E: info-dir-file /usr/share/info/dir
macchanger.x86_64: E: info-files-without-install-info-postin /usr/share/info/dir
macchanger.x86_64: E: info-files-without-install-info-postun /usr/share/info/dir
1 packages and 0 specfiles checked; 5 errors, 0 warnings.

I got rid of all but one of the errors with this fix I found online at fedora project’s wiki for common rpmlint issues:
Requires(post): info
Requires(preun): info

%post
/sbin/install-info %{_infodir}/%{name}.info %{_infodir}/dir || :

%preun
if [ $1 = 0 ] ; then
/sbin/install-info –delete %{_infodir}/%{name}.info %{_infodir}/dir || :
fi

After building there was one last error, I needed to delete the info dir after installation. This only required one more line to be corrected and everything was error free.

Spacchart had some tricky issues:

spacechart.x86_64: W: non-conffile-in-etc /etc/spacechartrc

This problem was fixed by adding this line: %config /etc/spacechartrc

The manual problem I’m going to ignore and I’m still currently working on figuring out the “last file not found in %lang” warning.

Installing from Source

I tried to pick two packages that interested me from GNU software collection:

The process of installing from source is the following.  First acquire the source file, I used wget to grab a link from the GNU software collection.  Unpack the source and run the configure then make file which will prepare the installation.  Then run the make install command to finish.

1. Starchart- a 3D star-mapping program for GNOME

> wget ftp://ftp.gnu.org/pub/gnu/spacechart/spacechart-0.9.5.tar.gz

> time tar xvzf spacechart-0.9.4.tar.gz

[A list of files unpackaged]

real    0m0.382s
user    0m0.013s
sys    0m0.016s

> cd spacechart-0.9.4

> time ./configure && make

real    0m7.999s
user    0m1.378s
sys    0m1.521s

> time sudo make install

real    0m4.204s
user    0m0.171s
sys    0m0.116s

2. Macchanger- a program that can manipulate your MAC address

> wget ftp://ftp.gnu.org/gnu/macchanger/macchanger-1.5.0.tar.gz

> time tar xvzf macchanger-1.5.0.tar.gz

[List of files installed]

real    0m0.367s
user    0m0.009s
sys    0m0.006s

> cd macchanger-1.5.0

>time ./configure && make

real    0m1.779s
user    0m0.120s
sys    0m0.212s

>time sudo make install

real    0m3.637s
user    0m0.137s
sys    0m0.080s

Everything worked with no problems.

The two packaged RPMs can be downloaded here:

spacechart-0.9.4-1.fc16.x86_64.rpm

macchanger-1.5.0-1.fc16.x86_64.rpm

Spacecharts cool…

0.3 Release – Raspberry Pi F17 Image Creation

Here it is!  The 0.3 Release:

Now that the mkrootfs script was working in the 0.2 release it was time to focus on taking the resulting files of that script and putting them in their proper place.  This involved creating an empty file then using fdisk to create two partitions.  Then use losetup and kpartx to gain access to the partitions.  Now you can mount the partitions and copy the files created from the previous script (see 0.2 Release).  Now the tricky part, we need to resize the 2nd partition in order to not waste any space and avoid some other complications with SD cards.  You use resize2fs and then fdisk to resize the partition and then follow that up with another resize2fs just to make sure.  Ultimately the two scripts will be merged but it was easier to split them up for testing purpose.  The partition script is the following:

#!/bin/sh

dd if=/dev/zero of=test.img bs=1G count=2; echo -e “n\np\n1\n\n+50M\nn\np\n2\n\n\np\nw\n”|fdisk test.img
#make a block device out of a file
losetup -f -v test.img
kpartx -a /dev/loop1
ll /dev/mapper/loop1p*
mkfs -t vfat /dev/mapper/loop1p1
mkfs -t ext4 /dev/mapper/loop1p2

# Need to mount the img so we can move the files rootfs into the proper partitions
#mv boot <partition 1>
#mv * <partition 2>

# Need to shrink partition 2 and then resize for a second time to make sure
#resize2fs -m <partition 2>
#fdisk
#resize2fs -m /dev/mapper/loop1p2

—————————–

Things that still need to be completed:

For the ‘mkrootfs’ script the text file with the Raspberry Pi Fedora 17 package list needs to be completed and injected into the script.  Right now there is just a bare minimum being installed.  This is being worked on by M.A Sajed Shadani and should be completed soon.  Also once the ‘imgcreator’ script is completed the fstab in the rootfs will need to be changed to reflect where to find the directories it needs.

As for the ‘imgcreator’ script I’ve been having issues with testing this script on the Cdot-trimslice-13-1 server.  It doesn’t have kpartx and due to it being a koji builder it can be painfully slow.  For this script I need to still mount the partitions, move the files and resize before it is complete

Once the above is done a chron job should be started to do nightlies.

UPDATE: See comment below for an update of this project.

0.1 and 0.2 Release – Raspberry Pi F17 Image Creation

0.1 & 0.2 Release.

I have rolled my 0.1 and 0.2 releases together because I….(yeah not going to try for a lame excuse that nobody cares for).

The goal of this project is to create a bootable image that will be able to be transferred to a SD card for the Raspberry Pi by using a mkrootfs script which will pull a specific set of packages needed from the Fedora 17 alpha release and also any additional raspberry pi packages that are currently being worked on in SBR600.  The following is a copy of the script I’m working on thus far:

——————————————————————————–

#!/bin/sh

#rootfs creation for Raspberry Pi using F17 alpha image
#Version: 1.0
#Jesse Fulton <jfulton@learn.senecac.on.ca>

set -x
fsdir=rootfs-f17
# prepare root fs
mkdir -p $fsdir/dev
mknod $fsdir/dev/console c 5 1
mknod $fsdir/dev/null c 1 3
mknod $fsdir/dev/zero c 1 5
mkdir -p $fsdir/var/lib/yum
mkdir -p $fsdir/var/log

# install packages
yum –disablerepo=* –enablerepo=raspberrypi –enablerepo=fedora-arm-17 –installroot=`pwd`/$fsdir -y install fedora-release gcc initscripts redhat-rpm-config yum rpm openssh-server dhclient rpm vim-minimal passwd rootfiles wget rdate udev wireless-tools rsyslog strace gdb 2>&1 | tee $fsdir.log

# post-processing steps
cat > $fsdir/etc/fstab << EOF
/dev/root               /                       ext4    defaults,noatime 0 0
devpts                  /dev/pts                devpts  gid=5,mode=620   0 0
tmpfs                   /dev/shm                tmpfs   defaults         0 0
proc                    /proc                   proc    defaults         0 0
sysfs                   /sys                    sysfs   defaults         0 0
EOF

cat > $fsdir/etc/hosts << EOF
127.0.0.1       localhost localhost.localdomain
EOF

perl -pi -e “s/^root:\*:/root::/” $fsdir/etc/passwd
echo guest::500:500:Guest User:/:/bin/bash >> $fsdir/etc/passwd

cat > $fsdir/etc/resolv.conf << EOF
nameserver 4.2.2.2
EOF

cat > $fsdir/etc/sysconfig/network << EOF
NETWORKING=yes
HOSTNAME=fedora-arm
EOF

# pwconv creates shadow from passwd and an optionally existing shadow
chroot $fsdir pwconv
chroot $fsdir chkconfig network on
sed -i -e ‘s/root:\*:/root:$6$8wRE\/s4x$.TG\/wbiuHqqIPEr3wWGzudwl2rcJfimc5FGHVdQwvwuZMzzMBPoHSV\/aR2wchIhLVjSj8bpOaagzIipl5Nu4G\/:/’ $fsdir/etc/shadow

cat << EOF > $fsdir/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
EOF

—————————————————————–

This script failed on the openrd server but tested successfully on the Cdot-trimslice-13-1 this was probably due to openrd running an older version of Fedora, I think Fedora 12 and giving an undiagnosable error.

Right now I’m waiting on my project partner to provide me with a package list and also I need to add an additional script which will create two partitions and move the required directories into their respective partitions.  This is what I’m working on for the 0.3 release.

UPDATE:  Added comment on Release 0.3, there is a link to a copy of the script available for download.

My very first blog post, ever…

Hi,

My name’s Jesse, I am currently in my 7th year at Seneca College in the CTYC program.  I favor Linux and Unix but I try not to discriminate against the others.. I can’t wait till I’m out of school, it’s been too long of a journey, and I have a wife and 18 month old son to support.

These are some links:

– to my Seneca wiki page click here.

– to my Fedora wiki page click here.

IRC: jfulton

Here is a sample snippet of conversation:

cchoo2 testing 123
kavi hello
kavi hey chris whats up!
cchoo2 nothing much kavi
kavi finshed your sbr stuffs?
cchoo2 almost done, how about you?
|<– aspektors has left freenode (Read error: Operation timed out)
kavi almost too

my learn ID: jfulton

Raspberry Pi:

Finally, a computer that starts opening doors to the less fortunate by providing a much more attainable solution.  A truly inspired idea with very noble intentions.  Getting more computers in the classroom has been an economic issue in the past, the reduction in cost of providing students cheap computers could potentially open the doors for a great many more computers in the classrooms which will in turn lead to a new generation of inspired networking/programming enthusiasts .