AspireOne and encrypted SD card /home

Jan 28 2013

Tip for the week (well I finally sorted this just in time on Sunday for LCA2013 )

If you run /home with encryption it doesn’t come back properly after suspend resumes, unless you add the following to your kernel boot command line:

mmc_core.removable=0

I think this means the hot removal of the SD card slots doesn’t work so dynamically but in my case, it means I can suspend my machine – which I need to do a lot at LCA.

(With thanks to https://bbs.archlinux.org/viewtopic.php?id=91807 )

I found this out after rebuilding my trustty aspireone to Crunchbang Waldorf and suddenly suspend appeared to cause all manner of problems.

No responses yet

Linux.conf.au 2013 Day 1

Jan 28 2013

Thoughts on Linux.conf.au, Canberra: Day 1, January 28th

Well I am taking a quick break from tweaking my open programming  miniconf talk in preparation for tomorrow. I have only done a handful of public talks and only one in front of an audience that might be around the same size so the butterflies are fluttering just a tiny bit.

One thing I have been doing is watching some of the other other talks to watch presentation techniques and be inspired, and hopefully I can remember to put some of it into practice.  It seems the bar set at LCA is always a high one!

I really enjoyed the keynote by Bdale Garbee. It covered issues such as corporate involvement with open source (companies do need to make money, and this is ok), increasing complexity in open source restricting opportunity for small contributions, and the future of Linux desktop and evolution of the desktop.  I found quite a lot of his points striking a personal chord, having in recent times running into various roadblocks resulting in 2am oft-fruitless hacking sessions trying to make software “work” – not just how I want, but in a way I thought might have been, if not obvious to any software developer, at least possible given all the software that has existed in the past … it gets frustrating when software just seems to go backwards (or maybe its just my lawn) – but to quote Bdale , “we should write the software we want” where we is the  developer, and here I interpret this (hopefully correctly) to mean to not exclude “ourselves” as “hackers” just to make life easier for “users”

Of the miniconfs, my friend Kim Hawtin had a good presentation at the sysadmin miniconf today, I dont envy having to deal with that many web servers; Kevin Pulo with his live demo of Syzix showed how to pull a pull off a talk given constrained timeframe and Sheeri Cabrals advice for dealing with the filler “umms” in her captivating talk on podcasting of course translates to public speaking (hope I manage to avoid those!)

I wont be doing any live demos though…

Speaking of live demos, the day finished with the FirefoxOS. Redundancy saved the day here, the Mozilla presenters had two devices – this paid off when the first did not make a network connection; he was able to step in with a successful run of the Hacker beach app demo.  It is interesting they can make this work on low-spec hardware, if it can be ported to many older devices this may ever so slightly breathe live into otherwise good mobile equipment that might go onto landfill, serving as spare or even main phones.

(Editorial Follows – skip if TL;DR )

Here I will disclose, although I spend many of my days in front of Linux, using open source tools, and developing with open source libraries, apart from this blog, intermittent bug reports and some very minor patch submissions and failed starts**  I have not (yet!) managed to contribute much in the way of code to open projects.  Although I am considering strategies to increase my contributions,  sadly most of my career I have been working the wrong side of a virtual or physical firewall of some kind.  However I am hacker culture at heart, having a lifelong passion for all things computer, and those who know me are certainly aware of my enthusiasm for open source…  so I am going to be inspired from Paul Fenwicks keynote last year and bury my “imposter” feelings, and actually comment on the following issue anyway.  One thing I certainly learned at my first LCA last year, is you may as well participate as much as possible, as there are few opportunities in life like this one!

Regarding some of the recent developments in desktop software, alluded to by Bdale in the keynote.  My own personal example: udisks. I recently had to do some maintenance on a box running a mixed debian/ubuntu “franken”-distro.

Well, you get what you ask for maybe.

However, all I wanted to do is insert a USB stick and have it mount with the filesystem options I want.  On this system this was accomplished by a thing called UDisks, which I later found out seems to be part of some grand FreeDesktop.org software conglomeration.  It turns out that the mount options are _hard coded_ in the source. What? Really?

I have been in the software dev business for many years now, and one thing I drum into the grads I sometimes have to mentor is the usefulness of not hard coding _everything_ in any kind of non-simple software.  It just makes like too hard for diagnostics developing and tweaking, especially when you have layers of packaging and deployment in the way.  Sure you need some sane defaults, and you don’t want to go overboard with configuration because it can introduce maintenance complexity.  But I would have thought something as core as mount options, at least, would be configurable.  Not according to at least one UDisks bug resolver.  There is a bug report*** filed against UDisks asking for just this feature, and the attitude of the triager appeared to be “why would you want this?”, and in spite of use cases provided, the issue appears to have been dismissed out of hand.

(There are plenty of workarounds; using usbmount as per my earlier blog is one; but here UDisks serves to illustrate my point about making software unconfigurable.  And you cant always control what is installed on a machine you are working on.)

Other forums had patches of the C source code to do what you want; sure open source means you can do this, but why make things hard for ourselves?

This seems to be an instance of the increasing complexity in contributing to projects Bdale discussed in the keynote.

I would make the observation this all seems to be part of a broader split between ‘free desktop’ on one hand and ‘the unix way’ on the other, best summed up in the following blog, which I found whilst researching my travails with UDisks : Linux Futures, http://www.pappp.net/?p=969

All that aside, I am now running CrunchBang on my AspireOne and it works brilliantly.  OpenBoxe + XFCE + Debian FTW!

 

Must finish miniconf talk now…

 

** I ported to a Sane backend a driver for a Canon FS4000  slide scanner from code originally produced for Windows, but only got it working to what I would consider alpha stage; the Sane project devs consider it too immature for inclusion into the main line, as they rightfully should, and then I had to return the scanner to its owner before being able to finish it.  I loaded the lot onto github ( https://github.com/andymc73/sane-fs4000-backend ) in case it proves useful to someone else

*** I cant put my hands on the report atm., it is in my browser history, at home not here on my trusty netbook! and my google-fu is not quite working for me just now)

No responses yet

When ‘ssh -X somehost’ doesnt work…

Nov 24 2012

So I went to try and remote run an xterm from a machine I had not turned on for a while…

And unexpectedly received the following error message:

After some scratching around I found the following error message in /var/log/auth:

After more had scratching and reading the sshd_config manpage, I remembered I often turn off ipv6 on test machines on my local network (yes, I know…) This doesn’t always play well with default configs of a lot of software, including ssh. Enabling the following setting in /etc/ssh/sshd_config resolved the problem:

No responses yet

Fixing sluggish write performance of USB flash (thumb) drives

Nov 13 2012

    This has been noted in various places around the web but in practice what I did seems to be a combination of various writings so I have documented my own experiences here.

    Background

    I recently acquired a (yet another) USB flash drive, this a 16 GB “Dolphin” brand. The actual device reports as “048d:1165 Integrated Technology Express, Inc.” when interrogated using lsusb. I am using it to transfer transcoded Kaffeine PVR recordings from my PC to the set top box in the lounge for more comfortable watching.

    On first use, however, it took what seemed like forever to transfer a 250MB AVI file, over USB2, and looking at the GKrellM chart the write data rate appeared to be a very poor 350 kB/sec. So it seemed yet again, I needed to optimise a USB disk before it was adequate for use.

    In theory, to simplify things to one sentence, flash disk (and in particular, modern SSD) should be faster than spinning disks, as access is a true physical random access operation, without having to wait for the heads to be in the right spot. However this is invalidated due the blocky nature of flash disk writes. The actual reason for the poor write speed is that the default partition starts at the 63rd sector (byte 32256) on the disk, and USB flash drives, SD cards, etc. are designed to write data in chunks of say 128kB at a time. Even if you only write one sector, the entire 128kB (or 256 sectors) must be (re-read first and) written. So when a partition is not aligned on a 128kB boundary, more writes than otherwise necessary are required, slowing performance. USB flash drives generally employ FAT32 so they are usable on the widest variety of devices (including set top boxes) and the general experience of FAT32 is that write performance is severely affected if the partition alignment does not match the flash write size, for both the partition and the FAT master table itself.

    Procedure

    The procedure I follow for doing fixing misaligned flash drives is:

    1. Find a Linux computer, or reboot using a live Linux distribution such as SysRescueCD
    2. Destroy the existing partition.
    3. Recreate a single partition, ensuring it starts at the 256th sector (byte 131072, or 128kB)
    4. Format the partition to FAT32. with the following non default options:
      • override the default sectors per cluster to ensure clusters are aligned. This comes at some expense of apparent usable space, but the performance gain for writing large files such as video files is more than worth it.
      • Adjust the “reserved” sectors so that the FAT table itself is aligned to 128kB.

    Detailed Steps

    The following command sequence will accomplish this under Linux. This assumes your drive is at /dev/sdd, this will vary depending on what other disks you have.

    1. Run GNU fdisk with units in sector mode not cylinder mode. Then print the existing partition table (enter p when prompted. Below you can see the start sector of the existing partition is at sector 63. Note this is also a primary partition. This is typical of USB flash disks you might purchase at the local supermarket…

    2. Delete the partition:
    3. Recreate the partition, aligned at sector 256 (131072 bytes), and set the type back to FAT32 LBA (in this case matching what previously existed) (type ‘c’, or 0x0c, i.e. FAT32 LBA). Use of FAT32 LBA allows use to start the filesystem on an arbitrary sector bearing no relationship to legacy cylinders, etc. The final sector depends on the disk size.
    4. Save changes:
    5. Format the partition, setting the number of reserved sectors so that the FAT table remains aligned at a 128kB boundary. Assuming sectors per cluster, s=128 (65536 bytes), and our partition length of 31567469 sectors, we want the first fat to start at the 256th sector within the partition (which is OK as the partition itself is aligned.) For some sizes of flash disk, this can be an iterative process, but generally setting the number of reserved sectors to 256 will achieve what we want.

    6. This is the most important step – verify that the chosen number of reserved sectors has resulted in an aligned FAT table and aligned data area.


      The important figure here, is the data area sector – it must be an integer multiple of 256, and 256 x 17 == 4362 in this example.
    7. Test the result. I copied a 256 MB file onto the drive, and GKrellM is now reporting ~2.5MB/sec. More importantly, it finished in approx. one eighth of the time compared to before reformatting.

    The improved write performance should be just as noticeable from Windows.

No responses yet

Windows shenanigans – with a little help from our (Linux) friends – part 1

Nov 11 2012

Although I use Linux as my primary O/S, I am required to also use Windows at work and most family / friends / neighbours etc. use it. So I need to stay up to date with the Microsoft world to retain my computer geek “cred”, as I am often called upon to fix problems or provide tuition…

Quick tip if you have to use a Microsoft O/S – you may be able to resolve Windows Vista / Windows 7 boot problems using EasyBCD, it is free for non-commercial use. Similar can be accomplished using Grub2 and GPartEd; however EasyBCD can manipulate the native Windows boot manager, and I need to experiment further with my wifes Win7 laptop when she is not around ;-)

A while ago a close relative had a run of bad luck with his system. Amongst other things this involved migrating from an old “slow” Vista Premium to a fresh install, on a clean hard drive. The fresh install ran much faster without the years of crud build up and recent drivers, etc. but he was unable to make it work without the original “slow Vista” hard disk in the machine, which was the system (BIOS) boot disk. The computer involved had several internal SATA and external drives, a situation which had previously eventually lead to disaster as my relative attempted to sort it all out, but more on that another time!

The problem was the “new” Vista was added to the Windows boot menu but with the “old” drive removed, the system was rendered unbootable; i.e. the clean drive had no boot manager installed.

The solution I employed was to use a tool called EasyBCD. The procedure essentially involved first installing EasyBCD onto the old Vista, and using it to make the new drive the default, at which point we went out to lunch at least making his system slightly more usable.
Having confirmed the new Vista was automatically entered on reboot, EasyBCD was installed into the “new” Vista, and used to install the boot manager onto the new drive, and finally removing the old drive. One key step involved using the “Select BCD store” to edit the menu on the alternative disk.
In all cases, it is prudent to take a BCD backup! (And of course backup anything else important.)

This was not completed without some recourse to Linux; at the start of proceedings, in spite of a lot of to-ing and fro-ing of drives and cables, neither Vista system would recognise a new 2TB drive he wished to use for data. I was able to boot using Xubuntu 12.04 and this could not properly see the drive either! As a last resort we swapped it to a USB a caddy and using my Acer Aspire One running Squeeze with a 3.2.9 kernel confirmed the drive was OK. Then running a manual Windows update on Vista actually allowed the system to recognise the drive. Perhaps I should have done this first, but I think it can be useful to experiment a bit longer and it was more comfortable inside on this day anyway… S

It seems therefore that both older unpatched Microsoft systems and older Linux kernels cant see some larger hard disks.

This all happened a little while ago so I don’t have exact model numbers or software versions.

No responses yet

« Newer posts Older posts »