Thu Nov 28 03:29:29 CET 2013

Having fun with mysql

I don't have the full logfiles anymore, but this was a funny incident.
Some stresstesting managed to make mysql self-deadlock somehow. The easiest way to reanimate the server appeared to be a reboot.
Result: MySQUEAL refuses to start. And I am supposed to clean up that oopsie ...
131104 11:17:16 InnoDB: Completed initialization of buffer pool
InnoDB: Error: checksum mismatch in data file ./ibdata1
131104 11:17:16 InnoDB: Could not open or create data files.
Trying to figure it ouy from logfiles:
InnoDB: Log scan progressed past the checkpoint lsn 3615061792
131104  9:28:12  InnoDB: Database was not shut down normally!
Looking through the logfiles it looks like it figured out that there was an unclean shutdown, started to replay logs ... and corrupted the database in doing so.
Then of course it becomes hard to start up again...
Great :) Let's fix it:
# innochecksum ibdata1 -d
file ibdata1 = 253755392 bytes (15488 pages)...
checking pages in range 0 to 15487
page 0: log sequence number: first = 3615452885; second = 3615451674
page 0 invalid (fails log sequence number check)
Riiiight. Somehow that looks like partially written data. So now we restore from backup ... oh ... hmm, not good. Amusingly innochecksum in mysql 5.7 can repair errors, whereas the versions we have available can only point out that things are bad.
mysqlrepair assumes that the DB is running ... err ... Hello, McFly? Anyone hooome?
Let's try some more brute force:
mysqld_safe  --innodb_force_recovery 4
Now it's readonly, we can dump and restore, and then everything seems to be working.
Isn't it grate?

Posted by Patrick | Permalink

Fri Nov 22 04:55:25 CET 2013

Please to not Github

Today was another exciting day of having The Cloud producing more rain than anything else.

Over the last month I've noticed Github becoming more and more worsened, to the point that it beats SourceForge in my list of websites that suck. Where SF just likes to do pointless HTTP forwarding that turns a not found into a HTTP/200 on a totally unrelated text page (thus randomly giving you 15kB of random instead of what you asked ...
well ...

Connecting to github.com (github.com)|192.30.252.130|:443... failed: Connection timed out.
Retrying.
or:
Resolving github.com (github.com)... 192.30.252.130                                                                                                                                                                                          
Connecting to github.com (github.com)|192.30.252.130|:443... connected.                                                                                                                                                                      
                                                                                                                                                                                                                                             
GnuTLS: Error in the pull function.                                                                                                                                                                                                          
Unable to establish SSL connection.
or even ...
--2013-11-22 11:43:44--  (try: 2)  https://codeload.github.com/jfinkels/flask-restless/tar.gz/0.12.0
Connecting to codeload.github.com (codeload.github.com)|192.30.252.146|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-gzip]
Saving to: /distfiles/flask-restless-0.12.0.tar.gz
    [ <=>                                     ] 8,192        154B/s
(And after those 8kB nothing else came)

I mean, ok, I get it, I shouldn't try to do reproducable builds. Live in the fuzzy cloud of pulling random things and relying on faith ...

But come on, it shouldn't be *THAT* hard to just fetch friggin' files. Seriously.

Posted by Patrick | Permalink

Thu Nov 14 08:05:59 CET 2013

Small HOWTO: Virtual networking with KVM

Today I've tried setting up a virtual network for kvm that is accessible from the host (which makes sense for e.g. NFS) but not to the outside.
Since it took me more than a few minutes to figure out this little bit of information - here it is for future me and everyone else who wants to reference it: Create TAP device on the host and give it an IP:
    
# tunctl
Set 'tap0' persistent and owned by uid 0
#ifconfig tap0 10.0.0.1
Now the tricky part is starting qemu with the right network parameters.
It's not totally obvious, but makes sense: You want an emulated network card (virtio/virtnet), and you want a TAP connector, and both on the same VLAN.
qemu-kvm -enable-kvm -nographic -no-reboot -kernel kvm-kernel -append "console=ttyS0 root=/dev/vda quiet" -drive file=kvm-boot-xfs,if=virtio,index=0 -net nic,model=virtio,vlan=0 -net tap,vlan=0,ifname=tap0,script=no
Watch the "doubling" that happens there:
-net nic,model=virtio,vlan=0 -net tap,vlan=0,ifname=tap0,script=no
And now, magic - from within the KVM instance:
# ifconfig eth0 10.0.0.2
# ping 10.0.0.1
PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.
64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=0.577 ms
Tadaah, now you can access your host!

Posted by Patrick | Permalink