2009-12-10

VirtualBox strange port-80 forwarding

Task: Develop iPhone-adapted webpage in VirtualBox Gnu/Linux virtual machine. Test it from an iPhone. Get up quick.

OS X has a built in Apache. VirtualBox can share folders. Let Apache serve a shared folder, then the iPhone can surf to the Mac and I can develop in Gnu/Linux.

System > Sharing > Web Sharing turns on Apache.

/Library/WebServer/Documents contains index.html.en. Rename to hello.html. Now if you go to localhost you will see a list of files instead of It Works!

Make a folder (I called it vbox-web).

Go to VirtualBox, shared Folders. Add this folder, click make-permanent.

On the virtual machine:
sudo mkdir /mnt/vbox-web
sudo mount -t vboxsf vbox-web /mnt/vbox-web/

Ok, this does not work perfectly, I can't use symlinks and I have to work as a root. But it is a start, I can surf with the iPhone and develop on the virtual machine which is what I wanted.

Apprently from the VirtualBox Faq you should add some parameters to the mount command to make it work better.
Improved command:
sudo mount -t vboxsf -o uid=1000,gid=1000 vbox-web /mnt/vbox-web/

Also, not that if you want to do this each time it should not be added to fstab but to a script (see faq).

VirtualBox how-to access guest (ip, webserver)

I needed to do some iPhone development and the SDK requires Snow Leopard. So I installed it:
Carbon Clone Copier to make a mirror of my internal HD to an external USB Drive.
Remove USB Drive.
Wipe the internal HD.
Install Snow Leopard.
Attach the USB Drive, import settings from it.

Most things went well, however VmWare Fusion 2 did not start. Rather than mess with Fusion, I decided to give VirtualBox a go.
I copied the .vmdk file (inside the virtual machine folder), and imported it to VirtualBox. No problems.
Uninstalled vmware tools, installed VirtualBox tools. Very smooth so far. But I want to develop webpages on Linux in the guest, then access them from the Mac host. And I could not reach the guest from the host.

Here is how I fixed it partially (so far):

Info from virtualbox forum

Add two network cards (first host-only, second NAT) using VirtualBox gui (when guest is turned off).
reboot.
run dhclient as root (on Ubuntu sudo dhclient)

