Showing posts with label FEDORA. Show all posts
Showing posts with label FEDORA. Show all posts

Sunday, July 12, 2009

Fedora 11 - Upgrade from Fedora 10... not good... not good at all

Overview
So there I was, sitting at my workstation, doing a bit of work on my Fedora 10 server. When, all of a sudden a docile little dialog appeared notifying me that Fedora 11 was available and I could run pre-upgrade before upgrading.

Well, being an Ubuntu user, I have done many simple and smooth network based upgrades. So I figured, why not. Lets give it a shot. All my critical data is backed up anyway.

Now, I know what you are thinking. It states on the fedora project website that they prefer a clean install vs an upgrade. However, that doesn't mean an upgrade isn't possible? Right. I mean if your system pops a dialog saying "Distribution upgrades available" you should feel comfortable doing it. If it is possible but not recommended, why make the option so obvious.

I have been using Redhat/Fedora for as long as I have been using linux. Normally, I have followed the advice of doing a clean install vs upgrade. This time, I did the upgrade via network and let just say, it was not a good experience. Very little worked as advertised and I was always this close to system corruption and rebuild.

Now, I am not saying that an upgrade path from Fedora 10 to 11 spells doom. I am just saying that it almost did for me.

Background
My system has been upgraded twice by DVD. From Fedora 7 to 9. Then from Fedora 9 to 10. This may have set the stage for my upgrade distress. In all cases, there were some issues and bugs that I had to correct. Before FC7, I only did clean installs.

What Happened
My issues started during the pre-upgrade process. The updates dialog pops letting me know that FC11 is available. When clicked, the update process looks at your system and stages what it needs to upgrade.

During this phase, I got a message saying that the install image would not fit in /boot that that I needed a wired network after reboot to get the image during the upgrade. I had a wired network so I let it go.

After reboot, being sure to hit enter when you see the boot countdown (not documented) to get the option for the upgrade boot kernel.

Once I got into the actual upgrade process, I started getting error messages saying that it could not find packages (RPMs). That I could reboot or retry. The dialog said that reboot would mean possible corrption of my system. Retry, would simply retry (which is stupid). There was not a third option like, specify new location, data source, or continue anyway.

What is worse, is that it appeared that the installer was expecting RPMs to be in a different directory then they were in the install image (!!!). How this is possible, I have no idea since I never specified either. The update handled the mirror selection and all the behind the scenes work.

Well, corrupting my server, requiring a rebuild was just not going to happen. The following are a few thing I did to get through the mess and to a final working system.

Problem - Cannot Find Package to Install
It is possible that Fedora expected their install to barf so they were kind enough to provide most of the tools needed to correct them.

gives you a prompt. Here you will save the day.
gives you the current console log. Here you will see what is missing.

Two main tools that saved the day
  • wget
  • lynx
Both are text based and will let you fetch one or many missing files. lynx will complain since it needs a config. In /mnt/.../etc (look around) you will find a lynx.cfg and a lynx.lss. Copy them to /etc/. wget simply works.

