SiKing

January 18, 2017

Raspbian: running the system from RAID

Filed under: linux — SiKing @ 11:11 am
Tags:

SD card failures are a well-documented (and complained about) phenomenon on the Raspberry Pi. One of my clients have a product that runs on an RPi 24/7, and they tasked me to do something about this. I looked at several different things, and I am going to publish my findings here for (hopefully) the benefit of others.

So why do SD cards fail? To put it simply: each write generates a certain amount of heat; enough writes / heat will burn up the card.

In order to lower the chance of failure, there are certain things that can be done to the system. This discussion is a good starting point; this wiki is little more in-depth.

Some things that I looked into, but do not have enough information to share here, are:

  • Industrial-grade SD cards: usually come with some warranty, cost more money.
  • Moving logging to memory (tmpfs): tricky balance between how much memory you have versus how much memory you need for your app, and also how much information you need in case things crash as you will lose everything in memory.

I configured two things on my system: 1) ext2 file-system, and 2) RAID.

Preliminaries

The default Raspbian OS image creates the following partitions:

$ sudo parted /dev/mmcblk0 print free
Model: SD SD16G (sd/mmc)
Disk /dev/mmcblk0: 15.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
        32.3kB  4194kB  4162kB           Free Space
 1      4194kB  70.3MB  66.1MB  primary  fat16        lba
 2      70.3MB  4019MB  3949MB  primary  ext4
        4019MB  15.5GB  11.5GB           Free Space

Note that in this example the disk-blocks (“Sector size”) match, which is desirable. However, some SD cards are manufactured with physical block size of 1024 bytes, or more. In this case, the blocks should be aligned.

boot partition

The first block of Free space is just wasted space?!?!

The second block (“Number 1”) is mounted as /boot and is a FAT partition. The Raspberry Pi is able to boot only from the internal SD card, and only from a FAT partition; citation. This is a limitation of the Raspberry SOC architecture and cannot be changed.

Even at run-time, this partition is accessed. I tried just mounting the partition as read-only, but this caused the system to fail to boot. I still want to figure out why (and what) this partition is being written to at run-time.

root partition

The next block (“Number 2”) is mounted as / (root) and holds the entire OS. This partition is mostly vanilla ext4.

The only restriction on the partition that holds the operating system, is that the file-system must support user permissions – most Linux file-systems do. The default ext4 system uses a journal which causes additional writes to the disk. This is intended to prevent file corruption in case of a catastrophe like power loss during a write. The SD card is fast enough that a chance of such a catastrophe is minimal, and the extra writes cause additional wear on the card. After the base image is created the journal can be removed, or the partition reformatted as ext2, which does not have a journal. Note that if the journal is removed from an ext4 file-system, some tools will actually report that partition as ext2.

free space

The last block of Free Space is probably intended for user apps? When the RPi is booted the first time, there is a utility that automatically expands the root partition into all available free space.

This partition simply needs to be formatted and added to /etc/fstab, so it can be used as a /app partition. Once this partition is created, the first-time utility that expands the root partition will run and fail; the error can be safely ignored.

swap

A swap partition is conspicuously missing. The RPi uses a swap file. A swap file, versus a swap partition, can be easily reconfigured at run-time: turned on or off, resized, or even removed allowing for the space to be reclaimed by the system. dphys-swapfile controls the swap. Note that by default the vm.swappiness parameter is set to 1 (the lowest possible).

I have given some consideration to completely turning off the swap and removing it. However, I am not convinced this is a good idea.

  1. If the system does not need to swap, then the swap file is never written to. So just the presence of a swap file causes no additional wear on the SD card.
  2. And if the system does actually need to swap out, and no swap is available, the system will crash.

RAID system

We can install one or more additional SD cards (using a USB to mini SD adapter) on the RPi and configure them as a RAID system, where the additional card will be an exact duplicate of the first; this is a real-time function and should not be confused with a backup! In other words: if a file is erased from the system, it will be erased from both copies. In case one of the cards fails, the system can still operate on the one remaining card, ideally warning the user that the failed card should be replaced.

The math to calculate the odds of complete system failure is extensive. Using one additional SD card gives us only the possibility of mirroring the two cards (RAID1). Using two additional cards gives us the option of mirroring all of them (still RAID1), or using a more advanced system (RAID5), where the data is written across the cards. RAID5 also gives a slight performance boost – you are able to read or write almost twice as fast. Since you never get something for free, configuring three cards as a RAID5 you can lose only one; configuring three cards as a RAID1 you can lose up to two.

