<<

KNOW-HOW Ask Klaus! ASK KLAUS!

to report the right configuration options. If you use the “persistent Knoppix This is usually 1024x768 in 75Hz. If your image” feature, the automatically cre- notebook has a native 1280x800 resolu- ated /etc/X11/xorg.conf file will be tion, and it is not DDC-capable (i.e., reused on the next boot, so you don’t Klaus Knopper is the creator of Knoppix cannot read this information have to enter the boot options again. Knoppix and co-founder of the from the graphics adapter and display), To manually configure your X Server, you only get the 1024x768 resolution. you can use LinuxTag expo. He currently To change this, boot with the follow- ing options, entered at the boot prompt: works as a teacher, program- dpkg-reconfigure xserver-xorg mer, and consultant. If you have knoppix screen=1280x800 U in . vga=normal a configuration problem, or if Migrating Settings The vga=normal stays in text mode I have been a subscriber to your you just want to learn more until the X Server is started. It’s probably magazine from the beginning, about how works, send not necessary if your notebook handles but I have the following prob- the framebuffer mode 1024x768 well lem. I had a web server, with SQL, your questions to: using resolution scaling. email, etc. on a Pentium II machine. You may have to add horizontal and/ Now I have updated my hardware to klaus@linux-magazine. com or vertical frequencies according to your Pentium 4 with dual core and a mother- computer’s technical specs in the man- ual: Listing 1: Mount Flags Screen Resolution 01 mkdir /mysystem I’m using the Knoppix distribu- knoppix screen=1280x800 U tion and very much like it. Be- hsync=90 vsync=75 02 mount -o dev,suid /dev/hda2 / cause I’m a beginning Linux mysystem user, though, I am having some prob- Some other live distros use the maxi- 03 mount -o dev,suid /dev/hda5 / lems. The screen resolution in my porta- mum resolution and let the graphics card mysystem/home ble computer is 1280x800, but this mode handle out-of-range conditions, thus giv- 04 mount -o dev,suid /dev/hda6 / is not available on my system. I’ve heard ing better initial settings for high resolu- mysystem/var there is a solution for this, but I am hav- tion monitors without needing boot op- 05 mount --bind /proc /mysystem/ ing difficulties finding it. Please give me tions. But if you have fried an old VGA proc some advice. Video card drivers are pres- monitor once like I did (including white ent. My video adaptor is Intel Mobile smoke, noise, and stench, not a pretty 06 mount --bind /sys /mysystem/ 915GM; the default modes, which are sight) using too high resolutions and fre- sys found by Knoppix (hotplug , I think), are quencies, you tend to be more cautious 07 mount --bind /tmp /mysystem/ 1024x768 and 800x600. not to ruin old hardware; that’s why tmp Knoppix is very conservative about reso- 08 # If you are using udev, you Knoppix tries to run only safe lutions and frequencies unless you either will also need this: resolutions and frequencies on have a monitor that reports its preferred 09 mount --bind /dev /mysystem/ your graphics adapter and moni- settings properly, or you specify boot op- dev tor by default, if the hardware is not able tions that do the trick.

56 ISSUE 74 JANUARY 2007 WWW.LINUX - MAGAZINE.COM Ask Klaus! KNOW-HOW

