Posts Tagged ‘linux’
December 17th, 2010
This is probably not a common scenario, but I have RHEL running as a XEN VM on top of SLES (for testing). I am not sure if this is a common problem with XEN or just a problem with SLES but hopefully this will help someone else.
The trouble I had getting RHEL6 to install as a paravirtualized VM on XEN was the vm-install process was trying to boot a kernel from the installation media that didn’t exist. I would get errors that the path /images/xen/vmlinuz didn’t exist and even when I fixed that after rebooting it would fail because it couldn’t find the correct kernel. To get around this just takes a few little steps.
First, you need to copy the installation media to a web server and make a symbolic link from /images/pxeboot/ to /images/xen and so when XEN launches the installation it will pick up the pxeboot vmlinuz image which actually works just fine.
The next step is at the end of the installation don’t reboot. You need to go to the console on the VM. With the gui vm-install you can just hit the menu item ‘Send Key’->’Ctrl-Alt-F2′. Now you need to go to the /mnt/sysimage/boot directory. Here is where your dom0 xen will look for a kernel to use to boot. It will look for a file called vmlinuz-xen or vmlinuz-xenpae. Look for the default vmlinuz (mine was called vmlinuz-2.6.32-71.el6.i686). Now just make a symbolic link from that file to vmlinuz-xen. It will reboot and find the kernel and everything will work just fine even though there isn’t a specific xen kernel because of (I think) the pv drivers Red Hat decided to keep in there anyway (even though they dropped support for RHEL as a XEN host).
You will need to keep the vmlinuz-xen symbolic link up to date every time there is a new kernel installed, otherwise you will keep running on the original kernel (or the link might get broken if the old version is removed).
August 28th, 2009
I test software on SLES/SLED machines and it is always a pain trying to prepare images for re-use in other locations. SuSE uses hardware specific IDs for booting and configuring network interfaces by default so if you try to make an image and use it on another machine you are out of luck. Also, making VMWare images and cloning them creates all new hardware IDs as well so no cloning of the VMs either. Today I finally found a good way to fix all these problems so that network interfaces are set up automatically upon boot for DHCP and GRUB won’t boot using the /dev/disks/by-id/ location but just the /dev/sdaX location.
I found these tips on the Novell Cool Solutions page. One from http://www.novell.com/communities/node/1516/imaging-sled-10-sp1-workstation and another from http://www.novell.com/communities/node/5789/automatic-network-configuration-and-edirectory-configuration-bootable-vmware-images.
There are just two general steps that need to take place. First, make it so GRUB boots using the device name and not the device ID. To do this:
- Open Yast
- Navigate to System -> Partitioner
- For each partition that will be mounted click Edit, Fstab Options, and select Device name rather than Device ID
- Apply those settings
- Now open Yast -> System -> Bootloader
- For each entry click edit and for the root device select the proper device name
- Apply those settings and you are done
The second issue has to do with the device ID of the network card changing and so it is not configured for DHCP on boot. To make all your network interfaces configure automatically with DHCP on boot you need to be able to generate ifcfg-eth-id network configuration files for the interfaces on boot. To do this
- Download this buildeth0 script from (This was taken from a set of scripts on the second Novell link above)
- If you are running SLES/SLED 11 then download this script and rename it to buildeth0
- Copy the script buildeth0 to /etc/init.d/. Be sure to chmod 755 the script so it will execute.
- Now, add the script to the default run-levels rc3 and rc5 by running “chkconfig -a buildeth0″
This script requires that the persistent names are enforced and generated when your machine boots. This is already on by default in SLES/SLED. When the machine boots it will check all the devices connected and create persistent names for any ethernet device in /etc/udev/rules.d/30-net_persistent_names.rules. The script will check that file for any entries. It will then check to see if each of those entries have configuration information setup in /etc/sysconfig/network/ifcfg-eth-id-… if not it will generate that file automatically and configure the interface with DHCP. When the network is setup it will see the configuration there and configure the interface with DHCP.
To prepare for taking an image you should remove all the configuration information already setup for your machine so that when the new device boots it doesn’t wait for non-existing interfaces to be set up.
- rm /etc/sysconfig/network/ifcfg-eth-id*
- Edit /etc/udev/rules.d/30-net_persistent_names.rules and remove any SUBSYSTEM==”net” lines. (Don’t just comment them out)
That’s it, just shutdown and take a snapshot/image of the machine.
December 15th, 2008
So I needed to find the number of files in a directory recursively. I found a great way to figure that out on Linux that has helped me a couple times now. I definitely need to remember it…anyway here is is:
find /my/directory -type f |wc -l
If you need to find the number of directories recursively then do:
find /my/directory -type d | wc -l
Find will just print out all the files it finds. It you tell find a type to find it will only print files of that type (f for file, d for directory). wc will just count the number of lines in the output
December 3rd, 2008
For the last several months on my Ubuntu machine at work the numpad has not been working. It has been so frustrating. I would turn the numlock on and off and nothing would seem to get it to work.
I thought it was something wrong with the keyboard or possibly after a kernel update one of the drivers changed and killed it for some reason. I was on Hardy and haven’t taken the time to update to Intrepid yet. I just figured after I update to Intrepid it would fix the problem. Turns out it probably would have but I fixed it without having to upgrade yet.
This problem actually has to do with Gnome’s Accessibility settings! I found out that if I type 2,4,6, or 8 on the key pad it moved the mouse around by tiny amounts, almost unnoticeable.
To fix the problem I just went to System -> Preferences -> Assistive Technologies, clicked on Mouse Accessibility, selected the mouse keys tab and unchecked the “Allow to control the pointer with keyboard” option. That fixed it!
November 8th, 2008
Holy cow, this about blew my mind. I was working on a simple little website that had no FTP access so I was just planning on copying all the files down to check out the site and see how things were working. Obviously it is not fun to do that. Well I did have SSH access to the server and so I was trying to see what images were which, well, I didn’t really want to scp all the files I wanted to preview one-by-one. Oh, and I didn’t have root access and wasn’t sure if it had NFS available or not. That’s when I found out about sshfs!
With sshfs I can mount all the files locally over an SSH connection! To do this I:
sudo apt-get install sshfs
Edit /etc/modules and add a line that says ‘fuse’ if it is not there already
Add myself to the fuse user group:
sudo adduser username fuse
Then just mount the filesystem:
sshfs username@host:/path/to/remote/files /media/mount-point
Then to unmount do:
fusermount -u /media/mount-point
That’s it. It was so nice to work on all the files using my local tools and apps. Obviously this is not the best idea for changing a production server but it just provides a little nicer look at the remote files.
November 6th, 2008
I had installed Adobe Reader to replace the default eVince document viewer. The problem was that PDFs I opened in Nautilus still opened with eVince. I wanted to know how to fix it so it would always open with Adobe Reader.
In order to do that you need to navigate to the file you want to open with a certain program in Nautilus. Right click on the file and click on Properties. Open the “Open With” tab. Select the program you want to open the file.
Thats it! So easy, and much better than the Windows way of doing it, you just have to know where to go.