Fedora preupgrade with a tiny /boot partition

This post is for people with, well, mature, installations of Fedora. The installers of yesteryear defaulted to a very small 250MB /boot partition. That’s so small it really gets in the way of using Fedora’s preupgrade feature.

These are the tricks I use whenever I’m upgrading one of these mature installations.

Firstly you must remove every kernel except the one you are currently using to run your system. That should clear out enough space for preupgrade to get things ready for you.

Even with the kernels removed preupgrade stil won’t have enough space to store the stage2 installer image. That’s it can download it during the install. When preupgrade completes you can reboot, select “Upgrade” via grub (if it is not selected by default) and try to do the upgrade.

Round about now you will discover the second problem. Even with a wired connection you can’t download the stage2 installer. Why not? Well, because preupgrade has incorrectly setup the kernel boot line causing the stage1 installer to try and download the image from the wrong place. You can fixup the kernel boot line using grub’s editing tools. Have a look for the parameter that tells the stage1 installer where to download stage2 and remove /LiveOS/squashfs.img from the end (stage1 automatically appends this).

With this obstacle knocked down you’ll encounter the third and final issuette. When anaconda scans the system to check there is enough disc space to complete the install it can’t find enough space in /boot. Now, by far the biggest thing in  /boot right now is the stage1 installer image which has already been copied to RAM. In otherwords if you can delete it from /boot before anaconda checks there’s enough space then the upgrade process will finally work! If you have an encrypted root filesystem this is no problem because you have to enter a password before the space check. If you don’t have any encrypted partitions then you’ll have to be the worlds fastest typist to beat the space check. Good luck!

These are the commands needed to delete the preupgrade stage1 installer:

mount LABEL=/boot /boot
rm /boot/upgrade/initrd.img
 rm /boot/upgrade/vmlinuz
 umount /boot
 rmdir /boot

Note that you may have to tailor the initial mount command if your /boot partition is not labeled /boot.

Finally don’t worry about the wanton destruction of the stage1 files. As I say they are already loaded into RAM and if for some reason the upgrade still don’t work and you need to reload them a try again then you can just re-run preupgrade.

Have fun…

Share

My first diddly bow

This is a picture of my first ever diddly bow. It was constructed from ash and is primarily made using an axe with a little help from a saw and a knife. The axe is even used to drive the tuning wedge. Can you tune your instrument with an axe?

image

I set this up at a recent bush craft training weekend (which was, as ever, an excellent weekend). You can tell I was listening to the training because I identified the tonewood used to make it by the fungus growing on it. This is not a recognised techiniue for identifying a guitars tonewood!

Continue reading “My first diddly bow”

Share

Extracting text from the memory image of a running process

I found a really nasty problem with the bug tracker we use at work last week. If someone else posts to it whilst you are composing your comment it refuses to accept it. It doesn’t offer a “post comment anyway” feature and advises instead that you:

  • Press Back
  • Select the comment you have just written
  • Copy it to the clipboard
  • Reload the page in your browser
  • Paste the comment back into the text field

Other than the obvious epic fail regarding usability there is one additional problem in the instructions above. When you press back the rich text editing widget no longer has your comment in it! That’s right. Forty five minutes expressing my highly insightful view point as clearly as possible… gone.

Grrr…

I could tell the text was still there because I could press Forward and refresh but I just couldn’t see it.

At this point I fired up wireshark to try and capture my work as it went out over the network. This was when I realized that the bug tracker was using SSL and trying to launch a man-in-the-middle attach on myself was likely a waste of time.

So, the last resort of the desperate(ly lazy) is to grab the data from the memory image itself. That should be dead easy, I’ve been running GNU/Linux at home for almost fifteen years. I must have learnt my way around by now. Surely I just attach to a running process and dump its memory.

Having got the PID of the firefox process I fired up gdb:

 butch$ gdb
 GNU gdb (GDB) Fedora (7.3.50.20110722-10.fc16)
 Copyright (C) 2011 Free Software Foundation, Inc.
 License GPLv3+: GNU GPL version 3 or later
 This is free software: you are free to change and redistribute it.
 There is NO WARRANTY, to the extent permitted by law. Type "show
 copying" and "show warranty" for details.
 This GDB was configured as "i686-redhat-linux-gnu".
 For bug reporting instructions, please see:
 .
 (gdb) attach 23639
 Attaching to process 23639
 /usr/lib/firefox/firefox (deleted): No such file or directory.

At this point I tried the gcore command. No luck there either. gdb couldn’t figure out the memory ranges it needed to dump. Still I’m not one to give up. After trying and failing to scan /proc/23639/mem I decide to scan the list of the memory mappings and dump each one. When I discovered that firefox had over 700 blocks of mapped memory I decided to generate a gdb script to dump the memory automatically:

cat /proc/23639/maps \
| cut -d' ' -f1 \
| tr '-' ' ' \
| awk '{ print "dump memory core-" $1 "-" $2 " 0x" $1 " 0x" $2 }' \
> dumpmem.gdb

It worked. I have the memory in files. From here things get much easier:

cat core-* | strings | grep -C 40 BD-ROM | less

Yay.

Share

Washburn Mercury Series Tonewood