board with an integrated RAID control- piled in, instead of loading modules on If you don’t like the sound of the “quick ler. demand. way,” you may be better off with the My question is, how can I migrate all I would recommend you at least stati- other solution, which I would call the my data and configurations to my new cally compile in everything that’s needed “right way.” This approach requires in- machine? Bear in mind that my current for mounting the root filesystem, so you stalling an up-to-date operating system kernel is 2.4 and now I will have to won’t need an . Marking and all needed applications, then migrat- migrate to 2.6.16. testing, which is the the controller and the needed file ing the configuration files and data. only kernel that recognizes my RAID system(s) with y in make menuconfig of This is the method I would recom- controller. the kernel can make testing, upgrading, mend to provide a clean start, get rid of and debugging your system much easier, obsolete programs (with potential secu- Moving the operating system, because it keeps initrd/ initramfs and rity flaws), and reach a state-of-the-art applications, and data to a new module-related problems out of the criti- system that’s easier to keep up to date. machine is a common task, yet cal boot phase. This method requires somewhat more it is not always easy to find the best In case something goes wrong, you work, though, especially when configu- strategy to do this. can use a Kernel 2.6-based live CD to ration files have changed in syntax and There are basically two strategies. The find out what you have forgotten in location. Also, finding out which files quick solution is to try to move all data, order to get the copied system up and need to be transferred, and which ones including the operating system, libraries, running (see below). have been changed from the default and everything else, and then just So, the sequence would be: setup, is not always easy if you did not exchange the kernel to match the new 1. Copy everything to the new machine, write down a log of changes you made hardware. either with a 1:1 copy of your hard over the past years. (Almost nobody This strategy is probably the fastest disk, or remotely to one or many documents changes on their own servers way, but it is only possible if the hard- freshly formated and mounted parti- well enough. I don’t either, but I know ware architecture does not change in a tions on the new server. I recommend people must exist somewhere who do.) way that your applications (compiled for you type: Anyway, using this strategy, you a specific processor) won’t run anymore. rsync -Hav old_root_dir [root@U would first partition the new system and When moving from a Pentium II, in your remote-machine:] new_root_dir install Debian (as an example) from example, to a Pentium 4, this should not as root user in both cases. scratch, including all programs and ser- be a big problem. The only thing you 2. Configure and compile a new kernel vices you will need. It’s not always suffi- need to do is configure and compile the on the new machine, and at least up- cient to check on your old system with new kernel to match your hardware. date modutils. You may find it useful When moving from Kernel 2.4 to 2.6, to (as root) chroot to new_partition on ps auxw you will have to update at least your the new machine, so you are already modutils (modprobe, insmod,rmmod) working “inside” your copied system, to see what servers are running. (netstat because the module handling has if you can’t boot directly with the old -tulpe is also a good way to see what’s changed in 2.6 in a way that modutils kernel or the new one is not yet work- currently listening for connection re- from 2.4 simply won’t work anymore. ing right because you forgot some- quests.) There may be support programs Of course, you could as well use a static thing in the configuration. Please note or libraries (such as php) that don’t kernel with everything you need com- the comment about chroot below. show up directly in the list of processes. Use dpkg -l or rpm -qa on your old ma- Rescuing Your System chine to see what’s installed, and write If you wish to repair or update an in- Note that Listing 1 is only an example down all packages that you will proba- stalled system that cannot boot directly, that most likely will not match your fstab bly need. It’s usually a long list. you can use a “rescue system.” Some entries: After your new system is up and run- root server hosting providers offer this The last --bind mount is useful if you ning (including the perfect kernel for service in the form of a network-booting want to have access to a running X your hardware setup), you will have to (diskless) rescue boot that allows you to Server through its socket in /tmp, from transfer and maybe rewrite your configu- mount partitions and change files on inside the yet-to-be-handled chroot ration files for all services. I would rec- your server even if the system installed system. ommend doing this option-by-option in on disk is woefully defective and in a Now, provided that the partitions have each config file, because, if you also non-booting state. (You can also use been mounted in the correct order Knoppix for this rescue task, eventually switched from Apache 1.3 to the 2.x ver- (check etc/fstab in the root partition with a knoppix.sh script that starts an sion, for instance, the syntax and loca- again), you should be able to SSH server with your ssh key so you can tion of the config files will change, and perform a remote login.) chroot /mysystem trying to just copy the configuration files As soon as the rescue system is up, and, until you exit this shell, you can is most likely a very bad idea that can in- mount the hard disk partitions in the work inside the previously installed troduce security holes by enabling add- correct order and hierarchy. For Knoppix, system on disk, install a new kernel or ons you do not really want. Files such as you need the dev,suid mount flags new software package, repair your SSL certificates, as well as authentica- master boot record with lilo or grub, etc. (Listing 1). tion keys, must not be forgotten.

