May 22, 2013

a day in the life..

Got back from vacation today (since last Thursday). Here’s how I spent the day.

  • Caught up (skimmed) the 1500 postings to Linux-kernel and related mailing lists that had accumulated.
  • Reviewed, applied and cleaned up my patch backlog for trinity.
  • Caught up with direct mail that needed a response.
  • Brought my test machines up to 3.10rc2, and restarted tests.
  • Caught another pair of RCU/nohz bugs pretty quickly, and reported upstream.
  • Checked on the RMA for my failed SSD. Still awaiting shipment of replacement.
  • Received my ultrabay adaptor for my thinkpad. Surprised to find out that a full height SSD would fit into it.
  • Pushed out a 3.9.3 update for F18
  • Looked at bugzilla backlog. Swore a lot. 3.9.x rebase bugs started to trickle in.
  • Rewrote a bunch of code surrounding trinity’s rand() usage.
  • Finally got F19 installed via NFS on new test machine.
  • Hit an XFS assertion in truncate with trinity.
  • Then hit an i915 kms bug.
  • Noticed that x86 microcode loading had gotten really slow. It seems to be waiting a whole 60 seconds for each core.

a day in the life.. is a post from: codemonkey.org.uk

freecode-submit is now in Fedora – Submit your projects now!

Wow….Freshmeat before, right?

I often use freecode.com to search for the software suitable for packaging, it’s simple and applied. Every people can submit their release information to freecode.com. But there should be an easy way, so Eric S. Raymond wrote this program. freecode-submit is a script that supports remote submission of release updates to Freecode via its JSON API. It is intended for use in project release scripts. It reads the metadata from an RFC-2822-like message on standard input, possibly with overrides by command-line switches.

Now I’ve packaged it into Fedora, just try:

yum install freecode-submit

An submit your nice work now!

Reminder: Questionnaire and nomination dead lines

A gentle reminder on the deadlines for the elections:

The questionnaire closes on May 23 at 23:59 UTC.

The nominations close on May 25 at 23:59 UTC.

Please add your questions and nominations to the wiki pages before the period runs out.

Naming will close tonight, May 22 at 23:59 UTC too. If you have names to suggest for Fedora 20, please update the wiki page.

Handling terminal color escape sequences in less

This post is a quick one but I wanted to share it since I taught it to someone new today. When you have bash output with colors, less doesn’t handle the color codes properly by default:

