Here is the solution to Emacs mastery (from someone who watches other people’s YouTube videos…):

Learning

More Learning

Yet More Learning

Practice, More Practice…

Time to repeat.

 

Yet… More challenges:

Lots to learn

Huge number of options

Infinitely configurable

Which way is best

Vast software selection

Lots of online sources, spread around

 

Keys to overcoming challenges

Master self-confidence

Pick one problem at a time, and work hard on it

Take time to enjoy the new power gained. Feel rewarded.

Choose the next option.

(if this helps) Document what you did.

The instructions provide clues, but don’t spell out, how to set up org2blog for multiple blogs. https://github.com/punchagan/org2blog

(setq org2blog/wp-blog-alist 
  '(("wordpress" :url "http://username.wordpress.com/xmlrpc.php"
     :username "username"
     :default-title "Hello World"
     :default-categories ("org2blog" "emacs")
     :tags-as-categories nil) 
    ("my-blog" :url "http://username.server.com/xmlrpc.php"
     :username "admin")))

But what if you don’t want to specify your username and password in this multi-site set-up?

The answer lies in expanding on the elisp provided.

(let 

 (creds-stevedowe creds-warpuni creds-status)
 (add-to-list 'auth-sources "~/.netrc") 
 
 (setq creds-stevedowe (auth-source-user-and-password "stevedowe.me")) 
 (setq creds-warpuni (auth-source-user-and-password "warpuni.com")) 
 (setq creds-status (auth-source-user-and-password "status.warphost.net"))

 (setq org2blog/wp-blog-alist 
  `( ("stevedowe.me"
      :url "https://dowe.io/xmlrpc.php"
      :default-categories ("me" "process" "things" "world")
      :tags-as-categories nil
      :username ,(car creds-stevedowe)
      :password ,(cadr creds-stevedowe)) 

     ("warpuni.com"
      :url "https://warpuni.com/xmlrpc.php"
      :default-categories ("Analytics","BioData","FreeSoftware","Internet","Mobile","News","Productivity","Security","Social" "Support")
      :tags-as-categories nil
      :username ,(car creds-warpuni)
      :password ,(cadr creds-warpuni)) 

     ("status.warphost.net"
      :url "https://status.warphost.net/xmlrpc.php"
      :tags-as-categories nil
      :username ,(car creds-status)
      :password ,(cadr creds-status)))))

[ This is a legacy post. Some details may no longer be relevant to modern software implementations. ]

Gtypist menu options
Gtypist menu options
GNOME Terminal showing gtypist menu

Looking for a free software program to help me learn to touch-type, and shortly after my search started I found GNU Typist.  And GNU Typist (gtypist) is a gem.

The instructions are simple and the purpose of the program is equally simple: to “condition” the user into adopting and maintaining good typing habits.  After starting the basic lessons (“Quick QWERTY course”), it soon became clear that my touch-typing capability was far poorer than I had hoped and my typing speed these days is generally just luck-driven.

Thankfully, a considerate fellow called Simon Baldwin decided to write gtypist, and here we are.  The online documentation is equally useful; not only do you get help regarding how to acquire, install and invoke gtypist on your machine, but also a list of alternative free software typing programs which are a good fit in various situations (general, education, games-playing, etc).  Like most GNU software, a man page is also provided.

It is so easy to take this effort for granted, and yet how useful is this resource! Such is the way with free software: quite often, somebody already had that itch and had to scratch it.

Yes, I really could not think of a better title for this. 🙂

Recently I added a new drive, connected by USB, to a test server. It was for sharing with a virtual machine running on that server.

Chain of oops

When I connected the drive to the host, I decided to create a volume group and logical volume on it. This would have been fine, were it not that I then attempted to mount this logical volume in the host, rather than the guest.  The problem, as I later discovered, was that I’d created a volume group in the host, with the same name as a volume group in the guest.  Again, this would have been fine on its own, but the chain of errors was complete when I made the following next moves:

  • Shared the physical disk with the virtual machine
  • Activated the LVM volume group on the physical disk inside the virtual machine’s operating system (debian)

To its credit, LVM seemed to handle this quite well, and (if memory serves) merged my new logical volumes into one great volume group.

Identity crisis

Switching between different “hosts” (physical host and virtual guest) to edit logical volumes is not very clever, though.  The reason is that lvm, within an operating system with drives available at certain locations, will update those drives’ metadata where each drive is a physical disk that is assigned to a volume group.

Let me put this another way:  if you have /dev/sda1, /dev/sdb1 and /dev/sdc1 all as PVs (physical volumes) that belong to a VG (volume group), then making a change to the volume group – e.g. something simple like vgrename – will affect those three physical volume’s metadata.

Now, once you have finished doing this in the physical host and start playing around with the VG in your guest’s operating system, things aren’t going to look quite right.  If you exported /dev/sdc1 from the host to the guest, the guest might:

  • recognise the device at another location, such as /dev/sdb1
  • look at it with lvm and wonder where /dev/sda1 and /dev/sdc1 are…
  • let you edit this physical volume’s metadata (using LVM tools) in such a way that you cause further problems for yourself back in the physical host, if you planed to share it back there again.

The golden rules for an easy life, so far, are:

  • Don’t share volume groups and logical volumes between hypervisors and guests.
  • You can share a physical disk to a guest, but if you intend to use a logical volume on it within the guest, create it within the guest.  And use it only within the guest.
  • If you must manage and share logical volumes from the host to the guest, use NFS.

If you have already created a nightmare of “unknown” disks and missing PVs…

It’s not too difficult to remedy a tricky situation with messed up volume groups.  If you are absolutely, positively, 100% certain that you no longer require the missing physical volumes in your VG, then there are actually only three (or four) commands you need:

# lvm vgreduce --removemissing -f <volume group name>

This attempts to remove the missing PVs from your VG and writes an up-to-date config file in /etc/lvm/backup/.  If you inspect that file you’ll see a physical_volumes { } stanza which encompasses the physical volumes now remaining in your VG.

However, pay close attention to the status attribute of each PV.   You may also see the remaining entry has:

status = ["MISSING"]

If you then attempt a

# vgchange -ay <volume group name>

you may find that the VG will not become active and this file again contains several entries, related to the missing PVs that you thought you’d just removed.  The reason for this is that the remaining PV(s) have old meta-data which hasn’t been updated by LVM when you did that lvm vgreduce, earlier.  Fear not.

Issue:

# lvm vgextend --restoremissing <volume group name> /path/to/PV

e.g. /path/to/PV might be /dev/sdb1 – you’ll need to know this, no guesses 🙂

After this, inspect the backup config file that you looked at previously.  The status should have changed from “missing” to “allocatable”.  However, the missing PVs will still be present, so let’s get rid of them:

# lvm vgreduce --removemissing -f <volume group name>

Now take one more look at that config file.  It should just contain the PVs that are present and assigned to your VG.

Try activating the VG:

# vgchange -ay <volume group name>

1 logical volume(s) in volume group "<volume group name>" now active

If you’ve got this far, you’re basically on the home straight.  Simply mount the LV on the file system and away you go!

#CITIZENFOUR

For those who value freedom.

I was lucky to have spotted a recent social media post, alerting me to showings of CITIZENFOUR in London over the past weekend. CITIZENFOUR, in case you are not aware, is a film made by celebrated filmmaker Laura Poitras (Praxis Films), who accompanied journalists Glenn Greenwald and Ewan MacAskill to Hong Kong to interview Edward Snowden in the summer of 2013.

My partner and I took a train to Wimbledon. It was an uncharacteristically warm day, summer-like in all regards except the browning of the leaves. The trees looked tired as we marched along to the station; we weren’t missing this film for anything.

In contrast to the anticipation building up inside of me, waiting to see this film, Wimbledon itself was very ordinary. People going about their normal lives. Appetizing whiffs of just-cooked food were wafting over from the market stalls. Traffic was permanently in a hurry with barely any regard for pedestrians’ safety. And the shoppers held an equally high regard for the traffic too, voluntarily stepping out in front of anything coming.

And the shoppers …
voluntarily stepping out in front of anything coming.

The matinée showing at the bijou HMV Curzon cinema was starting just after lunch. I wanted to get there early so that, in anticipation of the queues, we would be assured of a good seat. When picking up our tickets, we spoke to a member of staff behind the bar/counter about the expected numbers.

Staggeringly, four seats had been booked. Including ours. Citizens: four.

To my slight relief, more than four people eventually turned up and attended the showing. Twenty, maybe. Perhaps thirty, tops. In a 110-seat room. And they were comfortable seats too. The best you’d find in any cinema, with lots of leg room and deep, comfortable cushions.

A Tale of Two Cities

After reading Lawrence Lessig’s blog post of his recent cinema outing in Cambridge, Massachusetts, with 500 movie-goers attending their picture house, I wondered how there could be such disparity across the pond. For us, there was no line to stand in before entering, and perhaps adding insult to injury, our tickets were not even checked by a member of staff when we walked in to pick our (unallocated) seats.

Perhaps it was the over-air-conditioned screen that turned people away. Considering that outside it was the very end of the British summer and we saw temperatures of 20 deg C, inside was another story altogether. We were lucky if it was more than 14. But I don’t think this was the reason for the poor turn-out; any evidence of forward-thinking would surely have improved the attendance?

What does this say about continued British apathy towards such fundamental issues?

A somewhat senior lady who attended the film, mentioned to me on her way out, “I don’t think I meant to come and see that. I thought it was something else.Citizen Kane, perhaps? I hope she wasn’t one of the original four who bought in advance…

Perhaps people felt it was a story already told. In some ways it was – but arguably, in many ways the whole story had not been told until now. A couple of reveals towards the end of the film were new information to me. Stuff I wasn’t aware of, from reading the Snowden book.

The Wombles

I am glad that a healthy number of people in the US are curious about this subject and decided to explore it further. You might expect this from the residents of Cambridge (Mass.), with its connection to Free Software and socio-political activism, and well done to them.

So, a quick glance at the population numbers of both areas provides some fairly meaningless stats on which to close.

Cambridge’s popn = 107,000 or so. Wimbledon’s: around 60,000.  Roughly speaking, for every 214 residents in Cambridge, one person attended Saturday’s matinée there. Only one person of every 3,040 in Wimbledon managed the same feat.  What does this say about continued British apathy towards such fundamental issues?

I am left feeling that provided Centre Court and strawberries are always available, Wimbledon won’t care much.  Unless, of course, someone personally has an infraction with the law, as a result authoritarian paranoia.  Then, perhaps, it might fill a column in page 7 of the local rag.  Residents might even chat about this at a local pub, in-between opinions on the state of the brew.

But to complain against wrongdoings is normal.  It’s human nature to focus on the oppressors rather than the oppressed.   Luckily, for us, in respectable communities there still burns a glimmer of hope that sense may prevail.

If it hasn’t been said enough times already, let it be said once more: Emacs and org-mode are quite probably the best way ever to organise your personal life.

Emacs, for starters

Emacs as a text editor is rock solid. If you have a computer where you type in text and which:

  • is web based (e.g. a chromebook)
  • has any kind of touch interface (a tablet, phone)
  • is running a heavy GUI (graphical user interface)

.. then you are certain to observe a certain lag on input. It might be very slight, but it will likely be there. I know this to be the case for many devices out there, even those which purport to be “high-end”.

With Emacs, there seems to be a much more direct connection to the keyboard: you type, text appears. You type faster, text appears faster. In fact, text is capable of appearing much more quickly than you can possibly type. This makes blogging quick and painless.

org-mode, for main course

Life in Emacs simply came to be, through org-mode. Emacs itself is amazing; org-mode made organising data even better. A quick refresher:

  • org-mode creates everything in plain text, for maximum portability between systems
  • it is known as an “outline mode” enhancement for Emacs, meaning it helps to display semi-structured text effectively
  • it allows for the creation of lists – of projects, tasks, notes, links … you name it, anything that can be represented in text
  • it is portable, allowing for synchronisation with mobile devices
  • using Emacs, it is powerful – allowing org-mode notes to interact with other aspects of Emacs
image of org-mode
org-mode in action: showing a list of links

Org-mode also supports all sorts of fancy formatting and customisation, meaning text can look good and be easy to follow.

org2blog, for desert

What would all this power be for, unless blogging! 🙂

Actually, blogging is just one activity which benefits greatly from the power of org-mode, as org’s powerful and easy formatting options are seamlessly translated into HTML and published to a blog.

In my case, I’m using a WordPress site. I create a new post using the commands

M-x org2blog/wp-login
M-x org2blog/wp-new-entry

I then type in my post and save it to a local file, using

C-x C-s

and then post it to WordPress for subsequent tweaking, with

M-x org2blog/wp-post-buffer

I can then add some final polish and check the format in WordPress before final publishing.

As a demo and an indication of speed, this blog post took only 5 minutes to write, post, edit and publish.

My philosophy behind this review is not just to compare the phone directly with other Android or iOS handsets, but also to focus on what it offers, independently of those other platforms.

In other words, for what this phone and OS provide, how well do they do it..?

Unboxing & initial impressions

I ordered through ZTE’s UK-based ebay site.  The phone was dispatched via the 48hr Royal Mail delivery service, which is where £5 of my £38.99 spend was allocated.  This was pleasing and does confer a certain progressive philosophy of ZTE.  It also means the handset + accessories cost only £33.99 including UK VAT (sales tax), which I find astonishing.

The packaging was robust and served its purpose.  After removing the colourful box from its mail bag, and opening it up, there I was greeted with the phone in somewhat cheapish-looking celophane.  Nevertheless, unwrapping indeed exposed the Open C as expected – not bright orange or blue, but dark and moody black – the way I like my phones!

Although I was expecting the handset to feel cheap, I was actually pleasantly surprised.  For its price, it feels very reasonable.  The materials – including the screen – naturally are plastic, but given the feel of the plastic one expects from a stock Samsung Galaxy S4 (that is, not premium!), the Open C had a feel to it more like that of a pebble, with its soft-touch almost rubberised plastic rear cover.

Size comparison: Open C vs Galaxy S4
Size comparison: Open C (left) vs Galaxy S4 (right)

Attractive design features include the recessed ear speaker, which sits snuggly atop of the screen, and the subtle, angular curvature towards the base of the phone, which meets the centred microUSB socket smoothly and seamlessly.  An iPhone 4 user I handed the device to commented on how nice in the hand it felt, and I must agree – it’s very comfortable to hold.

The compact charger and USB cable are standard fare, but the included earphones/headset are distinctly “cheap”.  In this case, you get what you pay for, but this is a minor thing.

Recessed ear speaker
The recessed ear speaker at the top of the screen is attractively styled.

Powering on

Start-up and set-up

Taking the rear cover off the phone revealed the battery compartment, SIM slot and microSD slot.  The battery was a very snug fit and the SIM slipped into the slot just fine.  The microSD card slot wasn’t quite as reassuring, and I felt the need to double-check I’d inserted the card far enough.   There are no spring-clip card slots on this phone; a clear cost-saver.  But cover back on, this was no issue, and the cover feels integral to the phone once back in place.

The software set-up feature of the phone has been well covered elsewhere, so I won’t go into that here.  One annoyance was that the phone couldn’t pick up my local time from any network I connected to, which I found unusual and slightly inconvenient.  The UI to change date and time was slightly unintuitive but the task was soon accomplished.

Boot-up and running through this “wizard” was relatively quick and the phone was ready to use within a few minutes.

Getting contacts into the phone

The ThunderSync Add-On for Thunderbird can export your addressbook as VCard files.  Although on first attempt these files were not recognised to import into the phonebook, trying again – once the phone’s set-up process had completed – yielded success.  241 VCard contacts imported perfectly.

The Import from SIM card function worked perfectly, as did the Import from Facebook feature.  I didn’t try the Import from GMail feature, as I don’t store contacts there.

Considering these features are what the phone offers, I would say that it manages these tasks reasonably well, although the out-of-the-box experience was not quite as smooth as possible.  It is a shame that CardDAV support wasn’t baked in too, but at least this is work in progress.

Managing contacts

A feature recognised by some Android users, and as a further plus, the Link Contacts feature allows you link an imported phonebook contact with a social media contact.  In addition, the Find duplicate contacts feature allows you to easily scour the phonebook and delete or merge any identified duplicate contact records, as desired.

In fairly quick time, I was up and running with all my contacts in the address book.

Importing Media

Getting music, videos and photos on to the device is painless, thanks to its straightforward USB Mass Storage support.  As an Android and Linux user, I was appalled when this transfer protocol was eschewed in favour of MTP on my Galaxy S4 – a “feature” of Jellybean+.

But back to the Open C.  Controlling whether the phone’s memory or the storage card is exposed to the USB host (i.e. the connected computer) was achieved through the settings on the phone.   Once connected, media transfers were effortless.

After disconnecting, simply opening up the Music player, Video player or Gallery displayed my media more or less as expected, although a 1080p mp4 video shot on the aforementioned S4 and transferred over, failed to materialise in the Video player’s file list.

Somewhat annoyingly, album art from transferred music also appears in the gallery, which seems a bit strange.  To make matters worse, this same album art was not visible in the Music player for the albums to which it corresponded.  Instead, I was greeted with placeholder patterns.  I’m not sure how this problem is avoided, but it’s far from perfect.

In use: the User Interface & Experience

In software development, an oft-accepted maxim is that your version 1 release is basically a proof of concept.  Version 2 is where you throw in lots of features, but version 3 is where it all starts knitting together well.

Given that this handset runs version 1.3, the FirefoxOS experience is acceptable.  It won’t set the world on fire (no pun intended), but the key features are here – some better than others.

Performance

Coming from a Galaxy S4, I was pleased with how responsive the Open C is.  On the Samsung, Touchwiz (the user interface layer on top of Android) does a wonderful job of slowing things down and adding a “treacle factor”, generally incurring an extra second or so for each major application switch.

Surprisingly, the Open C felt more nimble and less weighed-down than the S4 once I had opened 8-10 different apps on each.  Granted, the apps on the S4 are more feature-rich,  running on a more feature-rich operating system – and I do have quite a number of them.  But it’s more powerful hardware, you always pay by way of a performance penalty for complexity in software.

On the Open C, swiping across from one home screen to another was fluid and unencumbered, and opening apps was reassuringly nippy too.  Nothing felt laggy and the biggest challenge was getting used to not having a back button.

General OS Features

There have been many comparisons with Android here and elsewhere, but I would argue that this is a testament to the capability of FirefoxOS.   The Settings area provides a reasonable number of options, from power-saving, to connectivity, SIM management and security.

Unlike Android, I didn’t feel as though options we so nested to the nth degree that I couldn’t find what I needed, quickly.  This was refreshing and gave me pause for thought over just how large and burdened Android is now by its own capability.   This is, after all, a phone and Mozilla have fundamentally recognised this.

Sadly, one omission is Firefox Sync.  I was surprised that, being a FirefoxOS device, it doesn’t support Sync with Mozilla’s servers out-of-the-box.  What a shame – this will be inconvenient to some, and argues in favour of using Firefox (the browser) on Android, instead.

Another lamentable omission is a file browser.  I couldn’t see any way to browse the local file system.  Hopefully this will arrive in version 2 or beyond.

Where it does pick up the bat somewhat is with the Notes app, which seemingly offers Evernote syncing.  Although I’m not an Evernote fan, I know that many people are, and this may sway some opinions.  Along with CalDAV calendar sync, it goes some way towards being “cloud-friendly”, which is a nice touch for a browser-based OS… 😉

Hardware

The screen

The screen is where I have seen some criticism being levelled.  Let’s clear this up: having become accustomed one of the highest-resolution (441dpi), most saturated colour displays (AMOLED) on the market, I am not offended at all by the Open C’s screen.  In fact, quite the opposite.  I was surprised how well text seemed to render on it and colour saturation seems average, which in my book is actually a good thing (not too saturated or too pale).  At a claimed 233dpi, the resolution was workable, and the viewing angles from sides and from underneath were ok too.  Viewing the screen from the phone’s top, downwards, was where it all went to hell though – everything neg’d out quite quickly.

Position of Open C's microphone
The phone’s microphone positioning.  Note the capacitive home-button.  The general styling is also vaguely reminiscent of early HTC Android phones.

Sound quality

An often-overlooked area of smartphones is sound quality, via the headphone jack.  Having transferred a random selection of OGG music files, I selected John Williams’ Jurassic Park theme.  During listening I was very surprised that the Open C managed to dig up elements of a double bass (string instrument) in the performance.  By comparison, the S4 couldn’t dredge up this particular detail.

Unfortunately, the rest of the musical quality was middling at best – brass sounded honky, strings somewhat electric and the combination of these plus percussion was a bit brash and ringing.  When listening to the same track on the S4, I was greeted with a much purer, deeper soundstage with individual instruments identifiable and well placed.  Timbre on the S4 was markedly improved over the Open C and generally the listening experience was superior.  But still, it didn’t give me that low bass…

Whether the Firefox OS’s codec is sufficiently different to Android or whether this is hardware is, unfortunately, guess work.  For general listening, say on the train for an hour, the Open C will be plenty good enough.  It’s just not the last word in subtlety.

Battery life

The SIM I use for testing doesn’t have a data allowance, so I have switched off mobile data.  This will have had a positive effect on battery life, but a negative effect on a fair test.

Still, despite not using the phone as heavily as normal in that regard, during testing and initial set up the screen has been on a fair bit, with WiFi connected at all times.  I have seen nearly two days’ usage before needing its first re-charge, so that is encouraging.  I was surprised, too, that after a night on flight-mode, the battery charge level had not shifted a dime, from 66%.

One minor issue though, is that at 10% battery remaining, the phone suddenly died and got stuck in a reboot cycle.   This suggests the battery life/remaining isn’t possibly quite as accurate as it could be, although it could be argued that on its first charge, FirefoxOS hadn’t accumulated enough battery metrics to accurately predict exhaustion.

Camera

Image of back of Open C, showing camera.
The Open C’s camera

This is a tricky area to judge.  This is a £34 phone.  It’s difficult to buy a decent point-and-shoot camera for that price, so how does one judge this fairly?

The 3.2MP sensor is mounted on the back of the phone near the top, in the customary location.  There is no flash or manual/autofocus, and video recording is a rather old-school 352×288@15fps (according to GSMArena).  My testing seemed to concur with that.  Photos are stored as JPEGs, unless edited (in which case, for some reason they are then stored as PNGs), and videos as 3GP files.

In low-light settings, you can only expect average quality at best.  Still, to the naked eye, colour accuracy could have been a lot worse.

The included software does allow some recolouring to help adjust pictures, and the Aviary app is easy to download and install, for more comprehensive off-line photo editing.

Hardware Buttons

Finally, the buttons themselves.  In general use they don’t feel flimsy and give sufficient feedback.  But I do question the positioning of the volume rocker and wonder if it is on the wrong side?  I tend to be ambidextrous when using my phone – it goes to either ear indiscriminately.  I suppose the volume rocker has to be on one side – the right hand side it is!

Summary

Considering this is a £34 phone…

  • Build and general quality is better than expected
  • Setting up is straightforward – although a couple of caveats:
    • Importing VCard contacts from microSD card failed on first attempt, but then worked
    • Plugging microUSB cable into phone didn’t have that reassuring “click”, but connection seems secure enough. (NOTE: this may have been the cable I was using; another cable did seem more secure)
  • Size and thickness is very reasonable – and better than I was led to believe on some blogs/vlogs.  Phone is not too bulky and has a reassuring thickness when in the hand.
  • As a media device it’s fairly average, but as a phone which you won’t care about scratching up and little and using to the full, it’s great.   At the price, you can forget about protective cases – just chuck it in a bag or your pocket and get on with life!

Final words

Comparing to flagship smartphones is unwarranted.  It is not a flagship but an entry-level phone – so comparisons should be with Android phones at same price!

I was pleasantly surprised by the Open C.  The phone hardware, at this price, is exceptionally good value.  No, unless you’re incredibly limber it will not allow you to post selfies to Facebook (with no front-facing camera present), but is this a major thing?

Likewise, it’s a fairly “lightweight” experience all round: apps are less functional than their Android or iOS brethren, and the OS is less “tweakable”.  But as a result, it’s swift and responsive in use, and the vast majority of software included is stable and acceptable.

As an entry-level smartphone, for £34 + £5 p&p, I find it hard to fault.  If it weren’t for the stellar camera on my S4, I might consider switching to it.


 

A more in-depth review of FirefoxOS plus full specs on the Open C can be found at GSMArena.

I recently upgraded my laptop hard drive and decided to move all the virtual disk files of my virtual machines to my home directory.

However, when trying to run the VM, an error notification appeared:

Error starting domain: internal error process exited while connecting to monitor: Warning: option deprecated, use lost_tick_policy property of kvm-pit instead.
kvm: -drive file=/home/sd/libvirt/images/WinXPsp3IE8-d3.qcow2,if=none,id=drive-ide0-0-0,format=raw,cache=writeback: could not open disk image /home/sd/libvirt/images/WinXPsp3IE8-d3.qcow2: Permission denied

The Details section of that dialog showed me where the error was occurring:

Traceback (most recent call last):
 File "/usr/share/virt-manager/virtManager/asyncjob.py", line 45, in cb_wrapper
 callback(asyncjob, *args, **kwargs)
 File "/usr/share/virt-manager/virtManager/asyncjob.py", line 66, in tmpcb
 callback(*args, **kwargs)
 File "/usr/share/virt-manager/virtManager/domain.py", line 1114, in startup
 self._backend.create()
 File "/usr/lib/python2.7/dist-packages/libvirt.py", line 620, in create
 if ret == -1: raise libvirtError ('virDomainCreate() failed', dom=self)
libvirtError: internal error process exited while connecting to monitor: Warning: option deprecated, use lost_tick_policy property of kvm-pit instead.
kvm: -drive file=/home/sd/libvirt/images/WinXPsp3IE8-d3.qcow2,if=none,id=drive-ide0-0-0,format=raw,cache=writeback: could not open disk image /home/sd/libvirt/images/WinXPsp3IE8-d3.qcow2: Permission denied

 

… or, at least, that’s what I hoped.  Except it didn’t.

For a long time, I played around with permissions on the virtual disk image itself, the directory containing it, and further back/up until reaching ~.  None of it helped.

Then I stumbled upon this libvirt bug report.  Comment #6 by Cole Robinson was what I needed:

“What virt-manager typically offers to do is use ACLs to allow the ‘qemu’ user search permissions on your home dir, which is all it should need and is fairly safe and restrictive.”

In order to check and set this, you’ll need to use the File Access Control utilities – getfacl and setfacl:

# cd /home

My home is “sd”

# getfacl sd

# file: sd
# owner: sd
# group: sd
user::rwx
user:root:--x
user:www-data:r-x
group::r-x
group:www-data:r-x
mask::r-x
other::---

The reason I have www-data with read and execute permissions is that I do web development and testing, and I also keep all my web-dev files in ~ too.  This just makes my system more “portable”, safer to upgrade and/or easier to migrate to a different Linux.

To set the required permission for libvirt / qemu, you just issue this one liner:

# setfacl -m u:libvirt-qemu:r-x sd

.. substituting sd for your own ~ directory name.

setfacl (set file access control) takes three main arguments:

  • the action – in this case, -m means “modify” the ACL;
  • the data to apply, colon-separated: here we specify it’s a user (u) who is libvirt-qemu, and the permissions we want to allow are read and execute (r-x).
  • finally, we specify which files or folders ACL should be modified – in this case, my home (sd).

After this, my virtual machine runs up perfectly.

This is relevant for Crunchbang and other Debian-related distros.  For Fedora/CentOS, I believe the user should be qemu.

When installing Debian, or a derivative OS such as crunchbang, you may have opted to separate out your partitions/logical volumes to manage your disk space more finely.

I opted to do this.  My partitions were set up thus:

$ sudo lvs 

 LV     VG   Attr     LSize   
 home   t420 -wi-ao-- 438.10g 
 root   t420 -wi-ao-- 332.00m 
 swap_1 t420 -wi-ao-- 15.50g     <-- way too big!
 tmp    t420 -wi-ao-- 369.00m    <-- way too small!
 usr    t420 -wi-ao-- 8.38g 
 var    t420 -wi-ao-- 2.79g

This was not working for me.  Doing backups using the easy backintime was proving difficult, as backintime relied on more /tmp space than I had.

As I rarely touched swap space, I figured that 15.5G was probably a bit large for my needs.  Thankfully, nabbing swap space and reusing it for the filesystem is easy as pie – and all achieved with no downtime.

Here’s the sequence I typed into a terminal.  First, turn off swap:

$ sudo swapoff -a

Then resize the swap volume:

$ sudo lvresize -L 8GB /dev/t420/swap_1

Now re-format the swap partition before using it again:

$ sudo mkswap /dev/t420/swap_1

Then turn swap availability back on:

$ sudo swapon -a

And finally, resize the /tmp partition on-the-fly:

$ sudo lvextend -L +1G -r -v /dev/t420/tmp

Because the LVM tools have semi-awareness with respect to filesystems, the resizing of /tmp (using the -r switch) was achieved on-line – no need to log out, reboot or anything else.  The verbose (-v) switch allowed me to see everything that was happening.

The new partition sizing is:

 LV     VG   Attr     LSize 
 home   t420 -wi-ao-- 438.10g 
 root   t420 -wi-ao-- 332.00m 
 swap_1 t420 -wi-ao-- 8.00g 
 tmp    t420 -wi-ao-- 1.37g 
 usr    t420 -wi-ao-- 8.38g 
 var    t420 -wi-ao-- 2.79g

I also have 6.5G spare on the hard drive now, in case it’s needed by another logical volume.

LVM rocks for easy filesystem management!  Try it out!