Next thing you will need is a good working mirror. You will need to visit the fedoraproject site for that to find one. Each system will be different so you wil need to look at the console log to see where it is expecting to find the RPMs. Once you can see that (i.e. file:///mnt/system/...) you can cd to that directory and fetch each missing file one by one as you see the errors.

This job actually sucks since a missing gnome-libs problably means that gnome-libs-devel will be needed later. To get around this, I worked in broad strokes.
  1. I fetch a list of all the files using wget from the mirror site.
  2. I washed the "packages.html" file through cut and awk to get a list of only the rpm files
  3. This list of files was then washed through awk a second time to pre-pend wget http://..../file.rpm.
  4. This was then redirected into a text file for later use
When an error would pop up. For example gnome-libs. I would simple run the following from the prompt:

cat packages_wget.txt |grep gnome-libs |sh

Now the file (or any file with gnome-libs in it) will get fetched. This does not mean that it will get automatically installed but will be available for the installer.

I did this for all missing files. Later during the upgrade phase, there were more errors, so I followed the same approach.

I now what your are thinking
Why didn't I stop the install and download a DVD? I thought about that, however, the error messages dialog warned about corruption to the system and it was not clear how many files were actually missing. I might have been on my "last one". Once I got the above approach working, it went pretty fast. It was just an unforgiveable waste of time.

Hurray, the system upgrade is done. Reboot and Run Updates...!!!..Grumble
Finally, the upgrade completed. I rebooted the system and prepared for doing a yum update. This should be cut and dry now.... right? Nope. Aparently, there are several pre-release packages that were included in something the system was upgrading. Others had errors.

dhcp and cyrus-imap had a refernce to an openssl library that had an incorrect symlink. Looking at the error and correcting the symlink did the trick.

In a nutshell, yum update tried to upgrade a packages that does not exist on any mirror or even on the fedora site. Unless you know the full dependancy tree within the 631 updates, it is hard to turn off the ones in questions. For this reason, I had to upgrade in small batches until I found the packages that had the dependancies to the other packages that didn't exist.

Final Thoughts
I don't think I can stomach another Fedora upgrade. Will this happen to you? I am not sure. There could have been many reasons for my hardship, however, I have been using Fedora/Redhat for at least 10 years so I now the ins and outs. Install is not a strong point. It is flexible and easy to manage once running however. It is my (current) choice for a server OS.

My thought to you is: if the installer tells you that you do not have room on your /boot partition, cancel and walk away. I have a feeling that a DVD install would have gone better. A clean install would be best.

I just wish they could make it work like Ubuntu. That distro is great for package management. They just tend to be slower on updates (i.e. Java).

I will try to add more details about specific commands and syntax. My main goal here was to put information out, in the event, that other of you have run into the same issues.

Update 2009-Sept
Since my painful upgrade, the updates have been flowing just fine. My system has been running pretty well.

Sunday, November 4, 2007

HOWTO: setup sshd_config and ssh clients

Overview
SSH is integral in having a secure network. I love it and use it everywhere I can. There are a few things that can be done to make your setup easier to use and a bit more secure.

This setup was done using Fedora Linux version 3-7. Since openssh is a common package, this howto can be done one just about anything it runs on.

Disclaimer
I am, nor will I ever consider my self a security expert. Please ensure you understand these commands before using them. If you do find a hole or mistake, please leave me a note.

SSHD
The sshd daemon is the core to SSH. It is controlled using a config file /etc/ssh/sshd_config This file has many params. The following are a few that you should consider changing.

Force all clients to connect using version 2 and not 1.
Protocol 2

Narrow the list of users that can connect. If your network is small enough, list the users in an AllowUsers directive.
AllowGroups users
AllowUsers uuklanger smgeller
DenyGroups root
DenyUsers root

Lock down as much as you can here. You would be surprized how many differnt ways hackers try to get in. By telling sshd to only allow certain groups and users, you may prevent a hacker from getting in via a default account installed by some package you installed.

SSH Client
Using ssh is easy. From a prompt just type ssh -X rmnp.inhouse.rockynet.com to login as "you" to a system called rmnp. -X enabled X windows popping. If you need to copy a file, you can use the scp command. For example, scp file.txt rmnp.inhouse.rockynet.com:/tmp will copy the file file.txt in to /tmp on the server.

Once entered, a password prompt will be displayed. The password you use is the password of your account on the server. In this case, my uuklanger password for rmnp. Entering passwords is pretty boring. To get around this, and to increase your security, you can use keys. In the following example, you will see how to create and setup a key for user "uuklanger" on the workstation "tree" that will tell "rmnp" to trust your ssh connections. This assumes that you have never done this before and that the file authorized_keys does not exist.

On the workstation "tree" do the following as yourself (uuklanger in my case):
  1. cd ~/.ssh/
  2. ssh-keygen -t rsa -b 2048
  3. When you get asked for a filename, call it id_rsa
  4. The rest of the prompts, just hit enter.
  5. You will now have two files generated. id_rsa and id_rsa.pub
  6. scp id_rsa.pub uuklanger@rmnp.inhouse.rockynet.com:.ssh/authorized_keys
Done.. Now if you ssh to the server, you will be let right in. In step #6, if it fails, it is possible that you do not have a .ssh directory on the server. If that is the case, connect to the server and then ssh back to your workstation. SSH will create the .ssh directory for with the correct permissions. You can do this manually too.

For step #6, if you already have an authorized_keys file on the server, you will want to transfer id_rsa.pub to the server and then append it to authorized_keys. Otherwise, your file will be overwritten.

Now try to ssh -X rmnp.inhouse.rockynet.com and enjoy the direct access without the pesky password prompt.

Final Thoughts
These steps will help lock down ssh a bit more the the default. If you want to lock it down more, you can turn off passwords all together and rely on keys only. This can be done in the sshd_config file. See the openssh documentation for the steps on how to do this. This is just getting it going. There are tons of cool things that SSH can do on top of the settings done here. There are lots of tricks out there. Enjoy.

Friday, October 5, 2007

HOWTO: install/upgrade SUN Java under linux

Overview
For those of us using a flavor of linux that does not come with SUN Java (which is currently most of us), you may have run into a bit of a problem. Linux distros typically bundle the the GCC GCJ compiler. Sure, it is probably nice and all but I personally prefer SUN Java. It is what is installed on most non-linux based computers out there. It is the standard.

I, like others out there, have probably tried to remove GCJ from their systems. Well, it is not easy since everything Java that comes with the distro is bound to it. Arg!

The next option is to see if you can get SUN Java and GCJ to co-exist, so you install SUN Java anyway, and run
java -version. You still see GCJ's version. Arg! Why? because the GCJ's java is in the path.

You could setup all the path and JAVA_HOME/JAVA_PATH environment variable but, for me, that is just not enough. I want my environment to just use SUN Java. Outside of simply having 1 flavor of Java installed, this is the way to go. Make SUN Java the default Java.


Purpose
The following will describe the rather simple process for getting SUN Java to be the default Java. This is being done under Fedora Core 6 and 7 (RPM based), however, the technique should work for other distros. I am using SUN Java JDK 6 and am upgrading from 6u2 to 6u3. The process of upgrade or install is the same except for removing the old version :-) The most important aspect is the steps to follow.