$ colordiff chunk/functions.php chunk-old/functions.php | less
ESC[0;32m22a23,27ESC[0;0m
ESC[0;34m>       * Load up our functions for grabbing content from postsESC[0;0m
ESC[0;34m>       */ESC[0;0m
ESC[0;34m>      require( get_template_directory() . '/content-grabbers.php' );ESC[0;0m
ESC[0;34m> ESC[0;0m

Toss in the -R flag and you’ll be able to see the colors properly (no colors to see here, but use your imagination):

$ colordiff chunk/functions.php chunk-old/functions.php | less -R
22a23,27
>        * Load up our functions for grabbing content from posts
>        */
>       require( get_template_directory() . '/content-grabbers.php' );
> 
>       /**

The man page for less explains the feature in greater detail:

-R or --RAW-CONTROL-CHARS
       Like -r, but only ANSI "color" escape sequences are output in "raw" form.  Unlike -r, the screen appear-
       ance is maintained correctly in most cases.  ANSI "color" escape sequences are sequences of the form:
            ESC [ ... m
       where the "..." is zero or more color specification characters For  the  purpose  of  keeping  track  of
       screen  appearance,  ANSI  color escape sequences are assumed to not move the cursor.  You can make less
       think that characters other than "m" can end ANSI color escape  sequences  by  setting  the  environment
       variable  LESSANSIENDCHARS to the list of characters which can end a color escape sequence.  And you can
       make less think that characters other than the standard ones may appear between the ESC  and  the  m  by
       setting the environment variable LESSANSIMIDCHARS to the list of characters which can appear.

Handling terminal color escape sequences in less is a post from: Major Hayden's blog.

Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.

May 21, 2013

Availability Zones and Host Aggregates in OpenStack Compute (Nova)

Confusion around Host Aggregates and Availabaility Zones in Nova seems to be very common. In this post I’ll attempt to show how each are used. All information in this post is based on the way things work in the Grizzly version of Nova.

First, go ahead and forget everything you know about things called Availability Zones in other systems.  They are not the same thing and trying to map Nova’s concept of Availability Zones to what something else calls Availability Zones will only cause confusion.

The high level view is this: A host aggregate is a grouping of hosts with associated metadata.  A host can be in more than one host aggregate.  The concept of host aggregates is only exposed to cloud administrators.

A host aggregate may be exposed to users in the form of an availability zone. When you create a host aggregate, you have the option of providing an availability zone name. If specified, the host aggregate you have created is now available as an availability zone that can be requested.

Here is a tour of some commands.

Create a host aggregate:

$ nova aggregate-create test-aggregate1
+----+-----------------+-------------------+-------+----------+
| Id | Name            | Availability Zone | Hosts | Metadata |
+----+-----------------+-------------------+-------+----------+
| 1  | test-aggregate1 | None              |       |          |
+----+-----------------+-------------------+-------+----------+

Create a host aggregate that is exposed to users as an availability zone. (This is not creating a host aggregate within an availability zone! It is creating a host aggregate that is the availability zone!)

$ nova aggregate-create test-aggregate2 test-az
+----+-----------------+-------------------+-------+----------+
| Id | Name            | Availability Zone | Hosts | Metadata |
+----+-----------------+-------------------+-------+----------+
| 2  | test-aggregate2 | test-az           |       |          |
+----+-----------------+-------------------+-------+----------+

Add a host to a host aggregate, test-aggregate2. Since this host aggregate defines the availability zone test-az, adding a host to this aggregate makes it a part of the test-az availability zone.

nova aggregate-add-host 2 devstack
Aggregate 2 has been successfully updated.
+----+-----------------+-------------------+---------------+------------------------------------+
| Id | Name            | Availability Zone | Hosts         | Metadata                           |
+----+-----------------+-------------------+---------------+------------------------------------+
| 2  | test-aggregate2 | test-az           | [u'devstack'] | {u'availability_zone': u'test-az'} |
+----+-----------------+-------------------+---------------+------------------------------------+

Note that the novaclient output shows the availability zone twice. The data model on the backend only stores the availability zone in the metadata. There is not a separate column for it. The API returns the availability zone separately from the general list of metadata, though, since it’s a special piece of metadata.

Now that the test-az availability zone has been defined and contains one host, a user can boot an instance and request this availability zone.

$ nova boot --flavor 84 --image 64d985ba-2cfa-434d-b789-06eac141c260 \
> --availability-zone test-az testinstance
$ nova show testinstance
+-------------------------------------+----------------------------------------------------------------+
| Property                            | Value                                                          |
+-------------------------------------+----------------------------------------------------------------+
| status                              | BUILD                                                          |
| updated                             | 2013-05-21T19:46:06Z                                           |
| OS-EXT-STS:task_state               | spawning                                                       |
| OS-EXT-SRV-ATTR:host                | devstack                                                       |
| key_name                            | None                                                           |
| image                               | cirros-0.3.1-x86_64-uec (64d985ba-2cfa-434d-b789-06eac141c260) |
| private network                     | 10.0.0.2                                                       |
| hostId                              | f038bdf5ff35e90f0a47e08954938b16f731261da344e87ca7172d3b       |
| OS-EXT-STS:vm_state                 | building                                                       |
| OS-EXT-SRV-ATTR:instance_name       | instance-00000002                                              |
| OS-EXT-SRV-ATTR:hypervisor_hostname | devstack                                                       |
| flavor                              | m1.micro (84)                                                  |
| id                                  | 107d332a-a351-451e-9cd8-aa251ce56006                           |
| security_groups                     | [{u'name': u'default'}]                                        |
| user_id                             | d0089a5a8f5440b587606bc9c5b2448d                               |
| name                                | testinstance                                                   |
| created                             | 2013-05-21T19:45:48Z                                           |
| tenant_id                           | 6c9cfd6c838d4c29b58049625efad798                               |
| OS-DCF:diskConfig                   | MANUAL                                                         |
| metadata                            | {}                                                             |
| accessIPv4                          |                                                                |
| accessIPv6                          |                                                                |
| progress                            | 0                                                              |
| OS-EXT-STS:power_state              | 0                                                              |
| OS-EXT-AZ:availability_zone         | test-az                                                        |
| config_drive                        |                                                                |
+-------------------------------------+----------------------------------------------------------------+

All of the examples so far show how host-aggregates provide an API driven mechanism for cloud administrators to define availability zones. The other use case host aggregates serves is a way to tag a group of hosts with a type of capability. When creating custom flavors, you can set a requirement for a capability. When a request is made to boot an instance of that type, it will only consider hosts in host aggregates tagged with this capability in its metadata.

We can add some metadata to the original host aggregate we created that was *not* also an availability zone, test-aggregate1.

$ nova aggregate-set-metadata 1 coolhardware=true
Aggregate 1 has been successfully updated.
+----+-----------------+-------------------+-------+----------------------------+
| Id | Name            | Availability Zone | Hosts | Metadata                   |
+----+-----------------+-------------------+-------+----------------------------+
| 1  | test-aggregate1 | None              | []    | {u'coolhardware': u'true'} |
+----+-----------------+-------------------+-------+----------------------------+

A flavor can include a set of key/value pairs called extra_specs. Here’s an example of creating a flavor that will only run on hosts in an aggregate with the coolhardware=true metadata.

$ nova flavor-create --is-public true m1.coolhardware 100 2048 20 2
+-----+-----------------+-----------+------+-----------+------+-------+-------------+-----------+
| ID  | Name            | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+-----+-----------------+-----------+------+-----------+------+-------+-------------+-----------+
| 100 | m1.coolhardware | 2048      | 20   | 0         |      | 2     | 1.0         | True      |
+-----+-----------------+-----------+------+-----------+------+-------+-------------+-----------+
$ nova flavor-key 100 set coolhardware=true
$ nova flavor-show 100
+----------------------------+----------------------------+
| Property                   | Value                      |
+----------------------------+----------------------------+
| name                       | m1.coolhardware            |
| ram                        | 2048                       |
| OS-FLV-DISABLED:disabled   | False                      |
| vcpus                      | 2                          |
| extra_specs                | {u'coolhardware': u'true'} |
| swap                       |                            |
| os-flavor-access:is_public | True                       |
| rxtx_factor                | 1.0                        |
| OS-FLV-EXT-DATA:ephemeral  | 0                          |
| disk                       | 20                         |
| id                         | 100                        |
+----------------------------+----------------------------+

Hopefully this provides some useful information on what host aggregates and availability zones are, and how they are used.


Another week of rawhide (2013-05-21 edition)

So, another pretty quiet week overall. There was a soname bump in libpng, but it was untagged and never landed in a rawhide compose. The maintainer is going to create a compat package for the old version first, then update the main package so things can slowly move to the new version over time instead of breaking things over many days. I’m glad people are pushing back on these kinds of things to keep rawhide more generally useful. There are of course still unannounced soname updates that do break things, but I get the impression we are slowly getting better on this.

Another related nice change that landed this week is that rpm by default is only going to look for dependencies in .so files that also start in ‘lib’ or ‘ld’ and not just anything ending in .so. So far I’ve not seen any breakage due to this change and it should nicely reduce the number of deps carried in the collection.

Finally, something to note about rawhide testing that I am not sure I have any kind of answer for, but I think is worth exploring: When running rawhide it’s generally a good idea to reboot frequently. New kernels arrive almost daily, and it’s good to check that things all still boot normally (this exercizes at least: dracut, kernel, grub2 or other bootloader, systemd, other stuff that starts only on boot, etc). However, this also means that there’s likely not very many people running rawhide that test longer uptimes. This would exersize things like: updates of long running processes, systemd, memory leaks, logrotation, and other things that collect up and don’t run at boot). I’ve hit several odd systemd issues on upgrade, and I’m sure there’s more out there. Perhaps we should just say that this is what branched is better suited for (as kernels and reasons for update are less frequent there), or perhaps there’s some artificial way to test this, or a vm or the like could be left running to do so. Just something to consider.

Khaleesi!! Mother of Tux

If you’re a fan of Game of Thrones, you will definitely understand this post… ’cause we all love Khaleesi :)

mother of tux

Keystone venv notes

If you try running the unit tests, but you are missing a C library required to build a python module in the venv, you can continue building with

 python tools/install_venv.py

Code coverage can be generated using:

./run_tests.sh -c

Which will generate a report in keystone/covhtml/. An example one is posted here:

Audiospuren von YouTube Videos mit youtube-dl extrahieren
Bitte beachten Sie auch die Anmerkungen zu den HowTos!

Neben der bereits vorgestellten Methode, die Audiospur eines YouTube Videos mit Hilfe von VLC zu extrahieren, gibt es auch die Möglichkeit, das gleiche mit youtube-dl zu erledigen.

Dafür muss zuerst ggf. youtube-dl installiert werden

su -c'yum install youtube-dl'

Nachdem dies erledigt ist, kann man die Audiospur mit dem folgenden Befehl aus dem gewünschten Video extrahieren:

youtube-dl --restrict-filenames -x --audio-format "mp3" --audio-quality 9 -o "%(title)s.%(ext)s" "%URL%"

Der Platzhalter %URL% muss vorher noch durch die URL des YouTube Videos ersetzt werden.

Das Extrahieren der Audiospur eines urheberrechtlich geschützten Videos ist in jedem Fall eine Urheberrechtsverletzung! Ob hier jedoch das Recht auf die so genannte Privatkopie greift, kann im Einzelfall nur ein fachkundiger Anwalt beantworten!
kernel news – 21.05.2012

-Guenter Roeck has hwmon fixes for -rc2:

This pull request adds two more patches to the request I sent out last week.
If there is a reason for not accepting it, I would appreciate if you would
let me know to give me a chance to correct it.

-Konrad Rzeszutek Wilk has xen-stable fixes for -rc1:

Fixes:
* Regression fix in xen privcmd fixing a memory leak.
* Add Documentation for tmem driver.
* Simplify and remove code in the tmem driver.
* Cleanups.

-John W. Linville has a wireless pull request:

This pull request is intended for the 3.10 series. It contains a
variety of fixes for problems discovered during the merge window and
after 3.10-rc1.

For the mac80211 bits, Johannes says the following:

“This is what I have:
* a patch from Felix to fix RCU usage in his rate table code
* a patch from Ilan to add the wdev id to some notifications so they can
actually be used by userspace
* Sasha Levin found an issue in how hwsim handles devices
* a fix for a bug in the wiphy_register() error path that’s been there forever
* three fixes for WoWLAN
* AP mode frame matching was erroneously giving frames to all virtual AP
interfaces (reported by Jouni)
* a fix for HT handling in my CSA changes, found by Sujith
* a fix for some locking simplifications gone wrong
* Ben Greear found more cfg80211/mac80211 state confusion
* and a fix for another bug found by Jouni: local state changes need to be
reported by mac80211 to cfg80211 so it disconnects properly.”

And for the iwlwifi bits, he says:

“I have fixes for a firmware crash during resume, multicast RX,
aggregation and a workaround for a firmware scanning bug.”

Along with those…

Albert Pool adds a USB ID to the rtl8192cu driver.

Arend van Spriel restores a driver option support flag that had been
removed from 3.9 due to a bug in that version of the driver.

Felix Fietkau fixes a trio of ath9k issues with a series of small
patches.

Geert Uytterhoeven provides a Kconfig fix for ath9k (which you also
merged, so it isn’t in the diff here).

Larry Finger gives us a fix for a build warning on big-endian systems
for rtlwifi.

Rafał Miłecki adds some core IDs to the bcma driver.

Sujith Manoharan fixes a module unloading crash in ath9k, and corrects
some calibration settings for AR9485.

-Linus Torvalds announces Linux kernel 3.10-rc2:

So it’s been just over a week, and -rc2 is out.

For being an -rc2, it’s not unreasonably sized, but I did take a few
pulls that I wouldn’t have taken later in the rc series. So it’s not
exactly small either. We’ve got arch updates (PPC, MIPS, PA-RISC),
we’ve got driver fixes (net, gpu, target, xen), and we’ve got
filesystem updates (btrfs, ext4 and cepth – rbd).

And various random small fixes. Shortlog appended, it should get
smaller and more readable going forward.

-Dave Airlie has radeon and nouveau DRM fixes:

This is just a set of nouveau and radeon fixes, the nouveau ones fix some
suspend/resume regressions since use of copy engines and some fixes for Z
compression on some newer chipsets.

I’ve got another pull request for some new AMD radeon hw that shouldn’t
touch any existing hw support that I’ll send after this, its based on this
one, so pulling it will get this + that.
###########################################################################
Since I know its outside the merge window, but since this is new hw I
thought I’d try and provoke the new hw exception, it just fills in the
blanks in the driver for the new AMD sun and hainan chipsets. The pull is
based on the previous one with the changelog just for the new pieces.

-Steven Rostedt announces the release of kernel 3.6.11.4, here is the patch:

https://www.kernel.org/pub/linux/kernel/projects/rt/3.6/stable/patch-3.6.11.4.xz.

-Martin Schwidefsky has s390 updates, and that’s about it for today.


Anaconda Test Day Tuesday, and debugging

Sorry (again) for the late notice, but Tuesday 2013-05-21 – tomorrow or today, depending – is Anaconda Test Day!

Yeah, in a way it’s anaconda test day every day in Fedoraland, as we focus a lot of our day-to-day testing on the installer. But the folks running this Test Day have come up with some good extended test cases that go beyond what we cover in the release validation testing, so we should be able to find some more interesting bugs (it’s always fun).

We’ll be testing the current Beta candidate build, Beta RC2. As always, full instructions for testing are available in the Test Day page, and there will be QA folks on hand in #fedora-test-day on Freenode IRC for discussion and any help you need in testing or debugging. If you’re not sure what IRC is or how to use it, we have instructions here, and you can also simply click here to join the chat through a Web front end.

If you haven’t tried out the improved anaconda in Fedora 19 yet, this event is a great excuse to take a look at it: it is much more polished and stable now than it was in Fedora 18, so come try it for yourself and help us to improve it further before the final release of Fedora 19!

I’ve been really enjoying work on Fedora 19 lately. After the somewhat hellish Fedora 18 cycle where we worked more or less 24×7 on stabilising anaconda, Fedora 19 has been a pretty well-behaved release so far, and so I’ve had time to look around and try to investigate and fix up some other things. Among other things, today, I was looking into a couple of bugs which turned out to be very interesting (to weird people like me, anyhow) to debug. I don’t know if anyone else feels like this, but I absolutely love this stuff – it’s my favourite thing about my job, really, the process of pinning down exactly why something is going wrong, and how to fix it. I also love that in a project like Fedora, you rarely do it alone: it’s very cool to work alongside (or just watch) a big group of extremely smart and knowledgeable people, both inside RH and in the Fedora community. I just had the urge to do a post mortem on a specific bug here, because I really love this process. Those of you who do this every day can safely move on. :)

Since upgrading to Fedora 19, I hit a strange problem three or four times where there was a long delay when using the ‘su’ command to become root. I’d run ‘su’, enter my password, and then it would sit there apparently thinking about it for 15-20 seconds before returning a root prompt; it’s usually instant. This was different from the delay that usually happens when you get the password wrong – it happens when you get the password right, and is longer than that delay.

So when I finally got around to trying to figure out what was going on recently, I started out by trying to ‘strace’ the su process.

Now, strace is rarely the tool you really want to use for debugging. It’s a very unwieldy thing to use, for most cases. There’s usually a better way of doing it. But it can be invaluable for your real mystery bugs, like this one, where there is no other obvious way to attack the problem – no logs to sink your teeth into or obvious triage techniques you can use. It turned out to be invaluable for this bug.

At first I was stymied because if you just run the su process through strace from the outset, authentication always fails – strace interferes with it somehow. Tomas Mraz pointed out the workaround which really should’ve been obvious to me in hindsight: just run su first, then attach the strace to it (the ‘strace -p [pid]‘ command does this). That works fine. So, now I had the strace output, and it had a reasonably obvious smoking gun:


stat("/root/.xauth/import", 0x7fff660f8b70) = -1 ENOENT (No such file or directory)
getgid() = 1001
getuid() = 1001
pipe([4, 6]) = 0
pipe([7, 8]) = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f2a174b9a10) = 15192
close(4) = 0
close(8) = 0
close(6) = 0
read(7,

** PAUSE HERE **

"", 2048) = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=15192, si_status=1, si_utime=0, si_stime=0} ---
close(7)

The pause happened at “PAUSE HERE”: the strace output sat right in the middle of that line for 15 seconds before moving on. So what does that bunch of gibberish mean?

Extracting meaning from voluminous gibberish is an invaluable skill for the kind of stuff we’re working on here, which you only really develop with experience. But in this particular case, here’s how that stuff reads to me:

blahblahblahwordswordswords CHILD CHILD SIGCHLD 15192 blahblahblahwords…pause…SIGCHLD CLD_EXITED wordswordswords

The key thing to know is that, just before the pause, the su process created a child process. Basically, it ran some other command that it needed to run. This happens all the time: say you were writing a very unsophisticated file manager, if the user clicked the Create Directory button, your program would run a child ‘mkdir’ process. (That’s a horrible way to write a file manager, but you get the idea).

So what this means is that we’re not going to get any further staring at this strace, because the data just isn’t there. The pause happens right after a child process is forked off, and right when the pause ends, we see that the child process finished. That makes it pretty damn obvious that the pause is happening in the child process, somehow.

So what next? Well, we find out what the child process is. That ’15192′ is the pid of the child process. How did I know that? I didn’t (though a real developer probably would have), but it seemed like a reasonable guess – it’s a pid-ish number, it’s clearly associated with the creation of the child process, and if I were the developer of strace, then when a child process was created, I’d bloody well make sure it logged the pid. So it seemed a pretty safe bet, and it was easy enough to check: re-do the strace and check ‘ps’ output for the apparent pid while the pause was happening. And lo, it came to pass that I was right. So ps told me that the child process was this:

/usr/bin/xauth -f /run/gdm/auth-for-adamw-szT11D/database nlist :0

it’s trying to read some kind of authentication information from a database provided by gdm. Okay. Now we’re making progress.

The next step is probably pretty obvious: let’s strace the child process. It’s easy enough to watch the su strace output and fire off an ‘strace -p 15192′ (or whatever the new number was) right when the pause happens.

That yielded some nice gratifying results. The xauth strace showed this happening, seven times:

open(“/run/gdm/auth-for-adamw-szT11D/database-c”, O_WRONLY|O_CREAT|O_EXCL, 0600) = -1 EACCES (Permission denied)
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigaction(SIGCHLD, NULL, {SIG_DFL, [], 0}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
nanosleep({2, 0}, 0x7fff8b56d5c0) = 0

it tries to access (actually, create) a file, gets ‘Permission denied’, WORDSWORDSWORDS, then goes away to sulk in the corner for a bit: after that ‘nanosleep’ line, there was a two second pause. Multiply that by 7 (actually I think it’s probably 8, and the first happened before I got the strace started) and you get the long pause. Eureka!

Of course, we’re not done yet. When you run up against something like this, there are two key questions:

a) Why is it trying to do that in the first place?
b) Why is it failing?

a) can sometimes be an interesting question, but then, I always find it’s a good idea to consider a third question: ‘do the people who did this know better than I do?’, to which the answer is often ‘yes’. I’m certainly not going to start questioning the motives of the people who maintain util-linux unless it seems to be urgently necessary. So in a case like this, it’s probably prudent to assume that there’s a good and valid answer to a), and slide right along to b).

At this point it was necessary to call in the cavalry again, what with me still being the idiot monkey and all. So I got on IRC and bleated piteously for halfline – Ray Strode – the maintainer of GDM. He did most of the work from there on; I just sat around coming up with silly ideas.

It was still a pretty wide open problem area to start with; there are always multiple possibilities when you’re looking at a problem like this. We had to consider, for instance, the possibility that this file creation always failed, but didn’t always cause a delay. Or that the attempt to create the file itself isn’t a ‘normal’ thing but some kind of failure path; perhaps in the ‘success’ case, the file creation isn’t attempted. So it seemed prudent to run an strace on the ‘success’ case as well as the failure case. ajax – Adam Jackson – had a handy trick for achieving this. In the ‘success’ case the xauth command returns pretty much instantaneously, so you can’t catch it in strace just by being handy with the copy/paste shortcuts. Noo, we have to be smarter than that. So, we do this:

cp /usr/bin/xauth /usr/bin/xauth-real
cat > /usr/bin/xauth << EOF
strace -o /tmp/$$.strace /usr/bin/xauth-real "$@"
EOF

What we did there was replace the xauth binary with a wrapper script that runs the 'real' xauth (renamed to xauth-real) through strace. (The cat > << EOF...EOF stuff is just a way to create a file with any contents you like; you could just as easily create a file in gedit, and type in that strace line to it). The "$$" means "the pid of the process", so you wind up with /tmp/18104.strace or whatever.

After that nifty trick we run our 'su', and take a look at the strace. It shows that the creation of the file is indeed attempted in the success case, and works immediately. So as it turns out, this isn't a curveball: the problem really is that xauth should be able to create that file, but it's being denied permission. Still - always check for curveballs. Don’t get blinkers on when you’ve caught a hint of what the problem is: at every stage of debugging, try and consider all the possibilities.

With that knowledge we could focus in a little bit. After looking at various things we worked our way around to what turned out to be the problem: on the system where I was seeing the bug, /run/gdm/ had the permissions 1770 (and ownership root.gdm). Well, that’s clear enough.

We still weren’t done, though! The question is always why: why did the directory have those permissions? Remember, the bug isn’t permanent. Checking a normally-working system, the permissions were 0711, which is what halfline expected to see. Since I didn’t see the bug all the time, it looked like the permissions were usually right, but somehow, sometimes, they got set to the wrong thing. So what would be changing the permissions in the middle of a running session?

Tracking that down was a bit tricky. We poked through the gdm codebase looking for calls to chmod or other functions for setting permissions and couldn’t find anything. Finally, though, when we were getting pretty stumped, halfline thought to check the gdm package spec file. Eureka once again:

%attr(1770, root, gdm) %dir /run/gdm

And there, the prosecution rests: we have our culprit. On package installation, the permission on /run/gdm were set wrong. As we’d discovered while poking the gdm codebase, gdm has code to set the correct permissions – 0711 – at runtime, so most of the time, that was disguising this bug; when I booted up my system, gdm would fix the incorrect permissions. But what would trigger the bug would be any update to the ‘gdm’ package that I installed on the fly, without rebooting or restarting GNOME: the package install would set the permissions back to 1770, and boom, bug. A reboot would trigger gdm fixing the permissions and the bug went away again.

I don’t know, maybe I’m just weird, but I enjoy the whole process of narrowing something like that down, and it’s a great feeling when you get to the end and you’re satisfied that you know exactly what broke and how to fix it. Even if someone else wound up doing most of the work! Thanks much to Ray, Adam and Tomas for that.

I actually intended to also work through in similar fashion the other interesting thing I figured out today, which is why most of anaconda’s icons are missing when you run it from the new MATE Fedora spin, but this has gotten very long, so I guess I’ll save that for another time! Thanks for reading, if you got this far.

Fedora supybot upgraded

Fedora supybot upgraded

As of today, the supybot instance called zodbot has had its supybot-fedora plugin updated to the latest upstream release, which brings some new functions. In case of any questions/comments regarding zodbot, please visit us at #fedora-admin on FreeNode.

An overview of the new functions zodbot provides follows:

admins

(admins <group short name>) -- Return the administrators list for the selected group

hellomynameis

(hellomynameis <username>) -- Return brief information about a Fedora Account System username.
Useful for things like meeting roll call and calling attention to yourself.

localtime

(localtime <username>) -- Returns the current time of the user. The timezone is queried from FAS.
Conhecendo o Fedora 19 Alpha

Vamos conhecer as novidades na instalação do Fedora 19 Alpha, que a poucos dias foi disponibilizado: http://fedoraproject.org/pt_BR/get-prerelease, estas são muitas e posso garantir que ficou mais simples, fácil, rápido e ainda social, sendo assim mãos a obra:

Na primeira tela praticamente é a mesma do Fedora 18:

Aqui percebemos o aviso que esta é uma versão não estável(Stable):

Esta tela já demonstra que o Fedora 19 amadureceu muito desde a primeira versão do Anaconda no release 18:

Ajuste de data e horário:

Seleção de teclado:

Aqui vemos uma grande mudança no fonte de instalação, permitindo verificar a .iso, ou selecioná-la diretamente da sua rede, uma evolução considerável perante o release 18:

A configuração da rede lembra muito o próprio Network Manager:

Seleção de grupo de pacotes, permitindo o a seleção do ambiente gráfico: novo Gnome 3.8 ou o KDE Plasma:

A seleção de destino da instalação ficou muito mais simples e fácil de usar:

As opções para o particionamento:

O particionamento em si:

Partições automáticas:

Sumário de todas as opções algo novo e que leva a transparência para o usuário sobe suas opções:

Start da copia dos arquivos da origem da instalação para o destino selecionado:

Na cópia dos arquivos surge a seleção da senha de root, já presente no release 18, porém uma novidade a possibilidade de configuração de um usuário, em plena cópia de arquivos:

Setando senha do usuário “root”:

Nova tela, criação de usuário na instalação, novidade, pois somente após o reboot esta opção era fornecida:

Continuando a instalação:

A famosa tela de reboot, após a conclusão da cópia dos arquivos:

Após o reboot vemos um bem vindo muito legal e totalmente novo:

Posso novamente alterar configurações de teclado, isto permite você optar por não configurar o teclado na instalação, mas sim após:

Idem a tela anterior, mesma possibilidade para a criação de usuário, porém aqui não é possível setar o usuário para o grupo de Administradores. Também podemos perceber o botão de “Enterprise Login”, permetindo conectividade com gestores de identidade e autenticação, exemplo: FreeIPA:

Seleção de timezone, flexibilidade é uma das caraterísticas deste novo instalador, pois como já realizei a configuração na instalação, aqui ele apenas solicita minha confirmação:

A parte social do Fedora 19 vem a tona, aqui podemos selecionar nossa conta no Google, Facebook, entre outros, não sendo mais necessário configurar tudo após o primeiro login, facilidade e simplicidade:

Agradecimento, após, conforme nossa opção startarmos o Gnome 3.8:

Enfim aqui esta nosso novissímo Fedora 19, bom uso:

Como podemos perceber o Fedora vem inovando e mostrando porque é uma das principais distribuíções Linux, muitas outras novidades foram inseridas neste release e em breve falarei sobre outras novidades, espero que vocês tenham conhecido um pouco do Fedora 19, agora é baixar e instalar e usar a vontade. 

May 20, 2013

qemu 1.5.0 released, with ssh block device support

qemu 1.5.0 has been released, featuring ssh support so you can access remote disks over ssh, including from libguestfs.

Here’s how to use this from guestfish:

$ export LIBGUESTFS_BACKEND=direct
$ guestfish --ro -a ssh://onuma/mnt/scratch/winxp.img -i

Welcome to guestfish, the guest filesystem shell for
editing virtual machine filesystems and disk images.

Type: 'help' for help on commands
      'man' to read the manual
      'quit' to quit the shell

Operating system: Microsoft Windows XP
/dev/sda1 mounted on /

><fs> ll /
total 1573209
drwxrwxrwx  1 root root       4096 Apr 16  2012 .
drwxr-xr-x 23 1000 1000       4096 May 20 19:47 ..
-rwxrwxrwx  1 root root          0 Oct 11  2011 AUTOEXEC.BAT
-rwxrwxrwx  1 root root          0 Oct 11  2011 CONFIG.SYS
drwxrwxrwx  1 root root       4096 Oct 11  2011 Documents and Settings
-rwxrwxrwx  1 root root          0 Oct 11  2011 IO.SYS
-rwxrwxrwx  1 root root          0 Oct 11  2011 MSDOS.SYS
-rwxrwxrwx  1 root root      47564 Apr 14  2008 NTDETECT.COM
drwxrwxrwx  1 root root       4096 Oct 11  2011 Program Files
drwxrwxrwx  1 root root       4096 Oct 11  2011 System Volume Information
drwxrwxrwx  1 root root      28672 Oct 11  2011 WINDOWS
-rwxrwxrwx  1 root root        211 Oct 11  2011 boot.ini
-rwxrwxrwx  1 root root     250048 Apr 14  2008 ntldr
-rwxrwxrwx  1 root root 1610612736 Oct 11  2011 pagefile.sys

Vídeo do mês - Miles Davis - So what
<iframe allowfullscreen="" frameborder="0" height="315" src="http://www.youtube.com/embed/V1hT2u1jwcs" width="420"></iframe>
Send money with Gmail .

Google Wallet is now integrated into Gmail.

You can securely send money to friends and family in the U.S. using your Gmail inbox.

This is just for U.S. only.

Google introduce something like that to Gmail to push Google Wallet to a larger audience.

You can pay with your credit and debit cards for a low fee of 2.9% per transaction and receiving money is always free.

Roots

Hola pessoas,
Tenho visitado vários "planetas" Linux e tenho procurado ler alguns artigos. Tenho a dizer que sinto saudades do tempo do André Gondim. Naquela época (não faz muito tempo) você lia notícias realmente relevantes sobre distros, "chamadas de tradução", se sentia mais "envolvido" no mundo do software livre. Pessoas como o André faziam você sentir vontade de atualizar o seu Linux, mesmo que isso demandasse tempo ou alguma reinstalação. Meu amigo, para quem é pai (como eu), tempo é muito precioso. Mas ainda assim nos sentíamos instigados a tentar o novo.
Mas hoje... hoje, o que vejo são pessoas que estão buscando somente a sua promoção pessoal, se dizem "apaixonados" pelo "sistema" que utilizam. Querem somente o lucro com seus blogs e se esqueceram da colaboração. 
Essa é a situação dos planetas no Brasil. Ainda tempos o planeta Fedora, o planeta GNU Linux Brasil, o Viva o Linux e alguns outros que valem a pena. 
Um pensamento: o Linux nasceu como um sistema colaborativo e assim cresceu. Que tal resgatarmos as raízes?
...
Para amenizar um pouco o papo, temos uma enquete nova, vote em qual distro Linux você utiliza e comente neste post. :-)

English Version:

Hola people,
I have visited many Linux "planets" and read some articles. I have to say I miss André gondim. At that time (not long ago) we read relevant news about distros, "translation calls", felt more "involved" in the world of free software. People like André makes you felt encouraged updating your Linux, even if it demands time or any reinstallation. For people who have kids (like me), time is very precious. But still we felt encouraged to try again.
But today ... Today, what I see are people who are seeking only his personal promotion, say they "love" the "system" they use. They only want to profit from their blogs and forgot collaboration.
This is the situation of the planets in Brazil. Thankfully we have the Fedora planet, the planet GNU Linux Brazil, Viva o Linux and a few others that are worth it.
A thought: Linux began as a collaborative system and thus grew. How about we rescue the roots?
Del 14 al 19 de Mayo

Mi reporte de actividad reciente.

  • Documentando Fedora.
    • nmcli, control del NetworkManager desde la consola (wiki mejorado).
    • dunst, servidor de notificaciones para el escritorio (wiki mejorado).
    • sendEmail, envíós de emails desde la consola y para scripts (wiki mejorado).
  • Empaquetando
    • #631 Actualizando rubygem-rr
    • #629 Actualizando rubygem-rhc
  • Varios

Un pantallazo de dunst recibiendo notificaciones de DropBox.

- Gomix -

SELinux is a labeling system. First thought should be "Is there a label that would make this work?"
On the SELinux mail list today, someone asked:

I want to store the logs from openswan into a different file ( /var/log/ipsec ) than the default. For this purpose I added

plutostderrlog=/var/log/ipsec

to ipsec.conf.
    As long as I keep the server in permissive mode, openswan starts OK. If, however, I switch to enforcing, the daemon refuses to start with the following error message displayed in the console:


ipsec_setup: Starting Openswan IPsec U2.6.32/K3.0.78-1.el6.elrepo.x86_64...
ipsec_setup: Cannot write to "/var/log/ipsec".

   The audit log does not record anything useful so I tried to switch dontaudit to off and see if anything useful comes out. After running audit2allow and a bit of trial and error I came out with the following custom policy :

module myipsec 1.0;
require {
        type ipsec_t;
        type var_log_t;
        class file { write ioctl getattr append };
}
#============= ipsec_mgmt_t ==============
allow ipsec_mgmt_t var_log_t:file write;

   The above policy worked for me but I am wondering if it is OK

The problem is the administrator decided to add policy that allows ipsec_mgmt_t to write any file labeled var_log_t.  A hacked ipsec_mgmt could now overwrite any log file on the system labeled var_log_t, including /var/log/messages.  var_log_t is the default label for ANY file in /var/log directory that does not  have SELinux policy controlling it.  Also remember "write" access is always more dangerous then "append" access, since "write" allows you to truncate a file, destroying evidence, versus append to the end of a file.

In the paper I wrote a few years ago,

What is SELinux trying to tell me?
The 4 key causes of SELinux errors.


I explain that adding policy should be your third option, not your first.  In this case Dominic Grift pointed out the admin, that changing the label of the target would fix the problem and not involve adding custom policy.

semanage fcontext -a -t ipsec_log_t "/var/log/ipsec.*"
restorecon -v /var/log/ipsec


By telling SELinux that the content in the /var/log/ipsec log file was ipsec_log_t, you solve your problem and end up with the same security you had before the change.

Think Labels First...
Evolution no muestra correo entrante / Evolution not showing new emails

Esto es algo que suele suceder a menudo, mas aún en entornos configurados sobre nfs, o con frecuentes fallos de red.

Evolution, simplemente deja de mostrar los mensajes que arriban, no vemos ningún mensaje de error.

Como primera medida para solucionar este problema, podemos intentar una reconstrucción de las carpetas del evolution.

Si esto no da resultado, procederemos de la siguiente manera:

1) Cerramos el Evolution

2) Renombramos el archivo Inbox actualmente en uso:

$ cd /home/gsosa/.local/share/evolution/mail/local
$ mv Inbox Inbox.bak

3) Abrimos el Evolution: al no encontrar una carpeta Inbox, la creará nuevamente vacía.

4) En el Evolution vamos a Archivo –> Importar y seguimos los pasos para “importar un unico archivo”. Cuando lo solicite, seleccionamos el archivo previamente renombrado en el paso 2).

Con esto tendremos nuevamente operativa la bandeja de entrada (Inbox)


You know what deserves a new release ? HyperKitty.

The last release of HyperKitty was in February (19th). That’s a long time ago. And there’s been quite a few changes in the HyperKitty world, let me tell you.

So I’ve just published yesterday a new version of our favorite Mailman3 web archiver, which is available on PyPI. Here are the most significant code changes since the last version:

  • Merge and compress static files (CSS and Javascript)
  • Django 1.5 compatibility
  • Fixed REST API
  • Improved RPM packaging
  • Auto-subscribe the user to the list when they reply online
  • New login providers: generic OpenID and Fedora
  • Improved page loading on long threads: the replies are loaded asynchronously
  • Replies are dynamically inserted in the thread view

But code is not everything, and HyperKitty has now been deployed to serve real mailing-lists, alongside Mailman3 of course. The Fedora Infrastructure team uses is (lightly for now), and the Arquillian project has chosen to setup its lists on HyperKitty, using our server. This means we have a second server running, deployed using the HyperKitty RPMs and Ansible (which is great by the way).

If you’re interested in the future of mailing-lists, please checkout HyperKitty, I’m sure you’ll love it. And if you don’t, tell me why so I can make it work for you!

minised in now in Fedora – The GNU used-to-use SED implemention

I first heard mininsed when after using Linux for more than 5 years(although long long ago). As described from its official website, it’s a smaller, cheaper, faster SED implementation and Minix uses it so far. Then I found that GNU used to use it but now they’ve developed a brand-new sed with many extensions.

The first version was released in 199x years which I just got borned icon biggrin minised in now in Fedora   The GNU used to use SED implemention

I really don’t know what’s the difference between sed and minised. And I doubt only few people will use minised. “Why should I type 7 chars in order to run an command rather than 3 chars?”

But I still packaged it into Fedora as I treat it like an historic software which should be covered in current Linux distros.

Now I’m pacakging many projects founded by Eric S. Raymond, he has written so many small useful programs.

Just try:

yum install minised

If you can tell the difference between sed and minised, I wll be really very happy to include them into this post.

Red Hat Internship started, getting a ReviewBoard development instance running

Red Hat Internship started, getting a ReviewBoard development instance running

As of last week, I am officially an intern for Red Hat, Inc., tasked with extending the Reviewboard code review system. Currently, I am working on adding API tokens and OpenID login support to ReviewBoard, primarily to improve the usability of ReviewBoard in the Fedora and Red Hat infrastructures.

Last week, I have primarily been checking out the code to ReviewBoard and djblets (a library of reusable Django components by the same authors), to find my way around the code. I will send a weekly progress email to the ReviewBoard-dev mailing list and post it to my blog as well, to keep the community updated on my current progress.

Last week, I have primarily been busy with reading up on the code, and getting a demonstration instance up so my manager can follow my progress as-I-go. Because of my previous experiences with OpenShift, I decided to use that to host this demonstration instance.

Since other people might want to do this as well, I will give a short explenation of how I did this.

Development instance on OpenShift

There is an example available of how to get ReviewBoard into OpenShift, but that example uses the PyPI package, and thus the production release, of ReviewBoard.

This was unsuitable for me, as I want to use it to demonstrate my current progress to my manager, and thus need the latest development instances of djblets (a library written by the same authors with some reusable Django extensions) and reviewboard itself. For this setup, there is an explenation from the ReviewBoard maintainers to set up such an instance, but off course I did not want to use OpenShift as a normal host, and wanted to use the official git repository to host everything.

For starters, as I did not want to use the normal wsgi server with central pip, I used the Do it Yourself(DiY) cartridge.

As I wanted to be able to control which versions of djblets and openshift it uses, I decided to add those repositories as git submodules, which gave me the following (sanitized) directory structure in the OpenShift git repository:

.
|-- djblets
|-- .openshift
|-- rbtools
|-- reviewboard

Note: if you did this, you could just put my deploy/start/stop scripts in place and be done. If you want to do this, feel free to skip my explenations and head to the Download section.

Deploy script

After this, I had to build the deploy/start/stop scripts for OpenShift, to get the instance to setup everything and start/stop on push.

In the deploy script, I create my own custom virtual environment, because the DiY cartridge does not know what programming language you will use, so I start by creating one manually:

if [ ! -d "$OPENSHIFT_DATA_DIR/venv" ];
then
    mkdir $OPENSHIFT_DATA_DIR/venv
    virtualenv $OPENSHIFT_DATA_DIR/venv
    source $OPENSHIFT_DATA_DIR/venv/bin/activate
fi

Because the default python egg cache is in a custom home directory folder, I do not have write permissions on it, so I create that as well manually:

export PYTHON_EGG_CACHE="$OPENSHIFT_DATA_DIR/eggs"
if [ ! -d "$PYTHON_EGG_CACHE" ];
then
    mkdir $PYTHON_EGG_CACHE
fi

After this, I can finally build all of the components as specified in the upstream documentation:

(
    source $OPENSHIFT_DATA_DIR/venv/bin/activate
    cd djblets
    python setup.py develop
)
(
    source $OPENSHIFT_DATA_DIR/venv/bin/activate
    cd rbtools
    python setup.py develop
)

For ReviewBoard, this was a bit harder, as I have to initialize the database. I decided to do this on every deploy, and create the database in the repository directory. This makes OpenShift delete the database on every push, which makes sure that every time I start with a completely empty database.

(
    source $OPENSHIFT_DATA_DIR/venv/bin/activate
    cd reviewboard
    python setup.py develop
    python ./contrib/internal/prepare-dev.py <../dbinput
)

The dbinput file mentioned in the last line is a file with the details for the default user as requested by the superuser creation script. The contents of this file are in the following format:

yes
(username)
(email)
(password)
(password)

Make sure to end the file with an empty file, as otherwise the database creation script will get an EOF before it can read the password verification.

Start script

In the start script, I first initialize some environment variables and activate the virtual environment created in deploy. I also set HOME to a path in the TMP directory, as I want to make sure that everything gets created there, and is cleared every time I deploy, so I get a clean deployment every time I push. Python uses $HOME to store some more python information.

export PYTHON_EGG_CACHE="$OPENSHIFT_DATA_DIR/eggs"
source $OPENSHIFT_DATA_DIR/venv/bin/activate
export HOME=$OPENSHIFT_TMP_DIR/data
rm -rf $HOME
mkdir $HOME

Now the only thing remaining to do is… yeah, actually starting it!

nohup python ./reviewboard/manage.py runserver $OPENSHIFT_INTERNAL_IP:$OPENSHIFT_INTERNAL_PORT > $OPENSHIFT_HOMEDIR/diy-0.1/logs/server.log 2>&1 &

That was easy, was it not?

Stop script

In the stop script, I just stop every process which contains “runserver” in its command line. I do not have to be afraid to stop processes started by other users, thanks to the magic that is SELinux containers.

kill `ps -ef | grep runserver | grep -v grep | awk '{ print $2 }'` > /dev/null 2>&1
exit 0

If anyone knows a better way to do this, feel free to email me or put it in the comments.

Download

.openshift/action_hooks/deploy .openshift/action_hooks/start .openshift/action_hooks/stop

License of these files is beerware:

"THE BEER-WARE LICENSE" (Revision 42):
patrick@uiterwijk.org wrote this file. As long as you retain this notice you
can do whatever you want with this stuff. If we meet some day, and you think
this stuff is worth it, you can buy me a beer in return Patrick Uiterwijk

Comments/questions

Feel free to post comments or questions in the discussions section below, or to email me!

Orchestrating Your Storage: libStorageMgmt
<style type="text/css"></style> <style type="text/css"></style>

Abstract

This paper discusses some of the advanced features that can be used in modern storage subsystems to improve IT work flows. Being able to manage storage whether it be direct attached, storage area network (SAN) or networked file system is vital. The ability to manage different vendor solutions consistently using the same tools opens a new range of storage related solutions. LibStorageMgmt meets this need.

<style type="text/css"></style>

Introduction

Many of today’s storage subsystems have a range of features. Some examples include: create, delete, re-size, copy, make space-efficient copies and mirrors for block storage. Networked file systems can offload copies of files or even entire file systems quickly while using little to no additional storage, or keep numerous read-only point-in-time copies of file system state. This allows users to quickly provision new virtual machines, take instantaneous copies of databases, and back up other files. For example a user could quiesce a data base, call to the array to make a point-in-time copy of the data, and then resume database operations within seconds. Then the user could take as much time as necessary to replicate the copy to a remote location or removable media. There are many other valuable features that are available through the array management interface. In fact, in many cases, it’s necessary to use this out-of-band management interface to enable the use of features that are available in-band, across the data interface.

 

Problem

To use these advanced features, users must install proprietary tools and libraries for each array vendor. This allows users to fully exploit their hardware, but at the cost of learning new command line and graphical user interfaces and programming to new application programming interfaces (APIs) for each vendor. Open-source solutions frequently cannot use proprietary libraries to manage storage because of incompatible licensing. In other cases, the open-source developer cannot redistribute the vendor libraries. Thus the end users must manually install all of the required pieces themselves. The Storage Network Industry Association (SNIA) and the associated Storage Management Initiative Specification (SMI-S) have an ongoing effort to address this need with a well-defined and established storage standard. The standard is quite large. Preventing administrators and developers from leveraging it easily. With the scope and complexity of such a large standard, it is difficult for vendors to implement it without variations in behavior. The SMI-S members’ focus is on being the providers of the API and not consumers of them, so the emphasis is from the array provider perspective.  The SMI-S standard must define an API for each new feature.  The specification always trails vendor defined APIs.

 

<style type="text/css"></style>

The LibStorageMgmt solution

The libStorageMgmt project’s goal is to provide an open-source vendor-agnostic library and command line tool to allow administrators and developers the ability to leverage storage subsystem features in a consistent and unified manner. When a developer chooses to use the library, their users will benefit by their ability to use any of the supported arrays or future arrays when they are added. The library is licensed under the LGPL which allows use of the library in open-source and commercial applications. The command-line interface (lsmcli) has been designed with scriptability in mind, with configurable output to ease parsing. The library API has language bindings for C and Python. The library architecture uses plug-ins for easy integration with different arrays. The plug-ins execute in their own address space allowing the plug-in developer to choose whatever license that is most appropriate for their specific requirements. The separate address space provides fault isolation in the event of a plug-in crash, which will be very helpful if the plug-in is provided in binary form only.

 

LibStorageMgmt currently has plug-in support for:

  • NetApp filer (ontap)
  • Linux LIO (targetd)
  • Nexentastor (nstor)
  • SMI-S (smispy) Note: feature support varies by provider
  • Array simulator (sim) Allows testing of client code/scripts without requiring an array

Support for additional arrays is in development and will be released as they become available.

 

<style type="text/css"></style>

Example: Live database backup

An administrator has a MySQL database that they would like to do a live “hot” backup to minimize disruption to end users. They also use NetApp filers for their storage, and would like to leverage the hardware features it provides for point-in-time space efficient copies. The database is located on an iSCSI logical disk provided by the filer. (These are referred to as volumes in libStorageMgmt.)

The overall flow of operations:

  • Craft a uniform resource identifier for the array (URI) for use with libStorageMgmt
  • Identify the appropriate disk and obtain its libStorageMgmt ID
  • Quiesce the database
  • Use libStorageMgmt to issue a command to the array to replicate the disk
  • Release the database to continue
  • Use libStorageMgmt to grant access to then newly created disk to an initiator so that it can be mounted and backed-up

Crafting the URI

As the admin is using NetApp they need to select the ontap plug-in by crafting a URI. The URI looks like “ontap+ssl://root@filer_host_name_or_ip/”. The beginning of the URI specifies the plug-in with an optional indicator that the user would like to use SSL for communication. The user “root” is used for authentication, and the filer can be addressed by hostname or IP address. This example will be using the command line interface. We can either specify the URI on the command line with ‘-u’ or set an environment variable LSMCLI_URI to avoid typing for every command. The password can be prompted with a “-P”, or supplied in the environmental variable LSMCLI_PASSWORD.

 

Identify the disk to replicate

The administrator queries the array to identify the volume that the database is located on. To correctly identify which disk the admin first takes a look to see where the file system is mounted by looking for the UUID of the file system. Then they look in /dev/disk/by-id to identify the specific disk.

 

# lsblk -f | grep cd15fc03-749e-4d5b-9960-b3936ff25a62
sdb ext4 cd15fc03-749e-4d5b-9960-b3936ff25a62 /mnt/db

$ ls -gG /dev/disk/by-id/ | grep sdb
lrwxrwxrwx. 1 9 Apr 30 12:24 scsi-360a98000696457714a346c4f5851304f -> ../../sdb
lrwxrwxrwx. 1 9 Apr 30 12:24 wwn-0x60a98000696457714a346c4f5851304f -> ../../sdb

 

We can now use the SCSI disk id to identify the disk on the array.

$ lsmcli -l VOLUMES -t" " | grep 60a98000696457714a346c4f5851304f
idWqJ4lOXQ0O /vol/lsm_lun_container_lsm_test_aggr/tony_vol 60a98000696457714a346c4f5851304f 512 102400 OK 52428800 987654-32-0 e284bcf0-68e5-11e1-ad9b-000c29659817

This command displays all the available volumes for the array. It outputs a number of different fields for each volume on the storage array. The fields are separated by a space ( using -t” “) with the fields defined as: ID, Name, vpd83, block size, #blocks, status, size bytes, system ID and pool ID.

 

Definitions of each:

  • ID – Array unique identifier for the Volume (virtual disk)
  • Name – Human readable name
  • vpd83 – SCSI Inquiry data for page 0×83
  • block size – Number of bytes in each disk block (512 is common)
  • #block – Number of blocks on disk
  • status – Current status of disk
  • size bytes – Current size of disk in bytes
  • system ID – Unique identifier for this array
  • pool ID – Unique storage pool that virtual disk resides on

So, the array ID for the volume we are interested in is idWqJ4lOXQ0O.

 

Quiesce the database

Before issuing the replicate command, quiesce the database. For MySQL this can be done by establishing a connection and run “FLUSH TABLES WITH READ LOCK” and leaving the connection open.

 

Replicate the disk

To replicate the disk the user can issue the command (just outputting result ID for brevity):

$ lsmcli -r idWqJ4lOXQ0O --type CLONE --name "db_copy" -t” “ | awk '{print $1;}'
idWqJ4qtb1f1

 

This command creates a clone (space efficient copy) of a disk. The “-r” indicates replicate with the argument specifying which volume ID to replicate, “-type” is the type of replication to perform and “–name” is the human readable name of the copy. For more information about the available options type “lsmcli –help” or “man lsmcli” for additional information. The command line will return the details of the newly created disk. The output is identical to the information returned if you listed the volume, as shown above. In this example we just grabbed the volume ID as that is all we need to grant access to it in the following steps.

 

Release the database

Once this is done you can call “UNLOCK TABLES” or close the connection to the database.

 

Grant access to newly created disk

To access the newly created disk for backup we need to grant access to it for an initiator. There are two different ways to grant access to a volume for an initiator. Some arrays support groups of initiators which are referred to as access groups. For other arrays you specify individual mappings from initiator to volume. To determine what mechanism the arrays supports we take a look at the capabilities listed for the array.

 

To find out what capabilities an array has, we need to find the system ID:

$ lsmcli -l SYSTEMS
ID          | Name        | Status
------------+-------------+-------
987654-32-0 | netappdevel | OK

Then issue the command to query the capabilities by passing the system id:

$ lsmcli --capabilities 987654-32-0 | grep ACCESS_GROUP

ACCESS_GROUP_GRANT:SUPPORTED
ACCESS_GROUP_REVOKE:SUPPORTED
ACCESS_GROUP_LIST:SUPPORTED
ACCESS_GROUP_CREATE:SUPPORTED
ACCESS_GROUP_DELETE:SUPPORTED
ACCESS_GROUP_ADD_INITIATOR:SUPPORTED
ACCESS_GROUP_DEL_INITIATOR:SUPPORTED
VOLUMES_ACCESSIBLE_BY_ACCESS_GROUP:SUPPORTED
ACCESS_GROUPS_GRANTED_TO_VOLUME:SUPPORTED

 

The Ontap plug-in supports access groups.  In this example, we know the initiator we want to use has iSCSI IQN iqn.1994-05.com.domain:01.89bd03. We will look up the access group that has the iSCSI IQN of interest in it.

 

List the access groups, looking for the IQN of interest to backup too.

 

$ lsmcli -l ACCESS_GROUPS

ID                               | Name    | Initiator ID                     | System ID
---------------------------------+---------+----------------------------------+------------
e11c718b99e26b1ca8b45f2df455c70b | fedora  | iqn.1994-05.com.domain:01.5d8644 | 987654-32-0
e11c718b99e26b1ca8b45f2df455c70b | fedora  | iqn.1994-05.com.domain:01.b7885f | 987654-32-0
0a9a917c8cf4183f4646534f5597eb02 | Tony_AG | iqn.1994-05.com.domain:01.89bd01 | 987654-32-0
0a9a917c8cf4183f4646534f5597eb02 | Tony_AG | iqn.1994-05.com.domain:01.89bd03 | 987654-32-0

 

The one we are interested in has ID 0a9a917c8cf4183f4646534f5597eb02. So at this point we can grant access for the new volume by issuing:

 

$ lsmcli --access-grant-group 0a9a917c8cf4183f4646534f5597eb02 --volume idWqJ4qtb1f1 --access RW

 

If the IQN of interest is not available it can be added to an existing access group or added to a new access group. An example of adding to an existing access group:

 

$ lsmcli --access-group-add 0a9a917c8cf4183f4646534f5597eb02 --id iqn.1994-05.com.domain:01.89bd04 --type ISCSI

 

To see what volumes are visible and accessible to an initiator we can issue:

 

$ lsmcli --access-group-volumes 0a9a917c8cf4183f4646534f5597eb02 -t" " -H
idWqJ4lOXQ0O /vol/lsm_lun_container_lsm_test_aggr/tony_vol 60a98000696457714a346c4f5851304f 512 102400 OK 50.00 MiB 987654-32-0 e284bcf0-68e5-11e1-ad9b-000c29659817
idWqJ4qtb1f1 /vol/lsm_lun_container_lsm_test_aggr/db_copy 60a98000696457714a34717462316631 512 102400 OK 50.00 MiB 987654-32-0 e284bcf0-68e5-11e1-ad9b-000c29659817

 

At this point you need to re-scan for targets on the host. Please check documentation appropriate for your distribution. Once the disk is visible to the host it can then be mounted and then backed up as usual.

 

This sequence of steps would be the same regardless of vendor, only the URI would be different. Other operations that are currently available for volumes include: delete, re-size, replicate a range of logical blocks, access group creations and modification, and a number of ways to interrogate relationships between initiators and volumes. This coupled with a stable API allows developers and administrators a consistent way to leverage these valuable features.

Summary

Having a consistent and reliable way to manage storage allows for the creation of new applications that can benefit from such features. Quickly provisioning a new virtual machine by replicating a disk template with very little additional disk space is one such example. Having an open source project that can be improved, developed, and molded by a community of users will ensure the best possible solution. LibStorageMgmt is looking for contributors in all areas (eg. users, developers, reviewers, array documentation, testing).

References

Documentation

Project: https://sourceforge.net/projects/libstoragemgmt/

Project wiki: https://sourceforge.net/p/libstoragemgmt/wiki/Home/

Assistance

Mailing lists: libstoragemgmt-users@lists.sourceforge.net, libstoragemgmt-devel@lists.sourceforge.net

IRC at #libStorageMgmt http://freenode.net

#Flask, un excelente micro-framework web para python

 

Iniciando un proyecto con MongoDB para la web, me vi en un camino donde no sabía que framework web utilizar, usar django era mucho para las características que necesitaba, yo no usaría su ORM asi que prácticamente dejo de usar medio framework. Por ende después de varios días, gracias a @flaper87 (http://blog.flaper87.org/), me incliné por Flask, descargue la documentación en PDF y en ePub (SI!), empece a leerla y de verdad es muy sencillo iniciar una aplicación web, sin tantos parámetros.

Flask

Es un framework web ligero basado en Werkzeug WSGI toolkit y Jinja2, por ende las plantillas son muy similar a las de Django (Me parece esto inteligente); Flask es llamado microframework, pero lo “micro” no lo tiene en ningún lado, es extensible, asi que se pueden usar extensiones que hacen la vida mas fácil.

La primera versión de Flask, vio luz el primero de abril de 2010, y desde entonces ha ganado popularidad.

Hola Mundo!

En la documentación y la pagina del proyecto muestra un sencillo ejemplo de Flask, el eviterno “Hola Mundo”.

1
2
3
4
5
6
7
8
9
from flask import Flask
app = Flask(__name__)
 
@app.route("/")
def hello():
    return "Hello World!"
 
if __name__ == "__main__":
    app.run()

Documentación

Uno de los punto a favor de este framework es su documentación ordenada, y disponible en diferentes formatos para su descarga y posterior lectura.

La documentación se puede acceder a través de la siguiente dirección: http://flask.pocoo.org/docs/

Seguiré estudiando la doc, y escribiré nuevos artículos de este framework.

May 19, 2013

IIP Image server sous Fedora et RHEL/CentOS

Depuis un certain temps (mars 2009), je maintiens à titre totalement officieux un paquet RPM du serveur IIPImage dans mon dépôt personnel.

J'ai récemment décidé de l'intégrer dans les dépôts officiels, le but de mon dépôt n'étant pas de fournir des paquets sur le long terme, mais davantage de me servir d'incubateur en quelque sorte.... J'ai donc soumis une revue sur le Bugzilla.

Grâce aux conseils toujours très avisés de Remi sur cette revue, j'ai fait évoluer le paquet, apportant certaines modifications qui ne sont pas dénuées d'intérêt :

  • le paquet ne dépend plus de apache HTTPD, ceux d'entre vous qui utilisent d'autres serveurs web peuvent donc installer le paquet sans dépendances disons... farfelues :)
  • une unité Systemd qui permet d'exécuter le serveur seul, sur un port spécifié. Le service n'est disponible que sous Fedora 18 actuellement.

Les paquets nécessaires sont disponibles via mon dépôt pour les versions 17 et 18 de Fedora, ainsi pour les versions 5 et 6 de RedHat (et équivalents). Une fois la revue menée à bien, les paquets seront disponibles sur les dépôts officiels et seront supprimés de mon dépôt personnel.

Si vous souhaitez utiliser Apache HTTPD et mod_fcgid avec le serveur IIP, installez dans un premier temps les paquets adéquats :

$ su -lc 'yum --enablerepo=trashy install iipsrv-httpd-fcgi'

Vous trouverez dans le dossier /etc/httpd/conf.d un fichier nommé iipsrv.conf, dont vous pouvez vous inspirer pour votre configuration spécifique. C'est à peu près aussi simple que ça ; votre serveur IIP est désormais installé. Pour vérifier son fonctionnement de base, rendez vous à l'adresse http://localhost/iipsrv (ou celle que vous aurez configurée) ; vous devriez voir une simple page avec le nom du logiciel, sa version, un lien vers son site web et le nom de l'auteur.

Il semble qu'il ne soit actuellement pas possible de fournir de façon correcte des fichiers de configuration pour les autres serveurs, aussi, si vous souhaitez utiliser le serveur IIP avec un autre serveur web, ou directement en tant que service, installez uniquement le paquet iiprsv ;

$ su -lc 'yum --enablerepo=trashy install iipsrv'

Référez-vous ensuite à la documentation du serveur IIP ainsi qu'à celle de votre serveur web pour paramétrer tout ça correctement.

Si vous souhaitez utiliser le service, notez que l'adresse IP et le port sont configurables via un fichier actuellement disponible dans /etc/iipsrv/iipsrv.conf, dont le contenu est le suivant :

IP=127.0.0.1
PORT=9002

Une fois les valeur adaptées, lancez le serveur comme vous en avez l'habitude :

$ su -lc 'systemctl start iipsrv'

Votre serveur IIP est en route !

Vous pourrez tester ça avec Apache 2.4 et mod_proxy sous Fedora 18, par exemple. Ajoutez à votre configuration la ligne suivante (en adaptant l'hôte et le port si vous avez modifié la configuration par défaut) :

ProxyPass /iipsrv fcgi://127.0.0.1:9002/

Relancez Apache, et le tour est joué. L'adresse http://localhost/iipsrv devrait vous renvoyer la page par défaut.

Notez que par défaut, SELinux ne permettra pas à Apache de se connecter à un port qu'il ne connait pas. Pour y remédier, il vous suffira d'avoir recours aux bons et loyaux services de semanage :

$ su -lc 'semanage port -a -t http_port_t -p tcp 9002'

Notez enfin que ce paquet n'est peut-être pas actuellement dans sa version finale (tant que la revue n'est pas terminée), les modifications ultérieures ne devraient cependant pas avoir trop d'impacts (j'aimerai en être absolument certain, mais ma boule de cristal est malencontreusement tombée par terre récemment, et refuse catégoriquement de fonctionner :p).

N'hésitez pas à participer à la revue, ainsi qu'au projet IIPImage !

xfce4-terminal: Dropdown-Modus nutzen

Bitte beachten Sie auch die Anmerkungen zu den HowTos!

xfce4-terminal im Dropdown-ModusDas xfce4-terminal (ehemals Terminal) verfügt aber Version 0.6 über einen Dropdown Modus. In diesem Modus kann das Terminal wie ein Dropdown-Fenster geöffnet werden.

Der größte Vorteil ist sicher, dass das Terminal in das Icon im Benachrichtigungsbereich minimiert werden kann und dort im Hintergrund weiterhin seinen Dienst verrichtet.

Um den Dropdown-Modus effektiv nutzen zu können, empfiehlt es sich, einen Tastatur-Shortcut zu definieren. Dazu öffnen wir die Tastatur-Einstellungen unter Einstellungen -> Tastatur und wechseln im sich öffnenden Fenster in das Register Tastaturkürzel für Anwendungen. Dort legen wir über hinzufügen einen neuen Tastatur-Shortcut an.

Als Befehl tragen wir

xfce4-terminal --drop-down

ein und vergeben nach dem Klick auf OK die gewünschte Tastenkombination. Anschließend können wir die Tastatur-Einstellungen über Schließen wieder verlassen und das xfce4-terminal über die von uns gewählte Tastenkombination im Dropdown-Modus nutzen.

Ich persönlich habe den Dropdown-Modus auf die F12-Taste gelegt.
Edit: xfce4-terminal ist erst ab Fedora 19 Bestandteil des Fedora Repositories.
Thermic (formerly Heat): Pure python interface for linux temperature sensors

I am a sysadmin for Computer Science House, recently we have been having some issues with our AC units. Since summer is here, and we are running a skeleton crew in Rochester I decided to try and make a monitoring system to keep track of how hot our servers are running. This way we can try and keep ahead of the game and predict what machines will be effected by thermal emergencies first. The first part of this project is called Thermic. Thermic is a small pure python library for grabbing information from a computers temperature sensors on linux. At this point Thermic is really simple. It gives you access to the temperature in Celsius, Fahrenheit, and the sensors label. One of the neat things about Thermic is that it supports both python2 and python3. Check it out on github and pypi

A good nine years.

The Wayback Machine reveals that 20May2004 was the first time it crawled http://planet-india.randomink.org/ It has been nine years of making friends, crowd-surfing, reading about stuff folks are up to, life hacks and so much more. There’s not much to say other than “keep writing!” I know of a number of folks who like what they read and help out by pointing out new feeds which need to be aggregated.

May 18, 2013

Success!
It's a pass on the RHCE exam, w00t w00t!
OpenStack testing session @FLOCK

As you might heard, we at Fedora had FUDCons (Fedora Users and Developers conference), which is now replaced by a conference named Flock. The first one will be held in Charleston, South Carolina between Aug. 9th and 12th. 2013. Coming there is a unique chance this year, to meet many Fedora users and developers to come together, discuss new ideas, work to make those ideas a reality, and continue to promote the core values of the Fedora Community: Freedom, Friends, Features, and First.

OpenStack is a somehow complex thing to setup and to integrate into Linux distributions. Thus, I proposed an OpenStack testing hackfest at Flock, to test the latest build for Fedora, and also to bring users and developers together into one room. Currently, it is not decided, if this session is accepted, so please stay tuned.

Organizing photo libraries

The weather’s picking up so it’s time for spring cleaning around the house. When I moved back to Barcelona three years ago I took with me my old analogue photos and negatives, with the idea of sorting through them at some point and getting them digitized. And while I’m at it, maybe it’s time to pull all my various folders of photos together too and organize them.

Well, I finally started. I grouped the negatives, labeled them by year, put them in individual envelopes, and handed them off to a professional lab to scan them after doing a quick test run on one set (which turned out great, but it’s *really* annoying me that they scan to JPEG by default, charge 40% extra for TIFF, and use a non-multiple-of-8 resolution to scan at which means I can’t losslessly rotate the negatives. Yes, I’m anal.)

So now I pulled together all my various folders of photos, and before I start doing tagging and stuff like that, I want to organize them in a decent folder layout. Googling for ideas pretty much suggests that the way to go is

YYYY/MM/DD

with possibly some description together with the DD

I’m not really happy about that, however, because there are certain things I’d like to be able to do:

  • easily see where photos come from – did I make them ? did I get them from someone ? Did I download them from Facebook ?
  • Are these original files from a camera without editing ?
  • Are these the original scans ? From negatives ? From actual photos ? Or are they retouched, rotated, denoised, …
  • Are these photos SFW ? Can I point my media center slideshow to this directory and have it safely show any photos under it ? (What do you mean, you’ve never snowboarded at night in only your underwear, and mooning the photographer ?) Or maybe not even SFW, but simply watchable and reasonable quality or subject material?

I realize some of these issues can not be resolved simply with a directory layout. But I’m sure some of you must have had similar issues or come up with a slightly better layout ?

Point me in the right direction please.

සාගල පුර විදුහලට පරිගණක විද්‍යාගාරයක් ලබා දීමේ වැඩසටහන – 2013 මැයි මස 18 දිනට මූල්‍ය තත්වය


හන්තාන පාසල් විද්‍යාගාර වැඩසටහන යටතේ නුවර එළිය දිස්ත්‍රික්කයේ වළපනේ අධයාපන කළාපයේ දුෂ්කර පාසලක් වන සාගල පුර විදුහලට පරිගණක පහකින් සහ අවශ්‍ය අනෙකුත් උපාංග වලින් සමන්විත පරිගණක විද්‍යාගාරයක් ලබා දීමේ ව්‍යාපෘතිය අපි දැනටමත් ආරම්භ කර ඇත.


මේ සඳහා ඇස්තමේන්තුගත මුදල රු. 260,000 වන අතර මේ වන විට රු. 80,000ක මුදලක් එක් රැස් කර ගැනීමට හැකි වී ඇත. එයින් රු. 52,000 ක මුදලින් එක් පරිගණයක් මිලදී ගැනීමේ කටයුතු මේ වන විටත් සිදු වෙමින් පවතින අතර නුදුරු අනාගතයේදී එම පරිගණකය සාගල පුර විදුහලේ සිසු දරු දැරියන්ගේ අධයාපනය කටයුතු වඩාත් හොඳින් කරගෙන යාමට සහය වීම සඳහා පාසල වෙත ලබා දීමට අපි බලාපොරොත්තු වෙමු. ඉතිරි පරිගණක හතර සහ අනෙකුත් උපාංග අප වෙත මුදල් ලැබෙන ආකාරය අනුව මිළදී ගෙන පාසල වෙත ලබා දීමට අපි බලාපොරොත්තු දෙමු.
තවද පරිගණක සියල්ල එකවර ලබා දිමෙන් තොරව  මුදල් සූදානම් වූ විගස අදාල පරිගණ ලබා දීම සිදු කරන බව කරුණුවානෙ සලකන්න. එනම් මීළඟ රු25,000 ලැබුණු විගස දෙවන පරිගණකයද ලබා දෙනු ඇත.
රු. 80,000ක මුදල එක් රැස් කර ගැනීම සඳහා මූල්‍යමය දායකත්වය සැපයූ පුද්ගලයින්ගේ නම් පහත සඳහන් වේ.
  • හර්ෂණ වීරසිංහ
  • ජීවන් සූරිය ආරච්චි
  • බන්දුල රණතුංග
  • තිස්ස දොඩංගොඩ
  • රෝහණ දිසානායක
  • අසංග අමරවංශ
  • සිසි කැළුම්
  • ලක්ෂාන් පෙරේරා
  • ප්‍රවීන් ඉන්ද්‍රණාම
  • කල්ප පැතුම්
  • ඩනිෂ්ක නවීන්
මෙම වයාපෘතියේ සාර්තකත්වයට මූල්‍යමය මෙන්ම ප්‍රචාරණයෙන් සහයෝගය දැක්වූ ඔබ සැමට අපගේ අවංක ස්තුතිය පිරිනමමු. ඔබගේ සියළු සහයෝගයන් අනාගත පරපුරේ නැණ පහන් දැල්වීම සඳහාම වනු ඇත.
මෙම පාසලයේ දරුවන් සහ ගුරුවරුන් සඳහා පරිගණක භාවිත කිරීමට අවශ්‍ය මූලික දැණුම ලබා දිමේ පුහුණු වැඩ සටහනක්  ක්‍රියාත්මක කිරීමට නියමිත බැවින්. මේ සඳහා දායක වීමට කැමති අය වෙතොත් අප වෙත දන්වන්න.
 -------------------------------------------------------------------------------------------------------------

ඔබටත් දායක වීමට හැකියාවක් ඇත්නම් පහත සඳහන් වන ඒකා බද්ධ ගිණුමට (Joint Account) ඔබේ මුදල් බැර කර අදාල රිස්ට්පතේ පිටපතක් බන්දුල රණතුංග මහතාට හෝ කල්ප පැතුම් සොයුරාට ලැබීමට සලස්වන්න.

මුදල් ලබා දිමෙන් අනතුරුව බන්දුල මහතාට හෝ කල්ප සොයුරාට අදාල රිසිට්පතේ පිටපත සමඟ ඔබේ නම, අදාල මුදල, දුරකතන අංකය සහ විද්‍යුත් පැතැල් ලිපිනය හෝ සාමාන්‍ය තැපැල් ලිපිනය දන්වන්න.

ගිණුම් අංකය: 8480050534
බැංකුව: කොමර්ෂල් බැංකුව, යුනියන් පෙදෙස.
ගිණුම් හිමියන්: බන්දුල පුෂ්පකුමාර රණතුංග හෝ වැලිවිටිගොඩ හේවගෙ කල්ප පැතුම්
ගිණුම් වර්ගය: ඒකා බද්ධ


COMMERCIAL BANK, UNION PLACE
ACC NO: 8480050534
ACCOUNT HOLDERS
MR BANDULA PUSHPAKUMARA RANATUNGA
OR
MR WELIVITIGODA HEWAGE KALPA PATHUM


මූල්‍යමය දායකත්වන් සඳහා බන්දුල රණතුංග මහතාව අමතන්න:
ජංගම දුරකතන අංකය: 0714315426
විද්‍යුත් තැපෑල: bandula.ranathunga {[AT] } gmail {[DOT]} com
කල්ප පැතුම්:   callkalpa {[AT] } gmail {[DOT]} com 

පරිගණක උපාංග සහ ඒ ආශ්‍රීත තාක්ෂණික තොරතුරු සඳහා අතුල හේරත් මහතාව අමතන්න:
ජංගම දුරකතන අංකය:  0718217443
Cara Memakai Func

Melanjutkan tulisan sebelumnya.

Setelah selesai memasang dan mengkonfigurasi Func, kini saatnya kita coba memakainya.

Saat pertama kali funcd (func daemon) berjalan di minion, dia akan menghubungi certmaster. Kalau sertifikat miliknya belum terdaftar di certmaster maka ia akan automagicly mengajukan permintaan persetujuan.
Yang harus kita lakukan adalah menyetujui permintaan ini di certmaster, yaitu dengan cara menandatangani sertifikat milik minion tersebut.
Jalankan perintah certmaster-ca -l di komputer overload/certmaster untuk melihat daftar permohonan sertifikat.

1
2
[dheche@puppet ~]$ sudo certmaster-ca -l
dheche-laptop.ip

Dari contoh di atas terlihat ada permintaan persetujuan sertifikat untuk dheche-laptop.ip. Kemudian tandatangani sertifikat tersebut.

1
2
sudo certmaster-ca -s dheche-laptop.ip
/var/lib/certmaster/certmaster/csrs/dheche-laptop.ip.csr signed - cert located at /var/lib/certmaster/certmaster/certs/dheche-laptop.ip.cert

Setelah penandatanganan sertifikat, baru kita dapat mengirimkan perintah ke minion-minion yang sertifikatnya sudah ditandatangani.

Coba kita lihat dulu daftar sertifikat sudah ditandangani

1
sudo certmaster-ca --list-signed

Kemudian coba lihat daftar minion yg terdaftar

1
sudo func '*' list_minions

Perhatikan struktur baris perintah tersebut …

1
func [target] [command]

target: bisa kita isi ‘*’ untuk memerintahkan semua minion, atau ‘nama_minion’ untuk memerintahkan spesifik ke minion tertentu. kita juga bisa menggunakan pola tertentu, mis: ‘db*.com’ dsb
command: perintah yang bisa jalankan, antara lain: list_minions, call, show

Sebelum lanjut, kita perlu tahu dulu perintah apa saja sih yg bisa kita kirimkan ke minion? Kita bisa memanfaatkan perintah call untuk memanggil module remote yang ada di minion

1
sudo func '*' call system list_modules

Sekarang kita coba panggil salah satu module untuk melihat method apa yg tersedia. Misalnya kita panggil module command

1
sudo func '*' call command list_methods

Kita coba jalankan salah satu method yg tersedia

1
sudo func '*' call command run 'uname -r'

Sudah ada bayangan ? Coba kita main-main dengan modul-modul lainnya, misalnya modul yumcmd

1
sudo func '*' call yumcmd 'check_update'

Gampang kan ? Func ini keren kalau digabung dengan beberapa tools lainnya, misalnya puppet dan cobbler.
Selamat mencoba.

Icon hack for java applications

After hearing about Android Studio via Google I/O 2013, I have been toying around with underlying software called  IntelliJ IDEA Community Edition which is a pretty sweet free and open source (Apache v2 licensed)  IDE. IDEA was for packaged for a while in Fedora but has been retired unfortunately. Oddly no other linux distribution seems to be packaging it either. So I was trying to figure out how much work it is to revive it. Fedora git still has the old spec files and patches as part of its history. fedpkg clone intellij-idea and figure out the last useful git commit before it was retired via git log and make git point to that via git reset –hard e366b11. Clone the upstream git repo for IDEA and do a quick and dirty build and bingo!

Well… not quite.  Fixing the spec and associated patches etc  to build the latest version and follow the Fedora packaging guidelines would take a lot more work but one of the things that was bugging me was something that started out as a trivial thing yet turned to be a surprising problem.  The icon shown in alt+tab window was blurry. Looked around for a high resolution variant of the same icon and shoved it into hicolor icon theme directory and ran gtk-update-icon-cache only to realize that the GNOME Shell overview is showing a different icon from the one in alt+tab. Head over #fedora-desktop channel and talked to Matthias Clasen, adamw and Kalev and fiddled with a few different settings and still no go.

Read up on how GNOME Shell does the window matching and realize that this is a long standing problem with Java applications. Java sets the WM_CLASS based on the name of the class running the Swing main loop and there is no real Java API to reset it and since many applications can have the same classname, this confuses several desktop environments and window managers. A bug report has been open since early 2007 and I have filed one against Fedora openJDK in addition to the one on poor font rendering, hoping to see some progress on these issues.  Some folks have even developed elaborate hacks to fix the problem but atleast for GNOME Shell, all it took was to run sleep 5; xprop | grep WM_CLASS | awk ‘{print $4}’ and click on the IDEA window which reveals the class name as “jetbrains-idea”. If you rename the desktop file to match the classname (jetbrains-idea.desktop), GNOME Shell is able to pick up the right icon specified in the desktop file regardless of what the name or generic name is.  One can set the latter two to something appropriate like IntelliJ IDEA and GNOME Shell overview and alt+tab window would show that instead. Funky!


May 17, 2013

Chicken Scheme coming to Fedora and EPEL 6

With much help from Scott Olson, I’ve packaged Chicken Scheme for Fedora (and EPEL 6).

Chicken is a Scheme to C compiler that implements the R5RS Scheme language standard. It is portable and runs on x86, x86-64, IA-64, PowerPC, SPARC and UltraSPARC, Alpha, MIPS, ARM and S/390, according to their front page.

Please report any packaging bugs you come across, and we’ll try to get them fixed up.

I’ll outline some of the process for getting it into Fedora below.

Because Chicken distributes its releases as generated C code, and not the Scheme code used to make them, the Fedora Packaging Committee asked me to go through the process of bootstrapping Chicken.

After much discussion with Toshio Kuratomi, I finally understood that the process for bootstrapping a package means that you build it once, as given (with the C sources), then request a Buildroot Override in Bodhi. Once you do that, you wait up to 20 minutes for it to activate, then go compile the original (Scheme, in this case) sources, using the buildroot override’d compiler.

The process looked like this:

  • Decide I want to package.
  • Ask if I need to bootstrap, and get told that it’s iffy[1], but it would probably be a good idea to do it.
  • Write a spec file, with a toggleable %bootstrap flag. This lets us describe the process for building with, and without, the bootstrap available, in the RPM spec file. Building once the buildroot override is active is just a matter of toggling the flag, incrementing the release, and adding a changelog entry.
  • Get the package approved.
  • Build the package in Koji for all branches. (fedpkg build)
    • For the master (rawhide) branch, toggle the bootstrap flag, and increment release, then build again. Rawhide was done after that.
    • For the other branches, do fedpkg build as normal, but don’t do fedpkg update yet. Once the fedpkg build completes, go request a buildroot override.
    • Add the NVR of the fedpkg builds you did above to the buildroot.
    • Wait 20 minutes for the buildroots to generate.
      • It’s worth noting that you don’t need to do anything else to get the buildroot override active. All buildroot overrides are global to all builds.
    • Merge the latest commit from master into each of the branches (where we toggled the bootstrap flag and incremented Release).
    • fedpkg build
    • fedpkg update

Quite a number of steps, but they all make sense once you understand the process.

Once this was done, I convinced Scott to get a FAS account, and got him proxy-sponsored into the packaging group so that he could help maintain the package, since he was a huge help in getting it packaged up.

Enjoy using the package!

Working with GLFW library under Fedora.

This is another tutorial about OpenGL.

The main goal it's : using GLFW library.

It's very simple to use this library.

If you want to read more the go to this website.

sorting srpms by buildorder

Hey folks,
Working on something for Spot I revived some code I had written a
few years ago and then discovered that other people had made much more
robust leveled topological sorts than I had written :)

Anyway – if you grab the files from:

http://skvidal.fedorapeople.org/misc/buildorder/

And run:

python buildorder.py /path/to/*.src.rpm

it will look up the interdependencies of the src.rpm to figure out a
build order. It outputs a bunch of different things:
1. a flat build order
2. a build order broken out by groups – you can build all the pkgs in
any group in parallel provided that all the pkgs in the previous group
have finished building.
3. outputs lists of direct loops between srpms.
4. probably will output A LOT of noise and garbage from the rpm
specfile parsing from the rpm.spec() module

But it might be worth a look at and, ideally, patches to make it a bit
more robust.

If you have a set of pkgs which you need to build but you can’t figure
out the buildorder this might help you out.

I’d love to know how often it is right or ‘right enough’.

Known Issues:
1. some spec files make the rpm.spec() parsing break in interesting
ways – sometimes tracing back :)
2. if a pkg is not dependent on any other pkg and nothing else depends
on it – they get lumped in the last grouping. Not really an issue -
just something someone noticed and was surprised.
3. It will handle file-buildreqs not at all, it will handle virtual
provide buildreqs, not at all, if your buildreqs are REALLY picky about
requiring <= Version – it will ignore all of that. :)
4. I fully expect that 2 or more level circular build deps (foo req bar
req baz req quux) will not be detected but will make the topological
sort function die). If so…. tough… go fix your packaging.

Anyway – give it a run and see if it helps you solve a problem.

If it does let me know about it. Some of us are curious if this could
fit well in mockchain or wrapped around/in mockchain.


Fedora 19 virtualization test day 2013-05-28

Put it in your calendars .. May 28th is Fedora 19 virtualization test day.

New features include nested virtualization on Intel, new Boxes, new libosinfo, new qemu, KMS-based spice driver, live storage migration and virtio RNG.

Every day is libguestfs test day. Just follow the instructions here.


Rawhide kernels and kernel-install
This week we took a patch from Harald Hoyer to the Rawhide kernel.spec to switch to using the kernel-install tool to install the kernel onto the system. This new tool is provided by systemd and is intended to be distribution agnostic, with the eventual goal of getting into the upstream kernel Makefile as well.

Previously, the Fedora kernel package would call a script called 'new-kernel-pkg' to do the boot loader configuration addition, initramfs creation, and depmod steps in the RPM %posttrans script. That script is provided by the grubby package, which despite its name doesn't mean it only works with grub. It works with grub, grub2, silo, yaboot, lilo, and a variety of other bootloaders. However, to the best of my knowledge, it is a Fedora specific package. The other distributions all use their own flavor of initramfs/bootloader tooling for one reason or another.

The kernel-install tool provided by systemd is aiming to replace all of those tools. It was created in part to support the Boot Loader Spec, which aims to create a cross-distro way of managing boot loaders and boot loader entries. The intention is to make dual/multi-distro booting work well without requiring a lot of manual hacks or configuration. If you have questions on this, I would encourage you to talk to Harald Hoyer or Kay Sievers as they're driving that work.

At the moment, Fedora's kernel-install is patched to still call new-kernel-pkg if it exists. That should easy the transition for existing installs and result in machines still working. About the only fallout should be that you won't be able to install Rawhide kernels on older releases of Fedora. The RPM requirements specify that you have systemd >= 203 and dracut >= 027. Of course, there still may be bugs. If you're running Rawhide and hitting issues when you install or remove kernels, let us know.
Func: Fedora Unified Network Controller

Udah lama gak main-main dengan tools untuk maintain server. Kebetulan seminggu ini lagi iseng nyobain banyak hal remeh-temeh gak penting.

Mainan yang pertama, Func (Fedora Unified Network Controller). Ini tools untuk menjalankan suatu perintah ke banyak mesin sekaligus. Dulu udah pernah nyoba sih, sekarang cuma pengen revisit aja, pengen tau ada perkembangan apa. Kebetulan juga saya sudah lama gak jadi sysadmin, jadi itung-itung ini nostalgia … hahahaha

Secara umum, yang kita perlukan setidaknya ada 2 komputer. Komputer pertama berfungsi sebagai Overload (komputer tempat kita menjalankan perintah) dan komputer kedua berfungsi sebagai Minion (komputer yang menerima perintah dari overload).

Yang kita perlukan di Overload adalah Certmaster dan Func. Certmaster ini adalah daemon yang berfungsi untuk menangani sertifikat (semua komunikasi antara overload dan minion dilakukan secara terenkripsi). Sebenarnya certmaster bisa saja dipasang terpisah dari funcd (daemon func), tapi supaya lebih sederhana, saya gabung saja ya.

Sedangkan di Minion, kita hanya perlu func saja.

OVERLOAD

Proses instalasinya sederhana, tinggal yum install func

1
sudo yum install func

yum akan secara automagicly ikut menginstal certmaster

Selanjutnya, konfigurasi di Overload. Sunting berkas /etc/certmaster/minion.conf

1
2
3
4
5
[main]
certmaster = certmaster.ip
certmaster_port = 51235
log_level = DEBUG
cert_dir = /etc/pki/certmaster

Perhatikan baris kedua, isikan dengan hostname server overload. Sesuaikan dengan data DNS atau kalau tidak mau repot-repot, cukup catatkan saja pasangan hostname dan ip di /etc/hosts.
Secara bawaan, certmaster akan memakai port 51235.

Kemudian sunting berkas /etc/func/minion.conf

1
2
3
4
5
6
7
8
[main]
log_level = INFO
acl_dir = /etc/func/minion-acl.d

listen_addr =
listen_port = 51234
minion_name = certmaster.ip
method_log_dir = /var/log/func/methods/

Yang perlu diperhatikan cuma di baris ke tujuh (minion_name), isikan dengan hostname komputer overload.

Izinkan port-port ini di firewall, sunting berkas /etc/sysconfig/iptables

1
2
-A INPUT -m state --state NEW -m tcp -p tcp --dport 51234 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 51235 -j ACCEPT

restart iptables

1
sudo service iptables restart

Kemudian jalankan funcd dan certmaster, serta pastikan ia aktif saat komputer direstart

1
2
3
4
sudo service funcd start
sudo service certmaster start
sudo chkconfig funcd on
sudo chkconfig certmaster on

MINION

Selanjutnya kita pasang func dan konfigurasi komputer minion.

1
sudo yum install func

Sunting berkas /etc/certmaster/minion.conf

1
2
3
4
5
[main]
certmaster = certmaster.ip
certmaster_port = 51235
log_level = DEBUG
cert_dir = /etc/pki/certmaster

Perhatikan baris kedua, isikan dengan hostname server overload.

Kemudian sunting berkas /etc/func/minion.conf

1
2
3
4
5
6
7
8
[main]
log_level = INFO
acl_dir = /etc/func/minion-acl.d

listen_addr =
listen_port = 51234
minion_name = server-web.ip
method_log_dir = /var/log/func/methods/

Yang perlu diperhatikan cuma di baris ke tujuh (minion_name), kali ini isikan dengan hostname komputer minion.
Sebenarnya kita bisa mengosongkan variabel minion_name ini, nanti si certmaster akan automagicly memilihkan nama host yang sesuai, tapi di beberapa kasus saya lebih suka mendefinisikan nama minion ini secara manual, karena kadang kala komputer minion ini memiliki lebih dari 1 ip dan lebih dari 1 nama host, jadi lebih baik didefinisikan manual supaya lebih teratur.

Izinkan port 51234 di firewall, sunting berkas /etc/sysconfig/iptables

1
-A INPUT -m state --state NEW -m tcp -p tcp --dport 51234 -j ACCEPT

restart iptables

1
sudo service iptables restart

Jalankan funcd dan pastikan ia automagicly aktif saat komputer direstart

1
2
sudo service funcd start
sudo chkconfig funcd on

OK, proses instalasi dan konfigurasi Func sudah selesai.
Selanjutnya tinggal cara memakainya, tunggu di tulisan berikutnya.

Menampilkan Kembali Splash Boot Mode Grafis di Grub2

Saat saya menggunakan driver nouvue untuk kartu grafis Nvidia yang ada di laptop, tanpa perlu setting ini itu bisa menampilkan splash boot dalam mode grafis dengan mulus. Tapi setelah menginstal driver proprietary dari nvidia, saat boot plymouth hanya menampilkan mode teks.

Solusinya sederhana, dari menu grub, tekan “c” (tanpa tanda petik ya) untuk masuk ke console.

1
2
3
set pager=1
insmod vbe
vbeinfo

Kemudian cari mode vga yang didukung dari daftar yg ditampilkan. Laptop saya mendukung resolusi 1360x768x32 (catat resolusi ini)

Kemudian pilih font yang diinginkan, misalnya saya memilih menggunakan font DejaVuSansMono, jalankan perintah grub2-mkfont seperti berikut:

1
sudo grub2-mkfont --output=/boot/grub2/DejaVuSansMono.pf2 --size=24 /usr/share/fonts/dejavu/DejaVuSansMono.ttf

Kemudian sunting berkas /etc/default/grub, sesuaikan dengan resolusi dan font yang diinginkan

1
2
3
4
GRUB_VIDEO_BACKEND="vbe"
GRUB_TERMINAL_OUTPUT="gfxterm"
GRUB_FONT_PATH="/boot/grub2/DejaVuSansMono.pf2"
GRUB_GFXMODE="1360x768x32"

Langkah terakhir, backup berkas grub.cfg dan buat baru

1
2
sudo cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg.bkp
sudo grub2-mkconfig -o /boot/grub2/grub.cfg

Restart komputer … selamat menikmati kembali tampilan splash mode grafis yang hilang

Performance Variation in the Cloud

During my talks, I often try to make the point that horizontally scalable systems are often necessary not only to achieve high aggregate performance but also to overcome performance variation. This is true in general, but especially in a public cloud. In that environment, performance variation both between nodes and over time is much greater than in a typical bare-metal environment, and there’s very little you can do about it at the single-system level, so you pretty much have to deal with it at the distributed-system level. I’ve been using a graph that kind of illustrates that point, but it has a few deficiencies – it’s second-hand observation, it’s kind of old, and it’s for network performance whereas I usually care more about disk performance. To illustrate my point even more clearly, I took some measurements of my own recently and created some new graphs. Along the way, I found several other things that might be of interest to my readers.

The methodology here was deliberately simple. I’d get on a node, do whatever disk/volume setup was necessary, and then run a very simple iozone test over and over – eight threads, each doing random 4KB synchronous writes. I then repeated this exercise across three providers. It’s worth noting that each test is on a single machine at a single time. The variation across a broader sample is likely to be even greater, but these samples are already more than sufficient to make my point. Let’s look at the first graph, for a High I/O (hi1.4xlarge) instance.

Amazon I/O variation

Ouch. From peaks over 16K down to barely 6K, with barely any correlation between successive samples. That’s ugly. To be fair, Amazon’s result was the worst of the three, and that’s fairly typical. I also tested a Rackspace 30GB instance, and the measly little VR1G instance (yes, that’s 1GB) that runs this website at Host Virtual. The results were pretty amusing. To see how amusing, let’s look at the same figures in a different way.

IOPS distribution

This time, we’re looking at the number of samples that were “X or better” for any given performance level. This is a left/right mirror image of the more common “X or worse” kind of graph, which might seem a bit strange to some people. I did it this way deliberately so that “high to the right” is better, which I think is more intuitive. Too bad I don’t have comments so you can complain. :-P The way to interpret this graph is to keep in mind that the line always falls. The question is how far and how fast it falls. Let’s consider the three lines from lowest (overall to highest).

  • The Rackspace line is low, but it’s very flat. That’s good. 97% of the samples are in a range from just under 6000 to a bit more under 4000. That’s pretty easy to plan for, as we’ll discuss in a moment.
  • The Amazon line is awful. It has the highest peak on the left, but drops off continuously and sits below the HV line most of the time. As we’ve already noted, the range is also quite large. A flat line across a large range is exactly the opposite of a flat line across a small range; it’s very hard to plan around.
  • The Host Virtual line is the most interesting. 70% of the time it’s very nice and flat, from 13.5K down to 12K, but then it falls off dramatically. Is this a good or bad result? It requires a bit more complex mental model than a flat line, but once you’re used to the model it’s actually better for planning purposes.

Before I describe how to use this information for planning a deployment, let’s talk a bit about prices. That VR1G costs $20 a month. The Rackspace instance would cost $878 and the Amazon instance would cost $2562 (less with spot/reserved pricing). Pricing isn’t really my point here, but a 128x difference does give one pause. When the effect of variation on deployment size is considered, those numbers only get worse. Even when one considers the benefits of Amazon’s network (some day I’ll write about that because it’s so much better than everyone else’s that I think it’s the real reason to go there) and services and so on, any serious user would have to consider which workloads should be placed where. But I digress. On with the show.

Let’s look now at how to use this information to provision an entire system. Say that we want to get to 100K aggregate IOPS. How many instances it would take to get there assuming the absolute best case, and how many it would take to achieve a 99% probability based on these distributions?

<style type="text/css"> table { margin-left: 1cm; } td { text-align: right; } </style>
Provider Best Case 99% Chance Ratio
Amazon 7 13 1.86
Rackspace 14 28 2.00
Host Virtual 8 11 1.38

Here we see something very interesting – the key point of this entire article, in my opinion. Even though Amazon is potentially capable of satisfying our 100K IOPS requirement with fewer instances than Host Virtual, once we take variation into account it requires more to get an actual guarantee. Instead of provisioning 38% more than the minimum, we need to need to provision 86% extra. As Jeff Dean points out in his excellent Tail At Scale article, variation in latency (or in our case throughput) is a critical factor in real-world systems; driving it down should be a goal for systems and systems-software implementors.

Before closing, I should explain a bit about how I arrived at these figures. Such figures can only be approximations of one sort or another, because the number of possibilities that must be considered to arrive at a precise answer is samples^nodes. Even at only 100 samples and 10 nodes, we’d be dealing with 10^20 possibilities. Monte Carlo would be one way to arrive at an estimate. Another way would be to divide the sorted samples into buckets, collapse the numbers within each bucket to a single number (e.g. average or minimum), then treat the results as a smaller number of samples. You can even use enumeration within a bucket as well as between buckets, and even do so recursively (which is in fact what I did). When there’s a nice “knee” in the curve, you can do something even simpler. Just eyeball a number above the knee and a number below, then work out the possibilities using those numbers and probability equal to the percentile at which the knee occurs. Whichever approach you use, you can do more work to get more accurate results but (except for Monte Carlo option) the numbers tend to converge very quickly so you’d probably be overthinking it.

OK, so what have we learned here? First, we’ve learned that I/O performance in the cloud is highly variable. Second, we’ve learned a couple of ways to visualize that variation and see the different patterns that it takes for each provider. Third, we’ve learned that consistency might actually matter more than raw performance if you’re trying to provision for a specific performance level. Fourth and last, we’ve learned a few ways to reason about that variation, and use repeated performance measurements to make a provisioning estimate that’s more accurate than if we just used an average or median. I hope this shows why average, median, or even 99th percentile is just not a good way to think about performance. You need to look at the whole curve to get the real story.

what tag is this commit in?

Thanks to jbowes for saving me time with git. I had a commit and wanted to find out what tag it was in. I tended to do the opposite, given a tag is this commit in it. And boy did I do it the hard way:

git checkout TAG
git checkout -b TAG # assuming there wasn't one already
tig # search for the commit in the list

That was cumbersome and a bit error prone. Now with a simple command I can find the tag more easily.

git describe --contains COMMIT_SHA

[Automation] Cloudforms – May/June 2013 – Belgium

CloudForms

Dear *,

Next week, I will do a presentation about Cloudforms (Hybrid cloud management solution) [1][2].
If your company or you are based in BeNeLux and are interested by this presentation, just let me know and I will try to arrange a meeting for you.

[1] https://www.redhat.com/solutions/

[2] http://www.redhat.com/products/cloud-computing/cloudforms/

BR
Frederic


Hacking Firefox OS Developer Phone

keonProbably you already know about Geeksphone‘s Firefox OS Developer Phones. A couple of days ago I received mine (the Keon version) as a Mozilla Rep for testing and showcasing Firefox OS on upcoming events.

Keon comes with an old Firefox OS build, which means that it misses many cool features already landed on the current release branch (for instance most of the contacts import options), but also makes bug reporting difficult since you have to determine if a bug you’ve found has already been resolved before reporting it.

So with a little help from (Flash)Fredy here are some quick steps to get your Keon device updated :-)

Flash a new Firefox OS build

At Geeksphone forum you’ll find a relevant thread with unofficial recent builds and detailed guidelines on how to flash it on your device. Nothing else to add here, besides the fact that flashing a build comes with a certain amount of risk :-)

Update Gaia

If you are feeling less adventurous you could just update Firefox OS UI (Gaia). The steps are really easy. Plug your device and run:

git clone https://github.com/mozilla-b2g/gaia.git
git checkout v1-train
make reset-gaia

This will restart your device and when it comes back you’ll have the new Gaia.

The tools you need

In order for all the above steps to work you need adb, which stands for Android Debug Bridge and it’s a simple command line tool that helps you communicate with a connected Androd/Linux phone device.

Here are the steps needed to have adb working (at least on Fedora). First download the SDK tools from Android. Let’s assume that you uncompressed the archive on ~/android-sdk/.

cd ~/android-sdk/tools
./android

Then you check to install the “Tools”, that would probably have a “Not Installed” status on your system. This will download and install everything you need under ~/android-sdk/platform-tools.

adb

If you want to use adb from everywhere you have to add it on your system’s PATH. In this case:

export PATH=$PATH:~/android-sdk/platform-tools

You can add this to your ~/.bash_profile for permanent effect.

One last step is to add a udev rule for the specific device. Running lsusb on a terminal gives you the vendor identifier. For Keon this is “05c6″. So you have to add the line below at /etc/udev/rules.d/51-android.rules

SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", MODE="0666", GROUP="plugdev"

and tell udev to re-read the rules:

sudo udevadm control --reload-rules

If you did everything correctly then plug your Keon device and run:

adb devices

You should see a line for keon.

Hack

If you are developing an Open Web App then you could just use Firefox OS Simulator to push it on the Keon device. See how simple that is. The only thing you’ll need for this to work is the udev rule above. You won’t need adb, since the simulator comes with it’s own copy.

If you want to hack around Gaia and the core apps, then just fork the code, do all the changes you want and use your repo to flash Gaia on the phone as described above.

Happy Hacking :-)

 
Important: Don’t ever choose to reset your phone to Factory defaults. It seems that currently you get stuck if you do it and the only way to undo it is by flashing a new build (I speak from experience :P).

flattr this!

WebRTC without a signaling server

WebRTC is incredibly exciting, and is starting to see significant deployment: it’s available by default in Chrome and Firefox releases now. Most people think of WebRTC as an API for video calling, but there’s a general purpose method for directly sharing data between web browsers (even when they’re behind NAT) in there if you look harder. For example:

  • P does peer-to-peer mesh networking in JavaScript.
  • TowTruck allows you to add collaboration features (collaborative text editing, text chat, voice chat) to websites.
  • PeerCDN forms a network from a site’s visitors, and uses it to offload serving up static content away from the web server and on to the networked peers.
  • The Tor Project is interested in using WebRTC to enable volunteers with JavaScript-enabled web browsers to become on-ramps onto the Tor network for users under censorship, as part of the Flash Proxies project. The idea is that censoring organizations may block the public Tor relays directly, but they can’t easily block every random web browser who might route traffic for those relays over WebRTC, especially if each web browser’s proxy is short-lived.

All of this activity means that we might finally be close to solving — amongst other important world problems — the scourge of xkcd.com/949:


xkcd: File Transfer, used under CC-BY-NC 2.5.

I wanted to experiment with WebRTC and understand its datachannels better, and I also felt like the existing code examples I’ve seen are unsatisfying in a specific way: it’s a peer-to-peer protocol, but the first thing you do (for example, on sites like conversat.io) is have everyone go to the same web server to find each other (this is called “signaling” in WebRTC) and share connection information.

If we’re going to have a peer-to-peer protocol, can’t we use it without all visiting the same centralized website first? Could we instead make a WebRTC app that just runs out of a file:/// path on your local disk, even if it means you have to manually tell the person you’re trying to talk to how to connect to you?

It turns out that we can: I’ve created a serverless-webrtc project on GitHub that decouples the “signaling server” exchange of connection information from the WebRTC code itself. To run the app:

  • download Firefox Nightly.
  • git clone git://github.com/cjb/serverless-webrtc.git
  • load file:///path/to/serverless-webrtc/serverless-webrtc.html

You’ll be asked whether you want to create or join a channel, and then you’re prompted to manually send the first party’s “WebRTC offer” to the second party (for example, over an instant message chat) and then to do the same thing with the second party’s “WebRTC answer” reply back. Once you’ve done that, the app provides text chat and file transfer between peers, all without any web server. (A STUN server is still used to find out your external IP for NAT-busting.)

There are open issues that I’d be particularly happy to receive pull requests for:

#1: The code doesn’t work on Chrome yet. Chrome is behind Firefox as far as DataChannels are concerned — Chrome doesn’t yet have support for binary transfers, or for “reliable” (TCP, not UDP) channels (Firefox does). These are both important for file transfers.

#2: Large file transfers often fail, or even hang the browser, but small transfers seem to work every time. I’m not sure whose code is at fault yet.

#3: File transfers should have a progress bar.

Thanks for reading this far! Here’s to the shared promise of actually being able to use the Internet to directly share files with each other some time soon.