This setup still has one point of failure: the primary boot partition. We can replicate the boot partition using scripts, but the Raspberry Pi SOC is only able to boot from the one card that is plugged into the SD slot on the motherboard. If this partition has a failure, the entire system is dead.

What you are going to need

  • Two (2) identically formatted SD cards; at least one of them has to hold the Raspbian OS. In order to ensure the cards are identical, I just installed Raspbian on both of them.
  • One (1) USB to microSD card adapter; you can pick this up almost anywhere, but be careful: the cheaper models make lower quality electrical connections, and any slight bump might “dislodge” the card and degrade the array.

Procedure

I am a big believer in predictable and reproducible. The individual scripts are numbered (in the filename), and are intended to be run in numerical order. Each individual script accomplishes one specific task. This makes the entire procedure modular, and can easily be modified and experimented with. Each script contains checks for any assumptions, and everything is documented inline. All the scripts have to be run with elevated privileges: sudo ./<scriptname>.

The first couple of scripts must be run on a workstation.

  • 01-write_image_to_card [source]
  • 02-create_app_partition [source] – If you are not interested in having a separate /app partition, then you will need to boot both cards separately so that the free space is expanded the same.
  • 03-tune_root_filesystem [source] – If you are building a RAID system, this script can safely be skipped.

If you are building a RAID array, then rerun the above scripts against the second SD card.

To continue, you now need to boot from one card on the RPi. The Raspbian OS has a one-time startup utility that automatically expands the root partition into all available space. If the /app partition was created, this utility will fail; the error can be safely ignored.

It is probably a good idea to upgrade the OS at this point. One of the later scripts (04) will tie the RPi to the current running version of the kernel.

$ sudo apt-get update
$ sudo apt-get dist-upgrade
$ sudo reboot

To continue, you now need to plug the second card into the USB to microSD adapter. The next several scripts will configure the RAID system on the RPi. The second card must have the exact same partitioning as the primary. Currently I do not have a script that reproduces this; I just cheated by installing Raspbian on both cards – the first three scripts above.

  • 04-configure_initramfs [source] – This script will tie the RPi to the current kernel. Upgrading the kernel after this, also requires upgrading the initramfs.
  • 05-configure_root_raid_pass1 [source] – Configuring the root partition RAID requires a restart in the middle of the process; hence the “pass1” and “pass2”.
  • 05-configure_root_raid_pass2 [source] – After this script, you can monitor the RAID build with watch -n 5 cat /proc/mdstat. It’s a good idea to let this complete before continuing.
  • 06-configure_app_raid [source] – If you are not interested in having an /app partition, then just skip this.
  • 07-setup_maintenance [source] – The RAID should be monitored periodically. sync_boot_partition [source], raid_check [source]

Additional reading

Additional resources I found useul:

Advertisements

July 23, 2011

Groovy Selenium WebDriver and SoapUI, part 1

Filed under: automation,linux,windows — SiKing @ 4:13 pm
Tags: , ,

I recently started a new job and a new project that called for me to make use of some things I have used separately over the past few years: combine SoapUI and Selenium into one framework, and make them work together – actually pass information from one to the other and back. While I am at it, I thought I would dust off some skillz from a box that I have not been in for some time: Eclipse and Java (I know the title says Groovy, I’ll get to that).

setting it all up on Windows

Of course at work they must run Windows. 😦

  1. Download and install (unpack?) Eclipse Classic 3.7, and run the Check for Updates. Mental note: gotta look at Eclipse for Testers, someday.
  2. You need to give it Java: set JAVA_HOME and add %JAVA_HOME%\bin to the PATH. The first one that I tried – there were like half-dozen different versions on my machine 🙄 – Eclipse complained that it is missing something called jvm.dll. Better get the real thing.
  3. If you create a shortcut to launch Eclipse from your desktop, I found that it is a good idea to set the “Start in:” field to the same thing as what your workspace is.
    Eclipse shortcut properties
  4. Install SoapUI. This plugin needs some post-install work/commentary. If you also run the SoapUI IDE, especially a different version than what you just downloaded, the two will share one %userProfile%\soapui-settings.xml and there could be collisions; I would really like to find a way to relocate this file for the Eclipse plugin. Also, if you did not start Eclipse from your workspace – point 3 above – then you are going to 1) possibly overwrite your %userProfile%\default-soapui-workspace.xml, and 2) possibly pollute your Eclipse installation with three *.log files that SoapUI always creates on startup. Lastly: what used to be %SOAPUI_HOME%\bin\ext (external jars that should be added to soapUI classpath, for example JDBC drivers) is now %userProfile%\ext; another thing I would really like to relocate for the Eclipse plugin.
  5. Install Groovy. The instructions say to use http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.7/, but if you read between the lines, you will notice this is the development build and as such it changes often, like almost daily. I used http://dist.springsource.org/release/GRECLIPSE/e3.7/ and it seems to have worked right out of the box.
  6. Install SVN. I am not sure why Eclipse still comes pre-installed with CVS; does anyone still use this? When you’re done, make sure it worked. Normally there are problems.

