Iptables-tutorial work

It’s been a while since I looked at the iptables-tutorial to say the least. The last real commits where 9 years ago and the last proper release is closer to 13 years ago….

The last two three days I kind of picked it up again, for fun mostly. In the end of my maintenance of the project I kind of burnt myself out on the whole topic, I just did not want to do the whole thing anymore. I’ve grown and changed as a person since then. I don’t have the same spare time for one.

My first order of business, The build system was always a mess and I started cleaning out stuff that shouldn’t be there. A bunch of old scripts have been removed, I managed to remove the dependency on the fabpdf backend for jade and also the eps_to_png script with that, and almost all of the changes.sh scripts where removed. The Spanish and Portuguese builds where similarly cleaned up. Finally a Travis file was added to get automated builds running on Travis, and this actually works now!

I’m getting close to making a 1.2.3 release imho to get something new out there. The actual content has barely changed to be honest, maybe a few words at the most, but it feels like something that would be nice to get out there.

The task of getting this documentation up to par is a tremendous effort to be honest, and I’d be really interested in getting help from anyone who reads this. If you feel like contributing, contact me, check the code out on github, add bugs/tasks on stuff you find that is wrong, or provide pull requests. I would be thrilled to have other people working on this as well so it becomes more vibrant again and don’t stagnate as it has done over time.

Qt5.5 QtPositioning PositionSource unable to load due to missing symbols

December 31, 2015 by · Leave a Comment
Filed under: Development, Linux, Ubuntu 

I’ve slowly been working on a “Magic Mirror” for a long time now, trying to pick up some new technologies and making something fun. I’ve been working with Qt on and off for the last 10 years or so, but only peripherally, looking and awing over what they do. QML is absolutely awesome in my humble opinion.

A few weeks ago I started using Qt5.5 and ran into some issues executing the Magic mirror in a qmlscene now that I continued the project. It was fairly easy to reproduce but it seems to only affect the Qt binaries I’ve installed from the installer downloaded from qt.io. I’ve had verification that the code works with packages built from source, and trying to verify this on my own as well right now (building as we speak).

This is the sample code not working with qmlscene:

import QtPositioning 5.5
import QtQuick 2.0

Rectangle {
id: root

PositionSource {
id: positionSource
}
}

Bug is reported to qt.io here: https://bugreports.qt.io/browse/QTBUG-50227

Iptables-tutorial and ipsysctl-tutorial on github

I guess I should have done this a long long time ago. Both the iptables-tutorial and the ipsysctl-tutorial source code are now available on github. Many many years ago I had an idea of putting the version control system out there for use, but I never realized it for various reasons. Both these documents are old by today, but the basic information is still valid and will likely be for a long time to come it seems.

I apologize for the version history, I moved from CVS in a rather rude way to SVN without keeping the history, which was what I used back in those days.

I invite anyone and everyone to do edits if they wish to and send me pull requests to fix the issues they find, or to add the documentation they’d like to add.

The iptables tutorial is available at:
https://github.com/frznlogic/iptables-tutorial

The ipsysctl tutorial is available at:
https://github.com/frznlogic/ipsysctl-tutorial

Build ppa package

November 26, 2014 by · Leave a Comment
Filed under: Debian, Development, Linux, Ubuntu 

To build a package for ppa distribution, you need some tools. To “cross compile” for releases, for example i386 and amd64 packages on the same machine, takes some more work with schroot, dchroot etc. I’ll start with explaining how to create a “local” package for your own host, I’ll add another entry on how to do an i386 package from amd64. Everything is done on ubuntu 14.04 amd64 machine in this case, and I’m rebuilding dbus.

In short you need:

  1. apt-get install build-essentials dpkg-buildroot schroot gpg
  2. gpg –gen-key
  3. apt-get build-dep dbus
  4. mkdir dbus-amd64 && cd dbus-amd64
  5. apt-get source dbus
  6. export DEB_SIGN_KEYID=
  7. cd dbus-directory
  8. make changes.
  9. dch -i
  10. dpkg-source –commit
  11. dpkg-buildroot -i -I

If you plan on publishing your deb packages to launchpad or some such, you need to create an account and add a ppa. This is simple and done via the http://www.launchpad.net webpage. The webpage also gives you good upload information. Note that they require signed files, so signing must work for you first.

8. Create account on launchpad.
9. Export the gpg generated key to hkp://keyserver.ubuntu.com:11371 (easiest to do via Passwords and Keys tool
10. Import the key to launchpad using the key fingerprint.
11. Create a new PPA from the launchpad dashboard
12. dput ppa: dbus_1.6.18-0ubuntu4.4_source.changes

The package will be built by launchpad on its own, this may take some time..