Now the host only gets ip address, see what dhclient outputs as inet for the eth (I also have eth2 (NAT) and eth0 (loopback). Mine was 192.168.56.3

In order to get a stable adress all the time, I want to configure a static ip for my vm. I choose 192.168.56.56 because it is a nice number (and I guess the the dhcp server in Virtualbox will not use it).

Now I edit /etc/network/interfaces

#This is a host-only static interface for VirtualBox
iface eth1 inet static
address 192.168.56.56
netmask 255.255.255.0

reboot.
This does not work. I still have to do sudo dhclient and I get ip 192.168.56.3
Anway, I can live with a dynamic address for a while. And I need to get some work done.

However I found a good link to read when I want to fix this sometime in the future.
Ubntugeek, I think the solution is in here somwhere

2009-09-20

Virtualbox strangeness

I wanted to move a virtualbox virtual machine from my Mac to the new Fedora Linux box I have just got started. It has an AMD Sempron processor.

As it says in the instructions, I used VBoxManage clonehd to make a new VDI file, then copied it over to the Linux box.

The virtual machine was a 64 bit Ubuntu 8.04.

I used virtualbox to create a new Linux Ubuntu, then added the copied VDI file. However, when booting up it complains the I have a i586 kernel and not an X86_64. But I don't. The Fedora install is X86_64, I verified it with "uname -a". The package manager says that VirtualBox is for X86_64. The virtual machine itself is x86_64.

Is this a bug?

terminal that opens in finder

If you are on a Mac, you want to be able to open a terminal where the finder is.

First install iTerm instead of terminal.

Then follow the instructions here
http://cuasan.wordpress.com/2009/08/19/mac-open-iterm-here/

A lifesaver.

2009-09-13

Fedora 11 is the winner!

I can't almost believe it. I managed to install Fedora 11, it worked absolutely perfect. So in my informal Linux contest, I hereby prounce Fedora the winner. The winning installer was Fedora-11-x86-64 DVD.

These are the series of blogposts documenting the contest.

http://macgnulinux.blogspot.com/2009/06/ubuntu-upgrade-problems.html

http://macgnulinux.blogspot.com/2009/08/yet-another-failed-debian-installation.html

http://macgnulinux.blogspot.com/2009/08/march-or-die-you-ubuntu-installer.html

http://macgnulinux.blogspot.com/2009/08/gentoo-attempt.html

http://macgnulinux.blogspot.com/2009/08/failed-fedora-11-attempt.html

http://macgnulinux.blogspot.com/2009/08/open-suse-failure-as-well.html

http://macgnulinux.blogspot.com/2009/09/more-failures.html

http://macgnulinux.blogspot.com/2009/09/final-horrors-with-ubuntu-and-debian.html

2009-09-12

Final horrors with Ubuntu and Debian install

After failing to install to an old drive with data on, I have several blog posts about it here, I try a new fresh install overwriting discs. This should be simple to get to work. This is a fairly recent computer, I know it runs Linux with not much trouble, I have tried it before. This reinstall idea started when the Ubuntu apt-get got into a Catch-22 situation, and I saw a reinstall as the only solution.

First attempt is Ubuntu 9.04 Alterative installer AMD64. It does not detect the network with DHCP. Really. I tried it several times.

Debian 5.02 XFCE graphical installer. No Ext4 file system included. Whatever. I just want something up running. No problems detecting network, that was some problem with Ubuntu. It installs fine and I reboot. Then there is a slight problem, my screen (connected with VGA) turns into power-save mode some time after starting booting, so when it is time to enter my name and login I can't see the screen. The only way to get to see the screen is to push the power-off button, then the login screen appears. But then of course it starts to reboot so to no use. Now I could search for a solution if there is one, but I have no patience left.

2009-09-06

Moving Xen img to virtualbox failure

I wanted to transfer a xen image with Ubuntu to run under VirtualBox. Because I can control VirtualBox using scripts and the command line, and VMWare which I usually use doesn't think that feature is interesting to us Mac users.

I downloaded then xen test.img file from the server to my Mac.

VboxManage convertdd test.img test.vdi

Create a new virtual machine, use test.vdi as disk.

My mac crashes and reboots!

I try to boot the virtualbox virtual machine up again when the Mac has rebooted. It starts to boot, but says no disk found.

Boot up with a rescue disc installed. It doesn't find a partition table. fdisk -l shows a /dev/sda but also says it doesn't have a valid partition table.

I made one attempt to look for bugs on the Virtualbox site, but didn't find a report. Maybe it is not with VirtualBox? For reference the exact version is VirtualBox Os-X 3.04 r50677

Next strategy is to determine exactly what Ubuntu version the xen vm is running, using lsb_release -r, install the same version as a new virtualbox virtual machine, and then transfer the interesting files from the img file. That will be good enough I think, and probably faster than analyze this problem in depth.

2009-09-01

More failures

OK, I came up with a brilliant idea to install linux and save my home folder. First boot with a live-cd, remove /bin /sbin /usr and all those, preserving /home and /var (I got some files there). Then install linux. Now there can't be any old files in the way of the installation.

I tried Debian 5.02 but got the message failure to run chroot /target dpkg --force-depends --install /var/cache/apt/archive/base-passwd_3.5.2_amd64.deb var/cache/apt/archive/baise-files_5leeny3_amd64.deb

Now, maybe I should remove /var/cache also, and retry. Horrors! The problem is still there...

The Fedora 11. This installer said it could not mount /dev/vg1/root.

Ubuntu: The installer "Failed to remove conflicting files" and cannot continue. Now how had can that be? Even my retired aunt can remove files.
And by the way, which damn files?!!!

Now I give up. I am going to copy the home folder out, then reinstall a totally fresh OS on a newly formated disc.

2009-08-28

Open SUSE failure as well

After a series of failures with debian, ubuntu, gentoo and fedora to install over my old Gnu/Linux installation I give openSUSE a try. I have never tried this distribution before.

I download OpenSUSE 11.1 x86_64 DVD.
Boot up. Afer som time I get a blue screen saying file:/var/adm/mount/boot/x86_64/root: SHA1 sum wrong. If you really trust your repository, you may continue in an insecure mode.

Well I don't trust the bittorent download of Open-SUSE. But what is there to loose? I like living on the edge.

Then it says make sure CD1 is in your drive. Three times. But I have a DVD. The the installation fails. Nothing strange, I am used. Just try another time again.

It fails. It seems I now can select a network install. Now I just need an IP address. Sorry it was impossible to find, or didn't work. It was not http://download.opensuse.org/distributions/11.1/repos/oss/

I reboot, this time check the installation media first. Actually there was a problem in a sector. But I had the Mac verify the disc just recently when I wrote it.

Also for fun I try the firmware test. I find a memory hole, and some other things.

Reboot. Now I try to change to http instead of DVD as source. I select server download.opensuse.org and directory distributions/11.1/repos/oss/. Didn't work. I reboot and select http://download.opensuse.org and /distribution/11.1/repos/oss/
note the removed s in distribution. Didn't work. It seems it should be repo not repos. BTW how hard can it be to have this as a default?

And it didn't work with /distribution/11.1/repo/oss/ either. I am dropped into the text based installer. I try http based install once again. This time by pinging download.opensuse.org and putting in the real ip adress as numbers as the ip address of the server. It marches on!!!

It looks really good. Green and grey. Not Mac not Windows, just plain good looking.

I deselect use automatic configuration, select new installation.

The map to select location is even prettier than Fedoras. They focus on the important stuff.

I select Gnome as desktop for a change. They also have Xfce which I usually use.

Now they suggest to delete my partitions. Instead I choose Edit Partition Setup. I din't understand anything about my drives. I click back and "LVM based" before Edit Partion Setup. They have a button "Import mount points". And it finds an old /etc/fstab on /dev/vg1/root. Presumably leftovers from a failed Fedora install. My "real" old fstab was wiped out by Gentoo.

It takes some time to edit the paritions. It adds or picks up a volume group /dev/system I have not seen before. Anyway it seems it won't format any discs so here I go. yes, they warned me that the disk wasn't empty.

Now I am presented with a nice overview of the installation settings and can edit them again. This is the best I have seen for an OS installation.

Now the installer starts. I almost immediately get "initializing the target directory failed.". No information why it failed though. That is not user-friendly. I like the pretty map, but a little info here would have been even more appreciated.

Time to give up and go to bed. Now I have ran out of Gnu/Linux distributions to try I think.

2009-08-27

Failed Fedora 11 attempt

After Debian failed and Ubuntu failed to install and Gentoo required way too much of my time, in a way that is also "failing" to install, I am now giving Fedora a shot. Previously I have tried CentOS on a server and have been happy with it, it just runs Xen troublefree.

I want the 64 bit version, and I find a torrent on the fedoraproject.org site. I didn't know I had a torrent downloader on my Mac, but it seems that the Opera browser has one built in. Very nice.

Booting shows a black screen, with a white line growing at the bottom. More white line fever. However soon it seems nicer, it starts a good looking X-session. I get a message a hard disk is failing as a speech bubble at the top right of the screen. When I click it I get the palimpset disk utility. It seems the 160gb drive has bad sectors. I can select self-test to do an ATA SMART self test, I choose a short test. It seems OK but it has some bad sectors. I have just fixed a bad disk using ddrescue so I know how to fix it some day, I will blog about it soon.

Anyway, the palimpset disk utility seems nice, I can see my disks even the LVM ones.

I click on the Install to Hard Drive icon on the screen. This is not a text based installer as I have tried earlier. It is a graphical "wizard" resembling Windows and Mac OS. It feels refreshing after the Gentoo experience. Choosing my location is nice, just click on the world map.

It complains about a weak password, but lets me continue anyway. That is nice.

Now I get the option to partion the hard drive. One option is "Replace existing Linux system". Wonder what that means? Reformat everything including /home or just overwrite system files? I select it and review and modify partioning layout. Ok, it seems it meant blow everything because they have a slightly other LVM setup and want to install ext4 on it. I go back.

Now I choose a "Custom layout", and see my discs. I have to scroll up and down to see my whole setup, but I can select sdc, then click edit and select /boot as mount point.
I then click on my vg1/root device, click edit. I don't see how to select a mount point. But, if I click on the "root" part in the list of logical volumes in the popup window, I can select / as mount point. I then get a long warning about using a pre-existing partition without formatting it. But, they also say "However, if this partition contains files that you need to keep such as home directories, then continue without formatting this partition". Thanks for this, it seems I am not the first one seeing this need.

I now have a xfs lvm root and an ext3 boot, that is good enough, the other disk I might add later or mount manually. I click continue.

Then I get the message: your / partition does not match the live image you are installing from. It must be formatted as ext4. Damn! My guess is that they haven't support for xfs on the live-cd. But, I feel fedora is promising, so I download the 4Gb DVD instead. Maybe it is more complete?

Now, the DVD installer didn't complain about XFS. I select to have the bootloader on the /boot partition. I deselect "Office and productivity", trying to start with as small install as possible, then see what I want to add later.

Finally it is time for reboot. I think this will work...

No. Just a black screen, no choice of loading linux (grub or lilo). Can it be that I selected the boot disk for the bootloader? I will try another install using the default Fedora suggested, on sda1.

No that didn't work. I mess around with different start disks too no help.

Now, I try yet another time. This time I select to reformat my little 94 MB sda1 partition (no mount point) and also the sdc1 (/boot mount). And the 2 Gb swap I have on LVM.
Now I notice that the boot loader device option also list the boot order I just selected in Bios. And I can change it! I select the Master boot record of dev/sdc, select sdc as the first BIOS drive. Thats the 80GB ext3 boot disk I want.

I also notice I can Edit the Boot loader, so for the first time I press edit. And an Exception shows in Anaconda. I even have the option to send it to redhat. But they require an account, so they won't get my exception. I thought this information could be interesting even if I was anonymous.

It seems I need to restart the installer again. But I wasn't really interested in changing The boot loader menu name so I will give it one more try. This is the last attempt before I try Open Solaris. It have taken more than a day now.

Ok. It failed. The exception is in /usr/lib/anaconda/booty/x86.py line 154 in writeGrub. IOError: no such file or directory /mnt/sysimage/boot/grub/grub.conf

But OpenSolaris doens't support xfs. So I give Fedora one more try. This time it really seems that it doesn't pick up the boot order I just selected in BIOS. Anyway, I install it as MBR on sda. Then I will change boot order in bios. But the installer crashes yet another time. This time it is time to give up. I see no good option. Maybe it is time to wrestle with Gentoo. Or buy a big harddrive and dump my home directory, it should be readable from a live-CD.

2009-08-26

Gentoo attempt

After ubuntu failed to upgrade, I tried to install debian and then ubuntu but failed. Now it is time to try Gentoo, this is my first attempt ever with Gentoo. I downloaded the 20090813 daily installer of Gentoo, as suggested on their page. Booting made a command prompt appear.

No emacs, but vi. This does not start good.

There are some messages. Check /etc/kernels/kernels-config-* for kernel configuration.
A suggestion to type "links http://www.gentoo.org/doc/en/handbook/handbook.xml".

That starts a textbased browser. I can navigate with up and down arrow and enter. I get to the Gentoo AMD64 Handbook.

Lets skip step 1 to 4, I already have disks. And go to 5 installing the gentoo installation files.

It tells me to check the computer date using the date command. But where is the command prompt? Through esc>File os shell I can open it. I type date and it looks ok. Then exit to get back to "links". Now they want us to surf to a gentoo mirror and download a stage3 tarball. Using a textbased browser. Is this a rite of passage for nerds? Haha: I pass.

Now I find out how to navigate "links". Ctrl-N and P to scroll. Easy and nice. That was my first guess but I managed to press caps-lock instead of control.

tar unpacking instructions:
tar xvjpf stage3-*.tar.bz2
Apparently the 5 letters are very important. And five chunks is actually the upper limit of what a human can hold in his short-term memory. An average human, I needed to go back and forth some times. I suddently remembered that I could switch to a prompt by ctrl-alt-f1 and go back with ctrl-alt-f3, that makes everything easier.

Ok, now I should download a portage snapshot. Done.
Then,
tar xvjf /mnt/gentoo/portage-latest.tar.bz2 -C /mnt/gentoo/usr

With capital C, no trailing slash on usr

But I seem to be getting no space left on the device. And this is/should be on the ramdisk? I can remove the stage3 tar I guess. I try that. It doesn't help.

Ok, it seems I shouldn't be on the ramdisk.
I should mount my old drive on /mnt/gentoo. And my boot disc on mnt/gentoo/boot

fdisk -l shows my old LVM partitions. Some googling and I found this info:
. By now I have been listeing to Louie Louie covers since ubuntu failed. I think I like Thee Headcoats version of Louie Louie best.

To mount LVM i do:
vgchange -a y
lvscan

It shows the lvm disk, so I can mount it. First i mv /mnt/gentoo /mnt/prev
Then mount /dev/vg1/root /mnt/gentoo

It starts a xfs recovery and won't mount. However I saw no disk problems when I booted up ubuntu some hours ago. Anyway I need to do a dangerous xfs_repair -L /dev/vg1/root it seems. I have now listened to 29 versions of Louie Louie and have not come very far at all I think. Time for sleep after the great Iggy and the Stooges version. So far I think Gentoo is the Iggy Pop of linux distros. Thin and hard.


Then they want me to edit build options. This is what I pick from skimming through the manual.
march=x86_64 need to see if it is called that?
-O2 for default optimization
-pipe to speed up compilation

There should be a file in /mnt/gentoo/etc/make.conf.example, but there isn't so I won't select the march option. No there was a file, but elsewhere.
I add the option MAKEOPTS="-j3" because I have a dual-core.

Now time to install.
cp -L /etc/resolv.conf /mnt/gentoo/etc/
mount -t proc none /mnt/gentoo/proc
mount -o bind /dev mnt/gentoo/dev
chroot /mnt/gentoo /bin/bash
env-update
source /etc/profile
export PS1="(chroot) $PS1"
emerge --sync --quiet

Change locale to en_US.UTF-8 UTF-8 by editing /etc/locale.gen
then run locale-gen

My god this never ends. I skip select timezone.
emerge gentoo-sources

It is late, I don't want to manually configure the kernel. Instead genkernel.
emerge genkernel
genkernell all

Oops it seems I forgot to mount a drive on boot/
I do that, ctrl-c genkernel all, then run genkernel all again
But I am not sure it worked.
Anyway now I am going to sleep.

good morning. It seems it worked, there are some files in (chrooted) /boot

Now they want more editing. I am getting tired of the nano editor, I want emacs or a clone. But it seems that some guys at Gentoo refuses to add it, despite the emacs team volunteering to trim it down to a small size. This has been wanted since 2005 and emacs is one of the two big editors, consider this blog-post bad publicity for Gentoo if you want another argument to add emacs to the minimal-cd.

Ok, now you can edit a file and specify modules for the system. But I don't know what I should have, and there are no defaults suggested in the documentation. So I skip that right now. Maybe the modules are added dynamically later anyway?

Ok time to edit the /etc/fstab.
Shit, Gentoo has overwritten it with a default. My old setup with LVM and things is gone. I can't be the only one trying to do a reinstall over an old disc, so it wouldn't be too much to ask that the installer makes a backup copy of the old fstab. That is feature request.

Now this is too much to me. I scroll down to see the options, there are a lot of steps left. I haven't even started to configure X-Windows. I don't enjoy messing with Linux, I like programming. I give up. I might make another attempt if Fedora also fails, but that is the next alternative now.

March ör die you Ubuntu installer

Since debian didn't work well I try Ubuntu 9.04 AMD64 alternate installer. I notice there is a rescue a broken system option, exactly what I want lets try it. Now I get to the options, execute a shell or reboot. That won't repair my system. I look for the "Repair system using crowd-sourcing and AI and a live chat connection with skilled people" option. Couldn't find it. Let's try reboot, after all it usually fixes windows.

After the reboot I try the installer again, this time to install instead of rescue.
The installer looks exactly like debians, and I choose the same disc options.
I get a slightly better message explaining that files will be overwritten and I should back up. Then it says it is going to write partition table for some swap partitions, and goes blue. But not like a windows bluescreen, this bluescreen has no black text describing the error. Instead it has an white line at the bottom of the screen. I come to think of Motorhead and the book white line fever, and turn on Ace of Spades. What a classic! And I find out that Lemmys voice makes their covers of Breaking the Law and God Save the Queen absolutely brilliant. Then the bluescreen turns to red.

Partition disks. The installer needs to remove operating system files from the install target but was unable to do so. The install cannot continue. Go back or contine.

I click continue. March ör die. Then I get back to the partitioner. Try another time. Then I try to reformat the boot disk. Motörhead does another cover Louie Louie. Not as good as the Sonics but nearly as good as Paul Revere and the Raiders. There are enough Louie Louie covers to entertain me while Gentoo downloads. I come to think an installer should be like Motörhead. Just go on and on and do it good.

Yet another failed Debian installation

Since ubuntu wouldn't upgrade I decided to try debian once again.

This is the report about installing Debian 5.02 over my old Ubuntu Hardy.

I downloaded a CD image with XFCE and LFCE on, AMD64.

The first interesting part of the installation is the partitioon table. I had a messy old system with lots of drives. I selected an unusued 80gb drive as a boot partition, since I have had problems with a too small boot partition earlier. I also reselected my big LVM partition as the root system, but left it as it is instead of reformating it.

The installer then asks me if I want to proceed with an unclean disk which has an old system on it. That is exaclty what I want, I want to preserve my data.

Then comes a Debootstrap warning.

Failure to run: chroot /target/ dkpg --force-depends --install /var/cache/apt/archives/base-passwd_3.5.20_amd64.deb var/cache/apt/archives/base-files_5lennt3_amd64.deb

Base system installation error: the debootstrap program exited with an error (return value 1).
Check /var/log/syslog or see virtual console 4 for the details.

Then I get back to the installer.

I can open a shell as the last option in the installer, and i check the syslog with tail -200 /var/log/syslog | more.

dpkg seems to complain about pre-dependency problem: base-files depends on awk. But it continues anyway. Then there are pre-dependency problems for base-passwd, which depends on libc6 > 2.7.1 which is not installed.
Last it complains about a bad sector on hda, but who cares I am not installing on hda, so that can't be the problem. I guess the problem is that there is a problem with the debian installer. Surely it should be able to install over the existing system without these dependency errors. Maybe it picks up some settings from the old system. But it shouldn't do that so early in the installer, it smells really bad.

Now I can't keep track of which version, Ubuntu or Debian has failed most times. I am really temted to switch to another gnu/linux. I won't overwrite my old data, if I can't find a gnu/linux installer that works I'll switch to a hackintosh.

2009-08-24

Fixing crashed harddrives for friends

Sometimes a friend comes with a crashed harddrive and wants help. If they ask nice I will try to help them. This is one case. First I thought it was a windows problem, but after my recovery the end the drive really died so it was a drive problem

First I tried dd, with sync,noerror option. Everything seemed ok. But it did not transfer enough (I tried to verify with rsync in dry-run mode). I now think dd is not proper tool for this. There are people advocating it. But the problem is that it is not designed for rescuing operations. There are specialized tools for that, that try more than once on failing parts of the drive.

What you need: An empty usb drive at least as big as the failing harddrive. An iso-file of System Rescue Linux CD

Burn the iso file to a CD. On Mac use the Disk tool.

Boot, turn on the computer.

(not needed but if you want: lsusb -v to see usb devices)

fdisk -l to see drives. Find out who is the failing drive and which is the USB drive. Myabe you see the name of the harddrive manufacturer?

Take note of their "location", what is below /dev/ . It could be /dev/hda1 or /dev/sda1 for the failing drive.

You are going to use ddrescue (The gnu version which is not the same as dd_rescue. Known as gddrescue on debian). Reads bad sectors more slowly, should be better than most alternatives.

the command is going to be:

ddrescue infile outfile logfile

But first you will need to know the infile and outfile.

The logfile can be any name.

I suggest: /logfile

It is used by ddrescue if you need to restart it, then it can continue where it was instead of starting over. The logfile will be stored on a RAM-disk when you run the systemrescue CD. What it means is that you do not need to worry about it overwriting any of your data, and that if you turn off the computer the logfile will be gone and you will have to start over.

Note: Make sure you know what is infile and outfile, don't mess up the order.

This is the only command you will need to rescue your drive if you are lucky:

ddrescue -v /dev/sda /dev/sdc /ddrescuelog

However I suggest (see below): ddrescue -v -d -c 10 /dev/sda /dev/sdc /logfile

Note that this is for my example. Don't just use it without knowing which is your hd and which is your usb drive. You need to get infile and outfile right.

Starts good but slows down. The second night it copies less than 2 GB. More than a month left to finish.

ctrl-c then restart with new options -d and -c 10 (suggested by their mailing list)

I didn't notice the speedup at first, but after some hours it had analyzed the full 160GB. Then a new phases started "trimming error areas". And the errsize starts decreasing fom 49464 kb and 1873 errors down to, well after a day 4461 kb and 1933 errors. The errsize is decreasing slowly slowly...

After another day, the errsize is down to 3090kb and errors up to 1974 but the message has changed to "Splitting error areas" so I guess we are close...

Yes! Finished. Rescued 160038 MB errsize 3077kB and 1986 errors.

I turn of the laptop that has been turning me mad with its sound. Ooops, I forgot to verify the copy. It would be interesting to do that with rsync --dry-run. So I turn on the computer, but the HP bios reports: SMART Hard Drive detects imminent failure. Please backup the contents of the harddrive and run HDD self test in F10 setup. OK, but I can't boot into the live-CD because of this message, so I can't backup the contents of the harddrive. And doing the self-test just results in a message that it fails. But how do I get to the live-CD to do my own investigation? I can't.

But when I plug in the USB copy into my Mac and look at the directory with pictures, everything seems ok. Previously I used plain dd with noerror option, and then the pictures looked like they were there but wouldn't open. So my guess is that ddrescue has done its job! Great.

Here is another link if you want to read more.

2009-08-13

Firefox 3.5 Mac Os X segmentation fault

To my surprise, my new Firefox 3.5 on Mac OS X suddently stopped working.

/Applications/Firefox-3.5.app/Contents/MacOS $ ./firefox
./run-mozilla.sh: line 399: 2036 Segmentation fault "$prog" ${1+"$@"}


I don't remember the exact version, but I downloaded Firefox 3.5.2 again and it has worked since. I haven't seen this reported elsewhere by a web search.

2009-06-26

Markdown from Emacs to Html (Blogger)

I use emacs to write blog posts for blogger. I write in the markdown syntax, then convert it to html using markdown (markdown mode for emacs, which invokes the perl markdown command).

However, when writing I have hard breaks and 80 column width to make it readable, markdown converts a paragraph to a paragraph tag, but does not remove the line breaks. When inserted into the blogger ("Edit html") it looks crap, random line breaks all over.

I tried to use pandoc, a great alternative to markdown, and it removes the line breaks as it should, but is then too clever for its own good. It makes tags that are syntactically correct but dont work in blogger, because the end tags have a newline embede in its whitespace. Like this:

<atag>helloo</atag
>

To fix this, I use a regular expression replace in Emacs. It is unfortunate that Emacs doesn't have Perl syntax for its regular expressions, but I was glad it hinted to me what I should do. When I wrote \n it suggested what to do:

"Note: \n here doesn't match a newline, try C-q C-j instead"

In the end I made a simple Emacs command for this and put it in my .emacs file. Run with M-x better-markdown. Happy ending!

;; Makes better formatting in a blog
(defun markdown-better ()
(interactive)
(save-excursion
(let ((buffer "*markdown-better*")
(pandoc-strange-end-of-tag "
*>")) ; This is Newline, space, *, >
(shell-command-on-region (point-min)
(point-max)
"pandoc"
buffer)
(switch-to-buffer buffer)
(replace-regexp pandoc-strange-end-of-tag ">"))))

2009-06-14

Ubuntu upgrade problems

The basic reason for running gnu/linux in a virual machine rather than on the hardware directly is that gnu/linux is messier than people pretend it is. Upgrading a distribution has failed more times than it has suceeded for me. With virtualization you can revert, or make a brand new machine and copy over the files instead.

But I still have a workstation which runs Ubuntu Hardy, and I want to update it.

sudo apt-get update
sudo apt-get dist-upgrade

file list for package linux-restricted-modules-common contains empty filename

sudo apt-get remove linux-restricted-modules-common

file list for package linux-restricted-modules-common contains empty filename
dpg: ../..src/packages.c:252 process_queue: Assertion !queuelen failed.

I see no alternative but to reinstall gnu/linux and hope it doesn't wipe my files. I don't enjoy messing with things like this, and want something up fast. I am dead tired of Ubuntu, but I see no good problemfree alternative. I recalled I had problems with Debian too, but I haven't really ran the stable version. So that is my first alternative now.

2009-05-26

The purpose of this blog

What enormous amounts of good tips and insightful comments I have just wasted by sitting on my ass instead of blogging about it. From now on I am going to braindump here, if it is about computers but boring. That is in contrast with programming which in general is fun and interesting. Messing with hardware and software isn't very often.

That is why I hope this blog can be both a way to save information that someone else searching for a problem might have a need for, but also a therapeutic tool for me. I don't like banging my head against the computer screen. Not anymore. Headbanging is not for oldies.