setting it all up on Linux

Of course at home I run Linux. Surprisingly the Linux setup was a little more work. 😕

  1. I run Linux Mint 9 (Ubuntu Lucid Lynx – LTS); the repos have only Eclipse 3.5, which is way too outdated by now. Download and install (unpack?) Eclipse Classic 3.7, and run the Check for Updates.
  2. LM9 comes set up with OpenJDK. Eclipse will run with this, however, when doing this last time, I ran into some problems, like various things kept crashing the JVM. Somewhere on the Eclipse site (unfortunately, I cannot find the link now) they suggested that you use genuine Sun Java. This is accomplished with sudo apt-get install sun-java-jdk, and then you need to modify your eclipse.ini to point to /usr/lib/jvm/java-6-sun/bin/java.
  3. Install SoapUI. I’m still having problems with this one.
  4. Install Groovy. Use the same location as mentioned above, which makes it work right out of the box.
  5. Install SVN. Fix the problems.

June 5, 2010

Few weeks with Isadora

Filed under: iotal,linux — SiKing @ 12:32 pm

Originally I was going to make this entry One week with Isadora, but life got in the way as it so often does. 🙂

I have been running Isadora RC only from the liveCD for about one week. About a week before the final release I decided to bite the bullet and install outright. Overall I am very impressed – it is an amazing system, even more so considering that it is done mostly by volunteers in their spare time.

The good

I think some of these are derived from upstream, but still glad they got fixed by someone somewhere.

  • Absolutely love the new Software Manager. This tool alone makes Linux Mint one of the best distros around! :mrgreen:
  • I love the dark (Shiki-Wise) theme. Only one thing is missing: the extra scroll-up button right above the scroll-down button; I use a touchpad, and I don’t like moving my mouse that much. Half of the other themes have this. Would love to know how to modify this one tiny little thing. For this one thing I switched to the WildMint theme, even though I don’t really like the colour scheme of that one. I did change the default wallpaper to “Service-4” – it’s the one from “At your service” with the big leaf in the bottom RH corner. All the other ones were too busy for my tastes. 😛
  • I would suspend the liveCD each night, and about one out of three times it would not wake up properly. 😕 This problem is gone after the install. I now easily get weeks of uptime on my machine, suspending every night.
  • My post-install script (adding and removing software) got cut like in half! Really just gnome-games, gnome-user-guide, and build-essential. Why are these things still not included in a base system?
  • I no longer have ATI proprietary drivers! I am not sure if AMD opened up it up, or if someone just rewrote it from scratch, but this is great.
  • Compiz + Google Earth works. No more need for fussion-icon.

The bad

  • I am giving the mintMenu a try now; previously I had used the “Custom Menu”, which I think is derived from Ubuntu. Getting to most common applications is pretty easy, but getting to Preferences and Administration (I seem to be there a lot) requires a few extra clicks. I think I am suppose to use the Filter at the bottom, but at that point I need to use both the mouse and the keyboard. I have managed to (unintentionally) crash the menu on at least one occasion, and it does have a few quirky things like random selections are highlighted for no reason that I can see. Still not sure if I am going to stick with it.
  • I had a problem automatically connecting to my wireless network, but in the end I solved it. Still not sure if this is a bug or just user error.
  • What used to be Services under Elyssa is now gone. So I am not sure how to go about adding or removing services now … other than from the command line. Does Ubuntu really expect people to add/remove services from the command line? 🙄

The ugly