DBus remote connection

November 5, 2014 by · Leave a Comment
Filed under: Communications, Development, General, Linux 

In a project I’m working on at the moment we wanted to remotely monitor a DBus session bus. The system in question has several buses available using different users and systemd. d-feet can connect and monitor remotely via TCP.  The following code will allow you to connect to a remote DBus on a target development board for example.

First copy the original session.conf to separate configuration files for each user.

cp /etc/dbus-1/session.conf /etc/dbus-1/session.conf.<username>
cp /etc/dbus-1/session.conf /etc/dbus-1/session.conf.<username2>

Then for each of the newly created configuration file, add the following configuration but with different port numbers and correct username director in /run/user. The ip address should be the IP of the connecting host, not the server. Edit session.conf.<username> and add:

<listen>tcp:host=<ip>,bind=*,port=<port>,family=ipv4</listen>
<listen>unix:path=/run/user/<username>/dbus/user_bus_socket</listen>
<listen>unix:tmpdir=/tmp</listen>

<auth>ANONYMOUS</auth>
<allow_anonymous/>

The systemd script is rewritten to use a specific conf file for the specific user trying to start the DBus.

Edit  /lib/systemd/system/dbus-session@.service and rewrite the ExecStart line as follows.

ExecStart=/usr/bin/dbus-daemon --config-file /etc/dbus-1/session.conf.%i --nofork

This allows you to connect using d-feet or other dbus applications (potentially, you should be able to connect for example other services over the network to the new DBus….).

Choose “connect to other bus” and use as bus address:

tcp:host=<targetIp>,port=<port>

Done. Hopefully.

Testing out RasPlex

November 2, 2014 by · Leave a Comment
Filed under: Communications, Linux 

I decided to try out RasPlex after having run OpenElec and RaspBMC for about half a year, and before that XBMCbuntu for a few years. I’ve been using plex server on my file server for a few months already and plex on the tablets/phones to stream movies, tv shows, etc while in bed. I haven’t had that much time with RasPlex yet, but I’m really impressed so far, especially when you start looking at what type of infrastructure it enables. I’m now using the same chain of applications for my tv, phones, tablets, and laptops, this is something I’ve never been able to before (if you except NFS/SMB solutions with VLC or some such video player, which has proven unstable for the phone/tablet cases in my case, high def videos will stutter a lot among other things).

My main problem with the entire setup is that my fileserver is a bit too weak to transcode 1080p on the fly, it is a D525 Atom CPU however, and I didn’t see this usecase when I bought it, so I’ll have to live with it for now ;).

All that said, I’m still very happy with XBMC, but I feel that RasPlex so far has given a more… mature feeling. It seems to work very well with no big hickups so far, the UI on RaspBMC and OpenElec was really slow, something that still holds true in RasPlex, but it is better.

Raspberry Pi + 2x Arduino Nano V3.0

March 19, 2014 by · Leave a Comment
Filed under: Development, General, Hardware, Linux, Robots 

Quick update, during my evenings I’ve been working with one of the Raspberry Pi’s I won on a local contest a few months ago, and it’s generally derailed into some kind of “let’s put as much stuff on it as possible”, meaning that I currently got my Raspberry Pi hooked up with:

  • Slice of Pi
  • Adafruit PWM driver
  • Raspicam on a simple pitch/yaw servo gimbal that me and my 1,5 year old put together in 10 minutes. Controlled via PWM.
  • MPU9150 sparkfun breakout board
  • 2 Arduino Nano V3.0

The two Arduino Nanos have split functionality, where one will provide me with data that needs to be gathered frequently, and the other is used for slow processes such as reading out 1-wire temp sensors etc.

The first nano will have the following functions hooked up to it:

  • 3x HC-SR04 ultrasound distance sensors
  • Voltage measurement 0-20V circuit
  • Control of 2 relays
  • 3x line tracking sensors
  • Reed switch
  • 2x motor controls via L298P chip

The second nano has the following hooked up to it:

  • MPX2200GP pressure sensor (will use something else soon’ish)
  • 2x 1-wire DS18B20 temperature sensors.
  • Others?

The general idea was to move timing critical stuff off the raspberry to the Nano and let the first one deal with quick sensor readouts, while the second Nano is dropped off with relatively slow sensors (DS18B20 takes very long time to read out for example). The two nanos will talk to the Raspberry via SPI I think, or possibly serial ports, but this is less likely as it would either require me to use one USB serial driver and the raspberry UART or get a 2 port USB hub of some kind and talk via USB UART’s.

arduino-hookup

