Per i lettori italiani.
Ho messo in piedi un sito vetrina dove condivido le mie creazioni elettroniche.
Oggetti altamente artigianali e dilettanteschi. Talvolta brutti e fatti male.
https://www.gioele.xyz
In questo sito raccolgo e presento qualche idea e qualche realizzazione, spesso maldestramente scopiazzate, di semplici e molto artigianali oggetti elettronici fatti in casa (circuiti e roba basata su Arduino) con cui far divertire in qualche modo bambine e bambini.
E magari, perché no, stimolare la loro curiosità nei confronti di hacking, DIY, elettronica e informatica.
Saturday, April 16, 2016
Thursday, March 24, 2016
Arduino IDE and persistent serial port (Linux)
In the development of a little project with Arduino, I have to plug and unplug the USB cable a lot of times.
And I have a big annoyance: every time I plug the USB cable again, the port name changes from /dev/ttyUSB0 to /dev/ttyUSB1 and vice versa. So, in the IDE I have to go in Tools -> Port menu and select the right serial port every time before uploading the new sketch.
What a bore!
I've found this post, but the Arduino IDE seems that doesn't detect fancy names like /dev/arduino, but only names starting with "tty".
So my solution, in order to get a persistent name, is based on the http://hintshop.ludvig.co.nz/ blog post, but using a different port name:
sudo vi /etc/udev/rules.d/98-usb-serial.rules
SUBSYSTEM=="tty", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", SYMLINK+="ttyUSB10"
Reload udev rules with:
sudo udevadm control --reload-rules -R
Now in the IDE you can select this port and it never change every time you unplug and plug the USB cable.
And I have a big annoyance: every time I plug the USB cable again, the port name changes from /dev/ttyUSB0 to /dev/ttyUSB1 and vice versa. So, in the IDE I have to go in Tools -> Port menu and select the right serial port every time before uploading the new sketch.
What a bore!
I've found this post, but the Arduino IDE seems that doesn't detect fancy names like /dev/arduino, but only names starting with "tty".
So my solution, in order to get a persistent name, is based on the http://hintshop.ludvig.co.nz/ blog post, but using a different port name:
sudo vi /etc/udev/rules.d/98-usb-serial.rules
SUBSYSTEM=="tty", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", SYMLINK+="ttyUSB10"
Reload udev rules with:
sudo udevadm control --reload-rules -R
Now in the IDE you can select this port and it never change every time you unplug and plug the USB cable.
Monday, March 14, 2016
OMD: python problem after CentOS yum update
After yum update I got a problem, related to python, with check_mk in the OMD implementation.
Environment:
In the check_mk web page you can see a lot of messages like this in each "Check_MK inventory" check.
(Return code of 5 is out of bounds)
and if you issue the check_mk command you get
Cannot read file /omd/sites/prod/share/check_mk/modules/check_mk_base.py: 'frozenset' object is not callable
Environment:
- CentOS 7
- check_mk 1.2.4p5
- omd-1.20
In the check_mk web page you can see a lot of messages like this in each "Check_MK inventory" check.
(Return code of 5 is out of bounds)
and if you issue the check_mk command you get
Cannot read file /omd/sites/prod/share/check_mk/modules/check_mk_base.py: 'frozenset' object is not callable
My solution was:
cp /omd/versions/1.20/lib/python/hashlib.py /omd/versions/1.20/lib/python/hashlib.py.OLD
cp /usr/lib64/python2.7/hashlib.py /omd/versions/1.20/lib/python/hashlib.py
Thursday, March 10, 2016
Wednesday, February 10, 2016
SmartOS: how to clone a KVM machine
Get the disk0 filesystem of the VM to clone.
vmadm get uuid-originvm | json disks
[
{
"path": "/dev/zvol/rdsk/zones/uuid-originvm-disk0",
"boot": true,
"model": "virtio",
"media": "disk",
"image_size": 10240,
"image_uuid": "d8e65ea2-1f3e-11e5-8557-6b43e0a88b38",
"zfs_filesystem": "zones/uuid-originvm-disk0",
"zpool": "zones",
"size": 10240,
"compression": "off",
"refreservation": 10240,
"block_size": 8192
}
]
Create a json in order to add a disk to the new VM.
vi adddisk.json
vmadm get uuid-originvm | json disks
[
{
"path": "/dev/zvol/rdsk/zones/uuid-originvm-disk0",
"boot": true,
"model": "virtio",
"media": "disk",
"image_size": 10240,
"image_uuid": "d8e65ea2-1f3e-11e5-8557-6b43e0a88b38",
"zfs_filesystem": "zones/uuid-originvm-disk0",
"zpool": "zones",
"size": 10240,
"compression": "off",
"refreservation": 10240,
"block_size": 8192
}
]
Take a snapshot
zfs snapshot zones/uuid-originvm-disk0@toclone
Create a json file in order to create the new VM.
vi targetvm.json
Please note: there are no disks.
{
vi targetvm.json
Please note: there are no disks.
{
"alias": "targetvm",
"hostname": "targetvm",
"dns_domain": "mydomain.it",
"brand": "kvm",
"resolvers": [
"192.168.0.2"
],
"ram": "2048",
"vcpus": "2",
"nics": [
{
"nic_tag": "admin",
"ip": "192.168.0.201",
"netmask": "255.255.255.0",
"gateway": "192.168.0.1",
"model": "virtio",
"primary": true
}
]
}
vmadm create -f targetvm.json
Let's clone the filesystem of the origin VM.
zfs clone zones/uuid-originvm-disk0@toclone zones/uuid-targetvm-disk0
zfs clone zones/uuid-originvm-disk0@toclone zones/uuid-targetvm-disk0
Create a json in order to add a disk to the new VM.
vi adddisk.json
{
"add_disks": [
{
"media": "disk",
"model": "virtio",
"boot": true,
"nocreate": true,
"size": 10240,
"path": "/dev/zvol/rdsk/zones/435ca788-4935-ead3-f4e4-94e6eb7dd4b6-disk0"
}
]
}
Let's add the disk to the newly created VM.
vmadm stop uuid-targetvm -F
vmadm stop uuid-targetvm -F
vmadm update uuid-targetvm -f adddisk.json
This is important.
zfs promote zones/uuid-targetvm-disk0
zfs promote zones/uuid-targetvm-disk0
From man zfs:
zfs promote clone-filesystem
Promotes a clone file system to no longer be dependent on its "ori-
gin" snapshot. This makes it possible to destroy the file system
that the clone was created from. The clone parent-child dependency
relationship is reversed, so that the origin file system becomes a
clone of the specified file system.
The snapshot that was cloned, and any snapshots previous to this
snapshot, are now owned by the promoted clone. The space they use
moves from the origin file system to the promoted clone, so enough
space must be available to accommodate these snapshots. No new
space is consumed by this operation, but the space accounting is
adjusted. The promoted clone must not have any conflicting snapshot
names of its own. The rename subcommand can be used to rename any
conflicting snapshots.
Tuesday, January 19, 2016
mod_jk apache 2.4 smartos zone
If, compiling mod_jk, you get
/usr/bin/bash: ../build/libtool: No such file or directory
Then
cd native/
./configure --with-apxs=/opt/local/bin/apxs
mkdir build
cp libtool build/
make
cp ./apache-2.0/mod_jk.so /opt/local/lib/httpd/
/usr/bin/bash: ../build/libtool: No such file or directory
cd native/
./configure --with-apxs=/opt/local/bin/apxs
mkdir build
cp libtool build/
make
cp ./apache-2.0/mod_jk.so /opt/local/lib/httpd/
Subscribe to:
Posts (Atom)