Ubuntu decided to change the way the applets in the notification area work. The new way sucks, and I am not alone in my opinion. According to the GNOME team, this is an Ubuntu problem; IMHO it is an opportunity for Mint to distinguish itself from the its parent.

May 9, 2010

Skype for Linux

Filed under: linux — SiKing @ 8:11 pm
Tags:

Skype Aid
When you compare the features of Skype-Windows with Skype-Linux, you probably get the impression that the Linux version is the ugly child in the family. At some point last year Skype was even removed from all the Ubuntu repos. Unfortunately, I have not been able to find an alternative for video chat to Windows users – please reply to this post if you have an alternative. If you do go with Skype there will be problems, and not all of them have a solution – you need to accept that right from the start!

Most bugs and forum posts on Skype recommend that you install the latest version. Right there, notice that Skype-Linux has been in Beta since August of 2009. When you click through to the download page, the next thing you will notice is that you need at least Ubuntu 8.10 (Intrepid) / Mint 6 (Felicia). If you are running Mint 5 (Elyssa) / Ubuntu 8.04 LTS (Hardy), like me, I guess you are SOL. I do not think it is possible to find the previous version at Skype.com, you will have to go someplace else. 🙄

Next come all the video problems! In Skype go to Options (Ctrl-O), and under Video Devices there is a Test button. Click it and see what happens.

video does not work outright

If you went with Felicia / Intrepid (or later), chances are that the Test fails – at best you get a lot of video static, at worst you get nothing. I did not have this problem on Elyssa / Hardy with the earlier version of Skype. After some amount of Googling, I found this:

Skype does not work well with newer version of GSPCA Webcams driver (Linux Kernel >=2.6.27), possible workaround:

  • Ubuntu 32 bit: install “libv4l-0” package and launch Skype with: LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so skype
  • Ubuntu 64 bit: install “lib32v4l-0” package and launch Skype with: LD_PRELOAD=/usr/lib32/libv4l/v4l1compat.so skype

I am now on Mint 9 (Isadora) / Ubuntu 10.04 (Lucid) and this fix does seem to pass the test! In order to make this fix permanent for all users on your system, do the following:

  1. Open an editor, and enter the following:
    #!/bin/bash
    LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so /usr/bin/skype
    
  2. Save the file in your home with the filename “skype”.
  3. Open up a terminal, and switch to root (sudo bash) and run the following:
  4. cd /usr/local/bin
    mv ~/skype .		# move over the text file you just created
    chmod +x skype		# give the text file execute permissions
    
  5. Now try launching Skype from your menu, and run the video test again. It should pass.

video crashes when launched in chat

Yes it does. There is only one solution that I have been able to find somewhere on the Skype fora:

  1. Get the other party to start their video first. If the other party is also on Linux, I guess you’re screwed.
  2. On your end, in the video window, there is a pulldown menu. In that menu select “Double size”.
  3. You are now able to launch video from your end.

I have no idea why or how this works!

A few seconds into the chat, the doubled video window will freeze up, and the top 1/4 (so the original size of the video) will basically take over and continue to work. 😕 A few seconds after that, the top left corner (not the entire active area, but about 20% of it) will turn into a dead white block. There is no known fix for any of this. If I am wrong please reply to this post!

When you’re done with the chat, make sure that you hang up first. If the other side disconnects first, Skype on your end will simply crash.

Update 13/05/2010:

Just had a chance to try all this out live. I am now running LM9 (U10.04) and Skype is in the repos and I am using that one! It is suppose to be version 2.1.0.81, but the About page looks different than if you download the same version from Skype.com. So I do not know what other changes there are.

All the stuff in the “video does not work outright” section above still holds true.

I did not have to have the other party start their video first, and I did not have to double their video reception screen, and Skype still works as expected.

So far have not been able to confirm any of my other claims from above: the freezing of doubled screen, and the white block. But both of those are very minor issues compared to the other stuff.

December 26, 2009

Wireless in VMware Server 1.0.10 on Linux Mint 5

Filed under: linux,virtualization — SiKing @ 7:35 pm
Tags:

Over the holidays I updated my VMware Server, and I got my machines bridged to my wireless card. Yea baby! :mrgreen:

  1. Have a read through my previous HOWTO.
  2. Download VMware Server 1.0.10.
  3. Go through the install, but stop at the vmware-config.pl.
  4. Download Liken’s vmware-any-any-update-115-K2.6.24-WirelessBridge.tar.gz.
  5. Unpack Liken’s update. Replace vmmon.tar with the original from VMware Server. If you are following my instructions religiously, then you want cp /usr/local/lib/vmware/modules/source/vmmon.tar /tmp/vmware-any-any-update-116-K2.6.24-WirelessBridge/.
  6. Run the runme.pl in Liken’s update, and continue with vmware-config.pl (you have to do this as sudo, but you knew that right?).
  7. Cleanup the debris – see the note about libgcc_s.so.1 in my HOWTO.
  8. Before starting your machine, explicitly define the machine to use Custom Network Connection: /dev/vmnet2 (or whatever you bridged your wireless card to).
    Virtual Machine Settings

Credits: without the following people I would have never gotten this to work.

PS: This is my post #100! 😎

October 8, 2009

Installing Eclipse on Linux Mint (Ubuntu)

Filed under: linux — SiKing @ 9:21 pm
Tags:

Even thought Eclipse is available in the standard Ubuntu repos, it is not as easy or straightforward to install as other packages. Here is what I did to install the latest Eclipse + Pydev + Subclipse on my Mint 5 :mrgreen: (Ubuntu 8.04 equivalent).

Step 1: Install and update Eclipse

  1. sudo apt-get install eclipse-pydev, or you can just install the package eclipse-pydev from Synaptic. Pydev has Eclipse (and a bunch of other stuff) as a dependency, so you will get both. Subclipse is not available in the repos; no idea why; we will handle that separately below.
  2. Eclipse has it’s own package manager, which is not exactly compatible (in form or function) with APT (note that Synaptic is just a graphical front end for APT). Once the install completes lock the eclipse and eclipse-pydev packages: in Synaptic select the package and then select Package > Lock Version. This will ensure that Synaptic knows it is installed (in case it is a dependency for something else), but it should never mess with trying to update it.
    Eclipse pinned
  3. Start up Eclipse as a normal user, and enter your default working directory. This step will ensure that all the work files that Eclipse needs will be created, and they will be created with the correct permissions and in correct places.
  4. Next you want to update Eclipse. What Eclipse does not do for you, and you just simply have to know, is that you need to do this with root privileges – majority of Eclipse lives in /usr/lib/eclipse. If you skipped the previous step (creating all the work files), then the work files are going to be created with wrong privileges, and subsequently nothing is going to work right; even after I chowned all the ownership on ~/workspace I still had problems. Start Eclipse from a terminal with sudo eclipse. When it asks you where you want to keep your workspace, this time it does not really matter what you tell it – I normally tell it in /tmp.
  5. To update Eclipse, select Help > Software Updates > Find and Install, and follow Scenario 1 from the Eclipse wiki.

Step 2. Update Pydev

  1. Still as root in Eclipse, again select Help > Software Updates > Find and Install. This time select the second option “Search for new features to install”. Pydev was sold and re-licensed, and I suspect the new owners are not interested in keeping Pydev in the repos. So the new version is actually a new product.
  2. I was presented with three sites to search. I did not find anything I was interested in on Callisto Discovery Site. Pydev Extensions is what you want. The Eclipse Project Updates did find things, but I think they buggered up my install, so from now I just avoid them.
    install sites
  3. When presented with the available updates, select Pydev. The Pydev Extensions are a paid feature, and I am not using Mylyn.
    updates
  4. Another restart. If you check, you will notice that the Pydev Extension site has been removed. This means that from now on, to update Pydev, you can go through “Search for updates of the currently installed features” and not the “Search for new features to install” route.

Step 3. Install Subclipse

  1. Subclipse is a new feature, so still as root in Eclipse go to “Search for new features to install”.
  2. This time you have to add a New Remote Site. You get the necessary information from the Subclipse site.
  3. After that continue through the wizard. From the presented choices, I only selected Subclipse, minus the Revision Graph which I could not get some dependencies for.
    subclipse updates
  4. You need that JavaHL stuff, and contrary to the way things look above, you did not just install it. 😦 sudo apt-get install libsvn-javahl
  5. Now it gets complicated! Start up Eclipse, and see if it cluedin and figured out what you just did. From the menus select Window > Preferences, and in the popup window select Team > SVN. Under the SVN Interface, you need to see a version of some kind. If you see “Not Available”, Eclipse did not figure it out.
    Eclipse preferences
  6. If it is not right, first check you got the correct version of everything. There is a Subversion server – Subclipse version compatibility, and then Subclipse – JavaHL version compatibility. So, as an example, I am trying to connect to SourceForge which supports Subversion v1.5. So I will need Subclipse at least v1.4, which needs JavaHL v1.5. I am using Mint5 – Ubuntu Hardy – and according to this, I will need to grab JavaHL from their backports repository. If you are running Intrepid – Mint 6 – or later, you should be fine. Including additional repos in your system I will leave as an exercise to the reader.
  7. If after all of that it is still not working 😮 , you will need to edit your eclipse.ini. I did not have to do this, and I suspect that newer versions of Mint will be the same.

