Planet Ubuntu

Subscribe to Planet Ubuntu feed
Planet Ubuntu - http://planet.ubuntu.com/
Updated: 18 min 19 sec ago

The Fridge: Ubuntu Weekly Newsletter Issue 497

Mon, 02/06/2017 - 18:55

Welcome to the Ubuntu Weekly Newsletter. This is issue #497 for the week January 30 – February 5, 2017, and the full version is available here.

In this issue we cover:

The issue of The Ubuntu Weekly Newsletter is brought to you by:

  • Elizabeth K. Joseph
  • Chris Guiver
  • Paul White
  • Jim Connett
  • And many others

If you have a story idea for the Weekly Newsletter, join the Ubuntu News Team mailing list and submit it. Ideas can also be added to the wiki!

Except where otherwise noted, content in this issue is licensed under a Creative Commons Attribution 3.0 License BY SA Creative Commons License

Simos Xenitellis: How to create a snap for how2 (stackoverflow from the terminal) in Ubuntu 16.04

Mon, 02/06/2017 - 18:48

Stackoverflow is an invaluable resource for questions related to programming and other subjects.

Normally, the workflow for searching http://stackoverflow.com/, is to search Google using a Web browser. Most probably, the result will be a question from stackoverflow.

A more convenient way to query StackOverflow, is to use the how2 command-line utility.

Here is how it looks:

In this HowTo, we will see:

  1. How to set up snapcraft in order to make the snap
  2. How to write the initial snapcraft.yaml configure
  3. Build the snap with trial and error
  4. Create the final snap
  5. Make the snap available to the Ubuntu Store
Set up snapcraft

snapcraft is a utility that helps us create snaps. Let’s install snapcraft.

$ sudo apt update ... Reading state information... Done All packages are up to date. $ sudo apt install snapcraft Reading package lists... Done Building dependency tree        Reading state information... Done The following NEW packages will be installed:   snapcraft ... Preparing to unpack .../snapcraft_2.26_all.deb ... Unpacking snapcraft (2.26) ... Setting up snapcraft (2.26) ... $_

In Ubuntu 16.04, snapcraft was updated in early February and has a few differences from the previous version. Make sure you have snapcraft 2.26 or newer.

Let’s create a new directory for the development of the httpstat snap and initialize it with snapcraft so that create the necessary initial files.

$ mkdir how2 $ cd how2/ $ snapcraft init Created snap/snapcraft.yaml. Edit the file to your liking or run `snapcraft` to get started $ ls -l total 4 drwxrwxr-x 2 myusername myusername 4096 Feb   6 14:09 snap $ ls -l snap/ total 4 -rw-rw-r-- 1 myusername myusername 676 Feb   6 14:09 snapcraft.yaml $ _

We are in this how2/ directory and from here we run snapcraft in order to create the snap. snapcraft will take the instructions from snap/snapcraft.yaml and do its best to create the snap.

These are the initial contents of snap/snapcraft.yaml:

name: my-snap-name # you probably want to 'snapcraft register <name>' version: '0.1' # just for humans, typically '1.2+git' or '1.3.2' summary: Single-line elevator pitch for your amazing snap # 79 char long summary description: |   This is my-snap's description. You have a paragraph or two to tell the   most important story about your snap. Keep it under 100 words though,   we live in tweetspace and your description wants to look good in the snap   store. grade: devel # must be 'stable' to release into candidate/stable channels confinement: devmode # use 'strict' once you have the right plugs and slots parts:   my-part:     # See 'snapcraft plugins'     plugin: nil

I have formatted as italics the first chunk of configuration lines of snapcraft.yaml, because this chunk is what rarely changes when you develop the snap. The other chunk is the one that the actual actions take place. It is good to distinguish those two chunks.

This snap/snapcraft.yaml configuration file is actually usable and can create an (empty) snap. Let’s create this empty snap, install it, uninstall it and then clean up to the initial pristine state.