WWW.LINUX - MAGAZINE.COM ISSUE 74 JANUARY 2007 57 KNOW-HOW Ask Klaus!

mounted CD or DVD that may contain something GCC-related, the command to find those packages manually would be

find /media/ cdrom -iname U \*gcc\*.rpm -o -iname U \*gcc\*.deb

which finds both, DEB and RPM pack- ages on a DVD or CD that has been pre- viously mounted under /media/cdrom. To install a package for an rpm-based system, use

rpm -Uvh /path/to/package.rpm

and for DEB use

dpkg -i /path/to/package.deb

You may get errors because of missing dependencies. These are libraries and Figure 1: On a Suse system, you can use Yast to install software from an online source. other parts of the software that you need to install in order for the new package to After the configuration files are done, been looking for a GCC compiler. I have install or run properly. Usually, the error you can copy the user data, like data- an old (Red Hat) CD that has it. I have message contains a hint about which bases in /var/lib/mysql, mailboxes and been under the assumption that a com- package to search for and install first. homedirs (/var/mail/*, /home/*), and so piler is on the Debian 9.3 DVD. Is it? If Debian has some helper tools like apt- forth. Make sure the eventual user ac- so, how can I get to it? get (and GUI variants of apt-get like syn- counts you create match the file owner Most articles skip over the basic de- aptic) that resolve and install dependen- and group properties of the copied files. tails, assuming everyone is familiar. I am cies automatically if a list of installation You can use the -u and -g flag for use- not a beginner; I was probably writing resources has been added to /etc/apt/ radd on account creation, or just change code before you were born (as far back sources.list. The details are a little too the file credentials as needed by chown/ as 1962). It has been a long time since I lengthy for an article, but you’ll find in- chgrp. Also, don’t forget group member- last compiled source code, but if I can formation in the manpages. ships in /etc/group. find GCC, I know how to use it. Thinking about it, you probably have You will then have to thoroughly test a “personal edition” of Suse/ Novell each service. Most daemons have their First an expression of surprise GNU/ Linux (not Debian), because the own error logfiles, like /var/log/apache2/ from my side: where did you get personal edition, as far as I’m aware, error_log, which show what’s going Debian 9.3? The latest stable comes without a C compiler by default. wrong. For others, check /var/log/syslog Debian version as of October 2006 is still The compilers should be available on the or /var/log/messages (/var/log/daemon. 3.1, see http:// www. debian. org/ releases/. installation DVD, though, and can be log in some distributions). Debian will definitely boot with less added by the Yast system administration Though this method is much slower than 512 MB RAM. Even 64 MB should tool if you prefer to work with a GUI in- and requires more effort than the “quick be sufficient, though if you want to work stead with a manual installation. way,” it provides the most flexibility and with a graphical desktop, 256 MB is Linux Magazine actually received sev- safety, and it may save a lot of work and good, and 512 MB or more is nice. eral letters asking about GCC after the trouble when you are doing updates. Depending on which distribution you Suse 10 DVD in Issue #62 (January If you break your boot configuration are referring to, your question goes into 2006). A subsequent response on the along the way, you can use the rescue the direction of how to find and install a Letters page described how to configure method described in the box titled specific software package, since most your system to download Suse packages “Rescuing your System.” GNU/ Linux distributions nowadays use from an online source. See http:// www. a fine packaging system that allows you linux-magazine. com/ issue/ 63/ Letters. Finding GCC to install precompiled software. pdf. ■ I’m in my second year of read- If you use Debian, the names of soft- ing Linux Magazine. I have ware packages are usually *.deb. If you Debian 9.3. (10.1 won’t load, use Suse/ Novell, Mandriva, or Fedora Send your Linux questions to because my memory is below 512 MB). GNU/ Linux, the package names are klaus@linux-magazine. com. How do I find files on the DVDs? I have *.rpm. So, in order to find packages on a

58 ISSUE 74 JANUARY 2007 WWW.LINUX - MAGAZINE.COM