This is my recently acquired Washburn Mercury Series Tonewood electric guitar. Its a limited edition run from the mid nineties, with a mahogony body and a maple neck. As far as I can tell its entirely stock with its original coil tap on the bridge pickup controlled by the push-pull tone knob.

As you can see above the colour of the wood depends heavily upon the lighting. The final two photos, which were taken in the shade, give the best impression of the instruments real colour.

Share

Fixing problems with encrypted removable media

If you have plug encrypted removable media into a recent GNU/Linux distribution it will probably try to automount it for you.

So far, so hoopy.

However a recurring class of bugs in the hot plug logic is failure to tear down the encrypted device mapper when the media is removed without unmounting it first.

It results in a message something like this:

Error unlocking device: cryptsetup exited with exit code 5: Device udisks-luks-uuid-d9fb9d0d-74e6-49b1-94d3-7edc083f04c0-uid80377 already exists.

Naturally this is a bug in your distribution but it is one that tends to regress as the desktop stack is developed so knowing how to workaround will do you no harm at all.

I generally use:

sudo cryptsetup luksClose udisks-luks-uuid-d9fb9d0d-74e6-49b1-94d3-7edc083f04c0-uid80377

Note: gnome-shell-3.2 will prompt you for a password but doesn’t issue an error message if the automount fails. If you want to see the error message (and hence the name of the mapping) open the file manager and try to mount the encrypted partititon from there instead.

Although I couldn’t really be bothered you could easily write a script to automatically identify encrypted device mapping that aren’t being used and undo them by getting a script to look at the output of ls -al /dev/mapper. Probably it would be best to look for devices that have a mapping but are not mounted.

Share

The Joy Of Spam

Since first opening this blog one of the things that surprised me was the number of spam comments it attracted. Its hardly a high publicity site so I guess I was supprised how quickly the spam robots started to target my blog. Thankfully the first few spam comments were pretty obvious:

Without Perscription, Certified by FDA depression or other mental illness Cymbalta Cheap Overnight Doctor weight loss Real Online! It is Easy and Fast.Antibiotics online US chest pain confusion Cymbalta Generic On Line, No Hidden Fees! Licensed Pharmacy, muscle aches Were to Purchasing internet.buy brand buy Deutschland FDA Approved us pharmacy cabergoline, other medicines, foods, dyes, or preservatives Mevacor Colorado No prescription
pas cher order Zocor, acheter cheap Zofran, ordine cheap Zovirax, in italia order Zyban,

[From an online pharmacy]

After reading a little more on the subject of spam comments I quickly learned two things. The first is that spam comments are a fact of life if you want to allow anonymous comments (and doubly so if you don’t like CAPTCHAs). The other is that the part that always gives away the spammer is that the comment doesn’t contain any information related to the actual content of your article. This is because the spammer has to write one text and then post it to many different sites. Philosophically speaking if the spammer wrote bespoke comments for each site they would not longer be a spammer. Perhaps an artisan spammer who wrote bespoke comments would wind up being called a fillet-steaker.

Anyhow even with no obvious motivation for the comment the following messages did rather give away their true nature, especially when you remember that many bloggers only moderate the first comment from a user so if you let them through assume they will be back.

Thanks for taking this opportunity to mention this, I’m strongly about it and I benefit from garden greenhouse structures this subject. When possible, when you gain data, please update this website with new information. I have found it extremely useful.

[From a person in “trading strategies”]

After reading your blog post I browsed your website a bit and noticed you aren’t ranking nearly as well in Google as you could be. I possess a handful of blogs myself and I think you should take a look here: http://nottherightlinksothere.org You’ll find it’s a very nice tool that can bring you a lot more visitors. Keep up the quality posts

[From a SEO company]

The next two posts represent the most sophisticated spam comments I’ve received so far. Both avoid flattery and instead try to latch onto technical paranoia instead. The first one is particular clever for the question in the middle and its assumption that other humans really need to read this message. Whilst I’d prefer spammers to find some more productive line of work you have to admire someone at the top of the game like this:

I don’t know if it’s just me or if everybody else encountering problems with your blog. It seems like some of the text within your posts are running off the screen. Can somebody else please provide feedback and let me know if this is happening to them as well? This may be a issue with my browser because I’ve had this happen before. Cheers

[From a fake Burberry scarves salesman]

Howdy just wanted to give you a quick heads up. The text in your content seem to be running off the screen in Chrome. I’m not sure if this is a format issue or something to do with browser compatibility but I figured I’d post to let you know. The layout look great though! Hope you get the problem solved soon. Kudos

[From a pornographer]

It’s getting towards time to finish this post so I’ll introduce one of my favourites here. It’s not because of the quality of the prose, although one does have to admire the excellent spelling together with correct use of capital letters, commas and full stops (even on the last line). The reason it’s my favourite is this transparent attempt to flatter me into accepting the spam was attached to a pictoral joke. The “astonishingly thought-provoking” words that inspired such gushing praise numbered only ten.

You have written an astonishingly thought-provoking article. Your written content speaks to me and I share inside your views. Countless writers do not write original material, but you have really achieved an awesome job with this information.

[From a fake ugg boot salesman]

So to close I shall leave you with this comment and sincerely hope you share the sentiment.

I would brand your blog the dreamland! though Santa knocks at our door just once every year, you blog is open the entire year ¨C wow!

[From a fake ugg boot salesman]

Share