$ snapcraft Preparing to pull my-part Pulling my-part Preparing to build my-part Building my-part Staging my-part Priming my-part Snapping 'my-snap-name' |                                                                  Snapped my-snap-name_0.1_amd64.snap $ snap install my-snap-name_0.1_amd64.snap error: cannot find signatures with metadata for snap "my-snap-name_0.1_amd64.snap" $ snap install my-snap-name_0.1_amd64.snap --dangerous error: cannot perform the following tasks: - Mount snap "my-snap-name" (unset) (snap "my-snap-name" requires devmode or confinement override) Exit 1 $ snap install my-snap-name_0.1_amd64.snap --dangerous --devmode my-snap-name 0.1 installed $ snap remove my-snap-name my-snap-name removed $ snapcraft clean Cleaning up priming area Cleaning up staging area Cleaning up parts directory $ ls my-snap-name_0.1_amd64.snap  snap/ $ rm my-snap-name_0.1_amd64.snap rm: remove regular file 'my-snap-name_0.1_amd64.snap'? y removed 'my-snap-name_0.1_amd64.snap' $ _

While developing the snap, we will be going through this cycle of creating the snap, testing it and then removing it. There are ways to optimize a bit this process, learn soon we will.

In order to install the snap from a .snap file, we had to use –dangerous because the snap has not been digitally signed. We also had to use –devmode because snapcraft.yaml specifies the developer mode, which is a relaxed (in terms of permissions) development mode.

Writing the snapcraft.yaml for how2

Here is the first chunk of snapcraft.yaml, the chunk that does not change while developing the snap.

name: how2 # you probably want to 'snapcraft register <name>' version: '20170206' # just for humans, typically '1.2+git' or '1.3.2' summary: how2, stackoverflow from the terminal description: |   how2 finds the simplest way to do something in a unix shell.   It is like the man command, but you can query it in natural language. grade: stable # must be 'stable' to release into candidate/stable channels confinement: strict # use 'strict' once you have the right plugs and slots

We specify the name and version of the snap. The name is not registered already and it is not reserved, because

$ snapcraft register how2 Registering how2. Congratulations! You're now the publisher for 'how2'.

We add a suitable summary and description that was copied conveniently from the development page of how2.

We set the grade to stable so that the snap can make it to the stable channel and be available to anyone.

We set the confinement to strict, which means that by default the snap will have no special access (no filesystem access, no network access, etc) unless we carefully allow what is really needed.

Here goes the other chunk.

apps:   how2:     command: how2 parts:   how2:     plugin: nodejs     source: https://github.com/santinic/how2.git

How did we write this other chunk?

The apps: how2 : command: how2 is generic. That is, we specify an app that we name as how2, and it is invoked as a command with the name how2. The command could also be bin/how2 or node how2. We will figure out later whether we need to change it because snapcraft will show an error message.

The parts: how2: plugin: nodejs is also generic. We know that how2 is build on nodejs and we figured that one out from the github page of how2. Then, we looked into the list of plugins for snapcraft, and found the nodejs plugin page. At the end of the nodejs plugin page there is a link to examples for the user of nodejs in snapcraft.yaml. This link is actually a search in github with search terms filename:snapcraft.yaml “plugin: nodejs”(in all files that are named snapcraft.yaml, search for “plugin: nodejs”). For this search to work, you need to be logged in to Github first. For the specific case of nodejs, we can try without additional parameters as most examples do not show a use of special parameters.

Work on the snapcraft.yaml with trial and error

We come up with the following snapcraft.yaml by piecing together the chunks from the previous section:

$ cat snap/snapcraft.yamlname: how2 # you probably want to 'snapcraft register <name>' version: '20170206' # just for humans, typically '1.2+git' or '1.3.2' summary: how2, stackoverflow from the terminal description: |   how2 finds the simplest way to do something in a unix shell.   It is like the man command, but you can query it in natural language. grade: devel # must be 'stable' to release into candidate/stable channels confinement: strict # use 'strict' once you have the right plugs and slots apps:   how2:     command: how2     plugs:       - network parts:   how2:     plugin: nodejs     source: https://github.com/santinic/how2.git

Let’s run snapcraft in order to build the snap.