Last word

To remove this mess from your system:

$ sudo bash
# apt-get purge eclipse
# apt-get autoremove
# rm -rf /usr/lib/eclipse

Maybe I’m just spoiled, but all this should not be this difficult!

Update 09/10/26: So apparently I forgot an important step. After doing all these updates you have to rm -rf ~/.eclipse to reset everything on your account. Also, Pydev has been restructured (again), and re-released as version 1.5. Unfortunately, they forgot to notify the update manager, and you have to do it manually – note the ‘Quick Install’ cutesie note on the right hand side.

Did I mention that is beyond-stupid complicated?

September 29, 2009

Big loss for Linux today

Filed under: linux — SiKing @ 6:33 pm
Tags:

Approximately 2 and half years ago I became a serious proponent, dare I say evangelist, of Linux. As of today that is no longer the case.

Without going into all the boring and filthy details, I had some minor problems running a new 64bit kernel, on somewhat new-ish hardware that almost supports 64bits, with some older software. I tried to downgrade – clean reinstall – to something which I had previously confirmed on another machine works perfectly fine. After the install I had serious problems even connecting to the local network – plain DHCP. This is normally an immediate KO criteria for me, and I don’t even bother trying to figure out anything else. This time I did give it a second chance, only to run into more serious problems. 😡 Well, I’ll just reinstall back what I had at the beginning of the day and live with the small issues, right? Last time, the install took me under 60 minutes. After the second install I could not get anything to work again! How is it possible to use the exact same install media, on the exact same machine, and get two completely different results? After a day of pondering this dilemma – downtime for my employer – I am installing that other system first thing tomorrow morning. 😦

Here are some myths, that I personally have proven wrong:

Linux is cheaper. You know what? Nobody in the corporate world cares! I have yet to meet anyone anywhere who actually gives a hoot to save money for their employer in this area. Licensing costs for proprietary software, in the corporate world, are somebody else’s problem somewhere else and the software is effectively free to us here.

Linux is technically superior. That may be, but only if you are a geek that reads source code all day. One of my colleagues, whom I respect very much, runs Windows on his desktop, has a MacBook sitting on the desk next to him, wears OpenBSD T-shirts, and runs several different Linuxes in the back room. He is quite fluent in all these OSes. When someone asks him which OS he prefers, his answer is always: “whichever gets the job done the fastest.” The “job” that he is faced with on a daily basis: some marketing drone hassling him to “just get my laptop to work!” Bottom line: All operating systems will have problems. It just so happens that for Windows the problems are assumed by the (l)users, and there is always somebody around who knows how to “just get it to work.” However, if you run into a problem with your Linux machine, everyone just gives you that you-asked-for-it look and a shrug.

I am not expecting to see Linux on the corporate desktop any time soon. 😥

June 9, 2009

Converting graphics fast

Filed under: linux — SiKing @ 9:16 pm
Tags:

Every once in a while I have to covert/shrink/modify a picture. First off I suck at graphics (one of my sons is WAY better at it), but, like this time, I had to convert something from .svg to .jpeg and shrink it too. The package that you need to do this is imagemagic, and the command is: 'convert <orginal.svg> -resize 150 <target.jpeg>'. There is a huge number of switches that this thing takes. Check it out!

June 8, 2009

Installing VMware Server on Linux Mint (Ubuntu)

Filed under: linux,virtualization — SiKing @ 8:52 pm
Tags:

Installing VMware Server is not your typical point-and-click procedure. However, it is quite easy even for those who are a little squeamish with the command line.

Here I will be talking about installing VMware Server version 1.0.9 on Linux Mint 5 – I don’t do the latest’n’greatest anymore. Linux Mint is fully compatible with Ubuntu 8.04, so I would expect this procedure to be very similar, if not identical, for most derivatives and close versions.

