From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1103af,b8afe9e2d2d4136b,start X-Google-Attributes: gid1103af,public X-Google-Thread: 10d4db,b8afe9e2d2d4136b,start X-Google-Attributes: gid10d4db,public X-Google-Thread: f7ded,b8afe9e2d2d4136b,start X-Google-Attributes: gidf7ded,public X-Google-Thread: 100062,b8afe9e2d2d4136b,start X-Google-Attributes: gid100062,public From: kiesling@terracom.net Subject: Linux Frequently Asked Questions with Answers (Part 3 of 6) Date: 1998/09/13 Message-ID: X-Deja-AN: 390751070 Followup-To: poster X-Trace: news3.ispnews.com 905711759 209.69.148.254 (Sun, 13 Sep 1998 14:35:59 EDT) Organization: ISPNews http://ispnews.com NNTP-Posting-Date: Sun, 13 Sep 1998 14:35:59 EDT Newsgroups: comp.os.linux.announce,comp.os.linux.misc,news.answers,comp.answers Originator: kiesling@terracom.net Archive-Name: linux/faq/part3 Posting-Frequency: weekly 3.8 Can Linux access SMB file systems? Linux supports read/write access of Windows for Workgroups and Windows NT SMB volumes. See the file Documentation/filesystems/smbfs.txt of the Linux kernel source distribution, and "How do I upgrade/recompile my kernel?" in this FAQ. There is also a suite of programs called Samba which provide support for WfW networked file systems (provided they're for TCP/IP). Information is available in the README file at sunsite.unc.edu/pub/Linux/system/network/samba. There is a SMB web site at samba.canberra.edu.au/pub/samba. 3.9 Can Linux access Macintosh file systems? There is a set of user-level programs that read and write the Macintosh Hierarchical File System (HFS). It is available at sunsite.unc.edu/pub/Linux/utils/disk-management. 3.10 Can I run Microsoft Windows programs under Linux? WINE, a MS Windows emulator for Linux, is still not ready for general distribution. If you want to contribute to its development, look for the status reports in the comp.emulators.ms-windows.wine newsgroup. There is also a FAQ, compiled by P. David Gardner, at sunsite.unc.edu/pub/Linux/docs/faqs/Wine-FAQ/. In the meantime, if you need to run MS Windows programs, the best bet--seriously--is to reboot. LILO, the Linux boot loader, can boot one of several operating systems from a menu. See the LILO documentation for details. Also, LOADLIN (a DOS program to load a Linux, or other OS, kernel is one way to make Linux co-exist with DOS. LOADLIN is particularly handy when you want to install Linux on a 3rd or 4th drive on a system (or when you're adding a SCSI drive to a system with an existing IDE). In these cases, it is common for LILO's boot loader to be unable to find or load the kernel on the "other" drive. So you just create a C:\LINUX directory (or whatever), put LOADLIN in it with a copy of your kernel, and use that. LOADLIN is a VCPI compliant program. Win95 will want to, "shutdown into DOS mode," to run it (as it would with certain other DOS protected-mode programs). Earlier versions of LOADLIN sometimes required a package called REALBIOS.COM, which required a boot procedure on an (almost) blank floppy to map the REALBIOS interrupt vectors (prior to the loading of any software drivers). (Current versions don't seem to ship with it, and don't seem to need it). [Jim Dennis] 3.11 How can I boot Linux from OS/2's Boot Manager? 1. Create a partition using OS/2's FDISK.EXE (Not Linux's fdisk). 2. Format the partition under OS/2, either with FAT or HPFS. This is so that OS/2 knows about the partition being formatted. (This step is not necessary with OS/2 `warp' 3.0.) 3. Add the partition to the Boot Manager. 4. Boot Linux, and create a file system on the partition using mkfs -t ext2 or mke2fs. At this point you may, if you like, use Linux's fdisk to change the code of the new partition to type 83 (Linux Native)--this may help some automated installation scripts find the right partition to use. 5. Install Linux on the partition. 6. Install LILO on the Linux partition--NOT on the master boot record of the hard drive. This installs LILO as a second-stage boot loader on the Linux partition itself, to start up the kernel specified in the LILO configuration file. To do this, you should put boot = /dev/hda2 (where /dev/hda2 is the partition you want to boot from) in your /etc/lilo/config or /etc/lilo.config file. 7. Make sure that it is the Boot Manager partition that is marked active, so that you can use Boot Manager to choose what to boot. There is a set of HOWTO's on the subject of multi-boot systems on the LDP Home Page, http://sunsite.unc.edu/LDP/. 3.12 How can I share a swap partition between Linux and MS Windows? See the Mini-HOWTO on the subject by H. Peter Anvin, hpa@yggdrasil.com. It is available at sunsite.unc.edu/pub/Linux/docs/HOWTO/mini/Swap-Space. 4. Linux's handling of file systems, disks, and drives 4.1 How can I get Linux to work with my disk? If your disk is an IDE or EIDE drive, you should read the file /usr/src/linux/drivers/block/README.ide (part of the Linux kernel source code). This README contains many helpful hints about IDE drives. Many modern IDE controllers do translation between `physical' cylinders/heads/sectors, and `logical' ones. SCSI disks are accessed by linear block numbers. The BIOS invents some `logical' cylinder/head/sector fiction to support DOS. DOS will usually not be able to access partitions which extend beyond 1024 logical cylinders, and will make booting a Linux kernel from such partitions using LILO problematic at best. You can still use such partitions for Linux or other operating systems that access the controller directly. It's recommend that you create at least one Linux partition entirely under the 1024 logical cylinder limit, and boot from that. The other partitions will then be okay. Also there seems to be a bit of trouble with the newer Ultra-DMA drives. I haven't gotten the straight scoop on them--but they are becoming a very common problem at the SVLUG installfests. When you can get 8 to 12 Gig drives for $200 to $300 it's no wonder. [Jim Dennis] 4.2 How can I undelete files? In general, this is very hard to do on Unices because of their multitasking nature. Undelete functionality for the ext2fs file system is being worked on, but don't hold your breath. There are a number of packages available which instead provide new commands for deleting and copying which move deleted files into a `wastebasket' directory. The files can be recovered until cleaned out automatically by background processing. Alternatively, you can search the raw disk device which holds the file system in question. This is hard work, and you will need to be logged in as root to do this. 4.3 Is there a defragmenter for ext2fs etc.? Yes. There is defrag, a Linux file system defragmenter for ext2, Minix, and old-style ext file systems. It is available at sunsite.unc.edu/pub/Linux/system/filesystems/defrag-0.70.tar.gz. Users of the ext2 file system can probably do without defrag, because ext2 contains extra code to keep fragmentation reduced even in very full file systems. 4.4 How do I format and create a file system on a floppy? To format a 3.5-inch, high density floppy: $ fdformat /dev/fd0H1440 $ mkfs -t ext2 -m 0 /dev/fd0H1440 1440 For a 5.25 inch floppy, use fd0h1200 and 1200 as appropriate. For the `B' drive use fd1 instead of fd0. The -m 0 option tells mkfs.ext2 not to reserve any space on the disk for the superuser--usually the last 10% is reserved for root. The first command performs a low-level format. The second creates an empty file system. You can mount the floppy like a hard disk partition and simply cp and mv files, etc. Device naming conventions generally are the same as for other Unices. They can be found in Matt Welsh's Installation and Getting Started Guide. (See "Where can I get the HOWTO's and other documentation?") A more detailed and technical description is Linux Allocated Devices by H. Peter Anvin, hpa@zytor.com, which is included in LaTeX and ASCII form in the kernel source distribution (probably in /usr/src/kernel/Documentation), as devices.tex and devices.txt. 4.5 I get nasty messages about inodes, blocks, and the like. You may have a corrupted file system, probably caused by not shutting Linux down properly before turning off the power or resetting. You need to use a recent shutdown program to do this--for example, the one included in the util-linux package, available on sunsite and tsx-11. If you're lucky, the program fsck (or e2fsck or xfsck as appropriate if you don't have the automatic fsck front-end) will be able to repair your file system. If you're unlucky, the file system is trashed, and you'll have to re-initialize it with mkfs (or mke2fs, mkxfs, etc.), and restore from a backup. NB: don't try to check a file system that's mounted read/write--this includes the root partition, if you don't see VFS: mounted root ... read-only at boot time. 4.6 My swap area isn't working. When you boot (or enable swapping manually) you should see Adding Swap: NNNNk swap-space If you don't see any messages at all you are probably missing swapon -av (the command to enable swapping) in your /etc/rc.local or /etc/rc.d/* (the system startup scripts), or have forgotten to make the right entry in /etc/fstab: /dev/hda2 none swap sw for example. If you see Unable to find swap-space signature you have forgotten to run mkswap. See the manual page for details; it works much like mkfs. Running, 'free' in addition to showing free memory, should display: total used free Swap: 10188 2960 7228 [Andy Jefferson] Take a look also at the Installation HOWTO for detailed instructions of how to set up a swap area. 4.7 How do I remove LILO so my system boots DOS again? Using DOS (MS-DOS 5.0 or later, or OS/2), type FDISK /MBR (which is not documented). This will restore a standard MS-DOS Master Boot Record. If you have DR-DOS 6.0, go into FDISK in the normal way and then select the `Re-write Master Boot Record' option. If you don't have MS-DOS or DR-DOS, you need to have the boot sector that LILO saved when you first installed it. You did keep that file, didn't you? It's probably called boot.0301 or some such. Type dd if=boot.0301 of=/dev/hda bs=445 count=1 (or /dev/sda if you're using a SCSI disk). This may also wipe out your partition table, so beware! If you're desperate, you could use dd if=/dev/zero of=/dev/hda bs=512 count=1 This will erase your partition table and boot sector completely: you can then reformat the disk using your favorite software. But this will render the contents of your disk inaccessible--you'll lose it all unless you're an expert. Note that the DOS MBR boots whichever (single!) partition is flagged as `active'. You may need to use fdisk to set and clear the active flags on partitions appropriately. 4.8 Why can't I use fdformat except as root? The system call to format a floppy can only be done as root, regardless of the permissions of /dev/fd0*. If you want any user to be able to format a floppy, try getting the fdformat2 program. This works around the problems by being setuid to root. 4.9 My ext2fs partitions are checked each time I reboot. See "EXT2-fs: warning: mounting unchecked file system.". 4.10 My root file system is read-only! Remount it. If /etc/fstab is correct, you can simply mount -n -o remount / If /etc/fstab is wrong, you must give the device name and possibly the type, too: e.g. mount -n -o remount -t ext2 /dev/hda2 / To understand how you got into this state, see, "EXT2-fs: warning: mounting unchecked file system." 4.11 I have a huge /proc/kcore! Can I delete it? None of the files in /proc are really there--they're all, "pretend," files made up by the kernel, to give you information about the system and don't take up any hard disk space. /proc/kcore is like an `alias' for the memory in your computer. Its size is the same as the amount of RAM you have, and if you read it as a file, the kernel does memory reads. 4.12 My AHA1542C doesn't work with Linux. The option to allow disks with more than 1024 cylinders is only required as a workaround for a PC-compatible BIOS misfeature and should be turned `off' under Linux. For older Linux kernels you need to turn off most of the `advanced BIOS' options--all but the one about scanning the bus for bootable devices. 5. Porting, compiling and obtaining programs 5.1 How do I port XXX to Linux? In general, Unix programs need very little porting. Simply follow the installation instructions. If you don't know--and don't know how to find out--the answers to some of the questions asked during the installation procedure, you can guess, but this tends to produce buggy programs. In this case, you're probably better off asking someone else to do the port. If you have a BSD-ish program, you should try using -I/usr/include/bsd and -lbsd on the appropriate parts of the compilation lines. 5.2 What is ld.so and where do I get it? Ld.so is the dynamic library loader. Each binary using shared libraries used to have about 3K of start-up code to find and load the shared libraries. Now that code has been put in a special shared library, /lib/ld.so, where all binaries can look for it, so that it wastes less disk space, and can be upgraded more easily. Ld.so can be obtained from tsx-11.mit.edu/pub/linux/packages/GCC/ and mirror sites. The latest version at the time of writing is ld.so.1.9.5.tar.gz. /lib/ld-linux.so.1 is the same thing for ELF ("What's all this about ELF?") and comes in the same package as the a.out loader. 5.3 Has anyone ported / compiled / written XXX for Linux? First, look in the Linux Software Map--it's at sunsite.unc.edu/pub/Linux/docs/linux-software-map, and on the other FTP sites. A search engine is available on the World Wide Web at http://www.boutell.com/lsm/. Check the FTP sites ("Where can I get Linux material by FTP?") first--search the ls-lR or INDEX files for appropriate strings. Also look at the Linux Projects Map, ftp.ix.de/pub/ix/Linux/docs/Projects-Map.gz. There's a search engine for Linux FTP archives at http://lfw.linuxhq.com/ Also check out the Freshmeat Web site http://www.freshmeat.org, which is really cool. ("What online/free periodicals exist for Linux?" If you don't find anything, you could download the sources to the program yourself and compile them. See "How do I port XXX to Linux?" If it's a large package that may require some porting, post a message to comp.os.linux.development.apps. If you compile a large-ish program, please upload it to one or more of the FTP sites, and post a message to comp.os.linux.announce (submit your posting to linux-announce@news.ornl.gov). If you're looking for an application program, the chances are that someone has already written a free version. The comp.sources.wanted FAQ has instructions for finding the source code. 5.4 Can I use code or a compiler compiled for a 486 on my 386? Yes, unless it's the kernel. The -m486 option to GCC, which is used to compile binaries for x486 machines, merely changes certain optimizations. This makes for slightly larger binaries that run somewhat faster on a 486. They still work fine on a 386, though, with a small performance hit. However, from version 1.3.35 the kernel uses 486 or Pentium-specific instructions if configured for a 486 or Pentium, thus making it unusable on a 386. GCC can be configured for a 386 or 486; the only difference is that configuring it for a 386 makes -m386 the default and configuring for a 486 makes -m486 the default. In either case, these can be overridden on a per-compilation basis or by editing /usr/lib/gcc-lib/i*-linux/n.n.n/specs. There is an Alpha version of GCC which knows how to do optimization well for the 586, but it is quite unreliable, especially at high optimization settings. The Pentium GCC can be found on tsx-11.mit.edu in /pub/linux/ALPHA/pentium-gcc. I'd recommend using the ordinary 486 GCC instead; word has it that using -m386 produces code that's better for the Pentium, or at least slightly smaller. 5.5 What does gcc -O6 do? Currently, the same as -O2 (GCC 2.5) or -O3 (GCC 2.6, 2.7). Any number greater than that does the same thing. The Makefiles of newer kernels use -O2, and you should probably do the same. 5.6 Where are linux/*.h and asm/*.h? These are in the directories /usr/include/linux/ and /usr/include/asm/. However, they should be symbolic links to your kernel sources in /usr/src/linux/, not the actual directories. If you don't have the kernel sources, download them--see, "How do I upgrade/recompile my kernel?" Then, use rm to remove any garbage, and ln to create the links: rm -rf /usr/include/linux /usr/include/asm ln -sf /usr/src/linux/include/linux /usr/include/linux ln -sf /usr/src/linux/include/asm /usr/include/asm /usr/src/linux/include/asm/ is a symbolic link to an architecture-specific asm directory--if you have a freshly unpacked kernel source tree, you must make symlinks. You'll also find that you may need to do `make config' in a newly-unpacked kernel source tree, to create linux/autoconf.h. 5.7 I get errors when I try to compile the kernel. See the previous question regarding the header files. Remember that when you apply a patch to the kernel, you must use the -p0 or -p1 option: otherwise, the patch may be misapplied. See the patch manual page for details. "ld: unrecognized option `-qmagic"' means that you should get a newer linker, from ftp://tsx-11.mit.edu/pub/linux/packages/GCC/, in the file binutils-2.8.1.0.1.bin.tar.gz. 5.8 How do I make a shared library? For ELF, gcc -fPIC -c *.c gcc -shared -Wl,-soname,libfoo.so.1 -o libfoo.so.1.0 *.o For a.out, get tools-n.nn.tar.gz from tsx-11.mit.edu, in /pub/linux/packages/GCC/src/. It comes with documentation that will tell you what to do. Note that a.out shared libraries are a very tricky business. Consider upgrading your libraries to ELF shared libraries. See the ELF HOWTO, at sunsite.unc.edu/pub/Linux/docs/HOWTO/ 5.9 My executables are (very) large. With an ELF compiler ("What's all this about ELF?"), the most common cause of large executables is the lack of an appropriate .so library link for one of the libraries you're using. There should be a link like libc.so for every library like libc.so.5.2.18. With an a.out compiler the most common cause of large executables is the -g linker (compiler) flag. This produces (as well as debugging information in the output file) a program which is statically linked--one which includes a copy of the C library instead of a dynamically linked copy. Other things worth investigating are -O and -O2, which enable optimization (check the GCC documentation), and -s (or the strip command) which strip the symbol information from the resulting binary (making debugging totally impossible). You may wish to use -N on very small executables (less than 8K with the -N), but you shouldn't do this unless you understand its performance implications, and definitely never with daemons. 5.10 Does Linux support threads or lightweight processes? As well as the Unix multiprocessing model involving heavyweight -- Robert Kiesling kiesling@terracom.net