$ snapcraft clean Cleaning up priming area Cleaning up staging area Cleaning up parts directory $ snapcraft Preparing to pull how2 Pulling how2 ... Downloading 'node-v4.4.4-linux-x64.tar.gz'[===============================] 100% npm --cache-min=Infinity install ... npm-latest@1.0.2 node_modules/npm-latest ├── vcsurl@0.1.1 ├── colors@0.6.2 └── registry-url@3.1.0 (rc@1.1.6) ... Preparing to build how2 Building how2 ... Staging how2 Priming how2 Snapping 'how2' |                                                                               Snapped how2_20170206_amd64.snap $ _

Wow, it created successfully the snap on the first try! Let’s install it and then test it.

$ sudo snap install how2_20170206_amd64.snap --dangerous how2 20170206 installed $ how2 read file while changing /Cannot connect to Google. Error: Error on response:Error: getaddrinfo EAI_AGAIN www.google.com:443 : undefined $ _

It works again, and the only problem is the confinement. We need to allow the snap to access the Internet, and only the Internet.

Add the ability to access the Internet

To be able to access the network, we need to relax the confinement of the snap and allow access to the network interface.

There is an identifier called plugs, and accepts an array of names of interfaces, from the list of available interfaces.

In snapcraft.yaml, you can specify such an array in either of the following formats:

plugs: [ network] or plugs:    - network

Here is the final version of snapcraft.yaml for how2:

name: how2 # you probably want to 'snapcraft register <name>' version: '20170206' # just for humans, typically '1.2+git' or '1.3.2' summary: how2, stackoverflow from the terminal description: |   how2 finds the simplest way to do something in a unix shell.   It is like the man command, but you can query it in natural language. grade: devel # must be 'stable' to release into candidate/stable channels confinement: strict # use 'strict' once you have the right plugs and slots apps:   how2:     command: how2     plugs: [ network ] parts:   how2:     plugin: nodejs     source: https://github.com/santinic/how2.git

Let’s create the snap, install and run the test query.

$ snapcraft Skipping pull how2 (already ran) Skipping build how2 (already ran) Skipping stage how2 (already ran) Skipping prime how2 (already ran) Snapping 'how2' |                                                                               Snapped how2_20170206_amd64.snap $ sudo snap install how2_20170206_amd64.snap --dangerous how2 20170206 installed $ how2 read file while changing terminal - Output file contents while they change You can use tail command with -f  :    tail -f /var/log/syslog It's good solution for real time  show. Press SPACE for more choices, any other key to quit.

That’s it! It works fine!

Make the snap available in the Ubuntu Store

The command snapcraft push will upload the .snap file to the Ubuntu Store. Then, we use the snapcraft release command to release the snap into the beta channel of the Ubuntu Store. Because we specified the grade as devel, we cannot release to the stable channel. When we release a snap to the beta channel, it is considered as released to the edge channel as well (because beta is higher than edge).

$ snapcraft push how2_20170206_amd64.snap Pushing 'how2_20170206_amd64.snap' to the store. Uploading how2_20170206_amd64.snap [====================================================================] 100% Ready to release!|                                                                                             Revision 1 of 'how2' created. $ snapcraft release how2 1 stable Revision 1 (strict) cannot target a stable channel (stable, grade: devel) $ snapcraft release how2 1 beta The 'beta' channel is now open. Channel    Version    Revision stable     -          - candidate  -          - beta       20170206   1 edge       ^          ^ $ _

Everything looks fine now. Let’s remove the manually-installed snap and install it from the Ubuntu Store.