Required Downloads
The example will be done installing SUN Java JDK 6 Update 3 (6u3) to replace SUN Java JDK 6 Update 2 (6u2).
  • download SUN Java
    • Site: http://java.sun.com/
    • I used the RPM based install package called jdk-6u3-linux-i586-rpm.bin
  • download java-1.6.0-sun-compat-1.6.0.xx-1jpp.i586.rpm where xx is your update version (01, 02, 03,..)
    • Site: http://www.jpackage.org/browser/
    • In this case, we are trying to download a sun-compat for JDK 1.6.0.03 or 6u3. That is what I hope to find...
    • If a version for your JDK is not available, go on to step #3. This is my case for this example.
  • download the source file java-1.6.0-sun-compat-1.6.0.xx-1jpp.src.rpm where xx is the latest available version.
    • Site: http://www.jpackage.org/browser/
    • At the time of the writing, 1.6.0.02 was the only sun-compat available which is a version behind 6u3. This is ok.

Install/Upgrade
  • Install SUN JAVA
    • command: sh jdk-6u3-linux-i586-rpm.bin
    • agree to the terms by typing "yes"
    • You will see it install a bunch of RPMs into /usr/java/ and /opt/sun/
  • If your java 1.6.0-sun-compat RPM version matches your JDK...
    • command: rpm -Uvh java-1.6.0-sun-compat-1.6.0.03-1jpp.i586.rpm
    • you are done
  • If it does not match then install...
    • command: rpm -ivh java-1.6.0-sun-compat-1.6.0.02-1jpp.src.rpm
    • as above, version 02 was the only version availble
    • you are not done yet.
If the 2nd bullet passed and your JDK version (6u3 in my case) matches the sun-compat version (1.6.0.03) then you are done and can do any clean-up (see below). If you type java -version at a prompt, the version number should be as expected. Otherwise...


Creating your own sun-compat RPM (where sun-compat <> JDK)
Well, you were eager and could not wait for the jpackage guys to create a java-1.6.0-sun-compat-1.6.0.03-1jpp.i586.rpm for you. You just want the latest JDK working. Sound like me. No problems. You have already download the source file (java-1.6.0-sun-compat-1.6.0.02-1jpp.src.rpm or similar) so you can make your own. You have also installed it (3rd bullet above).

To make your own sun-compat RPM just do the following:
  • cd to /usr/src/redhat/SPECS/ (the source directory may be different on other distros)
  • edit java-1.6.0-sun-compat.spec using your favorite text editor
  • At the top of the file you will see %define buildver 02
    • For this example we want 6u3 so buildver should be changed from "02" to "03".
  • Save and close the file.
  • Make your RPM
    • command: rpmbuild -ba java-1.6.0-sun-compat.spec
    • stuff happens...
  • Look in /usr/src/redhat/RPMS/i586/ and you will see java-1.6.0-sun-compat-1.6.0.03-1jpp.i586.rpm
  • install it
    • command: rpm -Uvh java-1.6.0-sun-compat-1.6.0.03-1jpp.i586.rpm
As above, you should be able to run java -version and see (as in my case)

java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)