VMware are very good at hiding all the useful stuff on their website! 🙄 Here are all the pieces you are going to have to download:

  • VMware Server will require you to build kernel modules. You will need kernel header files for that. On Mint/Ubuntu you already have them at /lib/modules/$(uname -r)/build/include. The installer, further below, will be able to figure it out automatically, assuming you have all the defaults for your system.
  • To build stuff, you will need tools. I just grabbed the build-essential package and that had everything.
  • The VMware install guide is linked here – you want the Admin Guide, starting somewhere around page 36. I once accidentally found a much more succinct Install Guide on their page, but I can’t find it again. 😦 Below is only the relevant distill; however, I would still recommend that you have at least a browse through theirs in case you run into problems. There is also a detailed guide here, which may be of some use if you run into problems.
  • VMware is pushing the newer 2.0 version; older version are here – you want to get the “VMware Server for Linux. TAR Binary.” Right on that same page, notice the register for your free serial number(s) link. The server is free, but they will need an e-mail address where they can push more stuff on you.

First you will need to unpack the TAR Binary. You will only need this once, so you might as well do it in /tmp – which gets automatically emptied each time you reboot. Open up a terminal:

cd /tmp
tar xvf ~/Downloads/VMware-server-1.0.9-156507.tar.gz

And continue with the install:

cd vmware-server-distrib
sudo ./vmware-install.pl

I took defaults for everything except the following:

In which directory do you want to install the binary files?
[/usr/bin] /usr/local/bin

On Ubuntu, or any system that has a package manager, it is good idea to keep stuff you install manually somewhere else. The Linux file system has a place specifically for this purpose, and that place is /usr/local.

If you screw the install up, you can run sudo /usr/local/bin/vmware-uninstall.pl so that it cleans up, and then start again.

Next is the configuration. The installer will prompt you, or you can just run explicitly sudo /usr/local/bin/vmware-config.pl. Any time afterwards you want to change something, you will need to rerun this program. For Linux Mint 6 (Ubunt 8.10) or perhaps later, you might need this patch before you configure the VMware – suggestion is to run the configuration program, if it fails install the patch, if it passes just move on. Again, I took defaults except:

You can safely ignore the complaints about the extensions on the Icons, as well as the wrong version of the gcc compiler.

For networking, make sure you bridge all interfaces (ethernet and wireless). I did not use NAT.

In which directory do you want to keep your virtual machine files?
[/var/lib/vmware/Virtual Machines] /home/vmware/machines

The way I have my disk partitions set up, I had to override where the machine images will be kept. The images will be big, make sure the place you tell it has enough space.

If everything worked fine, you should get a new menu entry Applications > System Tools > VMware Server Console. The first time you try to run it, it will not work. 😦 If you run vmware from the command line, you will get:

/usr/local/lib/vmware/bin/vmware: /usr/local/lib/vmware/lib/libgcc_s.so.1/libgcc_s.so.1: version `GCC_3.4' not found (required by /usr/lib/libcairo.so.2)
/usr/local/lib/vmware/bin/vmware: /usr/local/lib/vmware/lib/libgcc_s.so.1/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /usr/lib/libstdc++.so.6)
/usr/local/lib/vmware/bin/vmware: /usr/local/lib/vmware/lib/libgcc_s.so.1/libgcc_s.so.1: version `GCC_3.4' not found (required by /usr/lib/libcairo.so.2)
/usr/local/lib/vmware/bin/vmware: /usr/local/lib/vmware/lib/libgcc_s.so.1/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /usr/lib/libstdc++.so.6)
/usr/local/lib/vmware/bin/vmware: /usr/local/lib/vmware/lib/libgcc_s.so.1/libgcc_s.so.1: version `GCC_3.4' not found (required by /usr/lib/libcairo.so.2)
/usr/local/lib/vmware/bin/vmware: /usr/local/lib/vmware/lib/libgcc_s.so.1/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /usr/lib/libstdc++.so.6)

According to the Gentoo team, this file is useless. Once you delete that, the VMware console should come up normally.

Update 09/06/18:

I just tried to do the above on Ubuntu 8.10 64bit. I did need the patch as mentioned above, and I did not get the error about libgcc_s.so.1 when starting vmware. However, I did run into an issue starting up my virtual machine. At first you get a blank error (as in: “The process exited with an error: End of error message.”), but if you turn on debugging in the advanced options you can see the actual error:

Version mismatch with vmmon module: expecting 138.0, got 137.0.
You have an incorrect version of the `vmmon' kernel module.
Try reinstalling VMware Server.