I’ve meanwhile also played around with Eagle CAD for the first time in my life, making some electrical drawings of the hookups. I’m considering making a PCB layout of everything when I get there, not sure if there is any interest in this out there except for “the lols”. The image is still very raw and missing a lot of stuff that I know needs to be added at some point.

During christmas I spent some time making opencv haar cascade training on clementine detection and generally fooling around with it. I think I’m leaning towards making a robot (chassi on the way) which will travel around in the room looking for objects… I guess some of the sensors are a little overboard for this, but it’s all fun and games while it’s not work… 😉

Raspicam and OpenCV instructions

December 21, 2013 by · Leave a Comment
Filed under: Development, Hardware, Linux, Robots 

I have previously gotten the opencv and python bindings to work via the 2.3 opencv system and facial recognition did work, but the system is bugged out and I could only get 64x64px image size.

I followed these instructions to get the raspicam to work with opencv and simplecv

http://tothinkornottothink.com/post/59305587476/raspberry-pi-simplecv-opencv-raspicam-csi-camera

However, there where some minor details wrong with it so here is a short list of the updates to the installation instructions on that page.

I noticed a few problems as I saw it with the above instructions, or possibly I didn’t read the instructions well enough. That said, very good info! Thank you!

Here are the issues I had:

The opencv_2.4.5.sh script pulls in libopencv-dev which in turn pulls in the entire libopencv2.3 from raspbian repositories, which in turn meant that simplecv was still using libopencv2.3.

apt-get remove libopencv-core2.3

Once that is removed, python-opencv is also removed and simplecv will not even run anymore. Adding the following will add the path to where the python cv bindings are.

export PYTHONPATH=/usr/local/lib/python2.7/site-packages/

And finally, the LD_PRELOAD to actually use the correct uv4l libraries.

export LD_PRELOAD=/usr/lib/uv4l/uv4lext/armv6l/libuv4lext.so

Once this is done, you should no longer get the munmap errors etc, and large resolution should work:

SimpleCV:1> cam = Camera(0, {“width”:640, “height”:480})

SimpleCV:2> cam.live()

etc.

Reflashing GlobalScale Mirabox filesystem

May 22, 2013 by · 2 Comments
Filed under: Development, Hardware, Linux 

I just worked my way through reflashing the mirabox and figured I’d post some instructions on how to do it. I’ve used the descriptions from this http://www.newit.co.uk/forum/index.php?topic=3880.0 post but found it to be lacking a few steps that could be construed as obvious… perhaps. Especially the use of ubifs is quite new to me, even though the commands are quite straight forward I got snagged up a bit in understanding how it works.

I’ve used the following rescue disk image:

https://docs.google.com/file/d/0B0imSF-34b8dZEc0SFo3N1Fzb0E/edit

And this rootfs image:

http://code.google.com/p/mirabox/downloads/list

Download and install the rescue disk on a microSD card:

  1. fdisk the microSD, create on FAT16 partition of 100mb size, the rest of the device as EXT3.
  2. Unpack the rescue disk
  3. Copy the mirabox file to the FAT16 partition
  4. Extract the rootfs.tgz file to the EXT3 partition.
  5. sync and umount the microSD card
  6. Connect a USB flash device to the computer
  7. Extract the rootfs image downloaded above
  8. Copy the rootfs to the USB flash device.
  9. Disconnect USB device.
  10. Connect micro-sd with mirabox kernel and rootfs to mirabox
  11. Plug in the mirabox to a computer via USB.
  12. Start the mirabox
  13. Hit a key at uboot
  14. >> set bootcmd ‘usb start; fatload usb 1 0x6400000 mirabox; bootm 0x6400000’
  15. >> set bootargs ‘console=ttyS0,115200 root=/dev/sdb2 rootwait’
  16. >> boot
  17. login as root password nosoup4u
  18. connect USB disk with rootfs on it to mirabox
  19. # cd /media/usbX where the rootfs img is located
  20. # ubiformat /dev/mtd2 –flash-image=rootfs-debian6.0-gti-mirabox-v5-0-1-120924.img
  21. # sync
  22. # reboot
  23. disconnect USB disk and remove devices.
  24. login to your hopefully working new filesystem using root/nosoup4u credentials.

 

Ubuntu 12.10 on Dell Precision M4600 APIC issues

February 4, 2013 by · Leave a Comment
Filed under: Hardware, Linux, Ubuntu 

I’ve recently installed Ubuntu 12.10 on a Dell Precision M4600 and had some APIC issues when trying to reboot, the same as everyone else seems to have pretty much. After upgrading the BIOS from A08 to A13 the issues seems to have gone away (not extensively tested, but so far so good).

Before the update, the computer got stuck on the last step of shutting down for restart, but after upgrading to A13 the computer is no longer stuck at that point anymore.

Next Page »