That is it.


Clean-Up After Successfull Install/Upgrade
Once you are sure everything is using the new version, you can (if desired) rpm -e your old jdk. Since SUN JDK 6 creates a symlink from the current version as "latest" there isn't much risk of using the old version... I did say "much" risk. I prefer removing the old once I confirm the new one is safe and stable.


Netbeans
To tell programs like Netbeans (we are all using it after all) to use the new JDK, simply update the JDK version in $NETBEANS_HOME/etc/netbeans.conf where $NETBEANS_HOME is the location of the netbeans install. That will affect all users of that install globally.


Java WebStart
I love WebStart, however, for some odd reason, desktop shortcuts created for linux (GNOME) hard code the full path (including version) to the javaws program. This is stupid since they should really just point to "latest". Regardless, you can either de-install/re-install the Java WebStart apps, or do the lazy approach and just edit the *.desktop files in your ~/Desktop/ directory. Just update the JDK version to match the current version.


Final Thoughts
This may seem like a long process but the steps are basic and easy. I keep the sun-compat source installed on my system and update the version number each time a new JDK comes out. I only get a new src and i586 version for new major JDK releases (i.e. JDK 5 to JDK 6). This makes the update process take a few minutes. About the same time it takes in Windows to update the PATH of the System Environment.

I hope these steps help it become easier for you too. I also hope that this blog become obsolete and that linux distros start bundling real SUN Java by default. It just the right thing to do. Some distros are already doing this. Fedora? Do you hear this? :-)

BTW
For Ubuntu, this may work. I need to try it.
http://coffeecokeandcode.blogspot.com/2008/09/installing-java-6-update-10-on-ubuntu.html

Monday, April 9, 2007

HOWTO: config 915resolution to have widescreen resolution

Overview
There is a problem with Intel Graphics chipsets to where where it doesn't know about wide screen resolutions. I don't know about the back story but I would like to be able to use 1440x900 with my monitor. The good thing is that someone has created a solution that gets around this issue.

My system is a 2007 ASUS P1-P5945G that uses the INTEL 945G CHIPSET. I have a 19" (widescreen) Viewsonic monitor that supports up to 1440x900 resolution. This system was purchased from http://www.mwave.com/ for a pretty good price.

Disclaimer
What works for me might not work for you. Ensure you know your hardware before you try this. It may be possible to toast your system (motherboard/monitor/mind) in attempting this. Just be careful and sure.

Technique
The idea it to change one of the preset resolutions in the Intel Graphics chip from its default to your preferred resolution. The good part is that there is a command for it but the change is not permanent. To get around this, someone created an init script that ensures your change happens at boot :-) Here is what you do....Assuming FC6.

1. Install 915resolution: yum install 915resolution
2. Get a list of Resolutions and pick one to replace: 915resolution -l

  • this will give you a long list of all the supported resolutions and bit levels
  • in front you will see a hex value (5a, 5b,...). Look for ones you will not be able to use with your monitor.
3. Edit config file and add RESOLUTION="..." statement: vi /etc/sysconfig/915resolution

  • If you want 5a to be 1440x900 at 32bit set RESOLUTION="5a 1440 900 32"
4. Run FC6 setup from xterm

  • Turn on System Service "915resolution" so it sets RESOLUTION=".." each time you boot.
5. Reboot.

  • When you come back up, you should be able to select 1440x900 (or whatever you picked) as your Preference->Screen Resolution.
When you boot your linux system next, you will be able to go into the GNOME Preference->Screen Resolution and see 1440x900 (or whatever you set) in the list.

What to Check
On my monitor, I have a little button that tells me the current resolution and refresh rate. Ensure this matches what your monitor can support.

I would also look at your /var/log/xorg.log and see if you got any errors. If so, do a little reading to ensure there is nothing bad happening.

GDM
I have run into an annoying thing with the "greeter" for Gnome. If your /etc/X11/xorg.conf has resolutions higher then the resolution you wish to use, it might pick the highest supported one in the list. This will give you a login screen that scrolls when you move your mouse around.

The only way I have found to fix this is to edit the /etc/X11/xorg.conf and remove any resolution higher then you desired (1440x900 for me) by you. This quick edit will correct that problem.

Final Thoughts
This concept seems to work. I have not read anything that says that this is dangerous or damaging. Still, do your research to ensure your hardware is safe.

If you use UBUNTU, check out this link for a good overview. Much of my information came from there.
http://www.ubuntuforums.org/showthread.php?p=1808047


- - -