And they’re not kidding. The fix is that you have to configure vmware twice! 😯

Then there was a second surprise: my arrow keys (along with a bunch of others) did not work inside vmware. There is an explanation as well as a solution, at the VMware Knowledge Base.

Every once in a while the keyboard will stop responding to mapped keys – things like Crtl-Alt-LArrow to switch desktops – you can run setxkbmap to fix it.

Update 09/06/24:

For some other reasons, I updated my box to Ubuntu 9.04 AMD64. When recompiling vmware I hit some SSL key errors.

Update 09/07/22: Bottom line: If you are going to go with VMware 1.x do not go over Ubuntu 8.04 (Mint 5). After several months of running it on 9.04×64, I feel it is quite unstable! Also, if you do want to virtualize 64bit operating systems, make sure your BIOS supports this thing … upfont. 👿

May 22, 2009

Linux Backup & Reinstall

Filed under: iotal,linux — SiKing @ 3:38 pm
Tags:

Last week I spent some time playing with DreamLinux (again), trying to get it onto a thumb-drive / memory-stick / whatever-you-call-those-things (again). Dream hosed my system (again). This time I lost my swap?!?! I’m sorry guys, but that installer sucks! It’s just as well, there were a few changes that I had been wanting to do to my system anyways which would require a complete reinstall.

The procedure that I basically follow is:

  1. Backup home. You have to do this as root, so that hoses the ownership of all the files. I know there is a way to do it correctly and preserve the ownership, but it actually does not matter that much – see further below.
  2. Install the system wiping the drive(s) clean.
  3. Install critical updates. In the case of Mint I do only levels 1 and 2. I am running Mint 5, which is based on Ubuntu 8.04, so at this point I also install the top bugs from Ubuntu 8.04.2.
  4. Clean the system – remove things that you definitely do not want. Install restricted drivers.
  5. Create a second “administrator” account, log in to populate the home.
  6. Crete all other users, log in to each to populate their home. I have an (apparently) weird habit of putting all my users into the group “users” as opposed to the default group == username, and giving their home 700 permissions.
  7. Log in as the “administrator” and restore backups. Can’t restore (or backup for that matter) my own home when I am using it. I used to get around this by running a live-CD, but this seems like so much less work. Change owner and group of all the user’s files to themselves.
  8. Install all apps.
  9. Get my kids to install all games. 😆

There is one app that, IMHO, should get special attention: Eclipse. Eclipse has it’s own package management built in. I normally install Eclipse along with any plugins that I want through Synaptic, and then I “pin” them – lock that version – so that Synaptic or Mint Update will not try to update these. I then go into Eclipse – have to run it as root in this case – and update the whole thing from within Eclipse.

April 10, 2009

Getting Linux distro name and version

Filed under: linux — SiKing @ 9:56 am
Tags:

It appears that I am not the only one that would like a consistent way of getting the Linux distribution name and version number for any and all distros. And it appears there is no solution to this dilemma. The following is my attempt at such a solution.

The script will currently give you correct results for only about 60% of ditros out there. Anyone want to add the algorithm for their fav distro, please do so in the comments. I will try to maintain this up-to-date.

#!/bin/bash

if [ -e /etc/*-version ]; then
	if [ $(egrep -q '[[:alpha:]]' /etc/*-version) ]; then
		# the file contains only the version, not the name
		pushd /etc &> /dev/null
		name=$(ls *-version)
		popd &> /dev/null
		printf ${name%-version}
	fi
	cat /etc/*-version

elif [ -e /etc/lsb-release* ]; then
	# This is probably the most reliable method, if it is available.
	description=$(lsb_release -d)
	echo ${description#Description:}

elif [ -e /etc/issue ]; then
	# This is quite unreliable, as admins are encouraged to edit this file to their heart's desire.
	head -1 /etc/issue | sed {'s/ [@\][[:alpha:]]//g'}

fi

March 15, 2009

Pimp your desktop

Filed under: iotal,linux — SiKing @ 4:37 pm

If downloading and installing stuff from gnome-look.org is too complicated for you, as it is for me, then try GnomeArtNT.

Got to give credit where credit is due: I first heard about this app at MintCast #5.

Next Page »

Blog at WordPress.com.