H4ck3rm1k3's Blog

exploration of free/libre open source software and things

Installing RHEL 7.5 in debian sid on a chroot — May 6, 2018

Installing RHEL 7.5 in debian sid on a chroot

I love using chroot, even if docker is more comfortable, I find that it gives you a better way to learn more about the system than doing things the easy way.

For this example I am installing RHEL7.5 into /opt/redhat/chroot/ on a debian sid server.

Normally I do not spend my free time on Redhat but it seems that it is a good idea to learn it because many companies will test your redhat specific experience and call that linux skills.


So I registered on redhat and got a download link, using wget I downloaded it, my command contains an auth link I cannot share, so get your own.

wget https://access.cdn.redhat.com//content/origin/files/sha256/d0/d0dd6ae5e001fb050dafefdfd871e7e648b147fb2d35f0e106e0b34a0163e8f5/rhel-server-7.5-x86_64-dvd.iso?_auth_=XXXX

Verify the sha256 sum of the download before using it against official site

sha256sum rhel-server-7.2-x86_64-dvd.iso

Prepare chroot

We can prepare a chroot with an empty directory and mount special dirs into it

mkdir /opt/redhat/chroot/{root,dev,home,mnt,opt,proc,run,sys,tmp,var}

mount the special filesystems to your chroot, these are from the debian system and provided by the kernel running in debian.

mount -o bind /run /opt/redhat/chroot/run/

mount -o bind /proc /opt/redhat/chroot/proc/

mount -o bind /sys /opt/redhat/chroot/sys/

mount -o bind /dev /opt/redhat/chroot/dev/


Mount DVD

Now we mount the dvd iso loopback



mount /opt/redhat/rhel-server-7.5-x86_64-dvd.iso /cdrom -t iso9660 -o/opt/redhat/chroot/mount/cdrom

in mount output we see

/opt/redhat/rhel-server-7.5-x86_64-dvd.iso on /opt/redhat/chroot/mount/cdrom type iso9660 (ro,relatime)


First Pass Install

Now do a provisional install of all the packages in the dvd.

This will give us the basic binaries we need to get install the redhat system and then we will reinstall them the proper way. There must be a better way to do this and I am sure the experts will give me some feedback, but this way works for sure and can be used in a pinch.

So from inside the chroot

