f-log

just another web log

30 Apr 2022:
two more shark enclosures awaiting clouds waves and sharks

Another toothy update

I updated the Anagram Shark Attack code .

I added yet another two test regions. These ensure any changes continue to work regardless of screen resolution/orientation.

It is important now, as I am trying to add in the animated clouds and waves.

There is actually some clouds behind the boxes in this image. Screenshot of html Anagram Shark Attack JS-e

The animations are sped up and it is much more enjoyable to play.

See progress game link

18 Apr 2022:
fighting for ssh push for the shark project

Just a quick one.

I updated the Anagram Shark Attack code . Still a long way to go.

When I came to push it to GitHub, I hit a problem.

fatal: Authentication failed for 'https://github.com/robgithub/AnagramSharkAttackJS-E.git/'

and

git remote -v
origin  https://github.com/robgithub/AnagramSharkAttackJS-E.git (fetch)
origin  https://github.com/robgithub/AnagramSharkAttackJS-E.git (push)

shows that I am still on the old non-ssh repo format. Which is no longer supported :(

a quick

git remote set-url origin git@github.com:robgithub/AnagramSharkAttackJS-E.git

gives me

git remote -v
origin  git@github.com:robgithub/AnagramSharkAttackJS-E.git (fetch)
origin  git@github.com:robgithub/AnagramSharkAttackJS-E.git (push)

and then

git push
Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 6 threads
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 1.71 KiB | 585.00 KiB/s, done.
Total 4 (delta 3), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (3/3), completed with 3 local objects.
To github.com:robgithub/AnagramSharkAttackJS-E.git
   3262ed4..82c5555  master -> master

I got the tiles to stop trying to animate the wrong way in certain edge cases. This is the first step in reinvigorating the project and hopefully seeing it completed!

17 Apr 2022:
where are the images

Oops!

Helps if I upload the images that go with the blog post.

Still... there is now an opportunity to create an auto detect and upload function :D

14 Apr 2022:
3d printing a motorcycling monk

This was another February thing. Last one, promise :S

The other D&D players all had there own fancy character figures. Some exquisitely painted.

I decided that I would have a go at 3D printing my own character...

My character is a Monk .

Blender-ing

I created a curve that I could extrude from the bottom and then used the sculpt tools to create arms and more details.

screen shot of blender monk stage 1

Then I crafted a hand, duplicated it with mirror and extruded a staff.

screen shot of blender monk stage 2

I didn't have time to sculpt a realistic human (half-elf) head. So he ended up with a motor bike helmet.

screenshot of blender monk stage 3

Used the 3D print toolkit to help iron out some odd bits

screenshot of blender monk stage 4

3D Printed

3D printed monk x4

3D printed monk x4

3D printed monk x3

3D printed monk x2

3D printed monk

First I printed it too large, then too small, then with supports and still too small.

Finally the Goldilocks zone was reached!

14 Apr 2022:
a beehive of 3d printed coin holders

This was another February thing. Yes, there are a few.

Now I had the power of remote 3D printing I had some work to do.

Covid had left me with a load of unwanted coinage.

photo of 3d printed coin holders

There are only two sizes

photo of 3d printed coin holders sizes

I also added a nub underneath the coins to ensure I could get them out again :D

I liked the hexagon design to allow them to be positioned in any layout.

Here is the printer with the Blinkt illuminating the 3D coin holder being printed.

photo of 3d printed coin holder being printed lit by blinkt

and yes I could have printed more than one at a time :S

14 Apr 2022:
blinking at the octoprint

This was another February thing

Now, before I get OctoPrint working I want to get a Blinkt working!

"A what?" I hear you say. It is a simple RGB led strip that can fit easily on the GPIO pins of most Raspberry Pis.

Blinkt product page

I can use it to illuminate the print process. Ideally I would get a longer Pi Camera cable and connect the camera directly to the 3D print head. You know, like normal people :D

I tried to install everything in Raspbian.

sudo apt-get install python3 python-blinkt

But that failed due to missing dependencies.

The Github repo suggests you just run the following.

curl https://get.pimoroni.com/blinkt | bash

so just run a random script from the internet :(

It tries to install everything needed and will ask you a couple of questions regarding what you want to install.

cd ~/Pimoroni/blinkt/examples
python rainbow.py

Shows it works

Now I can ssh into the Pi and turn On/Off the lighting :D

14 Apr 2022:
offline highlighting to decrease your javascript dependancies part 2

Just a quick post to test that my code highlighter is working.

As much as I liked the in page JavaScript doing all the work... well, you know.

So I wrote a tiny Node JS app that just reads in a file, runs it past the same highlighter library and spits out the results.

I did learn about multi-line Javascript regular expressions :D

var destination = hljs.highlightAuto(target).value;
var pattern = new RegExp(match[0], 's');
result = source.replace(pattern, '<code class="nohighlight">' + destination + '</code>')

Lets see how it gets on with this tricky code block

14 Apr 2022:
offline highlighting to decrease your javascript dependancies
10 Apr 2022:
Docking a 3D printer with OctoPrint

This was a February thing

Docking a 3D printer with OctoPrint

I have the Creality Ender 3V2 3D printer , but I have a small problem. A small 8ft ladder access problem :(

The ladder leads to a 5ft square (well ventilated) area with the printer in the middle. I was taking a USB key from my Gentoo machine and then climbing up the ladder, setting up the printer and then continuously going back up and down to check on the print process. REMEMBER printers can catch on FIRE .

The solution is obviously OctoPrint . Remote access to 3D printers with real-time camera view, stats and time-lapse videos.

But would it work on MY 3D printer? TLDR ; yes

Skipping the OctoPi for direct Docker

Now I had heard that to host OctoPrint on the Raspberry Pi there is a special version called Octo-pi

At the same time I wanted to play with Docker

Docker runs things as containers that have no access to anything that you do not explicitly give them access too. i.e. Sand-boxed.

note this container is OctoPrint not Octo-pi - ( Octo-pi now has a Docker image info page )

Pi Prep

I got the Pi (Pi Zero W) working first and made sure the camera was enabled ( Raspberry Pi OS currently uses Buster so you have to manually enable the camera interface in legacy mode )

Usual download: Lite image from raspberrypi.com

All good!

Docker up OctoPrint

Then to install docker I went against all the guides that downloaded it from the Docker website and instead used the repositories (means I might have got an older version, but I wanted to live dangerously).

sudo usermod --append --groups docker $USER
sudo apt install docker-compose

( docker-compose is not Docker , but does include the docker command. It is confusing, but will make sense later)

Test that Docker is installed and ready to go

docker --version
Docker version 20.10.5+dfsg1, build 55c4c88

sudo docker run --rm hello-world

Now I can get the latest octoprint docker-compose file (remember OctoPi now has Docker instructions)

wget https://github.com/OctoPrint/octoprint-docker/raw/master/docker-compose.yml

Oh, I need to know what interface the Pi is using to the printer.

sudo apt-get install python3-pip
python -m serial.tools.miniterm

lists

/dev/ttyAMA0 
/dev/ttyUSB0

and updated to the docker-compose.yml file (lots of trial and error to get it just right)

docker-compose.yml tweaks

Ports need to be changed from

80:80

to

5000:5000
8080:8080

Where 5000 is a non-privileged port. Means I can use a web browser on another machine in the network. 8080 is so I can see the raw camera stream without needing OctoPrint . Ideal when I can take my phone up the ladder and muck about with the Pi camera alignment.

Enabled devices and added the USB port from earlier

devices:
- /dev/ttyUSB0:/dev/ttyUSB0
- /dev/video0:/dev/video0

Enabled the environment variable for streaming from the camera

environment:
- ENABLE_MJPG_STREAMER=true

and just because it was there and I was interested, I enabled the extra config-editor docker container.

This allows you to use a web browser to edit config files. didn't need it, but was interesting to see working.

Make it start on Boot

Now I need to make sure everything works on on Power On . The power socket is at the bottom of the ladder ;)

sudo systemctl enable docker
sudo systemctl enable docker.service
sudo systemctl enable containerd.service

Reboot and wait an age, but it is working!

Then configure my Creality Ender 3V2 3D printer in the Octoprint GUI from a remote machine on port 5000 :)

https://howchoo.com/octoprint/ender-3-v2-octoprint

Some quick Docker trouble shooting steps

docker-compose ps

shows running containers

sudo ls -Ral /var/lib/docker/containers/

will find all the files including logs for the containers. They have very long identifiers.

Additional References

OctoPrint Docker Hub

https://hub.docker.com/r/octoprint/octoprint

Official configuration docs

https://docs.octoprint.org/en/master/configuration/config_yaml.html#server

Reference list of timezones used in docker https://docs.diladele.com/docker/timezones.html

Other useful links

https://www.abqlug.com/tutorials/installing-pi-hole-docker-compose-for-dummies/

https://pumpingco.de/blog/setup-your-raspberry-pi-for-docker-and-docker-compose/

https://jfrog.com/connect/post/install-docker-compose-on-raspberry-pi/

https://www.baeldung.com/ops/docker-volumes

03 Apr 2022:
so long dnet stats

Due to Covid I have officially switched to FoldingAtHome to consume my CPU cycles.

So this post will be the first where the creaky Perl script that scraped my stats has been replaced.

Maybe in the future I can go back and help dnet.

03 Apr 2022:
flog markdown fix

Oh look

Markdown

Highlighted code

Please mind our dust as we fiddle (while Rome burns)

02 Apr 2022:
Markdown takes over part 1
02 Apr 2022:
wifi in the wind - tale of woe

Let the tale of " WiFi in the wind " begin.

No wifi, hmmm, reboot, still no wifi, restart services and poke around, still no wifi. Notice I am a bit behind on my kernel versions...

Rebuild kernel and reboot, still no wifi!

Other devices on the same wifi network were unaffected, so it has to be my machine.

dmesg output

[   13.198493] r8169 0000:06:00.0 enp6s0: Link is Down
[   13.973094] wlp5s0: authenticate with de:ad:be:ef:ea:77
[   13.983449] wlp5s0: send auth to de:ad:be:ef:ea:77 (try 1/3)
[   14.044387] wlp5s0: authenticated
[   14.044660] wlp5s0: associate with de:ad:be:ef:ea:77 (try 1/3)
[   14.060440] wlp5s0: RX AssocResp from de:ad:be:ef:ea:77 (capab=0x1431 status=0 aid=1)
[   14.066047] wlp5s0: associated
[   14.066146] wlp5s0: Limiting TX power to 20 (20 - 0) dBm as advertised by de:ad:be:ef:ea:77
[   16.767315] r8169 0000:06:00.0 enp6s0: Link is Up - 1Gbps/Full - flow control rx/tx
[   16.767328] IPv6: ADDRCONF(NETDEV_CHANGE): enp6s0: link becomes ready
[   18.156560] wlp5s0: disassociated from de:ad:be:ef:ea:77 (Reason: 2=PREV_AUTH_NOT_VALID)
[   32.420430] wlp5s0: authenticate with de:ad:be:ef:ea:77
[   36.840058] wlp5s0: send auth to de:ad:be:ef:ea:77 (try 1/3)
[   37.795690] wlp5s0: send auth to de:ad:be:ef:ea:77 (try 2/3)
[   38.819714] wlp5s0: send auth to de:ad:be:ef:ea:77 (try 3/3)
[   39.775007] wlp5s0: authentication with de:ad:be:ef:ea:77 timed out
[   54.451376] wlp5s0: authenticate with de:ad:be:ef:ea:77
[   58.882067] wlp5s0: send auth to de:ad:be:ef:ea:77 (try 1/3)
[   59.766767] wlp5s0: send auth to de:ad:be:ef:ea:77 (try 2/3)
[   60.765040] wlp5s0: send auth to de:ad:be:ef:ea:77 (try 3/3)
[   61.763927] wlp5s0: authentication with de:ad:be:ef:ea:77 timed out

(MAC address blurred for your convenience)

The device seems to be working, but cannot associate with the access point

iw event (during a wpa_supplicant restart)

wlp5s0 (phy #0): scan started
wlp5s0 (phy #0): scan finished: 2412 2417 2422 2427 2432 2437 2442 2447 2452 2457 2462 2467 2472, ""
wlp5s0: new station de:ad:be:ef:ea:77
wlp5s0: del station de:ad:be:ef:ea:77
wlp5s0 (phy #0): auth: timed out
wlp5s0 (phy #0): scan started
wlp5s0 (phy #0): scan finished: 2412 2417 2422 2427 2432 2437 2442 2447 2452 2457 2462 2467 2472, ""
wlp5s0: new station de:ad:be:ef:ea:77
wlp5s0: del station de:ad:be:ef:ea:77
wlp5s0 (phy #0): auth: timed out
wlp5s0 (phy #0): scan started
wlp5s0 (phy #0): scan finished: 2412 2417 2422 2427 2432 2437 2442 2447 2452 2457 2462 2467 2472, ""
wlp5s0: new station de:ad:be:ef:ea:77
wlp5s0: del station de:ad:be:ef:ea:77
wlp5s0 (phy #0): auth: timed out
wlp5s0 (phy #0): scan started
wlp5s0 (phy #0): scan finished: 2412 2417 2422 2427 2432 2437 2442 2447 2452 2457 2462 2467 2472, ""
wlp5s0: new station de:ad:be:ef:ea:77
wlp5s0: del station de:ad:be:ef:ea:77

Same story. Scans, finds AP, cannot authenticate

There now follows some of the varied commands I tried to get more information.

ip a
dmesg
rc-service wpa_supplicant restart
rc-service wpa_supplicant stop
wpa_supplicant -Dnl80211,wext -iwlp5s0 -c/etc/wpa_MY.conf -B
ifconfig wlp5s0
ifconfig wlp5s0 up
ifconfig wlp5s0
rmmod rtl8192ee
modprobe rtl8192ee
lsmod
ip a
rc-service wpa_supplicant restart
cat wpa_supplicant/wpa_supplicant.conf_no_countrycode 
cat wpa_supplicant/wpa_supplicant.conf
wpa_supplicant -Dnl80211,wext -iwlp5s0 -c /etc/wpa_supplicant/wpa_supplicant.conf -B
lspci -knn
lsmod
modprobe rtl8192ee
rc-service wpa_supplicant restart
ls /etc/modprobe.d/
iw dev wlp5s0
iw dev wlp5s0 connect
iw dev wlp5s0 connect MYSSID
ip a
iw dev wlp5s0 link
rc-service wpa_supplicant restart
iw dev wlp5s0 link
echo "options mac80211 probe_wait_ms=1500" > /etc/modprobe.d/mac20811.conf
iw dev wlp5s0 connect MYSSID
dmesg
ip link show wlp5s0
ip link set wlp5s0 up
ip link show wlp5s0
iw wlp5s0 scan
rc-service wpa_supplicant stop
iw reg get
rfkill list
iw dev wlp5s0 set power_save off
iw event
rc-service wpa_supplicant restart
rc-service wpa_supplicant stop
rfkill list
killall wpa_supplicant
rc-service wpa_supplicant restart
iw event -f
ip link
iw reg get
iw reg set GB
dmesg
rc-service wpa_supplicant stop
wpa_supplicant -B -D nl80211 -i wlp5s0 -c /etc/wpa_supplicant/wpa_supplicant.conf_no_countrycode 
modprobe cfg80211
rc-service wpa_supplicant restart

After all that (and a whole lot more) I created a large trip hazard and connected an ethernet cable.

I wondered if I had been unlucky and had built the kernel a bit wrong. Well there a couple of differences in the .config files, but I wonder what apps I installed last?

some eix log spelunking led to net-wireless/wpa_supplicant Oh! smoking gun!

but wait. What's this in the dmesg ?

[    4.085869] rtl8192ee: Using firmware rtlwifi/rtl8192eefw.bin
[    4.086053] Loading firmware: rtlwifi/rtl8192eefw.bin

(which is good)

[    0.396076] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2

(which is definitely BAD )

Rebuilt the kernel paying attention to certain RULES in the gentoo doc about what has to be a module

Thoughts at the time were that the issue is - the regulatory database that defines the allowable WiFi channel frequencies for each country. - WiFi device firmware - something called macsec that I noticed in the change logs of wpa_supplicant. https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=49c884d31f99241bb978d04afffdeff46364597d

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/networking_guide/sec-using-macsec https://developers.redhat.com/blog/2017/06/28/whats-new-in-macsec-setting-up-macsec-using-wpa_supplicant-and-optionally-networkmanager#conclusion

OK, doesn't appear to be MACsec

Back to basics

dmesg

lspci -knn

iw reg get

rc-service wpa_supplicant restart

iw event -f

iw dev wlp5s0 connect MYSSID

iw dev wlp5s0 get power_save

rfkill list

iw wlp5s0 scan

Even removed /etc/modprobe.d/mac20811.conf (see above for random things I added)

wpa_supplicant -Dnl80211,wext -iwlp5s0 -c /etc/wpa_MY.conf -B

no change

Right about now I would like some errors to look up!

Many hours of research and not seeing anything on Gentoo forums

Found a custom driver for my card Realtek Semiconductor Co., Ltd. RTL8192EE PCIe Wireless Network Adapter

Which required manually building and then the disabling of the normal driver

echo "blacklist rtl8192ee" | tee -a /etc/modprobe.d/50-blacklist.conf
mkdir /etc/modules-load.d 
echo "8192ee" | tee -a /etc/modules-load.d/8192ee.conf

reboot

lsmod shows new driver in use

no errors in dmesg

But still no WiFi :(


Time to dig even deeper.

wpa_supplicant -Dnl80211,wext -iwlp5s0 -c /etc/wpa_supplicant/wpa_supplicant.conf -d

Runs in super debug mode (wish I had started with this, but no one seems to mention it in troubleshooting steps)

hmmm lots of stuff including

nl80211: set_key failed; err=-22 Invalid argument

then

wlp5s0: 0: 18:35:d1:2f:7a:51 ssid='MYSSID' wpa_ie_len=26 rsn_ie_len=24 caps=0x1431 level=-44 freq=2412  wps
wpa_parse_wpa_ie_rsn: invalid group cipher 0x8 (000fac02)
wpa_parse_wpa_ie_rsn: invalid group cipher 0x8 (000fac02)
wlp5s0:    skip RSN IE - parse failed
wlp5s0:    skip WPA IE - GTK cipher mismatch
wlp5s0:    reject due to mismatch with WPA/WPA2
wlp5s0: No suitable network found

Then this post lead me to check the ciphers

iw phy0 info | grep -A9 'Supported Ciphers'

Which lead me down another rabbit hole rebuilding the kernel with various cryptographic bits enabled and disabled.

More hours lost and nothing gained :(

So its not the Kernel, the Driver or the card. That leaves the user-land software wpa_supplicant

Oh, look another rabbit hole.

Time to roll back to an earlier version of wpa_supplicant

Unfortunately Gentoo has purged the older releases (presumably due to security concerns) so the usual

emerge --ask =net-wireless/wpa_supplicant-2.9-r8

Found no valid atoms . Yep, that was the message.

But would you know it, there is a copy over at /var/cache/distfiles/wpa_supplicant-2.9.tar.gz

But that is just the source code and not what Gentoo actually uses to do package installs. That is an ebuild

So where is the ebuild file for wpa_supplicant 2.9 ?

Not on my system! It might be that my backup script removes all the old package information to save disk space.

The internet will provide and all the historical ebuilds are in the source code repository.

wget "https://gitweb.gentoo.org/repo/gentoo.git/plain/net-wireless/wpa_supplicant/wpa_supplicant-2.9-r8.ebuild?id=7751088eb97abfc6ec4495b0622e3860c0cbdb3e"

Now I can compare that with the new 2.10-r1 ebuild

/var/db/repos/gentoo/net-wireless/wpa_supplicant/wpa_supplicant-2.10-r1.ebuild

There was very little to tell them apart, but I did notice NO_TKIP with a note

# Watch out, reversed logic

and some macsec stuff but, I had already ruled that out.

Now, what is tkip ?

USE flag notes , note

Add support for WPA TKIP (depreciated 2009)

So, unlikely to be needed for modern hardware then...?

Enabling tkip and emerging created a working wpa_supplicant !!

Job done, I will get my hat.

But no, I wanted MOAR!

And it was at this point I found I was not the only one.

Gentoo forums post re wpa_supplicant issues

Side note: Normally when I have an issue with Gentoo it has been experienced and written up months before it hits me.

So, in a sensible world tkip should be disabled by default. Which was the route Gentoo had gone down.

But something in wpa_supplicant on my system connecting to my wireless access point wanted this enabled.

What was that earlier about reversed logic ?

The wpa_supplicant code uses a flag called CONFIG_NO_TKIP which has to be enabled to be activated ...

When gentoo builds with no TKIP USE flag, I believe it explicitly sets the CONFIG_NO_TKIP to Y which is different from not setting it.

The code in wpa_supplicant NEVER checks the value, it only checks it the flag is DEFINED/UNDEFINED not if it is Y/N

AGHhh! another rabbit hole. Will I ever get out ?

What if I could do the emerge and see the source code when changing the tkip USE flag?

FEATURES="keepwork" emerge -av wpa_supplicant
cp -R /var/tmp/portage/net-wireless/wpa_supplicant-2.10-r1 /tmp/wpa_supplicant-2.10-r1_no_tkip

Now we are playing with power!

Though you do have to clear up each time.

rm -fr /var/tmp/portage/net-wireless/wpa_supplicant-2.10-r1

then use ufed to change the tkip USE flag

FEATURES="keepwork" emerge -av wpa_supplicant
cp -R /var/tmp/portage/net-wireless/wpa_supplicant-2.10-r1 /tmp/wpa_supplicant-2.10-r1_tkip_flag_set

/tmp/wpa_supplicant-2.10-r1_no_tkip/work/wpa_supplicant-2.10/wpa_supplicant/wpa_supplicant -D nl80211 -i wlp5s0 -c /etc/wpa_supplicant/wpa_supplicant.conf -d

doesn't work and

/tmp/wpa_supplicant-2.10-r1_tkip_flag_set/work/wpa_supplicant-2.10/wpa_supplicant/wpa_supplicant -D nl80211 -i wlp5s0 -c /etc/wpa_supplicant/wpa_supplicant.conf -d

does work

Would you believe that this account is highly cut-down? Well there were other rabbit holes and numerous dead ends that I felt added nothing to the already crowded party.

and why did I blog/flog this lot when I could have just noted that enabling the tkip flag fixed it?

There are lots and lots of very interesting and useful commands/instructions/paths etc and I want to be able to refer to them. Remember this and many pages are for me, not you.

With that said, enjoy!

loading results, please wait loading animateloading animateloading animate
[More tags]
rss feed

email

root

flog archives


Disclaimer: This page is by me for me, if you are not me then please be aware of the following
I am not responsible for anything that works or does not work including files and pages made available at www.jumpstation.co.uk I am also not responsible for any information(or what you or others do with it) available at www.jumpstation.co.uk In fact I'm not responsible for anything ever, so there!