$ snap remove how2 how2 removed $ snap info how2 name:      how2 summary:   "how2, stackoverflow from the terminal" publisher: simosx description: |   how2 finds the simplest way to do something in a unix shell.   It is like the man command, but you can query it in natural language.   channels:                 beta:   20170206 (1) 11MB -   edge:   20170206 (1) 11MB - $ snap install how2 error: cannot install "how2": snap not found $ snap install how2 --channel=beta how2 (beta) 20170206 from 'simosx' installed $ how2 how to edit an XML file How to change values in XML file Using XMLStarlet (http://xmlstar.sourceforge.net/): ...omitted...

Costales: 2 Años con Ubuntu Phone: Pasado, presente, futuro

Mon, 02/06/2017 - 13:44
Hace exactamente 2 años, el 6 de Febrero del 2015, Canonical me hacía entrega como insider del bq E4.5, un par de meses antes de su venta al público.

Presentación Ubuntu Phone en Londres

Y sí, usé Ubuntu Phone durante 2 años en exclusiva (excepto unos pocos días que jugué con Firefox OS y Android).
 
E4.5

PasadoYo estaba muy feliz con mi bq E4.5 cuando ¡Oh sorpresa! Canonical nos entregaba un Meizu MX4.


Eran los buenos tiempos, con dos compañías volcadas en Ubuntu Touch, sacando a posteriori el bq E5, el Meizu PRO 5 y la tablet bq M10. Y una Canonical publicando actualizaciones OTA cada mes y pico.

Tablet M10
En estos 2 años leí muchos artículos sobre los primeros terminales. Casi todos desfavorables. Se olvidaban de que eran móviles para early adopters y les hacían reviews comparándolos con lo mejor de Android. ¡Fail! Para ser justos estas primeras versiones de Ubuntu Phone superaban a las primeras versiones de Android e iOS.

A nivel personal, nacían uNav y uWriter :')) Con un éxito arrollador que me sorprendió.

Ubucon Paris 15.10PresenteGrandes baluartes de Ubuntu, como David Planella, Daniel Holbach o Martin Pitt abandonan Ubuntu. Y junto a eso leo que Canonical para el desarrollo del móvil, con una redacción que no invita al optimismo. Pero ese 'para' no significa 'abandona'.

UBPorts coge relevancia en estos últimos meses trabajando en los ports de Fair Phone 2 y OnePlus One.


FairPhone 2FuturoEl presente no puede hacer que me sienta especialmente optimista. Ya no sólo por Ubuntu Touch en particular, si no por el mercado móvil en general. Un excelente Firefox OS que murió, un SailfishOS que se mantiene a duras penas, un Tizen que sólo papa Samsung mantiene con vida y un Windows Phone que se mantiene tercero en base a pasta del number one en el escritorio.
Y es que a pesar de la falta de privacidad, seguridad y en especial de software libre, nadie tose a Android.

Imagen de neurogadget


¿Y cómo plantea Ubuntu ese futuro tan negro? Pues podemos decir que Canonical se va a jugar el todo o nada a una sola carta: snap.

snap

Debo aclarar aquí el estado actual: En PC tenemos Ubuntu con Unity 7 y en móvil Ubuntu con Unity 8. Pero todo es el mismo Ubuntu, la misma base.

Y esa es la jugada, a corto plazo deberíamos tener un Ubuntu con Unity 8 tanto en PC como en móvil y basado en paquetes snap (que no tienen problemas de dependencias y tienen muchísima seguridad al 'isolar' las aplicaciones).

Y ahí entra en juego la convergencia: Mismo Ubuntu, mismas aplicaciones, distintos dispositivos.

Imagen de OMG Ubuntu!
Pero el coste de esta jugada podría ser muy caro: Dejar atrás toda la base actual de móviles (se salva la tablet), por usar Android de 32 bits y el salto implicaría usar 64bits lo cual no parece factible.

Martin Pitt: Migrated blog from WordPress to Hugo

Mon, 02/06/2017 - 13:04

My WordPress blog got hacked two days ago and now twice today. This morning I purged MySQL and restored a good backup from three days ago, changed all DB and WordPress passwords (both the old and new ones were long and autogenerated ones), but not even an hour after the redeploy the hack was back. (It can still be seen on Planet Debian and Planet Ubuntu. Neither the Apache logs nor the Journal had anything obvious, nor were there any new files in global or user www directories, so I’m a bit stumped how this happened. Certainly not due to bruteforcing a password, that would both have shown in the logs and also have triggered ban2fail, so this looks like an actual vulnerability.

I upgraded to WordPress 4.7.1 a few days ago, and apparently 4.7.2 fixes a few vulnerabilities, although all of them don’t sound like they would match my situation. jessie-backports is still at 4.7.1, so I missed that update. But either way, all WordPress blogs hosted on my server are down for the time being.

I took this as motivation to finally migrate to something more robust. WordPress has tons of features that I never need, and also a lot of overhead (dynamic generation, MySQL, its own user/passwords, etc.). I had a look around, and it seems Hugo and Blogofile are nice contenders – no privileges, no database, outputting static files, input is Markdown (so much nicer to type than HTML!), and maintaining your blog in git and previewing the changes on my local laptop are straightforward. I happened to try Hugo first, and like it enough to give it an extended try – you have plenty of themes to choose from and they are straightforward to customize, so I don’t need to spend a lot of time learning and crafting CSS.

I ran the WordPress to Hugo Exporter, and it produced remarkable results – fairly usable HTML → Markdown and metadata conversion, it keeps all the original URLs, and it’s painless to use. Nicely done!

So here it is, on to a much more secure server now! \o/

Costales: FOSDEM 2017

Mon, 02/06/2017 - 05:03
Viajar a algunas Ubucons me ha permitido conocer a personas excepcionales de la comunidad. Y en esta ocasión, me animé a asistir al FOSDEM en Bruselas, uno de los eventos más importantes de Europa en cuanto a software libre.
VIERNES 3 DE FEBRERO - BEER EVENTLlegué el primero al evento cervecero del viernes, al que pronto se unieron Marius, Ilonka, Diogo, Tiago, Laura, Rudy y Quest. El famoso Delirium Cafe estaba muy petado y eso que sólo podían entrar asistentes a FOSDEM.Olive, Quest, Rudy, Tiago y yoAhí estuvimos conversando sobre Ubuntu y disfrutando de buena cerveza, hasta que a la 1 nos retiramos cogiendo un autobús dirección a la casa de Diogo (que me hospedó en su casa ¡Gracias Diogo!), pero ops... íbamos en el autobús equivocado que nos alejó 30km al sur de la ciudad. Tuvimos que volver en un taxi en la gélida madrugada belga. Aunque Diogo, con su buen humor característico, intentaba animarnos a Tiago y a mi intentando que disfrutaramos de las vistas de un edificio con luces de colores que había cerca.
SÁBADO 4 FEBRERO - CONFERENCIAS (DE MOZILLA)Este será mi único día de conferencias, pues el domingo tengo el avión de vuelta temprano.No había apenas charlas sobre Linux o Ubuntu, así que disfruté el día entero en el aula de Mozilla.
Rina Jensen abrió el día con una charla muy interesante sobre qué motiva a la comunidad de código abierto.
Continuó Pascal Chevrel, con quien trabajé muchísimo en el pasado para la localización de Firefox al asturiano. No lo había conocido antes en persona y moló ponerle cara :)
Tras Pascal, Alex Lakatos nos mostró el potencial de las Herramientas de Desarrollador que están preinstaladas en Firefox. Y Daniel Scasciafratte nos contó el potencial de las webextensions.
Rina Jensen
El gran Pascal
Un invitado especial
La sala estuvo muy llena casi todo el día
Interrumpí la sesión para ir a comer con Tiago y Diogo. Tras comer coincidí con Jeroen, que no le veía desde la Ubucon Europe. Charlamos largo y tendido, tanto, que me salté 6 charlas.Jeroen y yo
De vuelta a la conferencia de Mozilla ví demostraciones como las de Eugenio Petulla con el A-Frame para realidad virtual.
El potencial de javascript para crear juegos HTML5, por Istvan Szmozsanzky y cómo de fácil es flashear ese juego en una miniconsola Arduboy.
Las últimas conferencias fueron las de Daniel Stenberg con una gran sala abarrotada sobre qué será lo siguiente a HTTP/2, la de Robert Kaiser sobre las alternativas para loguearse en webs, Leo McArdle sobre Discourse, Kristi Progri sobre el papel de la mujer en el software libre en general y Mozilla en particular y Glori Dwomoh sobre como obtener más atención y empatía cuando hablemos de nuestra comunidad.
Finalizó una muy amena charla de Raegan MacDonald sobre asuntos actuales de copyright.
Raegan MacDonaldTras las charlas nos reunimos parte de los ubunteros, alargando la noche con unas pizzas y cerveza en el centro de la ciudad.
Centro de BruselasRudy y Tiago
¡Hasta la próxima!