cd /opt/redhat/chroot
for x in mount/cdrom/Packages/*.rpm; 
    do echo $x; 
    sudo rpm2cpio $x | cpio -idmv; 


Outside the chroot, copy in your resolv.conf

cp /proc/mounts/opt/redhat/chroot/etc/mtab

cp /etc/resolv.conf /opt/redhat/chroot/etc/resolv.conf

Go into the chroot

Launch the chroot like this

chroot . /usr/bin/bash


Activate subscription

For this case I have the 30 day subscription, so lets use it :

subscription-manager register --username ZZZ --password XXXX  --auto-attach

See https://access.redhat.com/solutions/253273

Add DVD to system as source

Then you can add the dvd mounted as a repo and reinstall everything

vi /etc/yum.repos.d/iso.repo with the Content (https://www.cyberciti.biz/tips/redhat-centos-fedora-linux-setup-repo.html)


Install packages from dvd inside the chroot

Now I can install the packages officially :

yum install bash rpm yum emacs httpd rpm-build gcc glibc-headers

See also :


Setup EPEL

Setup EPEL (https://www.tecmint.com/how-to-enable-epel-repository-for-rhel-centos-6-5/)

wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -i epel-release-latest-7.noarch.rpm

I noticed that the bin,lib,lib64 and sbin directory were being created by the rpms, and that you need to move them out of the way and link them to /usr/*.  So I needed to leave the chroot, move the old dirs out of the way, and then link them.

mv bin binold
ln -s usr/bin bin
mv lib libold
ln -s usr/lib lib
mv lib64 lib64old
ln -s usr/lib64 lib64
cp -rv lib64old/* lib64/
mv sbin sbinold
ln -s usr/sbin/ sbin

Finally I had to then reinstall the filesystem package, so maybe installing that from the beginning would be good.

rpm -i /mount/cdrom/Packages/filesystem-3.2-25.el7.x86_64.rpm


Reinstall Everything

To reinstall all the packages

yum list installed | cut "-d " -f 1| xargs yum reinstall -y


And finally to then install everything else from the cdrom

yumdb search from_repo mountedcd | grep \. | grep -v = | xargs yum install -y


Happy Hacking!

See also


Forking python tests : forkr — July 23, 2017

Forking python tests : forkr

Often we work on large static datasets and code that takes a long time to load. Then we work on adding on little bits of code on top of that, but the time to load the data needed to run a test case can be daunting.

In such cases we can load all the data we want and then fork the process, the child process will inherit all the variables from the parent and you can then load new snippets of code on top of that baseline to do you development.

For this I created the forkr lib that you include with

import forkr


The global data will be made available to the child process.

I find running the nose test modules in python very useful. The only problem is getting the global data into there, so I created a simple plugin that you can use forkr.DataPlugin, this overrides the prepareTestCase to install the __global_test_data__ variable into each nose test module that you load, this way tou can

Code is here: https://github.com/h4ck3rm1k3/py-loadr-forkr-debugr/blob/master/forkr.py tested on python2.7, compiles on 3, not tested yet

Python supports reloading code, but I have not been able to get that working to my satisfaction.  Best is to load all your variable code in the child process.

Installing git on sdf — December 17, 2016

Installing git on sdf

In some cases you want to install git where you are only a user,  the .bashrc is not being interpreted, and sshd does not allow you to send the path variables, in short a locked down system. What you do in this case, you unpack the binary packages into some path, and prepend that path via a git ssh command script to your ssh command. Here we do this for sdf, the superdimensional fortress that gives you lifetime shell and web hosting for $36 one time fee (http://sdf.lonestar.org/index.cgi?access). It is running netbsd 6.0 on an amd64 machine , so we fetch the binaries right off the server.

How to install git on sdf as a arpa member :

  1.       mkdir ~.local
          cd ~.local/
          wget http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/amd64/6.0/All/git-base-2.10.0.tgz
          wget http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/amd64/6.0/All/git-2.10.0.tgz
          tar -xzf git-2.10.0.tgz
          tar -xzf git-base-2.10.0.tgz
          rm *.tgz
  2. On your client machine :
      1. Setup your ~/.ssh/config
      2. Host sdf
        	  User h4ck3rm1k3 
        	  HostName sdf.org
      3. Setup ssh login script to prepend path
        	    shift # remove the hostname that is arg1
        	    # now we set the path and call the command without the hostname
        	    # host name is sdf that is configured in the .ssh/config
        	    exec /usr/bin/ssh sdf "export PATH=/sdf/arpa/gm/h/h4ck3rm1k3/.local/libexec/git-core/:/sdf/arpa/gm/h/h4ck3rm1k3/.local/bin:/usr/pkg/bin:/usr/local/bin:/usr/bin:/bin;$@"
      4. Setup your git config to use custom login script
        	    repositoryformatversion = 0
        	    filemode = true
        	    bare = false
        	    logallrefupdates = true
        	    [remote "origin"]
        	    uploadpack = /sdf/arpa/gm/h/h4ck3rm1k3/.local/libexec/git-core/git-upload-pack
        	    url = ssh://sdf:/sdf/arpa/gm/h/h4ck3rm1k3/html


  1. https://git-scm.com/docs/git-config
  2. https://linux.die.net/man/5/ssh_config
  3. http://sdf.org/
Please help with school district map for Hamilton, NJ — September 3, 2016

Please help with school district map for Hamilton, NJ

We (http://codefortrenton.org/) are working on a project to create a school district map for Mercer Country NJ.

Our map so far is here: http://codefortrenton.github.io/school-districts/mercer/#9/40.1074/-74.5313

We are still missing the data for Hamilton because the data we got was in a low res pdf file that was a screen print of the original gis data. It is also up side down etc.

Here is the original pdf : https://github.com/codefortrenton/school-districts/blob/master/Hamilton/Hamilton.pdf

We split out the pages into png and are working on rectifing them with mapwarpers

The pngs are here https://github.com/codefortrenton/school-districts/tree/master/Hamilton



Example rectified map : http://www.mapwarper.net/maps/15521#Export_tab

and resulting OSM relation https://www.openstreetmap.org/relation/6535002

We created a Google doc to track progress so far,

The sheet with with the doc is here, leave a comment on it and we will add you to the writers.


please help !

If you want to chat, you can join our slack channel https://code4trenton.slack.com/messages/opendata/, and if you don’t like slack I am alone in the irc.freenode.net #codefortrenton channel

1732 SIXTH ST, Ewing NJ is smaller than listed — August 27, 2016

1732 SIXTH ST, Ewing NJ is smaller than listed

The house located at 1732 SIXTH ST Ewing NJ is listed falsely on the county website and hud home store.

We were interested in the property and upon inspection measured the length of the house from front to back, it was 41 feet long. The county website lists it as 48 feet long.

hudhomestore The house is listed there at 939 square feet.

Screenshot from 2016-08-27 07-15-16

On the mercer county site it is listed as 1128 square feet. http://pip.mercercounty.org/propertycard/1102_52_203.pdf

Screenshot from 2016-08-27 07-07-32

The actual size of the house is different, it is not 48 feet long, but 41 feet on the exterior, we calculated the total space from outside to be 888 sqft max. This does not count for walls,

The front part A is 17 * 20 feet, not 24 * 20 in size. That is a difference of 240 sqft so the tax information would be incorrect.



Lawrence School Districts — August 14, 2016

Lawrence School Districts

Here is another take on the Lawrence Township School Districts,

I took the parcel outlines from mercer county and associated them to schools via a ruby script, as an output we have a set of shape files.


Then I converted them to points using qgis “extract nodes”



Then I used the voronoi polygons on them to calculate regions,


and clipped it with buffered region

Finally I dissolved all the borders between the school regions to give the simple borders:

lawrenceFinally I used the qgis web export to create a website :

(export to web map)


You can find my scripts to convert and look up the data here:


and the data for the school districts here:


Need a way to find speakers for open source conferences — July 27, 2016

Need a way to find speakers for open source conferences


I am working on the next edition of the Software Freedom Kosova Conference on the 22nd of Oct, and we are looking for speakers (http://sfk16.flossk.org/call-for-speakers).

I am thinking that we need a way for potential speakers to register and make themselves available to conferences. They would register with a generic system, define the topics they can speak about (maybe pull from github and gitlab commits etc to show abilities) and then define locations and times available.

Conference organizers would register and be vetted (to prevent spam) and after they check out speakers could be contacted via the system and invited to speak.

Commission on English Language Program Accreditation whitewashes history — April 13, 2016

Commission on English Language Program Accreditation whitewashes history

The webpage of Commission on English Language Program Accreditation has tried to whitewash the internet.


Previously they had the college of northern NJ listed:

Granted 5-year initial accreditation
  • Woods English Language Institute, University of Northern New Jersey, NJ, USA

But this was removed.

I have made backups of the page previously.

archive.org snapshot of page





Proposal for Civil Solution System — April 5, 2016

Proposal for Civil Solution System


I have been thinking a long time about what we need for civil solution planning and implementation. I propose we create an open source platform and build a platform that can be used by many people in many places. The basic idea is that citizens can raise issues, collaborate on them, select the ones that are important and the define what is needed to implement them, and finally track pledges and deliver pledges to implement the problems. Government agencies fit into the system because they are already pledging to provide services and we will ask them to deliver on these promises. We want to support civil funding of solutions via money or even services, work, food, transport or shelter etc to solve problems.

What are the activities supported by this system?

  1. Registration of users via self service or via phone messages or other means. Allow users to login via fb or twitter.
  2. Storing and Handling of uploads of geotagged pictures of problems. Allow for users to position the photos. Allow multiple photos per incident.
  3. Allow for users to send sms and mms to a phone number
  4. Collection of problem description and severity
  5. Sharing of problems with other user via social media
  6. Collection of votes and comments and feedback from other users to help sort and collaborate on problems.
  7. Reporting of problems via Fax, PDF file or statistics to responsible agency
  8. Tracking of response and feedback from agency
  9. Tracking of progress of resolution, if the agency does not respond setting timeouts and limits.
  10. Display of map with easy reporting of problems.
  11. Creating of mobile apps that allow the easy reporting of problems.
  12. Marketing of the application via traditional media
  13. Allow people to pledge money or resources for the resolution of the resources
  14. Allow for volunteers to donate time to help process requests.
Why is this project important?
  1. Serving the people better
  2. Create a platform for managing volunteer resources
  3. Managing the funding of citizen problems.
  4. System accessible via simple sms or phone
  5. Increasing of transparency of government
  6. Easy Tracking of citizen reports
  7. Tracking of agency response times
  8. Prioritization of problems via group feedback
  9. Need a central server for Hosting citizen feedback.

Implementation, A synthesis of the following software :

We would implement an http://www.open311.org/ like system.

and various projects from https://www.codeforamerica.org/

See my older post on using social media for conference organizing that contains some of the ideas covered here in a different context.

UPS store overcharges you to print from internet — March 27, 2016

UPS store overcharges you to print from internet

Yesterday at around 4pm, we went to the UPS Store at 957 NJ-33 #12, Trenton, NJ 08690 to print a few pages and notarize them. The refused to type in a url to print for us and gave us no other option except to email them or use the computer at a minimum charge of $2.50. After we got home I found out I can print 6 pages for $0.12 via HP eprint and have it printed at the UPS store,  http://compass.ups.com/print-from-your-mobile-device-at-the-ups-store/ They did not offer me this or tell me about it. I feel ripped off.