Jul 28 2010

[en] Fixing Ubuntu boot process after restoring tar backups to newly formatted disk (with UUID changed)

Napisał(a) Grzegorz w kategorii English, Informatyka, Krótkie, Porady

Mostly note to my self for future reference.

What they don’t tell You in the tar backup tutorial is that it’s not enough to edit /etc/fstab (and their instructions for grub are for grub-legacy).

Because after restoring you probably have new partition UUIDs, you must:

  • boot livecd
  • mount your root fs
  • mount -B /dev /rootfs/dev, etc. (with proc and sys at least) to be able to chroot from livecd to your root fs
  • chroot /rootfs
  • edit /etc/fstab and change UUIDs there (new ones you can get using blkid
  • do sudo dpkg-reconfigure -plow grub-pc to automatically upgrade grub config files, just let it install to the drive(s) it was on
  • do update-initramfs -u so UUID stored inside initramfs get updated, too

Then you should be able to boot it.

Brak komentarzy

Jul 08 2010

[en] Fixing VirtualBox 3.1, 3.2 (and others?) slowness for Ubuntu host and Windows XP guest

Napisał(a) Grzegorz w kategorii English, Informatyka, Krótkie, Porady

Install VirtualBox Guest Additions in Windows’ safe-mode so system file protection doesn’t interfere with the installation, it’s that simple and fixed all my VirtualBox performance problems.

Brak komentarzy

Jun 26 2009

[en] Fix PNG images dark in IE

Napisał(a) Grzegorz w kategorii English, Informatyka, Krótkie, Porady

IE can’t do anything right. If you save some graphical elements to PNG, and try to put them on an area with CSS-defined color, there will be a difference even if you used the same color in the PNG — IE renders PNGs darker than it should. The reason for this is misinterpretation of gAMA frame saved in PNGs that makes it possible to better color-match pictures. The fix is to remove this frame, and doing it on Ubuntu is as easy as:

aptitude install pngcrush
cd your-graphics-directory
mkdir fixed
find . -type f -exec pngcrush -d fixed -rem cHRM -rem gAMA -rem iCCP -rem sRGB {} \;

Now you have a “fixed” directory where you have PNGs that will work properly in IE (and are a bit smaller which is a nice side effect). If you’re sure they’re ok, just do

mv fixed/* ./
rmdir fixed

That’s all.

Brak komentarzy

Jun 03 2009

[en] Fix irregularity of Java Timer and ScheduledThreadPoolExecutor

Napisał(a) Grzegorz w kategorii English, Informatyka, Porady

Using Java Timer class one can schedule a task for recurring execution. Even though ScheduledThreadPoolExecutor makes it possible to create timers with nanosecond resolution (but beware of underlying operating system clock precision!), regularity of task execution is by default awful.

I have run into this once and had to explain the customer that it’s not fixable. When I measured the delay between timer executions, etc. it turned out that doing as much as new Thread(runnable).start() usually takes 1-5 milliseconds, but at times it takes two orders of magnitude longer: even half a second!

Same customer, other project and this time I thought of a reason for this behaviour: garbage collection. I started with calling System.gc() explicitly inside measured code and it takes 200-500 milliseconds! So it must be it.

Is there a solution? Of course there is. It’s called The Concurrent Low Pause Collector and has been in Java since version 5. Read the linked article for many, many details, but shortly just add:

-XX:+UseConcMarkSweepGC

to the usual java -jar command and the garbage collection will be done in parallel with your code execution. Of course it’s no golden bullet, it makes overall performance worse (now instead of 1-5 milliseconds, a single loop pass takes 4-10 milliseconds), but for this particular use, it makes Timer regularity better by two orders of magnitude.

Brak komentarzy

May 29 2009

[en] Solution to SIL3124-2 “no valid device”

Napisał(a) Grzegorz w kategorii English, Informatyka, Porady

SIL3124 is a PCI (as in old PCI, not PCI express) SATA-II controller which I had to buy because my NAS’ old Gigabyte motherboard supports (downspeeded) SATA-II drives only to 750GB size. Of course I got to know this AFTER buying 1,5TB drive ;-)

Anyway, it’s always uphill and even though SIL3124 card sees the drive and I’ve installed Ubuntu Server with no problems to it, I couldn’t boot the card. It kept saying “no valid device”. Turns out it has a RAID-only BIOS by default so if someone - like me - wants to use it as an JBOD (Just a Bunch Of Disks) controller, BIOS upgrade is needed. How user friendly not to mention it in a - Czech-language - manual.

Of course, being mainly a Linux user with no CD- or DVD-drive, I have it even more uphill. BIOS flashing tools are available for Windows and DOS. Soooo the solution is:

  1. Use HP USB Disk Storage Format Tool to create bootable DOS pendrive, here’s Polish language tutorial: http://forum.purepc.pl/Dyski-twarde-cdromy-dvd-pendrive-inne-pamieci-f55/Boot-Pendrive-t254005.html if You don’t speak Polish, just google “boot pendrive dos”, in the tutorial is a link to Win98 boot files You might use.
  2. Download UPDFLASH and the newest BIOS zip from http://www.siliconimage.com/support
  3. The zip file has more than one BIOS inside, read the README and see which one is “IDE” BIOS or “non-RAID” BIOS. Copy the file together with UPDFLASH to the pendrive.
  4. Boot the PC with the PCI SATA Controller from the pendrive.
  5. Run “updflash biosfile.bin”
  6. If you don’t have a UPS, pray to Atheist’s God(TM) that there’s no blackout during flashing process.
  7. Use motherboard’s (not SATA controller’s) BIOS to set Hard Drive as first boot priority, make sure there’s “Bootable Add-In Cards” enabled somewhere.
  8. Reset and enjoy bootable large drives.

Note: Drive’s UUIDs change because of that so it’s best to do it BEFORE installing Ubuntu, otherwise You get a maintanance console.

Komentarze: 2

Następne »