004editorial.qxd
21.11.2000
17:36 Uhr
INTRO
General Contacts General Enquiries Fax Subscriptions E-mail Enquiries Letters
COMMENT
01625 855169 01625 855071 www.linux-magazine.co.uk subs@linux-magazine.co.uk edit@linux-magazine.co.uk letters@linux-magazine.co.uk
Editor
Julian Moss jmoss@linux-magazine.co.uk
Staff Writers
Keir Thomas, Dave Cusick , Martyn Carroll
Contributors
Richard Ibbotson, Peter Rival, Joel Rowbottom, Charlie Stross
International Editors
Harald Milz hmilz@linux-magazin.de Hans-Georg Esser hgesser@linux-user.de Bernhard Kuhn bkuhn@linux-magazin.de
International Contributors
Björn Ganslandt, Christian Perle, Christian Reiser, Georg Greeve, Hagen Höpfner, Heike Jurzik, Jochen Lillich, Karsten Günther, Michael Schilli, Mirko Dölle, Ralph Hildebrandt, Stefanie Teufel, Thomas Walter, Tobias Hunger, Tobias Peter, Ulrich Wolf
Design
vero-design Renate Ettenberger, Tym Leckey
Production
Hubertus Vogg
Operations Manager
Pam Shore
Advertising
01625 855169 Neil Dolan Sales Manager ndolan@linux-magazine.co.uk Linda Henry Sales Manager lhenry@linux-magazine.co.uk Verlagsbüro Ohm-Schmidt Osmund@Ohm-Schmidt.de
Publishing Publishing Director
Seite 4
Robin Wilkinson rwilkinson@linuxmagazine.co.uk Subscriptions and back issues 01625 850565 Annual Subscription Rate (12 issues) UK: £44.91. Europe (inc Eire) : £73.88 Rest the World: £85.52 Back issues (UK) £6.25
Distributors
COMAG, Tavistock Road, West Drayton, Middlesex England UB7 7QE
R. Oldenbourg
Linux Magazine is published monthly by Linux New Media UK, Europa House, Adlington Park, Macclesfield, Cheshire, England, SK10 4NP. Company registered in England. Copyright and Trademarks (c) 2000 Linux New Media UK Ltd
SCRATCH MY ITCH Linux is already one of the leading contenders among server operating systems. It's becoming a popular choice for embedded systems too. But the main battle for world domination - or at least global recognition - will be fought on the desktop. There may be few who truly believe that Linux will knock Windows off the top perch but it could certainly become a significant presence in the desktop market. Whether or not it does, though, will depend largely on the quantity and quality of the applications that are available. Can the free software movement deliver what's needed? Most readers of this magazine will need no convincing of the benefits of free software. But much of the time getting these benefits means using software that's still in development. As a programmer I can identify with, as Richard Stallman put it, the desire to "scratch an itch" (write a program that meets one's personal needs.) It provides the motivation to spend hours of spare time writing software for no monetary reward. But programmers write what programmers want. The result is that Linux has some excellent development tools but few complete applications. Every developer uses email, so there are dozens of mail clients (though no really good one.) Few developers need powerful word processors or spreadsheets so rather less effort has been spent on this area. Although, thanks to Sun, we now have a free, full-featured open source office suite, there are still many gaps in the free software portfolio. As Linux becomes more popular among end users, commercial software developers will take the opportunity to exploit these gaps and make some money. Whether or not this will be a good thing depends on your point of view. If your desire is simply to see people use something other than Microsoft products, perhaps it is. But if Linux becomes just a platform on which people run commercial (and most likely closed source) applications they will lose the benefits that motivated people to develop it (and other GNU projects) in the first place. Linux will be perceived as just another operating system, which isn't a good idea at all. To prevent this, free software developers must start developing what Linux users need, not what they themselves want. And they should pool resources to create one finished, world-class application of a given type not several incomplete alternatives. In other words, they ought to think about scratching someone else's itch, not just theirs.
No material may be reproduced in any form whatsoever in whole or in part without the written permission of the publishers. It is assumed that all correspondence sent, for example, letters, e-mails, faxes, photographs, articles, drawings, are supplied for publication or license to third parties on a non-exclusive worldwide basis by Linux New Media unless otherwise stated in writing. ISSN 14715678
Julian Moss
Linux is a trademark of Linus Torvalds Linux New Media UK Ltd is a division of Linux New Media AG, Munich, Germany Disclaimer Whilst every care has been taken in the content of the magazine, the publishers cannot be held responsible for the accuracy of the information contained within it or any consequences arising from the use of it. The use of the CD provided with the magazine or any material providied on it is at your own risk. The CD is comprehensively checked for any viruses or errors before reproduction. Technical Support Readers can write in with technical queries which may be answered in the magazine in a future issue, however Linux Magazine is unable to directly provide technical help or support services either written or verbal.
4 LINUX MAGAZINE
4 · 2001
We pride ourselves on the origins of our magazine which come from the very start of the Linux revolution. We have been involved with Linux market for six years now through our sister European-based titles Linux Magazine (aimed at professionals) and Linux User (for hobbyists), and through seminars, conferences and events. By purchasing this magazine you are joining an information network that enjoys the benefit of all the knowledge and technical expertise of all the major Linux professionals and enthusiasts. No other UK Linux magazine can offer that pedigree or such close links with the Linux Community. We're not simply reporting on the Linux and open source movement - we're part of it.
008news.qxd
22.11.2000
9:41 Uhr
Seite 8
NEWS
Lutris serves up new solution Lutris Technologies has created a new Solution Partner Programme which aims to make it easier for vendors like ISVs, systems integrators and business and Internet consulting firms to work with them on the development of solutions and related services that draw on the Lutris Enhydra Java/XML open source Internet application server. Partners can build more robust, scalable solutions and at the same time avoid passing heavy product licensing expenses on to their customers, says Lutris So far Lutris has partnered with eight early adopters of its Solution Partner Program, including Indiqu, i-engineering, GravityRock, Mobilitee, Rarefire Technologies, Reliance Systems Inc., room33, and Together Teamsolutions. Lutris Technologies chief executive Yancy Lind commented, “Many ISVs and system integrators want to use open source technologies to increase control, lower total cost of ownership, and provide higher quality solutions. Lutris Technologies' current strategic alliances include those with Compaq, NEC, SuSE, VA Linux and Navisite. ■
Chief executive of SuSE Linux AG, Roland Dyroff
Cluster back-up
Server power ramped up
Large-scale clustered computer solution provider Linux NetworX has integrated a backup software solution into its Evolocity cluster solutions. Linux NetworX Evolocity cluster systems are aimed in particular at large scale applications with heavy data computation, data handling and storage needs, such as Application Service Providers, web hosting centers and e-commerce backbone providers. The company has integrated the BRU Backup and Restore Utility from Linux backup solution provider Enhanced Software Technologies to increase levels of data storage backup for the network. BRU uses its AUTOSCAN(TM) feature to verify the backup online. If a backup window does not allow online verification, its Anytime Verify(TM) tool can enable administrators to verify the backup at a later time, on a different system if necessary. Although tape device technology offers high levels of reliability, errors can still occur. BRU detects errors on the tape following backup of the archive and enables recovery from errors to restore the original data.
Linuxlab has expanded the capacity of its EPower ThinRack 4-in-1 Pentium III web servers. First released in March of this year with 256 MB of RAM, the new ThinRack servers now offer a limit of 512 MB. In addition to increased RAM, the new servers feature expanded hard disk capacity and come with 6, 18, or 20 gigabytes of storage space. They also come with four power supplies per case, up from two, for improved server reliability. Linuxlab's FarMan load-balancing software enables users to configure their server farms from a single management screen. It monitors the network for potential server problems and notifies technical support so they can be addressed before they become critical. If a server develops a problem, FarMan will remove it from service and notify the network administrator.
Info
Info
http://www.estinc.com www.linuxnetworx.com
www.linuxlab.com ■
■
SuSE plots its S390 course... SuSE Linux has announced full details of its new mainframe solution that enables enterprises to scale Linux from their PC clients to their host systems. SuSE Linux S/390 supports IBM's G5 and G6 servers as well as IBM Multiprise 3000. It can be installed either in a logical partition (LPAR), as a guest under the operating system VM (Virtual Machine) or within the Virtual Image Facility (VIF), which enables the implementation of several thousand independent Linux images on a single machine. SuSE has used the same code base for SuSE Linux S/390 as for its other platforms, enabling software developers to create applications on their PCs and migrate them to very large systems as the Linux APIs are the same. The new product features more than 700 applications tailored for the enterprise environment and offers support and service options for enterprise needs, including installation planning, training, performance measurement and tuning.
8 LINUX MAGAZINE 4 · 2001
SuSE sees its typical SuSE Linux S/390 customer as someone likely to want to exploit the software's web serving capabilities first by running Apache and installing a firewall. The customer can then integrate S/390 into the existing infrastructure, using IBM's connector facilities, which feature access to relational and non-relational data (DB2, VSAM, DL1), access to transactions (Cics) and to messaging systems (MQ). According to SuSE's research, most OS/390 customers have started Linux activities. However, the company expects SuSE Linux S/390 also to appeal to VSE customers who have been looking forward to the new S/390 functionality. The new solutions makes SuSE Linux the only company worldwide that currently offers a Linux distribution for IBM S/390 servers, according to Roland Dyroff, chief executive of SuSE Linux AG. He commented, “SuSE Linux S/390 is the result of the unique partnership between SuSE and IBM. SuSE's technological leadership and expertise in combination with IBM's strength and reliability make SuSE Linux S/390 the operating system of choice in the enterprise server environment.”
Info http://www.suse.co.uk ■
008news.qxd
22.11.2000
9:41 Uhr
Seite 9
NEWS
Overland's marketing manager for Europe, Howard Rippiner
Green light for Overland Tape backup solution provider Overland Data's AIT LibraryProTM automated backup tape library has been certified to run under Linux by Enhanced Software Technologies (EST), which sponsors and administers the Linux Tape Device Certification Programme. The AIT LibraryPro, the first scalable AIT library, can be scaled up to nine modules for a maximum configuration of 8.55 terabytes native capacity (22.2 TB with compression) and throughput of 388 gigabytes per hour (1.0 TB/hr. with compression) using Sony AIT-2 drives. Using the upcoming Sony AIT-3 drives, the capacity will be increased to a maximum configuration of 17.1 TB (up to 44.5 TB with compression) and maximum throughput of 713 gigabytes per hour (up to 1.85 TB/hr with compression). LibraryPro allows customers to scale the capacity and performance in modular increments for a customised solution to precisely match their specific storage needs, and combines the company's ultra-reliable Mainframe Class Robotics technology with the inherent advantages of Sony's AIT technology. "EST's Linux Tape Device Certification Programme gives end users the quality assurance that the Overland product family demonstrated complete compatibility with the Linux Operating System," said Howard Rippiner, Overland's marketing manager for Europe.
Info www.overlanddata.com http://www.linuxtapecert.org
Caldera scoops award Caldera Systems has received Network World's Blue Ribbon award for its OpenLinux eServer 2.3 enterprise server solution. Caldera's OpenLinux eServer came top of the list of five Linux server-side distributions based on the following criteria: LAN administration and setup, added applications and value, installation, service support policies and documentation. OpenLinux eServer 2.3 is a thin server, component-based operating system designed for easy installation, configuration and management. It is pre-tuned for server-specific hardware and reduces configuration and management time. OpenLinux eServer includes several installation profiles providing optimized software architecture for single-purpose servers. Caldera Systems' president and chief executive Ransom Love commented: "We're delighted to win this award. This reinforces Caldera's leadership as a provider of superior Linux business solutions for the enterprise." ■
■
Debugger from LynuxWorks Fresh from its merger with system software supplier Integrated Software & Devices Corporation (ISDCorp), real time embedded systems solution provider LynuxWorks launched its new SpyKer event trace and visualization tool at the end of November. The SpyKer tools are aimed at software developers using both real time and Linux operating systems including the company's own LynxOS real time operating system and BlueCat Linux. They enable programmers to debug their software by tracing kernel events without the need for instrumented kernel and library events and without a special instrumented version of the library. The tool can also be used to trace user application events without modifying the program's source code. This can save the developer time and improve the application's time to market speed.
"From 12 years of embedded experience, we've learned programmers don't like instrumenting their code, and they don't like to run specially instrumented kernels or link with special instrumented libraries," said Mitch Bunnell, LynuxWorks CTO and author of SpyKer. "You can load SpyKer on to LynxOS or just about any Linux and get valuable kernel traces instantly, without reboot, special kernels or source code modification." The company has announced that it has registered its proposed initial public offering of its common share stock.
Info www.LynuxWorks.com lbowlby@lynuxworks.com lou@vitalcompr.com jim@stapleton.com
Jump start for IT administrators Caldera Systems has completed the first three courses for its OpenLinux Solution Series. The courses, Linux Essentials, NDS on OpenLinux and Samba on OpenLinux, are now available to OpenLearning Providers. The OpenLinux Solutions Series of one and two day courses is designed to educate IT professionals working in a business environment who wish to deploy and manage specialised servers, that is servers optimised for specific functions such as Web, DNS/DHCP, SAMBA, firewall and application servers. The Linux Essentials course is aimed at providing IT professionals with a jump-start to OpenLinux Administration. NDS on OpenLinux is for those managing networks with a global directory service, while the Samba on OpenLinux 1 is for maximizing Windows and File/Print services. “This series addresses the needs and business interests of IT professionals working with Linux,” said David Acheson, director of education for Caldera Systems, Inc. “We will provide solutions and increase productivity in the organizations they serve. Caldera can do it with high-quality curriculum and in less time.” Caldera plans to make a further three courses available by the end of the year. The courses are DNS/DHCP on OpenLinux for TCP/IP Address Management, Apache on OpenLinux – Deploying and Hosting Secure Web Environments, and Samba on OpenLinux 2 – Using OpenLinux as an NT Domain Controller. For more details about OpenLearning Courseware or to find an OpenLearning Provider, see Caldera's website.
Info http://www.calderasystems.com/ openlearning
■ ■ 4 · 2001 LINUX MAGAZINE 9
008news.qxd
22.11.2000
9:41 Uhr
Seite 10
ad
008news.qxd
22.11.2000
9:41 Uhr
Seite 11
ad
008news.qxd
22.11.2000
9:42 Uhr
Seite 12
NEWS
Red Hat “on track”
Netscape launches version 6
Red Hat has announced that its vice president of operations, Kevin Thompson, has been promoted to chief financial officer. Thompson joined Red Hat in October 2000 with more than thirteen years of experience of managing operations, financial transactions including debt and equity offerings, and mergers and acquisitions behind him, said”In the time I have been involved with Red Hat, I have become convinced of Red Hat's ability to revolutionise the software industry I am confident that Red Hat is on track to meet the goals we've communicated to the public markets improved gross margins, continued 100 percent revenue growth and profitability by the end of calendar year 2001.”
AOL subsidiary Netscape Communications has launched version 6 of its browser. It contains new features for privacy and security and gives users the opportunity to browse the Web across a variety of platforms. Powered by the embeddable Netscape Gecko browser engine, Netscape 6 has been rewritten in an open source environment and offers enhancements to the Netscape Internet suite, which includes such applications as Netscape Navigator, Netscape Mail, Netscape Instant Messenger powered by AOL Instant Messenger and Netscape Composer. The browser engine can run on a wide variety of platforms including PCs and workstations as well as a range of new consumer devices, including the new “Instant AOL” Gateway household Internet appliance. The enhanced privacy and security features mean the Password Manager can be set to remember all login names and passwords at the sites visited. Users have the option to set the Password Manager to automatically fill this information in on return visits, or to specify that Password Manager should remember only certain login names and passwords. Forms Manager enables users to fill in Web forms automatically by specifying the personal information they want to make available while Cookie Manager enables users to view every cookie placed on their hard drive and remove any they don't want. Jim Martin, Senior Vice President and General Manager at Netscape, said, “Feedback has indicated that Internet users do not like to be limited to one browser. With Netscape 6, we broke the mould by creating a brand new browser that lets consumers choose how they use the Internet. They can put the content they care about most right up front; customise features to suit their individual needs and even change the look and feel of the browser to reflect their interests and lifestyles.” Martin added, “In designing Netscape 6, we looked very carefully at how consumers and professionals use the Internet in their everyday lives. And we worked very closely with the development community to build a new browser based on the standardscompliant, innovative, open source Gecko technology that enables users to fully experience the Internet in ways never possible before.” Netscape 6 is available for Windows, Macintosh and Linux and can be downloaded from http://www.netscape.com/download or grabed from the issue CD. ■
Info www.redhat.com ■
New database Mandrake rolls out 7.2 MandrakeSoft has released version 7.2 of its engine
Info
graphical operating system geared towards improving productivity and making system administration a more user-friendly process, with the help of value add products and services from Macmillan. The new distribution allows the system administrator to access the administration tools through its DrakConf application, which now offers improved tools for custom menu creation. MandrakeSoft has also made the Common Unix Printing System (CUPS) available for more efficient single or networked printer administration. The release also includes StarOffice and Koffice integrated office suites, and features updates to the Linux Library, including a multimedia tutorial, while users can also choose from a variety of graphical interfaces with which to customise their desktops. New products included with the release include Linux-Mandrake Complete 7.2, MandrakeSoft's solution for users new to a Linux environment, as well as its operating system tailored for supporting more advanced peripheral devices, USB cameras and scanners, Linux-Mandrake PowerPack Deluxe 7.2, and its professional and SME version, LinuxMandrake 7.2 Professional Suite. Henri Poole, chief executive of MandrakeSoft said he believed the new release would convert many Windows Me, NT and 2000 users to Linux. He added “With the easy to use and automated administration tools provided we have truly arrived at a point where we can offer an incredibly complete operating system with powerful office tools, high-performance server applications – all tuned to a high degree of security, stability and usability.”
sourceforge.net/projects/sanche z-gtm
Info
Greystone Group is offering its M database technology, GT.M, to users of x86 GNU/Linuxbased platforms as open source freeware.GT.M is a multiparadigm database engine, and has been used as a platform for building high-throughput database applications for both host-based and client/server architectures. The binary release is now available for download and Sanchez says the source code will be made available shortly. :”By making our database technology and programming language available on the GNU/Linux platform, we inherit a worldwide group of programming and testing resources that will cooperate with us, while working on their own behalf to enhance the software,” said ` Greystone spoksman Although the software is free for anyone to use, commercial users who want support will be expected to pay for commercial maintenance contracts
http://www.linux-mandrake.com ■ ■ 12 LINUX MAGAZINE 4 · 2001
008news.qxd
22.11.2000
9:42 Uhr
Seite 13
NEWS
Linux solutions are yet to reach full potential Enthusiasm for Linux solutions has not yet translated into large-scale deployments in the workplace, a new report from Zona Research indicates. The report, The New Religion: Linux and Open Source, is based on interviews with 109 technical decision makers who have implemented Linux applications in their organisations already, or intend to do so over the next 12 months. Most respondents represented large enterprises, with more than one third from organisations with more than 2,500 employees, while 55 per cent worked within organisations with more than 500 employees. The report provides an overview of the Linux marketplace and examines the current state of Linux deployment in organisations and the factors driving its deployment as well as shedding light on user perceptions of the Linux and Open Source value proposition. The survey reveals that most current Linux deployments are restricted to pilot programs or departmental deployments. Almost two thirds of respondents said there were 100 or fewer Linux users in their organisations and, of these, nearly half said they had twenty-five users or fewer. Just a quarter of respondents said their organisation had
made a strategic commitment to open source solutions. Most respondents were looking to Linux as a replacement for Microsoft Windows, however, almost two thirds said they were replacing legacy applications with Linux, which indicates it is being used to replace existing Unix operating systems. The top reasons respondents gave for their decision to implement Linux included stability and reliability, lower price, speed of applications and services and overall scalability. Charles King, Senior Industry Analyst at Zona Research commented, “Overall, if Linux development were compared to the Pilgrim Separatist movement, this would be the year 1640, when the second wave of Puritans were being assimilated. The Great Revolution is yet to come. Much like the behaviour of the early Java market, Linux is being tested and evaluated, but it has not caused the wholesale replacement of existing applications and operating systems,” continued King. “Just over half of our respondents indicated their organisation would replace existing applications with Linux, but at the same time 40 per cent of our sample had not yet deployed a single copy of Linux.” ■
AvBrief scoops top award As the UK's first Internet service providing a “one stop shop” for online flight briefing, AvBrief was awarded the best E-business Start-up Award at the Computer Weekly EBusiness Excellence Awards, November 2000. Following research conducted by the AvBrief team, a desire amongst aviators to have easy access to flight information, especially timely weather data, was discovered. A need was highlighted for a central online reference site providing flightplanning information. Access to superior data on all aspects concerned with a safe and enjoyable flight would generate a positive force for better pilot decision-making, an enhanced professional attitude and superior airmanship, actively making a contribution to increased flight safety for all users of the skies. AvBrief was founded in 1999 by a team of five, all of whom are keen pilots. AvBrief is supplied weather data from the United Kingdom Meteorological Office (UKMO) delivered via the International Civil Aviation Organisation (ICAO) satellite system, SADIS. In addition, airfield and navigational data is supplied by the Aeronautical Services Group of Racal Avionics Limited.
AvBrief is available to all pilots with Internet access and offers free information for users that register at www.avbrief.com as well as further information and services to paying subscribers. Subscription is offered at £35 a year, with payment invited online or by fax, or post if preferred. There are now over 16,000 registered users within six months since the site's launch. AvBrief receives meteorological data, including airport weather reports and forecasts, forecast charts and digital model data, from the ICAO SADIS (Satellite Distribution) VSAT (Very Small Aperture Terminal) and Receiver. The SADIS system is supplied with current met data from the World Area Forecast Centres at the UK Met Office in Bracknell and the National Weather Service in Washington DC. More than 50,000 textual met reports are distributed every 24 hours, with a large number of weather charts in addition. To supplement this, AvBrief obtains additional Aviation Meteorological information by fax from the UK Met Office and by FTP. Aeronautical navigational data is provided on a four-week update cycle (AIRAC) from the master navigational
database managed by the Aeronautical Services Group of Racal Avionics Ltd. The information is stored on AvBrief's servers for processing and dissemination. These high performance servers use the Linux operating system, and run a relational database management system to ensure that the most appropriate and timely data is available for users through a high bandwidth (512 kbps) connection to the Internet. Users can also look-up airfield details such as runway details, radio frequencies and other helpful aeronautical information. The software used to run the system has been written by the AvBrief team in C, Perl and PHP to run in conjunction with well established open source platforms such as the Apache web server and Postgre SQL Object-Relational BMS. For performance and resilience the servers run as a Red Hat Linux Cluster using the Linux Virtual Server (LVS) software.
Info www.avbrief.com ■
4 · 2001 LINUX MAGAZINE 13
008news.qxd
22.11.2000
9:42 Uhr
Seite 14
NEWS
Navaho launches Linux web solutions Communication tools developer Navaho Technologies has launched its new Linux based Web based solution for the small to medium sized enterprise. The Navaho WebOffice communications software solution enables businesses to access the Web via its own servers and proxy servers. Navaho WebOffice offers e-mail and proxy servers with content and Web address filtering to help businesses control and monitor their e-mail and Web access by content list and by listing URLs to be allowed or blocked. Other features include intelligent caching and quota controls to minimize online time, the ability to check e-mail via a Web interface and to send and receive faxes electronically to ensure the use of paper is kept to a minimum. It also provides time efficiency features in the form of file and printer sharing and a calendar and groupware systems. James Acketts, operations director at Navaho Technologies Ltd, said, “The Internet is changing the way everyone works, small and medium sized businesses have to keep up with the developments, new software and upgrades can be expensive and complicated. We have designed a Server solution for busy offices, it is well priced, easy to use and offers every facility you expect from office software but will be as mobile as you are.” The Navaho WebOffice range starts at £999. ■
Penguin Computing and Bull to collaborate
GNOME Foundation news
Linux system provider Penguin Computing is to partner with global IT group Bull to offer end to end Linux solutions to the European market. The two companies' initial efforts will focus on Bull's service, support and provision of Penguin Computing solutions to the Europe market. However, Bull and Penguin Computing also plan to collaborate on manufacturing and logistics of Linux-based solutions. Bull, which already offers a complete range of services for Linux users, including consulting, application and technology integration, support of applications and infrastructures and dedicated Linux phone support, recently contributed private equity financing for Penguin Computing to support the company's international expansion. Bull's vice president of research and development Gerard Roucairol added, “Bull launched its Linux business two years ago because our European customers were increasingly regarding Linux as a key component of their overall IT strategy. Our partnership with Penguin Computing provides Bull with a reliable and proven Linux infrastructure solution to bundle with Bull's existing support and Linux development expertise. Together, Penguin Computing and Bull deliver a compelling Linux solution for these customers.”
MandrakeSoft and Borland-Inprise have both announced they are to join the Advisory Board of the GNOME Foundation, which aims to promote the GNOME graphical desktop. MandrakeSoft also plans to offer financial sponsorship to GNOME developers working on GNOME Office/Open Office solutions. The GNOME project has built a free desktop environment and application framework for software developers on Linux and other Unixlike operating systems. GNOME is part of the GNU project, which focuses on the development of Linux. MandrakeSoft has included the GNOME environment in its Linux-Mandrake operating system since the early releases. Existing GNOME Advisory Board members include Hewlett-Packard, IBM, Red Hat, Sun Microsystems and Turbo Linux. “We are delighted that MandrakeSoft is joining the Foundation's Advisory Board and extending its commitment to GNOME,” said Miguel De Icaza, co-founder of GNOME. www.linuxmandrake.com
Info
Info
www.bull.com http://www.penguincomputing.com
http://www.gnome.org ■
■
Omnis Software's RADical rewriting Omnis Software has rewritten the core of its 4GL rapid application development (RAD) program for its latest release with the aim of providing developers with a more powerful and intuitive environment. Omnis Studio 3.0 has been redesigned to deliver faster Web based applications by taking advantage of multithreading when executing methods or when directly accessing a database such as Oracle, DB2 or Sybase. The latest release features updates to the Omnis Web server and Web Client technologies, geared towards speeding up Web based business applications. It has also been enhanced to give programmers a more intuitive, easier to use and more powerful development environment. Omnis has added client side methods to the program, enabling a greater range of functions to be performed locally, and 18 new Web-specific components for a more responsive user interface. New components include clocks, sliders, picture faders and complex grids. Omnis UK president Gwyneth Gibbs said, “The
14 LINUX MAGAZINE 4 · 2001
engineering team has done a fantastic job of incorporating and exploiting technologies specifically to make the most of the Internet. This latest version of Omnis Studio will allow an enterprise to create powerful, Web based, business solutions in even less time, confident that they will prove scalable, robust and extendible.” She added that developers would have the added benefit of knowing that if the solution has to be moved from a Windows server to Linux, or the other way round, the solution would enable them to do this in hours rather than weeks or months, as they would not have to rewrite their code. “We believe that solutions built on this technology, which allow customers complete control of where and how they deploy their solutions, are essential for commercial success in an uncertain datastore and OS world.” A demonstration version of the software is available for download from the Omnis Web site at ■ www.omnis.net
008news.qxd
22.11.2000
9:42 Uhr
Seite 15
ad
008news.qxd
22.11.2000
9:42 Uhr
Seite 16
NEWS
Forming the KDE League Open source desktop environment developer KDE has announced it has formed the KDE League, a group of industry leaders and KDE developers committed to the promotion, development and distribution of KDE. KDE is the developer of the K Desktop Environment (KDE) 2.0, an object-oriented, componentbased desktop and office suite. The League's focus will be on promoting the use of KDE, both by enterprises and individual users, encouraging its continued role as an open source desktop alternative on PCs and workstations and ensuring it becomes a desktop standard on handheld devices. It will also promote the development of KDE software by third-party developers. Although the League will not play a direct role in developing the core KDE libraries and applications, KDE hopes that League members will contribute to the KDE code base. “The creation of the KDE League marks a vital step forward for KDE,” said Matthias Ettrich, founder of KDE. “With the support of our corporate partners, we can work together to ensure KDE gains wider recognition, a greater number of applications and increased functionality, while maintaining the open development model and technical excellence that has made KDE the most popular Open Source desktop.” The founding members of the KDE League include Borland, Caldera, Compaq, Corel, Fujitsu-Siemens, Hewlett-Packard Company, IBM, KDE.com, Klar‰lvdalens Datakonsult, theKompany.com, Mandrakesoft, SuSE, Trolltech and TurboLinux. However other corporations who support the goals of the League can apply for membership.
Info www.kde.org
SuSE Linux releases new edition SuSE Linux has announced the release of the PowerPC Edition of SuSE Linux 7.0. SuSE Linux 7.0 for the PowerPC features include applications for image processing, desktop applications, emulators and a range of available window managers, network tools and editors. The inclusion of MoL (Mac on Linux) means users can access a network-capable MacOS, either in a window or in full screen mode. Linux 7.0 also features SuSE's integrated installation tool, YaST2, which automatically recognises and configures the hardware during the installation process. The PowerPC Edition supports IBM's pSeries with POWER3 processors, expanding the range of supported hardware already running on version 6.4, which includes Apple PowerMac, IBM RS/6000, and Motorola PReP systems. The new XFree86 4.01 can now detect and identify common graphics subsystems such as ATIÇs Rage 128 graphic card. The configuration tool SaX2 offers simplified installation and setup for graphics cards. In addition to the KDE 1.1.2 graphical user interface for Linux and Unix, the PowerPC Edition also offers the beta version of the next generation desktop interface, KDE 2.0.
New Linux PPC edition LinuxPPC has announced that a public beta test version of its latest release is now available. The beta, which can be installed over any existing RPM based Linux on Power PC distribution, includes the latest versions of Helix Code's GNOME, KDE 2.0, XFree 4.0, Mozilla 5.0 and glibc. At 1.5 gigabytes, and with a base installation of 500 megabytes, the beta includes the basic operating system, networking software, the X Windows graphical interface software, the Mozilla and Netscape Web browsers, and the KDE and GNOME desktop environments. The size of the installation means that users need a fast connection such as DSL to have a reasonable download time. Users can install the beta by downloading the updater utility onto a computer with an existing Linux/PowerPC distribution, running the updater and then downloading the beta from an FTP site. LinuxPPC is based on the RPM system RPM, the Red Hat Package Manager system which is used for both installing software on some Linux systems. However the Debian distribution, which does not use the RPM system, cannot be upgraded and Debian users must use an installer program rather than the updater program if they wish to install the beta. Developer Jeff Carr said, “As long as your system uses RPM, you can upgrade to the public beta.”
Info http://www.suse.de/en/produkte/susesoft/ppc/ind ex.html
Info http://linuxppc.com/support/updates/product/2000 publicbeta.php3
■ ■
3D driver for Radeon Xi Graphics – which provides graphics support software for Linux and Unix systems has released a new driver with Linux graphics support for two members of ATI Technologies' new high performance RADEON family of graphics cards – the RADEON 32Mb DDR and the RADEON 64Mb DDR. The new RADEON Linux Graphics Driver (LGD) is now available as part of Xi Graphics' current Linux Graphics Driver v1.1 product line. The driver is available for download in demo mode from Xi Graphics' ftp site and provides OpenGL-compliant 3-D support and fast 2-D support. Users who decide to purchase the full product can buy a license key online from the Xi Graphics site. When users buy the License Key for v1.1 of the driver, they can download and unlock an alpha version of the forthcoming v2.0 of the RADEON driver and will be entitled to free upgrades to v2.0 when it is released. “The RADEON cards are very impressive,” remarked Jon Trulson, Xi Graphics' Engineering
■ 16 LINUX MAGAZINE 4 · 2001
Manager. “Coupled with v2.0 of our new X server and OpenGL rendering pipeline, the performance numbers we are getting are truly amazing. They beat NVIDIA GeForce2 GTS numbers in most of the tests, a feat that we didn't think would be accomplished for some time with Linux,” Trulson continued. “With the upcoming Linux 2.4 kernel, the numbers will improve even more. “ATI's support of Xi Graphics further demonstrates our commitment to become the leading hardware graphics vendor for Linux and help to ensure its success,” said Kevin Oerton, Director Technical Marketing, ATI. Technical and pricing information on the new RADEON product line is available from ATI's Web site.
Info www.ati.com www.xig.com ■
008news.qxd
22.11.2000
9:42 Uhr
Seite 17
NEWS
Communicado Fax Software Linux based software provider Merlin Software Technologies has unveiled its new Communicado Fax product at Comdex Fall's Linux Business Expo. Scheduled to ship in December, Communicado Fax enables users to send faxes from any application and on a variety of platforms, ranging from StarOffice and Wordperfect under Linux/Unix to Microsoft Office under Windows/Macintosh. Its multi-line server platform is based on the Linux platform. In addition to hardware and application compatibility, the product offers the user a range of features including address books, a built-in fax viewer with thumbnails, and cover pages and power features such as broadcasting, forwarding and detailed usage reporting and accounting, as well as support for multiple inbound and outbound lines. Communicado Fax is a fifth generation development and originates from Merlin's HotWireFAX. “With Communicado, we have combined the affordability and reliability of Linux servers with the flexibility of allowing any platform, including Microsoft Windows, to fax from any application,” said Merlin president Robert Heller. “Our product is well positioned to capitalise on the growing business penetration of Linux servers and their co-existence with other platforms such as Microsoft Windows.”
Info http://www.MerlinSofTech.com
MobileOffice and Productivity.NET Open source operating system solution provider ThinkFree has partnered with security ASP McAfee to deliver Web based business applications to customers of McAfee's Productivity.NET managed applications service centre. The Productivity.NET service centre will feature McAfee's MobileOffice productivity solutions for word processing, spreadsheet and presentation graphics services, powered by the ThinkFree Web based business tools. MobileOffice suite components include the word processing application MobileOffice Write, for creating and editing electronic documents and featuring an HTML editor, the MobileOffice Calc spreadsheet program for calculating and charting numbers and the presentation application MobileOffice Show, which enables users to create, format, edit and design business and personal presentations. As well as MobileOffice, Productivity.NET offers the MobileDisk file management system. “The partnership with McAfee.com highlights ThinkFree's migration from a direct consumer-oriented focus to an OEM distribution model and
reflects the company's new business strategy of working with leading ASPs to provide customers with business productivity solutions, said ThinkFree president Ken Rhie.” “Launching this product with McAfee.com demonstrates a great achievement for ThinkFree, providing us with a major stake in the business as well as consumer marketplaces. This partnership also represents a major endorsement of ThinkFree's emerging technology and commitment to help leading ASPs expand their offerings and bring customers value-added services that deliver on the full promise and potential of the Internet well ahead of other industry initiatives.” Patti Dock, vice president of marketing at McAfee.com commented, “Our partnership with ThinkFree reflects the goal of our .NET Initiative to empower businesses with proven, cost-effective solutions to fulfill their security, support and productivity needs.”
Info http://www.mcafee.com/net http://www.thinkfree.com ■
■
90-day evaluation of Teamware Office Fujitsu subsidiary Teamware Group has announced that the new release of Linux-Mandrake 7.2 is to feature a free 90-day evaluation copy of its groupware product Teamware Office 5.3 for Linux. Teamware Office 5.3 for Linux, a ready-to-run groupware product with a customisable user interface and state-of-the-art communications features, is an intranet solution geared to the business needs of small and medium sized organisations. Teamware Office 5.3 for Linux includes the Teamware Mail e-mail solutions, time and resource scheduling in the form of Teamware Calendar and the Teamware Forum discussion groups solution. Teamware Office 5.3 also provides document storage and retrieval with Teamware Library. The solution offers a customisable user interface and a browser-based interface with templates to enable the user to change the look and feel of the software, or to allow businesses to give the software the corporate identity of their business. The product supports nine languages. “Becoming a partner of MandrakeSoft offers great opportunities to increase the recognition of our product in the Linux community,” said Colin Sydes, Product Manager for Teamware Office for Linux. “Being bundled with one of the world's most popular Linux distributions can really add to our efforts in gaining a global market share in the Linux-based groupware solutions”. “We are excited to offer products that meet our customers' needs for initial deployment and ongoing operations of successful Linux solutions. MandrakeSoft is committed to mainstream commercial adoption of Linux and adding sophisticated, easyto-use administration helps us achieve this goal for our customers”, said Frederic Bastok, Product Manager, MandrakeSoft.
Info www.teamware.com/linux ■ 4 · 2001 LINUX MAGAZINE 17
008news.qxd
22.11.2000
9:42 Uhr
Seite 18
NEWS
Compaq makes the grade Cisco Systems has awarded its Global Support Partner certification to Compaq. Compaq has been a global Cisco Systems Integrator since 1992. The certification indicates that Compaq has met Cisco's standards in capabilities, worldwide services infrastructure, networking expertise and customer support systems. Compaq, which is responsible for the implementation, support and maintenance of solutions based on both Unix and NT, already has 54 Cisco certified professionals operating from five Compaq UK offices. The company plans to increase this number to 122 by the end of the second quarter of 2001. Compaq's existing alliance with Cisco has seen the company deploy Webenabled business solutions to Her Majesty's Land Registry (HMLR) and Nationwide Building Society. The company has spent £2m on a Cisco stateof-the-art customer demonstration and scenario-testing lab in Reading where Compaq can replicate customer environments for the purposes of troubleshooting their problems or testing solutions before deploying them to customer sites. In Warrington Compaq and Cisco have built a £1m lab where
teams from both companies can work on the development of Voice Over IP (VOIP) and Directory Enabled Networks “Obtaining GSP status is a significant achievement because it requires the partner to be equipped with a large Cisco-certified technical staff capable of providing around-the-clock, around-theglobe support,” said Tom Mitchell, vice president, worldwide channels at Cisco Systems. “Compaq's ability to achieve GSP status demonstrates its commitment to selling and supporting Cisco solutions worldwide.” “Our GSP status with Cisco marks the launch of our worldwide initiative to support and maintain Cisco Internetworking solutions, including Cisco's AVVID architecture,” said Paul Mears, director of Compaq Customer Services. “Compaq Global Services can play a major role in helping Cisco customers rapidly and successfully deploy world-class Web-enabled business solutions.”
Info http://www.compaq.co.uk ■
Knox data protection software is a winner Cnet.com gave its coveted seal of approval to Knox Software's data protection product after thorough review. The company's flagship product, Arkeia, a professional network backup solution, earned the CNET Editors' Choice Award and scored 9 out of a possible 10 on the CNET ratings scale. The product received high marks for its comprehensive management tools, activity tracking, and for its extensive network support. “Despite a high learning curve, Arkeia's superb, flexible feature set makes it a musthave for any Linux environment in need of a backup solution”, said Michael P. Deignan from CNET. The full CNET article is available at http://linux.cnet.com/linux/0-2136888-73182779.html The CNET Linux Center Editors' Choice Award is the latest of several industry awards received by the Arkeia product. “We strive to provide a great value proposition for our customers with the Arkeia product, as well as promote the use of the Linux operating system in main-stream businesses”, said Phil Roussel, CEO of Knox Software Corp.” As a proven solution for enterprise network backup requirements, Arkeia 4.2 provides incremental and full backups, scheduled or on demand, and preserves directory structure, registry, symbolic links and special attributes. Arkeia utilises client-side compression and a unique multi-flow technology to deliver data backup and restore throughput rates that are 200 to 300 per cent faster than rival software packages. Arkeia Version 4.2 provides several powerful enhancements such as a job queuing facility, multiple user interface options, a virtual backup server facility and e-mail notification upon completion of backups. Designed for heterogeneous network environments, Arkeia provides client support for over 30 different hardware-OS configurations. Its full version can be downloaded at: http://www.arkeia.com/download .html for a 30-day trial. ■ 18 LINUX MAGAZINE 4 · 2001
Gateway unveils new Internet appliance In the wake of Compaq's announcement of its Home Internet Appliance with close links to Microsoft's MSN Web services, Gateway has unveiled its Transmeta processor powered Internet Appliance with links to AOL in the US and, the company says, the European launch will follow soon. Gateway Connected Touch is one of the new line of network ready Web access appliances that Gateway has been working on with AOL and the Internet Appliance is linked to the AOL Internet service. It is based on Transmeta's Crusoe processor and the Mobile Linux operating system and features home networking technology from chip manufacturer Broadcom enabling it to connect at broadband speeds to other equipment around the home using traditional phone lines. The device is a consumer Web pad, operated by stylus, touchscreen or wireless keyboard and designed to be used in parts of the home where PCs are not usually present and to connect to other devices around the home, providing tools such as calendars, message pads and address books, as well as Internet based services on the AOL model, including e-mail, instant messaging and themed Web channels. Gateway recently announced an alliance with Broadcom, with plans to develop systems providing streamed digital audio and video content to a variety of consumer electronics devices, including Internet Appliances. Gateway has also launched a music player device that can access music files stored on PCs and can connect to existing stereo systems or be used as a standalone appliance. ■
Compaq recalls notebook batteries Compaq has announced a worldwide voluntary recall and replacement programme for the battery packs distributed with its Armada E500 and V300 notebooks. The affected battery packs were distributed worldwide in notebooks, as separate options, and as replacement spares. The recall has been announced as a result of Compaq's discovery of a defect in one battery pack that was manufactured between June 2 and July 10, 2000. This failed battery pack overheated and released some smoke, which caused damage to the notebook computer. For more information on the recall and replacement programme call Compaq at 0207 7452 006, or visit www.compaq.co.uk/products/ portables/battery_recall.STM ■
022apache.qxd
21.11.2000
14:43 Uhr
REPORT
Seite 22
APACHE CONFERENCE
London Olympia – 23rd to 25th October 2000
INDIAN AUTUMN RICHARD IBBOTSON
The European Apache Conference was a mix of smooth sophistication and welcoming technical help that all of us have grown to appreciate. Many of us had that customary feeling of deja vu. Perhaps some of us had been there before. Perhaps not.
The BSD Team
The conference is all about the well-known Internet program – Apache. This is the Open Source software that runs most of the Internet. Without it the Financial Times and other institutions of that sort couldn't carry out their day-to-day business. Apache is extremely sophisticated and will become a 2.0 release in the not too distant future. Plans for GUIs and all sorts of the refinements after version 1.3 are afoot. The first port of call for information about the Apache Conference is Daniel Lopez Ridruejo who is a software engineer at Covalent technologies. Daniel gave us his Apache projects overview. This did a really good job of outlining broad concepts before the real meat of the conference arrived on the table. Ryan Bloom is also a reliable reference. He is also a software engineer at Covalent Technologies. His own talk about 22 LINUX MAGAZINE 4 · 2001
writing Apache 2.0 modules was a complete masterpiece from beginning to end – the kind of thing that most programmers would like to hear. There are many more parts to Apache and Apache configuration than most people know about or imagine. Just about anything to do with the Internet is based on Apache or the modules that make it so versatile and reliable. Even XML is somewhere in the Apache software. To put it succinctly, Open Source software is all about new technology and not old technology. A really good example of this was the talk by John Zukowski about developing dynamic web sites with java server pages. The whole thing took place on the upper floor at the Olympia conference centre. All we had to do was walk between the Sun vendor theatre where
022apache.qxd
21.11.2000
14:44 Uhr
Seite 23
APACHE CONFERENCE
we learned all about Java development with GNU/Linux and Free BSD, and the various lecture theatres where all kinds of really substand technical presentations were taking place. Everything was there for those who wanted it. The Sun/ Free BSD presentation by Kristin Thorleiffsson was worth going to alone. The exhibition hall had a good selection of stands that covered most things that Open Source software people might want to ask about. The Covalent stand was placed prominently – in full view as people walked through the door. I had a word with Randy Terbrush, the Chairman and CTO of Covalent Technologies about his work. Randy started out with computers through his background in geology. He told me, "I worked in the oil industry in California and when it collapsed I found myself working in user interface software development with CAD systems on Intel systems. I remember the 0.7 GNU/Linux kernel. In 1994 the Internet started to warm up and I decided to start a services business that would help other Internet users. I began looking around for server software and found other people who were like minded from institutions such as MIT. In 1998 we released our own product which was the SSL module. Since then the company has become more of a products and services business. Covalent sees itself as a hybrid business model that produces Open Source applications and products. Nettruss is our latest product. It's a GUI that cuts down Apache configuration from a three day job to a few minutes. Apache can be configured on the fly for load management etc. The Covalent intrusion detector is also available. It stops the server serving web pages when an intruder is detected." Recently there was a re-organisation of Senior Management at Covalent Technologies. Mark Losh, Jim Zemlin and Scott Albro are part of the new team. Covalent offers comprehensive training programs for Apache web server throughout the United States and Canada. There are plans to extend the training scheme to Europe in 2001. I found Jim Jagielski over on the Zend Technologies stand. He's known as the PHP evangelist. We talked about his work with PHP. He says he was always interested in science fiction so he got interested in computers and went to college at the John Hopkins University on a PDP 1145. After that he went to work for NASA. This was good for his own understanding of the Internet. His enthusiasm for Open Source software is aweinspiring. He's the kind of person who could run an entire University unaided. After leaving NASA he started his own web-hosting company and quickly became a member of the Apache group. If you haven't yet tried PHP then it might be a good idea to take a look at it. It's the most reliable software I've seen for a long time. Over on the Wrox stand I found Peter Wainright. He started out by hacking around at home with BBC basic. He graduated in Electronic
REPORT
Peter Wainwright with his best-selling publication
Chairman and CTO of Covalent Technologies, Randy Terbrush
Daniel Lopez prepares to deliver his Apache overview
Ryan Bloom spoke eloquently about Apache modules
Engineering from Imperial College where he taught himself C programming. This proved to be his future and he started to produce software for a job. His latest enterprise is his new book Professional Apache from Wrox Press. It's proving to be a best selling publication. When he isn't writing books he's involved in space tourism and commercial space exploration. The Free BSDi stand proved to be full of surprises – it's also available for Alpha and other platforms follow soon. If you are a BDS'er then look towards Open BSD for one or two suprises soon. The BSD technology is not new to most of us. However, the approach that the BSDi team have to promoting BSD and providing support is highly refreshing. The next Apache Conference will be from the 4th to 6th of April at Santa Clara in California. Those of you who haven't been there may like to know that it's a great place to go to. Hope we see you there. ■
Useful references http://www.apache.org http:/www.covalent.net – Ryan Bloom rbb@ntrnet.net http://www.apachecon.com ■
4 · 2001 LINUX MAGAZINE 23
024automation.qxd
21.11.2000
15:17 Uhr
REPORT
Seite 24
ROBOTIC CRANE
Bridge crane robot with Linux
CRANE DRIVER EMULATOR
ULRICH WOLF
The advantages of Linux's free software model are producing success stories in the most unlikely places. Indeed, Linux is even being used to drive a robotic crane in an Austrian cement works as you'll see in this month's Report. The 49 tonne colossus swings into action, guided along two railway tracks 198m long. The trolley seeks its goal, and the grab drops, accurate to the centimetre, into the grey mountain of cement clinker. It picks up a few thousand kilos and transports it across the gigantic warehouse. This is a process it repeats over and over again. The colossus in question is obviously a crane, but no ordinary one; this crane is driven entirely by Linux-based computing power. The fact that this Linux crane even exists is down to two things – an enthusiasm for Linux, and the need for economy and efficiency.
Economic change In the mid-nineties, the cartel-like organisation of the Austrian construction materials industry was feeling the effects of increasing competition, especially from the recently opened-up European market. To safeguard the future of the company, 24 LINUX MAGAZINE 4 · 2001
Everything looks almost identical at first glance, but the Linux crane can distinguish everything.
management at the Perlmooser cement works in the eastern Steiermark, a tranquil area close to the Austrian-Slovenian border, was forced to increase productivity at ever-increasing scale. Hand in hand with this was a reduction in the workforce and modernisation of the plant's technology.
024automation.qxd
21.11.2000
15:17 Uhr
Seite 25
ROBOTIC CRANE
More efficiency in the warehouse Despite its efforts, by the end of the Nineties, the French Lafarge group – the biggest construction materials producer in the world, had taken over Perlmooser, which now traded under the name of Lafarge-Perlmooser. Although many changes had already been made, the crane machinery used in the plant was still in need of a general overhaul. This is exactly what happened, with Linux entering the equation at the same time. But before we go on to describe this development, it might be useful to briefly look at the cement manufacturing process. Cement is made from the three components: limestone, marl (an intermediate layer found between the limestone and the topsoil lying on top of it) and sand. These basic materials are ground up and mixed together in a specific way, then heated in a furnace to produce an intermediate product called clinker. This is then combined with other additives such as gypsum, Portland blast-furnace cement or limestone to form various types of cement, depending on the types and amounts of additives used. From this you can clearly see that a cement works is no small place, and requires various bulk goods to be stored, transported and mixed in order to operate. Large warehouses are used to store everything, but while this protects everything from the rain, it does mean that there's a great deal of dust in the air, which reduces the life of any machinery working inside.
Linux solution without precedent As the result of a favourable combination of chance and sales skill, the small company "Automatix", near Bremen, received the contract to overhaul the plant's electrical system and develop a controller that could completely replace a human crane driver. It just so happened that Jürgen Sauer, the director of Automatix, was a passionate Linux enthusiast who insisted on playing, way back in 1991, with the now-legendary "Task-Switcher", kernel version 0.1, and implemented Linux from Version 0.91 as mail and news-server at FH Hannover. He was therefore more than a little prejudiced when it came to selecting the basic operating system for the crane control system. He could have chosen Solaris as the company also uses Suns in process control, but stability and open source status tipped the scales in favour of Linux.
REPORT
it was all a good idea. Being a totally new product, all kinds of technical problems also had to be overcome, but thanks to Linux's open source basis and the skills of Sauer's technical team they did eventually achieve their aim. The process did often involve workarounds, and even the odd modifications to the operating system kernel itself. The approach they took to the task was fairly unusual. The plant was, after all, a prototype. Right at the start it was impossible therefore, to create a complete performance specification. Very often they ended up being amended and adapted to the logistical conditions. As a result, Automatix had to work very closely with the cement works engineers understand their requirements and generate the storage philosophy required in the control software. Even the heuristic knowledge gained by the crane drivers went into the software. The outcome of Automatix's efforts was that two warehouses in the cement works in Steiermark were fitted with robot cranes built with the company's Linux-based control technology and have been doing their work, mostly without complaint, since February 2000. As no software is completely free from bugs (although the machines sometimes run for months without any problem) from time to time there are still software problems that case the cranes to grind to a halt. Sauer is always on the case immediately, though, hot on the trail of the bug. Interestingly, the first version of the graphical interface used to program the cranes was Javabased, the theory behind this choice being that it allowed access the programming module from the Microsoft-based computers in the company's offices and not just from the Linux systems. The Java UI was quickly replaced by a KDE-based one for stability reasons, however, and thanks to Qt for Windows, remote access via the office machines is still possible.
Figure 1: The bridge crane at work
Open source – less stress Sauer set himself the goal of not just automating "a bit", but of constructing a full "crane driver emulator" based on Linux. Anyone who now sees the gentle movements with which the heavy grab moves, knows that he has succeeded. Getting his idea of the ground in the first place was difficult, however, as the customer had to be convinced that 4 · 2001 LINUX MAGAZINE 25
024automation.qxd
21.11.2000
15:17 Uhr
REPORT
Seite 26
ROBOTIC CRANE
has been improving, for example, as the robot never pours gypsum onto the limestone heap or smashes the conveyor belt with the grab, as would occasionally happen with human crane drivers. Talking of the conveyor belt, this has also been given the Automatix treatment and is now controlled by a Linux system and known as a "travelling tripper".
The smarter crane gives way
[top] Figure 2: The "eyes" of the crane: The blue boxes are laser scanners, through which a 3D image of the environment can be generated. [above] Figure 3: Screenshot of the program interface. The narrow, boldly outlined rectangle represents the position of the crane, the small box inside it is the travelling trolley. The second, black-bordered rectangle on the top edge represents the travelling tripper. The red-bordered area is temporarily prohibited to the crane.
The large number on the bottom line For the technical director of the works, an engineer named Luger, the operating system of his crane controller is of little importance. Indeed, all that really matters to him is that everything works and productivity has been increased. As he himself sometimes puts it, "the large number at the bottom right hand side of the page is right". In any case, Luger expects the investment made in the plant to have paid for itself in four years. Quite apart from the savings on labour, the robot plant also brings other advantages. Quality
Figure 4: The travelling tripper. 26 LINUX MAGAZINE 4 ¡ 2001
The travelling tripper is really just a movable conveyor belt that brings the raw material from the nearby quarry into the warehouses. However, its Linux control system can recognise where there are gaps in the piles of raw material in a warehouse and moves conveyor to fill these areas. As the travelling tripper runs on a rail beneath the crane, certain safeguards have to be programmed to prevent the two from causing each other problems. If an order for material would cause the crane to get in the way of the tripper, for example, the order is postponed until the tripper moves away, the next order being processed in the meantime. It is also possible to switch both devices over from automatic to manual operation should it be necessary at any point. It was not by chance that Lafarge-Perlmooser took the gamble of going in for such far-reaching automation. The management of the cement works generally takes an open-minded view when it comes to advanced technologies. The Perlmooser works is the only cement production plant in Europe equipped with a flue gas desulphurisation system.
Software with human experience Luger is very happy with all the new technology, as is the company management, because despite its complexity the plant is actually very reliable. So although the commissioning phase took longer than originally planned, the project, says Luger, is now delivering, and he is very happy with his "bottom right" figures. â–
028distributions.qxd
22.11.2000
13:02 Uhr
COVER FEATURE
Seite 28
DISTRIBUTIONS
Latest Linux distributions
THE NEW ONES The arrival at our offices of Debian 2.2, SuSE 7.0 and Red Hat 7, not to mention the Caldera's Technology Preview and Mandrake 7.2, had our editorial team fighting each other over who got to look at them first. But how do these new distributions differ, and what can they offer users of previous version? Read on to find out.
The big distribution publishers refuse to be side tracked by the fact that kernel 2.4 has yet to be officially released. Shortly after SuSE made the leap to 7.0, Red Hat responded with its own version 7 and at the same time did away, possibly somewhat prematurely, with the 0 after the dot. Debian on the other hand, has taken a slightly more cautious set forward. You won't find the very latest versions and patches of everything in 2.2, but on the other hand you will find stability and very well designed package management. Since the end of July, Caldera has been distributing a “Technology Preview” of its next 28 LINUX MAGAZINE 4 · 2001
distribution, which features a preliminary version of kernel 2.4, not to mention XFree86 4.0. Despite the fact that neither this version of Caldera nor our copy of Mandrake 7.2 were final release version we've still included them here, though you can expect the “real thing” to be at least slightly different. This is especially true of Caldera, which really is exactly what it says – a technology preview – and not anything else.
Red Hat 7 Red Hat's latest distribution comes bundled with huge amounts of software. Indeed, the Deluxe version we tested has no less than ten CDs in the box. As well as office productivity tools, which we'll cover a little later, demo versions of several games (such as Simcity
028distributions.qxd
22.11.2000
13:03 Uhr
Seite 29
DISTRIBUTIONS
Unlimited, Descent 3 and Parsec) are included, as are commercial applications with limited run-time or functionality restrictions such as the PCB layout program Eagle. You even get a full version of Railroad Tycoon II, which practically justifies the price of the distribution itself. Additionally you get two printed manuals (totalling about 600 pages) and 30-day telephone support covering the installation of the product. Also worth noting is that version 7 supports automatic software updates, just like Debian distributions. To achieve this for all tools and applications, however, all Red Hat developers will need to convert to the new 4.0 RPM format that is used in version 7. Usefully, as a consequence of the move to this version o RPM the database format has been upgraded to Berkeley DB 3.1. No user intervention is required to make the database upgrades as they are migrated automatically during the installation process. No distribution is complete anymore without an office suite or two, and with Red Hat 7 you get, amongst others, Abiword, Siag-Office and StarOffice. A demo version of Applixware is also included. Interestingly, StarOffice is actually included twice, both as part of the Red Hat RPM package and on the enclosed StarOffice CD. Databases such as MySQL and applications like Gimp 1.1.25 are also provided, as is the aspell package, the successor to the old ispell spellchecker.
Kernel and compiler By deciding to use a patched version of the unofficial GNU Compiler Collection 2.96, Red Hat has provoked more than a little controversy, and the pros and cons of it have been endlessly discussed on the Internet. Supporters of the decision claim that Red Hat's patched compiler produces better optimised code. Opponents point out that the applications created by it can be incompatible with other distributions. Whether these either of these things matter to you or not, though, there's no escaping the very annoying fact that this compiler cannot be used for compiling the kernel. You need “kgcc”, which is actually a front for egcs-2.91.66,as found in Red Hat 6.2.
COVER FEATURE
First Debian, then Red Hat: automatic updates.
Talking of kernels, Red Hat 7 makes use of version 2.2.16. As with almost all mainstream distributions, it comes with some very diverse patches, including one that provides some USB support. AGPgart is also included, this supporting 3D hardware acceleration on cards from companies like ATI and Matrox. More significantly, an optional “Enterprise-Kernel” is also provided. This offers enhanced support for the TUX kernel web server. Those who enjoy experimenting can also try out test version 3 of kernel 2.4, which is also included on one of the supplied disks.
Not ReiserFS ... or is it? Surprisingly, especially considering all the other new features this distribution includes, Red Hat has not integrated the ReiserFS journaling files-system into version 7. This isn't really a significant issue, though, and in any case anyone simply can't do without ReiserFS can download an unofficial ISO-Image of a suitable patched Red Hat 7 CD 1 from http://cambuca.ldhs.cetus.puc-rio.br/. And if you feel that the wait and expense of downloading 650 Mbytes by modem or even ISDN is just too much for you, appropriate root/ boot diskettes can be downloaded from the ReiserFS homepage (www.reiserfs.com).
Installation
In Red Hat 7 gamers will get their money's worth.
Installation has not changed all that much in comparison with the previous version. Despite this, we found that the Anaconda installation tool gets 4 · 2001 LINUX MAGAZINE 29
028distributions.qxd
22.11.2000
13:03 Uhr
COVER FEATURE
Seite 30
DISTRIBUTIONS
installation variants, though, only KDE 1.1.2 is on the disk. For X configuration you are provided with XFree86-4.0.1. This supports the 3D capabilities of ATI graphics cards, the G400 from Matrox and the Intel i810/i815, and Nvidia drivers can be found on one of the extra CDs. Interestingly, although automatic monitor recognition via DDC worked in our tests, our CTX monitor being correctly identified, we found that no timing details for it were included in the supplied monitor database. On the brighter side, we had no problems with our PCI sound card and Ethernet adapter, these being automatically recognised and correctly configured.
ISDN at last! With Red Hat 7 setting up ISDN is simplicity itself thanks to isdn-config
ISDN support has been fairly based in previous versions, but this is no longer the case in version 7 thanks to isdn-config (see illustrations). This makes setting up ISDN absolute child's play. Indeed, we were able to make a dial-up Internet connection in under one minute, even though we'd never used this utility before. Things are supposed to work just as simply with ADSL (using adsl-config), but unfortunately we had no suitable equipment to test this out. confused too easily. If you first select Workstation Installation with automatic hard disk partitioning and then opt instead for a user-defined system, things can go badly wrong, for example – after spending ages selecting individual packages, which are then apparently correctly transferred to your disk, you'll find that the configuration options (network, X-server and s on) are missing. Since LILO is one such option, the system simply cannot be booted. The main options provided by the installation routine are simply “Desktop”, “Server” and “Userdefined”. As with earlier Red Hat versions, the last option allows manual package selection. Unfortunately applications and tools provided on any but the main CDs cannot be installed here, and instead must be installed manually once the system is up and running. Thanks to RPM doing so very easy, of course, but with ten CDs it can take ages to just find the application you want, let alone install it. One particular casualty of this somewhat limited installation procedure are the HowTo files, which have to be manually copied to your hard disk unless you don't refer to them very often.
Success: Configuration As a result of an old Red Hat tradition, you'll find that of GNOME is the desktop installed as standard, the version provided being 1.2. KDE is also included in this distribution, however, and can be selected instead o GNOME during the distribution's installation. According to the Red Hat web-site, the distribution should also include a beta version of KDE2. According to one of the ready-made 30 LINUX MAGAZINE 4 · 2001
Conclusion Traditionally, Red Hat is more oriented towards the professional customer. For this reason, the concessions made for the Joe Bloggs user (such as USB and AGP support) are particularly praiseworthy. However, some may argue that Red Hat 7 is just a tad too innovative. In the first week after its release more than 200 bugs were reported. This is Linux, though, and it won't be long before they are all put right.
SuSE Linux 7.0 The installation of SuSE Linux 7.0 is a very simple process indeed, and even beginners should find no insurmountable obstacles preventing them from getting a system up and running. Also helping to make installation that little bit easier is the fact that SuSE 7.0 comes with a sack of documentation. You won't be disappointed with the amount of extra goodies you get in the box, either. They consist of six CDs and a total of 1500 packages, the Professional Edition is one of the biggest distributions in the test.
Installation and configuration We very much liked the way the installation process has been designed, ending as it does in the configuration of the most important hardware (see Figure 1). We were also pleased by the way that sound and ISDN cards were recognised an
028distributions.qxd
22.11.2000
13:03 Uhr
Seite 31
DISTRIBUTIONS
completely installed on our test system without a hint of a problem. What's more, the Xconfiguration during installation is, quite frankly, exemplary, with XFree86 3.3.6 or 4.0 being installed depending on your graphics card. Games freaks will also appreciate the fact that SuSE comes with quite a few 3D drivers. The only complains we really had was the fact that it isn't possible to reduce the size of an existing Windows volume during partitioning. For many years now, SuSE has been supplying its proprietary YaST configuration tool with its distributions, a version with a graphical interface also being included since SuSE 6.3. Almost all system adjustments are performed in SuSE via YaST, from name-server control to printer installation and network card and Internet access configuration. YaST cannot configure absolutely everything, though. A new facility added in this distribution is the amalgamation of all masquerading and firewall settings into the file /etc/rc.config.d/firewall.rc.config. This makes the configuration of a firewall comparatively easily, but YaST is totally ignorant of the facility.
Administration without YaST YaST does have its finger in most parts of the configuration pie, though. This makes it an obvious choice as an administration tool even if you can't manage absolutely all configurations possible. Indeed, anyone wanting to work without YaST to any great extent is going to have to deal with problems at every turn. Most settings are actually stored by YaST in its own files and not in the configuration files of the programs themselves. For example, when calling up SuSEconfig after the installation of a package using YaST (or after a minor alteration to its configuration, for that matter), reference is made only to the data from SuSE's own files, and any modifications made by
COVER FEATURE
hand in the configuration files of the services and programs are simply overwritten. Luckily, though, it is possible to specify which files YaST should deal with and which it must keep its hands off.
[top, left] Red Hat 7, here with the disavowed, but well-eaned “.0”.
False sense of security
[top, right] Nice: graphical boot selection menu
Another issue we have with SuSE 7.0 is in its security profiles. The problem is that /etc/permissions contains of list privileges, users and groups for files that do not necessarily exist on the system. /usr/lib/majordomo/wrapper, for example, is registered in /etc/permissions with rwsr-x-r-x and user and group root although it is not usually installed at all. One possible, though admittedly highly improbable, consequence of this is that a user could install their own wrapper in a system without one and with an unprotected /usr/lib/majordomo. This would then be placed in SUID root the next time YaST was launched, thereby serving as a back door entry way into the system. As we said before, though, it is possible to run SuSE without YaST and SuSEconfig. However, if you do so, you must remember /etc/permissions when there are changes to ownership conditions and service privileges.
Conclusion For beginners in particular SuSE Linux 7.0 is highly recommended. As is the case with all the other distributions, though, SuSE does have its idiosyncrasies, and users migrating from another distribution may well find themselves stumbling on the occasional hitch because of them. This is only likely to occur if you attempt to dispense with YaST and SuSEconfig and forget the far reaching tendrils of both programs, however, in which case you can end up spending hours doing configuration work but achieving absolutely nothing. 4 · 2001 LINUX MAGAZINE 31
028distributions.qxd
22.11.2000
13:03 Uhr
COVER FEATURE
Seite 32
DISTRIBUTIONS
Debian GNU/Linux 2.2 “Potato” Debian GNU/Linux 2.2 “Potato” comes in many forms. For our tests we used the six CD set (three of which contain source code), though smaller and larger distributions are also available.
Installation We very much liked the fact that during installation you are kept informed at all times of what's going to happen next, and can skip sections or even perform them repeatedly if need be. As can be seen in Figure 1, you are even offered useful alternative options in many places, and can clearly see all of the steps to come during the entire installation process. The installation process is not perfect, however Kernel module selection proved to be a fiddly and time-consuming process, and one that could be improved greatly by simply listing related items together, rather than all over the place as is currently the case.
Crystal ball gazing: With Debian you can see in advance what to expect
PC Card support for Notebooks superfluous? We also had a surprise in store during the second part of the installation procedure, which occurs
32 LINUX MAGAZINE 4 · 2001
after the main installation process and the system has been re-started. Although we were working on a notebook with network card and modem PC cards installed, the installation program asked us if the PCMCIA package should be uninstalled, as, the program claimed, it would certainly not be needed. Hmm… Finally, we had huge problems getting our sound card working, as Debian doesn't seem particularly good at hardware detection in general. In some cases you'll find that you even have to recompile the kernel in order to get things up and running properly.
dselect takes some getting used to Even more irritating than selecting the kernel modules is dselect, the program used to select and install of individual Debian packages. Again the way the options are listed is the problem; instead of grouping the programs by task, with all XFree86 programs under XFree86 and the network tools under Network, for example, you'll find that such things as the cdrecord package is grouped with “Available Extra packages in section otherosfs” at the bottom of the list. Having said that, it is possible to search for packages, and doing so can help a great deal.
028distributions.qxd
22.11.2000
13:04 Uhr
Seite 33
LINUX GOES EMBEDDED Embedded Systems 2001 Fair & Congress 14 - 16 February / Nuremberg Germany
w w w. l i n u x - e v e n t s . d e · w w w. e m b e d d e d - s y s t e m s - m e s s e . d e
028distributions.qxd
22.11.2000
13:04 Uhr
COVER FEATURE
Distributions Distribution CDs Packages Manuals Pages in manuals Goodies Support XFree86 KDE GNOME Installation Installation modes Exotic installation media ftp nfs samba from DOS partition Configuration during installation XFree86 ISDN, Modem Sound Network Printer USB ZIP/JAZ Scanner Partitioning Resising of Windows partition Default partitions
Choosable file systems ext2 lvm reiserfs Graphical Installer Back button Online help Boot Loader Add-ons Boots beyond cylinder 1024 Dual boot prepared Security Services activated Security profiles Runtime configuration Remote configuration ISDN, Modem ISDN channel bundling Provider data base Sound Joystick Network Printer USB ZIP/JAZ Scanner Firewall
Seite 34
DISTRIBUTIONS
Mandrake 7.2 2 (Powerpack: 7 CDs) 1536 2 o 100 day e-mail 3.3.6/4.0.1 1.94 (Beta) 1.2.1
Red Hat 7 10 o 2 ~700 Sticker 30 days phone 4.0.1 1.1.2 1.2.1
Debian 2.2 9 4590 1 362 90 days e-mail 3.3.6 (Source from 4.0.1) 1.1.2 (Beta 2.0) 1.2.1
SuSE 7.0 6 1990 4 ~1000 3 Sticker, Tux Badge 30 days phone and e-mail 3.3.6/4.0.1 1.1.2/1.9.2 (KDE2 Beta 2) 1.2.1
3
3
2
6
+ + + +
+ + +
+ -
+ + +
+ + + + + + o o
+ + + o -
+ + (not ISDN) + -
+ + + + + + -
+ “/boot (10 Mb); / (250 Mb); 50:50 /usr and /home”
o
+ -
“/boot 23 MB; /swap 133 MB, / (Rest)”
+ + +
+ -
+ -
+ +
+ + “LILO; Grub” + +
+ + “LILO; Grub” Graphical LILO +
+ LILO +
+ + LILO -
all installed 5 (crackers playground ... paranoid)
all installed -
all installed -
all installed 2
+ + + o + + + + + o o +
+ + + + + + + + + o o +
+ + -
+ + (ADSL) + + + + + +
34 LINUX MAGAZINE 4 · 2001
028distributions.qxd
22.11.2000
13:05 Uhr
Seite 35
DISTRIBUTIONS
Distributions Masquerading XFree86 3D support Commercial drivers Display detection Wheel mouse support Multihead support Grahical login KDM/GDM/XDM Software: ALSA OSS free Commercial OSS Office packages Web browser Full versions Demos:
COVER FEATURE
+ “Xdrake; XF86Setup” + o o + +
+ o + “Nvidia; tdfx” + + +
anXious, XfreeSetup -
+ “Sax; Sax2, XF86Setup” + nvidia, FireGL1 + -
+/+/+
+/+/+
+/+/+
+/+/+
+ o
Within Kernel “StarOffice 5.2; Abiword; Applixware Demo” “Netscape; Mozilla; Lynx” o Railroad Tyccon, Descent 3, Simcity Unlimited
+ (Version 0.4.1) + + + Applixware Office 5.0 “StarOffice 5.2; Word (30 days), StarOffice 5.2 Perfect 8” Netscape 4.71, w3m, Lynx Netscape 4.74, Lynx, w3m o o Civilisation: Call To Power, o Eric's Ultimate Solitaire, Heretic II, Heroes III, Myth II, Railroad Tycoon II
“Netscape 4.71; Lynx” freeciv o
On the bright side, beginners and migrating users in particular will find using tasksel quite painless. This program allows you to select and install package groups such as C-development or GNOME, but without any fine control over exactly what individual applications to install. This means you can easily glog up your hard disk with programs you don't actually need. If you've opted to have XFree86 installed, the menu-driven aniXious configuration utility will have to be used to configure your system at some point. This is easy enough to use, though depending on the exact options you've installed you may have to spend some time to get everything correctly configured.
APT: Powerful package tool If you want to see Debian's best and most useful feature, we recommend you start by installing the most basic system possible. Once you've done so, remaining programs such as XFree86, GNOME or whatever applications you need can be installed with the excellent APT, ask apt-get. Using this any desired programs, including all dependencies can be installed at with a few button pushes.
DJ Debian The drawback of opting for this type of installation method is that you'll probably find yourself turning into a DJ, swapping disks over and over again like there's no tomorrow. You can avoid this problem completely if you have a handy CD server with plenty of free drives and a fast network connection of course! Disk swapping aside, APT is so well written than even updating an old version of Debian is child's
play. You needn't even stick to the command line program, wither, as several new graphical frontends for APT are available, including gnome-apt. Though most of these are still in the alpha-test state, they are already good enough to work with. Best of all, though, in most cases it is not even necessary to modify the configuration files when using APT, a feature most other RPM-based distribution would do well to emulate.
Conclusion At first glance Debian looks uncouth and awkward. But once you have a system up and running it's easy to get used to and, of course, you get absolutely problem-free updates, Debian being more than just a nose ahead of most other distributions in this area. We have to admit that sometimes you do get the feeling that anything graphical and user friendly is somehow tantamount to blasphemy with this distribution though. This situation is slowly changing, so it won't be too long before Debian becomes at least a little bit more migrating-user-friendly.
Mandrake 7.2 The final Mandrake 7.2 distribution is already available. We’ll take a look at it here. Although only a minor release revision, Mandrake 7.2 gives us a taste of some fairly big changes about to take place in the Linux world; you get KDE beta 1.94 for example, and XFree86 4.01 is provided as an optional X-Server. Quite apart from new features brought in from external developers, the Mandrake developers 4 · 2001 LINUX MAGAZINE 35
028distributions.qxd
22.11.2000
13:05 Uhr
COVER FEATURE
GNOME-APT is still in its infancy, but can already be used for package installation
Seite 36
DISTRIBUTIONS
themselves have once again sat down and polished up the installation routine a little. There's little change in the user-interface compared to that of 7.1, so anyone who has already installed Mandrake will find themselves in familiar territory. But you'll find that, for example, there's a new dialog box in which the user has to confirm that he accepts the licence.
which KDE is installed as standard so that the look and feel is very similar to that of a Windows desktop. Important services are also started automatically and are therefore available immediately.
New features
Linux no longer means just developing, and is slowly becoming a regular desktop operating system. This means it has to provide some form of entertainment for the user, of course, so you'll find a range of games installed as standard. These are not the proprietary classics but rather open source games such as “freeciv”, a free clone of Civilisation II, and Maelstrom and Clanbomber.
Apart from support for modems and ISDN adapters, Mandrake 7.2 also comes with tools to help you make use of xDSL Internet connections, which will be handy if you are lucky enough to have an ADSL connection. And along with Lpr, the time-honoured print system, Mandrake has integrated the UPS print system in the new distribution. In addition to this the new distribution offers a sensibly preconfigured Apache web-server with PHP and MySQL support. Postfix is installed as the Mail Transport Agent, and a remote configuration via Webmin is possible. As in older versions, Mandrake is aiming this version at users migrating from Windows. As such, the simple and graphical installation routine is designed to help you end up with a system on
36 LINUX MAGAZINE 4 · 2001
Games
On security Still not properly documented online in Mandrake 7.2 are its “Security levels”, which can be configured during installation. The on-line help does, however, refer to the printed manual regarding this. Unfortunately we did not have this during the test, so can't comment on how well it explains things.
028distributions.qxd
22.11.2000
13:05 Uhr
Seite 37
DISTRIBUTIONS
The various classifications range from “Cracker playground” to “paranoid”, with the latter being expressly intended only for server operation. With this latter security level the user can't log in as root on the console, first having to log in with a normal user ID and then changing using su. The best choice for general use is “Medium”, which means you won't be overly constrained but your computer won't be sitting there with all ports open just inviting unwelcome guests to drop in.
Partitioning In both the user-defined and expert installation modes you can opt to have DiskDrake, Mandrake's partitioning utility, automatically create your partitions for you. On the 30Gbytes drive fitted to our test system, selecting this option resulted in 10 megabytes being allocated to /boot and 250Mbytes each for / (root directory) and the swap partition, the rest of the drive being was divided into /home and /usr. DiskDrake also allows existing Windows partitions to be reduced in size, which is very handy indeed. We did have some problems with DiskDrake failing to recognise the partition table on one of our drives.
Spoilt for choice After partitioning the hard disk you will be presented with a selection of packages to install. A menu allows you to select from various items, such as KDE, Gnome or Communication Facilities, then select or deselect each individual package listed within the main option directly. Dependencies are automatically taken care of for you doing your package selections, but sometimes things go slightly awry. When deselecting Lynx, for example, the HTML help pages are flagged for deselection too, even when another browser was installed. The individual packages are, however, well organised and the tree structure used to display them makes locating everything you want very easy. Mandrake's new installation routine shows no sign of the annoying bug that managed to slip into version 7.1. Previously, in the size details associated with each package the words kilobyte and megabyte had been swapped around. This was of course obvious for packages apparently billed as being, for example, 11530Mbytes in size. Still, this is now all history, 7.2 now showing the correct sizes for everything. The total package size is still expressed as a percentage when you select more options than can be accommodated in the available disk space, though. Because of this it just isn't clear what precisely is going to be installed and what isn't in this situation. You might find yourself having to choosing to install “30%” of the packages, for
COVER FEATURE
Mandrake and ADSL As we mentioned elsewhere, as well as modem and ISDN adapter support, Mandrake also supports ADSL. The developers have not thought things through properly, however. The problem is that many forms of ADSL adapters aren't directly connected to a PC at all, instead having their own Ethernet ports through which they must be accessed. In such situations a network card must obviously be installed on your PC, but the Mandrake installation procedure for ADSL access only checks whether a network card has even been installed in the system right at the end. If it finds you don't have one, all your efforts will have been in vain, as the routine stops then, forgets everything you've told it about your ADSL connection, and moves on to the next installation step. Almost as annoyingly, if you first try to install a network card with a (fake) IP address, having let you do so the installation routine then jumps straight to the next item on the list, without giving you the chance to configure your ADSL connection. This is where Mandrake 7.2's flexible installation routine, which allows you to jump back to a previous setup comes in handy. All you have to do is jump back to the ADSL option and chose the appropriate country from the listed options. Next you'll probably be asked whether pppoe (PPP-Over-Ethernet) should be used. The necessary packages are now installed for you, after which some more information must be provided: • • • • •
Name of the ISP: first DNS of the ISP: Second DNS of the ISP: ID (Login): Password:
Finally, you can decide whether the ADSL connection should be activated immediately on booting (DialOnDemand) or if you would prefer to start the connection manually. Unfortunately we found that even having done all this our ADSL connection still didn't work. Some detailed investigation revealed the reason why. Although all values (Login-ID, password, Ethernet card used, and so on) had been correctly entered in the pppd configuration files, they had not been transferred into the rp-pppoe configuration file (/etc/ppp/pppoe.conf). This isn't actually necessary for making a connection using your own scripts, but Mandrake insists on using the scripts provided with rp-pppoe, adsl-start and adsl-stop, and for this a correct configuration file is vital. The user must therefore revise this file manually, or else call up the setup script provided with rp-pppoe, “adsl-setup”. Another problem we discovered was that even though we told Mandrake not to automatically connect at boot time, this choice was ignored. Resorting to deleting the corresponding links in the run levels was the only way we could solve this problem. All in all, then, in the beta version of 7.2 the ADSL installation routine can only be described as a total flop. If you run into similar problems and can't seem to solve them, a thorough read of the many ADSL HowTos on the Internet may we very worthwhile.
example, which is virtually meaningless. You can, of course, activate the Individual package selection option in order to check the selection again and see exactly what's going on, but this shouldn't be necessary. Once you have selected everything and complied with all dependencies, the next step is 4 · 2001 LINUX MAGAZINE 37
028distributions.qxd
22.11.2000
13:05 Uhr
COVER FEATURE
Seite 38
DISTRIBUTIONS
simply to select the Install option. Depending on your option selections and the speed of your computer, you can now either go for a quick cup of coffee or redecorate the whole house.
Conclusion Mandrake has gone to some trouble to make installation simple, and in general it has succeeded. Indeed, even a fairly inexperienced user should be able to cope with it, while more experienced users will find it easier than ever to perform quite advanced tasks.
Caldera Technology Preview A pre-release products we looked at is the Caldera Technology Preview. In return for living with potential instabilities, anyone trying this out will get the newest of the new: a 2.4 series kernel, KDE 2.0 Preview, JAVA Software Development Kit 1.3 and, of course, XFree86 4.0. You will, however, have to do without all the third-Party and commercial packages included in the normal OpenLinux distribution, as these aren't included. Also missing are some of the more interesting and useful features provided by most distributions as standard. The likes of ReiserFS and XFS are missed out, for example, but while this is understandable, we did find it puzzling that such basics as ssh and GNOME are also left out. As a result of its leanness, all you get in the box are two CDs (one for installation and one containing source code) and a black and white booklet, illustrated with lots of screen-shots to guide you though the installation routine. The usefulness of the “Installation Guide” is somewhat hindered by fact that it isn't very detailed, but for a beta version the mere existence of a printed manual is unusual enough. Also worth noting is that although beta versions are normally free, the Technology Preview will actually cost you around 20 dollars. You can get you money back via a discount voucher, however.
Business as usual By and large not much has changed in the installation procedure – but not was there any need: Caldera was the first Linux distributor to boast a graphical installation, and this experience shows. Additional hardware support has been added, however, though these include obscure items such as Japanese keyboards. As usual with Caldera's setup routine, in the Technology Preview an area on the screen is reserved for displaying online help. Although this provides plenty of information, further details can be displayed at the click of a help button on the lower right hand margin. 38 LINUX MAGAZINE 4 · 2001
Patience is something that anyone using the Caldera installer “Lizard” will need plentiful supplies of. If you press too often on the “More” button because nothing seems to happens when you press it the first time, the Lizard will jump through the next few installation steps. This is especially annoying because, unlike the Mandrake installation routine, you cannot backtrack with Caldera's Lizard. The problem has been in existence since the very first version of the program, and it is really about time it was fixed. On the bright side, Lizard's network installation is superb, most configuration being automatically entered for you – even the name of the NIS domain is determined. Amusingly, as is now pretty much the custom with Caldera, there is still a little game at the end of the configuration section for you to play in order to pass the time during the inevitably longwinded file copying that occurs once you've made all your installation selections. After Tetris and Pacman this time its Mah Jong – no doubt it'll be a 3D flight simulator by version 20.
Configuration The distribution's own configuration tool, COAS, is unfortunately as complicated and annoying to use as ever. The root password has to be entered each and every time before you can access each individual configuration sub-item, or example. However, configuration tools have now been integrated into the KDE control centre, in a manner similar to the Corel Linux distribution, and these are very easy to use.
Conclusion This distribution is obviously not suitable to everyone and indeed it was never meant to be. As its name quite firmly tells you, this is a technology preview, nothing more and nothing less. As such it is totally unsuitable for beginners, and even a typical Linux geek who likes to experiment will be dissatisfied because too many features and programs are missing. The installer is still ahead by of the competition in many areas, but no great advances or innovations have taken place.
A look into the crystal ball In the recent past, commercial distribution publishers have mainly been directing their efforts towards easier installation, the only other improvements made mostly being quite minor. This is all for the good, and means installation is now much less painful than ever before. But things are likely to change before too long, as distributors will soon have to face a new challenge. Instead of being judged by how new the kernel is or whether it needs seven or ten mouse clicks to complete the installation, distributions will be judged by how well
028distributions.qxd
22.11.2000
13:05 Uhr
Seite 39
DISTRIBUTIONS
they match up to the standards laid down in the Linux Standard Base (LSB). The LSB is a sub-group of the “Free Standards Group”, and was established only very recently. The File Hierarchy Standards can be found at http://www.linuxbase.org/test/lsbtestnws.html. If the LSB manages, as is predicted, to get a reference implementation up and running, although the world of distributions won't be changed at a single stroke, there will be a much greater hope of a “split-free” future. Of course, Kernel 2.4 will be included in future releases, but this will scarcely deliver any surprises for normal users, since all the important drivers are already installed as back ports in the 2.2 series kernel. It can get quite exciting when it comes to file systems, though. This is where freedom of choice will certainly increase in future. At SGI and IBM they are working all-out to port their journaling file systems. In addition, ReiserFS has proven itself as a very practicable proposition, and ext3 will be finished one before long. Users can therefore expect to find an additional menu in the installation routine of the future, with a list of five or more file systems for them to select. Fans of the well-groomed appearance will also be delighted with KDE 2.0 ad KOffice, but on the other hand it could take ages before the monolithic StarOffice is taken apart and reassembled as
COVER FEATURE
Smart and new The KDE-Desktop
OpenOffice and finds its way into the standard distributions. But, as always, when it comes to reading the tea leaves, we will leave it on Wilhelm Busch who said “Things will turn out differently, no matter what you expect.” ■
Anzeige
4 · 2001 LINUX MAGAZINE 39
040usbinput.qxd
21.11.2000
16:10 Uhr
ON TEST
Seite 40
USB
Linux USB in practice
SINGLEFILE INPUT CHRISTIAN REISER
needs a quarter as much memory. The 16k of hid.o is not exactly enormous. The hid driver on the other hand also supports mice, joysticks and a few graphics tablets. Our test revealed that the special keys of the Microsoft keyboard can only be used with the hid driver. The module keybdev is also necessary in order to pass on keyboard events to the console driver.
Keysonic ACK-298
This issue sees the beginning of a series of articles on USB peripheral devices. This month, we're looking at input devices: keyboards, mice, joysticks and graphics tablets.
One thing is clear right from the start, the success rate is encouragingly high. All ten devices worked. This is mainly due to the fact that both mice and keyboards use a specifically defined protocol. However, there are some differences in the case of joysticks. Many of them operate with the standard driver. Other joysticks, such as the Logitech Wingman Force, require extra modules to be loaded.
Keyboards It's quite easy to connect a USB keyboard to your computer. Simply activate "Support USB-Keyboard" in the BIOS of your computer and skip the rest of this article. The keyboard is recognised by BIOS and then accessed under Linux like a normal keyboard. Loading the modules for the USB controller under Linux renders communication via BIOS impossible, since this is re-internalised. A kernel support then has to be installed. There are two different modules to choose from, which can cope with USB keyboards: usbkbd and hid. The sole advantage of the usbkbd driver is its size. As a specific keyboard driver, it only
40 LINUX MAGAZINE 4 · 2001
The 105 keys and the additional PS/2-USB-mouse connection of the Keysonic ACK-298 worked as expected. The integrated converter converts the PS/2 control signals to the USB mouse protocol. But at the same time "only" three mouse keys and one wheel are supported. The mouse on the Keysonic keyboard is addressed in this case like any other USB mouse – and also correspondingly installed (see section on mice). This keyboard is comfortable to use despite its low price. The keys have a firm pressure point, making it obvious whether or not a key has been pressed
Microsoft Internet Keyboard Pro The keyboard itself actually consists of three devices: The 105 normal keys, the 19 special keys and a 4-port hub (in which, however, 2 ports are already internally occupied). The hub functions without any problems and supports both high and low-speed devices. The normal keyboard, too, posed no problems – sadly, the special keys did. But this is not exclusively a USB problem the PS/2 connector (also provided) requires at least as much additional configuration to make the keys work. The configuration necessary is also required for other keyboards, so we have devoted a separate box to this topic ("special keys under Linux").
Mice As in the case of the keyboards, there are two modules to choose from: usbmouse and hid. Here again, when using the hid module you just can't go
040usbinput.qxd
21.11.2000
16:10 Uhr
Seite 41
USB
ON TEST
wrong. After that, mousedev has to be loaded, which passes the events to the device file(s). These are created as follows (in /dev): bash> mknod bash> mknod bash> mknod [...] bash> mknod all mice
mouse0 c 13 32 # 1. mouse mouse1 c 13 33 # 2. mouse mouse2 c 13 34 # 3. mouse mice c 13 63 # Mixed signal fromU
With these files the USB mice can be addressed like their PS/2 counterparts, and in the case of the text console with, say, /usr/sbin/gpm -tps2 -m /dev/mice.
Logitech MouseMan Wheel In addition to the two keys and the wheel on the front, this product from Logitech has an extra key on the side. This keyboard is also suitable for larger hands. It is rubberised on the side and the somewhat angular shape the mouse sits well in the hand. There were no problems worth mentioning when it was used under Linux.
Logitech WingMan Gaming Mouse This mouse was the only one of those tested here which did not come with a wheel. The only advantage was one less component to go wrong. That's important in the case of this mouse model, as it was built to withstand maximum loadings for gaming. Surprisingly, the connecting cable is not as sturdily designed as its MouseMan colleagues introduced above. Otherwise the device can be positioned very smoothly and easily. The buttons are very smooth and confirm every press with a clearly audible "click".
test this worked superbly – there were no problems with any mats. Two of the four keys are operated with the thumbs – this worked first time. Side grip suffers slightly because of the very rounded housing. Background: The wheel actually consists of two keys: an up key (4) and a down key (5). After restarting the X-Server, with xev the „Key presses"
Integrated hubs make life easier. The special keys of the Microsoft Internet Keyboard Pro, like other keyboards, require special treatment.
Special keys under Linux If a key is pressed, the keyboard generates a so-called scan code, and when released, a second one. In USB this is first queried by hid (Human Interface Device) and then reaches the kernel via keybdev. But this doesn't matter at this point. The scan codes consist of one (in the case of control keys, of two or more) byte(s). On release, a value increased by 0x80 is always generated (for example 0x1e for "a" pressed, 0x9e "a" released). These scan codes can be queried directly, perhaps with showkey -s. After that, a key can be assigned a "Keycode" using setkeycodes. There are 128 of these: The first 88 are equivalent to their scan codes – the rest are dynamic. These can be queried with getkeycodes. These key codes must then be assigned an action once and for all (for example the issue of a letter to the application). This is done with the aid of loadkeys. In the following example, we will configure the "Mailkey" on the keyboard so that when it is actuated the console program pine starts:
Microsoft IntelliMouse Explorer
bash> showkey -s
This mouse will catch the eye on any desk or workstation. As soon as it is activated, the IntelliLogo lights up in a subtle red to remind you of its new design. This mouse no longer works with the traditional rollerball. Instead, movements are detected directly by scanning the backing. In our
kb mode was XLATE press any key (program terminates 10s afterU last keypress)... 0x9c 0xe0 0x6c 0xe0 0xec bash> setkeycode e06c 120 # we assign theU keycode 120 to the scancode e06c bash> loadkeys EOF > keycode 120 = F70 > string F70 = "pine\n\n\n\n" > EOF With XFree86 things look a bit more complicated. X-Server is one of the applications that query the scan codes directly from the kernel and then reprocess them. Unfortunately the concept is not as good as that of the kernel. With XFree86 the scan codes are permanently assigned keycodes. If these are altered the entire X-Server will have to be recompiled. If you are confident enough to do this, you can find some tips below.
It worked out of the box: Logitech MouseMan Wheel 4 · 2001 LINUX MAGAZINE 41
040usbinput.qxd
21.11.2000
16:11 Uhr
ON TEST
Seite 42
USB
Wheels under X To be able to use the mouse wheel under XFree86 (from 3.3.2) it has to be entered into the configuration file XF86Config (either in /etc or /etc/X11). To do this, you enlarge the "Pointer section" by the following lines: ZAxisMapping 4 5 # or in the case of XFree86-4.0.x: Option "ZAxisMapping" "4 5"
The "Red Shooter" from the electronics mail order firm Conrad has a good price/performance ratio.
Leaves very little to be desired.
should now be interpreted as wheel movements. After successful modification of the XF86Config there are now two options for "attuning applications to the wheel": IMWheel or Xdefaults. These two methods are fundamentally different in concept. IMWheel is a program that has to be explicitly started, while the Xdefaults contain standard settings for the X-Server. This means that no additional resources are needed. However, configuration is possible only to a limited extent. In the Xdefaults, each wheel movement is assigned an X-event – but in IMWheel the wheel movement can have two keys assigned (e.g. up and down arrow keys). The configuration file has the following structure: "Programname" None, Up, Key None, Down, Key2 # And now with key combination: Alt_L, Up, Key3 Alt_L, Down, Key4
The unusual control concept of the Microsoft SideWinder Dual Strike can lead to damage to the device in tricky games manoeuvres.
Any application can simply be attuned to the mousewheel. The drawback is that regardless of where you are in the window, the same action is always performed. This could be very troublesome, especially with something like a multiframed Netscape. There are also a few applications that can use the mousewheel without any special installation, as they directly process mouse buttons 4 and 5. These include Staroffice, Wine, XMMS, Gimp and all Xaw programs.
Joysticks Only a few USB graphics tablets will currently run with Linux. The Wacom Graphire USB is one of them.
It is only since kernel version 2.2.x that support for joysticks has been firmly integrated. The result of this has been that developers of applications for which joystick support would be useful (say games), didn't usually offer any support for this important input device class until recently. Thanks to games porters such as Lokigames, the use of joysticks under Linux has now become the norm. The use of USB is a logical progression for the application. In such cases USB joysticks behave as if they were attached to the game port. The following device
42 LINUX MAGAZINE 4 · 2001
files will be needed for this though. These can be added with the command mknod (provided they're not supplied by the distributor): bash> mknod js0 c 13 0 # 1. Joystick bash> mknod js1 c 13 1 # 2. Joystick On kernel modules, in this instance, you will also need, in addition to input and hid, joydev.
Conwheel Red Shooter USB This joystick has four keys and six axes: two for the X/Y axes, two rotating wheels on the ground plate and two "axes" for controlling the viewing direction (hat stick). Apart from the thrust controller, five LEDs have been added, which reflect the current respective setting. The joystick is constructed exclusively for righthanders. The only problem is that the maximum input values of the X/Y axes are reached considerably before the maximum excursion, and the result of this is that the joystick is "dumb" in the marginal area.
Logitech WingMan Extreme The exterior gives no sign at first of what is hidden inside this gamepad. Apart from the eleven buttons there is also a digital directional controller or as an alternative to that, directional control via a position sensor. If this is active, a turn to the right is interpreted as a control signal to the right. Only ten of the eleven buttons can be occupied – the eleventh is provided for toggling between motion sensor and cursor. Control by means of the sensor functions very well. The zero setting is easy to find. The only snag is that for long-time players the forced position caused by the joystick could become tiring. In any case a lot of physical input is guaranteed. There is no shortage of fun and games.
Microsoft SideWinder Dual Strike This gamepad takes a bit of getting used to. Apart from the "normal" cursor and the nine buttons, there are also two axes. These can be actuated by turning the two halves of the SideWinder towards each other. However, you should bear in mind that not every direction is allowed! This type of control requires discipline from the player, so that nothing goes wrong. Apparently the manufacturers, Microsoft, were also aware of this. They have installed an additional sensor/ button in the axes so that the operating system can give a warning as soon as a critical condition occurs. Unfortunately this emergency backup does not function with Linux.
Wacom Graphire USB Graphics tablets with USB connections are still relatively rare. One of the best sellers is the Wacom Graphire USB. It is also the only one which is already
040usbinput.qxd
21.11.2000
16:11 Uhr
Seite 43
USB
ON TEST
SuSE 6.4 and USB SuSE 6.4 does not use a dynamic procedure to load the requisite USB module. This means that it may no longer be possible to perform any input when using a USB keyboard. A tiny error has slipped into the file /etc/config.d/usb.rc.config. Instead of the two modules hid and keybdev, the module usb-keyboard has been loaded. Despite its intuitive name, this module does not even exist. Nor does the mouse module, mousedev would be more correct in this case. Consequently under SuSE 6.4 the line in the configuration file ought to look like this: USB_DRIVERS="hid keybdev mousedev" SuSE did not set a good example in Version 6.4 (which is still widely distributed) when it came to the device files. If you don't notice that the pre-installed files are wrong as soon as a mouse has been connected, you'll be in trouble. Solution: simply delete the existing files and reinstall them.
directly supported in the kernel. With the module wacom the tablet is recognised as a mouse. In order to still be able to use the pressure sensitivity, you have to use the XInput expansion from XFree86. The module for this can be found at the fifth Web site listed below. To connect it up, the following specifications in the "Input-Section" of the configuration file XF86Config are necessary.
principle, buy any USB mouse, any USB keyboard and any USB joystick without any worries. With a few minor modifications, these too should be capable of installation under Linux. It is only in the case of the graphics tablets that there is at present still insufficient support. In the next issue we will take a look at data storage devices with USB connections. ■
Section "Module" Load "xf86GraphireUSB.so" EndSection
Input concept Simultaneously with USB in the upcoming kernel 2.4, an attempt is also made to introduce a new input structure. This is based on the fact that all hardware drivers first send their signals to the central input module. The modules which process the signals and pass them on to the device files – the so-called "event handlers" are also registered there. So evdev is a very special "event handler". With its associated program evtest all events sent out by a specified device (the movement of an axis, or key press for example) can be captured. This might be a keyboard. But it also functions with all other drivers that use the input module. Unfortunately this general input architecture is currently only used by USB:
Section "XInput" Subsection "gmouse" Port "/dev/input/input0" DeviceName "Graphire Mouse" Mode Relative AlwaysCore EndSubsection Subsection "gstylus" Port "/dev/input/input0" DeviceName "Graphire Pen" Mode Absolute AlwaysCore EndSubsection Subsection "geraser" Port "/dev/input/input0" DeviceName "Graphire Eraser" Mode Absolute AlwaysCore EndSubsection EndSection At this point care must be taken to ensure that the "device" is definitely specified. It is advisable to ensure that the Wacom driver is loaded first and thus always sits at "input0". After restarting the X-Server all you need is an application which accesses XInput. Obviously in this case a Malprogram such as Gimp would be appropriate. Unfortunately both GTK and Gimp have to be converted again first. Refer to http://www.gtk.org/~otaylor/xinput/ for this.
Interim results The success rate for the USB devices so far tested under Linux is encouragingly high. You can, in
bash> mknod input0 c 13 64 bash> mknod input1 c 13 65 bash> mknod input2 c 13 66 bash> evtest input0 Event: time 970205127.333596, Event: time 970205127.549600, Event: time 970205127.997621, Event: time 970205128.133621, Event: time 970205128.805643, Event: time 970205128.901644,
type type type type type type
1 1 1 1 1 1
(Key),code (Key),code (Key),code (Key),code (Key),code (Key),code
29 (LeftControl), 29 (LeftControl), 28 (Enter), value 28 (Enter), value 1 (Esc), value 1 1 (Esc), value 0
Info [1] http://www.ics.mq.edu.au/~robbie/linux/itouch.html [2] http://www.infosun.fmi.uni-passau.de/~nils/type6/ [3] http://www.lokigames.com/ [4] http://www.suse.cz/development/input [5] http://www.pxh.de/fs/graphire/ [6] http://www.gtk.org/~otaylor/xinput/ ■ 4 · 2001 LINUX MAGAZINE 43
value 1 value 0 1 0
044netwider.qxd
22.11.2000
13:15 Uhr
ON TEST
Seite 44
NETWORK COMPUTING
Netwinder OfficeServer
BLACK OFFICE JOEL ROWBOTTOM
Can Netwinder's unassuming "black box" server really supply an all in one office solution?
Normally I'm not a fan of "all-inone" office solutions, but when I was sent Rebel.Com's Netwinder OfficeServer product to review I was pleasantly surprised. It's one of the "black box" servers on the market at the moment which provide utilities such as print spooling, file server, directory services, an Intranet/Extranet server, an administration utility, backup services, and lots more. Externally it's small, discreet and unassuming – a beige box, which can stand either flat, or upright (it comes with its own stand if you prefer the latter): the front contains a power LED and hard disk LED. There are a plethora of ports on the rear of the unit, two for ethernet, a serial port through which a modem can be used, a parallel port, an SVGA port for a monitor and keyboard if you need it, and rather surprisingly a mouse port. It's also rather quiet. On the right-hand side there's a reset button – this seems to be placed rather carelessly, as the manual encourages the user to place the unit on the side leading to the possibility of accidental reset. A slider switch controls the volume of the speaker. Together with the unit itself, the package also comes with both a rather thick spiral-bound paper manual for administrators and a thinner edition for end-users. Finally there's a quick-start CD-ROM containing RPM editions of packages for the OfficeServer, browseable versions of the manuals, and other utilities designed to recover the unit in the event of a crash. The sheer documentation itself will be a comfort to users who are new to the Linux operating system. When you first power-up the OfficeServer, you might be forgiven for thinking you've bought a Mac: a brief tune sounds, followed by a sampled voice saying "Welcome to Netwinder!" when it's finished booting up and is ready for use. Total time
44 LINUX MAGAZINE 4 · 2001
to start up can take between 3 and 8 minutes, depending on whether or not it's carrying out disk maintenance. From the first, power-up configuration takes place through a web browser-based interface. There are two sides to this: the usual "System Administration" side, but also a less common "User Services" side. Both sides of the interface are accessible remotely, and I can imagine that this aspect of the Netwinder software is very useful in circumstances such as unexpected staff absence! The bundled user services aim to take oftrequested user actions from the system administrator and give the responsibility to the user: for instance, the email section allows creation of response text for receipt acknowledgements and "away message" text, without even entering a command-line. I was particularly impressed with the website creation tool giving a "wizard" approach. This useful little utility allows a user to create their own website in little under 5 minutes, although a method of uploading websites to an ISP's own server would have been useful. There are facilities to add in graphics and of course edit the pages directly, if you so wish. There's a discussion list system whereby a user may join public or private lists, and a flexible document management system. Of course, the ubiquitous filestore is present and accessible from both Apple and Windows machines, enabling users to share their files in both public and private areas. On a final note regarding the user-side system: a backup facility is provided for users to take responsibility for saving their own user-space on the unit to a local machine. This, I imagine, will be a powerful tool in heightening user confidence in the device. The administration system consists of the usual facilities associated with such a product: creation and deletion of users, websites, host entries, services, etc. It provides an extensive suite of facilities for such management, including a
044netwider.qxd
22.11.2000
13:16 Uhr
Seite 45
NETWORK COMPUTING
firewalling and port forwarding feature that isn't normally associated with units such as the OfficeServer. It's simple approach to this and the associated network address translation will make it a hit with people who are more familiar with a graphical environment for configuration. In addition to the obvious web server capability, a wide variety of access protocols are supported, including POP3/IMAP/SMTP (for mail), DHCP, a static DNS server, both Windows and Apple file sharing, print serving, and a web proxy service. A notable absence from the administration service is an SNMP capability, although for the target market this will probably not matter much. Working for an ISP, the questions asked most frequently regard security: both Virtual Private Networking and Secure Shell tools (as opposed to Telnet) are missing from the implementation. It would be good for Rebel to consider this as an addition to the unit's repertoire to satisfy the security-conscious! A VPN capability is mentioned on the back cover of the Administrator's Manual, but I couldn't find any reference to it inside – is this possibly a future expansion? So how do we get connectivity to the 'Net? If you're using ADSL or a leased line, simply plug an ethernet cable into one of the available ports. If you're using a modem it's quite simple – hook up a modem to the serial port, configure PPP under the control panel, and you're away. There's even an option for dial-on-demand or to bring the connection up between specific hours. Sadly though there isn't yet an option to limit the time spent online. Under the hood, it's powered by a StrongArm SA110 processor, with up to 128Mb RAM and a 2.5" IDE hard drive. This should be powerful enough for most applications of this unit, but the processor will more than likely cause compilation problems for many users trying to upgrade applications without Rebel.Com's own blessing. The ECP/EPP parallel port on the rear supports installation of a parallel-port ZIP drive, or a CD drive, so this may be a good route to go for backups of the unit. A rather serious omission is that of access to log data. There seem to be little or no logs available to view via the OfficeServer's front-end, which will leave novice sysadmins floundering when attempting to troubleshoot problems. This is the one major point which lets the OfficeServer down, although the standard syslog is running and accessible through the command-line interface and of course you can connect an SVGA monitor to view console messages.
ON TEST
I must admit that after trying to remotely administer the Netwinder from a distance, the large amount of graphics present on the front-end causes a substantial speed decrease on modems and slower leased lines. Indeed, due to the design it is almost impossible to view with older browsers. This makes carrying out administration tasks on your cellmodem a no no! The interface is very userfriendly though, and Rebel.Com provides a roadtest environment on their website so you can play with it before you make a purchase. In conclusion, although very useful for the small one-geek office it's more likely to frustrate the more competent technophile who will want to get inside and recompile software. It's absolutely ideal however for a company which is looking to deploy a firewall, gateway and Intranet solution and doesn't know where to start nor have the inclination to try. As far as office-in-a-box products go, the sheer easeof-use will make this worthwhile in saved time alone: logging capability aside, this is one of the better units for which Rebel should be justly proud.■
The Netwinder OfficeServer is available in two versions: Desktop or rackmounted.
4 · 2001 LINUX MAGAZINE 45
046snortnmap.qxd
22.11.2000
12:00 Uhr
KNOW-HOW
Seite 46
NETWORK SECURITY
snort and nmap – two sides of the same coin
CAIN AND ABEL RALF HILDEBRANDT
nmap is a port scanner, which can search a target computer for open ports, and thus for potential security loopholes. Snort’s task is to counteract nmap. Snort is a daemon which scans through a network for suspect packages and logs them.
There are two sides to the world of network security – good and bad intentions. You're either wearing the white hat or black hat. Usually, there's a gaping chasm in between the two. Yet at the same time they are more similar than most people would like to admit. In any case they use the same tools. Every security-conscious network administrator will want to make use of a port scanner one day and every hacker will be aware of the basic insecurity of every TCP/IP network. This is why many of them have a Network Intrusion Detection System monitoring the LAN. In this article we are going to take a closer look at two typical and frequently tried and tested examples from each genre.
nmap – the dark side nmap (for "Network Mapper") was developed by the hacker "Fyodor" primarily to scan large
networks. It does, of course, also work for individual hosts. Because of the large number of possible scans and options, there are now almost always several ways of going about the same thing. Sometimes you need a "fast" scan, sometimes you want to leave only minimal traces on the target system. There again, it might be necessary to get round a firewall, or scan for various protocols. 46 LINUX MAGAZINE 4 · 2001
nmap details The "TCP three-way-handshake", which forms the foundation for all TCP connections, can be seen in Figure 1. A connection is initiated by a SYN packet. The other party responds with a SYN/ACK packet, to which the party initiating the connection must then respond with an ACK in order to complete the connection. The types of scan supported by nmap are: • TCP-connect() scan Here the connect() system call of the operating system is used, thus a connection is made in a completely normal way. This is also the only type of scan which does not require any root privileges. • TCP-SYN ("half open") scan In this case a SYN packet is sent to the corresponding port. If the response from the
FIG 1: TCP three-way-handshake
046snortnmap.qxd
22.11.2000
12:00 Uhr
Seite 47
NETWORK SECURITY
•
•
•
•
target port is in the form of a packet with SYN and ACK, then the port is open. In this case an RST is sent, in order to prevent the connection being made in the first place (hence the name "half open"). An RST and ACK as response on the other hand characterises a closed port. TCP-FIN, Xmas or NULL (stealth) scan The fundamental idea behind a FIN scan is that a closed port responds to a FIN packet with an RST. Open ports, on the other hand, tend simply to ignore the packet. This behaviour is necessary (in accordance with RFC 793) for the correct functioning of the TCP. But even if a port is blocked by a packet filter, one may still be sent back an RST packet – in this case the FIN scan is wrongly reporting that any number of ports are open. A few systems (such as Microsoft) always send an RST regardless of the status of the ports. Therefore, with this type of scan, it is very easy to differentiate Unix and NT machines. In the case of a "full" Xmas scan all pre-defined flags (FIN, SYN, RST, PSH, ACK and URG) are set. The packet is decorated like a Christmas tree (hence the name). A "simple" Xmas scan has only FIN, PSH and URG set. According to RFC 793 the target system ought to send back RST for every closed port. With a NULL scan all the flags are cancelled (not set). According to RFC 793 the target system ought to send back RST for every closed port. TCP ftp proxy (bounce attack) scan This scan scarcely means anything any more because it is based on a feature of the ftp protocol which has by now been deactivated on most servers. In this case, a weakness of the FTP protocol was exploited. Details can be found at http://www.insecure.org/nmap/hobbit.ftpbounce .txt The user of this scan remains hard to locate for the scanned computer, as he/she is, as it were, hiding behind an FTP server which has a readwrite access directory (for example /incoming) and which offers the proxy feature. Phrack 51 lists as possible server types wu-2.4(3), wu2.4(11) and FTP server SunOS 4.1. SYN/FIN scan with very small, fragmented packets Instead of sending packets directly, they are split up into small IP fragments ("fragmented"). In this way, the TCP header is spread over several packets, so that it is harder for packet filters to detect exactly what is going on. Obviously this method cannot be used against firewalls, which collect and then defragment the IP fragments (as occurs for example through the kernel option CONFIG_IP_ALWAYS_DEFRAG under Linux). TCP-ACK/Window scan With the aid of this scan it is possible, for example, to determine whether a firewall is a
•
•
•
•
•
•
KNOW-HOW
simple packet filter for incoming SYN packets or a "stateful firewall". This scan sends an ACK packet with a random sequence number to the port. If an RST comes back, the port is classed as "unfiltered". If nothing (or an ICMP unreachable error) comes back, the port is classed as "filtered". Open ports cannot be detected. TCP-Window scan As with the ACK scan, only an anomaly in the TCP window size reporting code of an operating system is exploited. This means that in addition to the TCPACK scan, open ports can also be detected. UDP raw ICMP port unreachable scan This scan is fiddly, as open ports with UDP do not have to send any confirmation to our packet (UDP is not connection-oriented), nor closed ports an error packet. Fortunately most machines send an ICMP_PORT_UNREACH-error message, if a packet is sent to a closed UDP Port. So at least it is possible to find out if a port is closed. There are no guarantees that error messages for either UDP packets or ICMP will arrive. Therefore, a UDP scanner has to retransfer any potentially lost packets Otherwise, one would receive any amount of false positive results – say open ports where there simply are none. The scan is also unspeakably long-winded, as RFC 1812, Section 4.3.2.8 ("Rate Limiting") must be observed. This section stipulates the number of ICMP error messages per unit of time. So for example the Linux kernel in net/ipv4/icmp.h limits the creation of ICMP destination unreachable messages to 80 per 4 seconds, with a 0.25 second forced break, if this limit is exceeded. ICMP echo scan (ping-sweep) 'Not really a port scan, as ICMP does not recognise any ports. In this case all machines are simply pinged in order to determine whether they are "up" or "down". TCP-Ping scan This scan sends a packet with ACK flag to a port (standard: 80). If, in response, an RST packet comes, the machine is "up". This scan can be used as an alternative when (as at www.microsoft.com for example) the echo port has been deactivated. Direct (non-portmapper) RPC-scan This scan functions in tandem with the scan types from nmap. All open ports are bombarded with SunRPC-NULL commands in order to detect whether they are RPC ports and if so, which program and version they are using. Protocol scan This scan sends IP headers (without data) with different protocol fields to the host. The host then (normally) returns a "Protocol Unreachable", for the protocols that it does not control. nmap can now create a list of the protocols supported by a process of elimination. This is very similar to the UDP scan from a design point of view. Naturally, there are also hosts here which do not send back 4 · 2001 LINUX MAGAZINE 47
046snortnmap.qxd
22.11.2000
12:00 Uhr
KNOW-HOW
Seite 48
NETWORK SECURITY
a "Protocol Unreachable" – in this case all protocols appear as "open". So this scan will not work against HP-UX Version 10.20 for instance. • Determination of an operating system using TCP/IP "Fingerprinting" In this method, a selection of packets are sent with different TCP flags (SYN, BOGUS, Don'tFragment-Bit...) to an open and a closed port respectively and the response is compared with entries from known systems from a databank (like a fingerprint). An overview of all flags specified in the protocol is given in Table 1. Obviously one can also modify the "fingerprint" of the TCP/IP stack on commercial Unixes. In particular, HP-UX 10.20 therefore comes with very naive default settings; this is where the tool nettune can work wonders: /usr/contrib/bin/nettune -s tcp_random_seq 2 /usr/contrib/bin/nettune -s hp_syn_protect 1 /usr/contrib/bin/nettune -s ip_forwarding 0 echo 'ip_block_source_routed/W1' | \ /usr/bin/adb -w /stand/vmunix /dev/kmem This makes the creation of the TCP sequence numbers "more random", protection against SYN flooding is activated, IP forwarding is deactivated and source-routed packets are blocked by a direct kernel hack. These are TCP packets which are allocated their path through the network, the route, at the point of creation by the IP stack. But nowadays very few routers still accept this mechanism. • TCP Reverse-Ident scan In 1996, Dave Goldsmith found in a posting on Bugtraq that the ident-protocol (RFC 1413) reveals the user under which a process connected via TCP is running. And this happens even if the process concerned did not even make the connection! That means that one can make a connection to the HTTP port and find out using identd under which user the httpd is running. This scan functions only with a TCP-connect() scan (Option -sT). In addition, nmap offers performance and reliability features such as a dynamic calculation of delay times, packet time-outs and retransmission attempts, parallel port scans and recognition of machines which are switched off by means of parallel pings. Naturally, one can easily specify the hosts and ports to be scanned. Apart from stating the port Table 1: TCP-Flags and what they mean TCP-Flag Meaning FIN finish disconnect SYN synchronize RST reset PSH push ACK acknowledge URG urgent (2) reserved (1) reserved 48 LINUX MAGAZINE 4 · 2001
status, nmap also defines the predictability of the TCP sequence numbers and thereby the susceptibility of the machine to IP spoofing attacks.
Hiding your own IP address Furthermore, it is also possible to activate a socalled "decoy" option (-D). This prevents the other party from finding out which host has initiated the scan. By specifying the option Ddecoy1.host.com,ME,decoy2.host.com, nmap "forges" packets with the sender addresses of decoy1.host.com and decoy2.host.com. If both decoy1.host.com and decoy2.host.com are "up", these will send RST-packets as expected, so that for the target machine decoy1.host.com, decoy2.host.com and the local host can be distinguished. If the decoy-Hosts are "down", the target of our scan will be flooded with SYN-packets. In standard mode nmap uses an ICMP ping and a TCP-ACK ping with Port 80 as originating port (Port 80 is often let through firewalls because of HTTP-requests) in order to determine whether machines are "up". Then the port scan is performed. An attempt is made to define the operating system of the scanned host as a last resort. It is obvious that one could easily write a rule for an Intrusion Detection System (IDS), which would detect an nmap-scan with certainty. Therefore one could, with -P0 for example, deactivate the ICMP ping. Explicit activation of the TCP ping is done through -PT.
Examples % nohup nmap -r -iR -I -sT -p53 > named.scaU n.out & % tail -f named.scan.out Now we can go on the hunt for machines on which named is running as root. The option -r scans the ports of the target machine in a random sequence, iR selects random IPs as target for the scan, -I activates the reverse ident scan, which only functions with a TCP-connect()scan (-sT). -p53 finally defines Port 53 as scan target. In the second example, we want to scan target.host, but at the same time avoid being detected too easily. So we will use a few decoy hosts: % nohup nmap -r -P0 -sS -Ddecoy1,decoy2,decoU y3,decoy4,decoy5 target.host In this instance, the hosts decoy1 to decoy5 should exist and be reachable or "up". The option -P0 deactivates the pings from target.host before the scan – we are assuming that it is "up". -sS activates the SYN-scan and -Ddecoy1,decoy2,decoy3, decoy4,decoy5 uses the hosts decoy1 to decoy5 in order to create a bit of confusion.
046snortnmap.qxd
22.11.2000
12:01 Uhr
Seite 49
NETWORK SECURITY
Snort – looking on the bright side Snort (http://www.snort.org/) from Martin Roesch is a socalled Intrusion Detection System (IDS). It is capable of analysing IP-Network traffic online and recording packets. It can also be used for protocol analysis, as well as for looking into the flow of network data for contents and logging corresponding packets together with their contents. By using context-sensitive rules, Snort can be used to detect a multitude of attacks and scans, such as for example Buffer Overflows, Stealth Port Scans, CGI Attacks, SMB probes and active OS Fingerprinting and to report these to the administrator. Snort can – if it has been configured with -enable-flexresp – even respond to incoming packets, for example by sending RST-packets, which are intended to close the connection down. This reporting can be done via syslog(), a file, a UNIX Domain Socket or smbclient (in the form of a WinPopup Requester).
Philosophy Intrusion Detection Systems (IDS) are technologies which reduce the risk of intrusion, but do not eradicate it altogether. An attack is a transient incident. Conversely, a "vulnerability" (weak point) permanently contains within itself the risk of an attack. The difference between an attack and a vulnerability, is that the attack exists only at a specific time, while the vulnerability exists regardless of the time of observation. One could also say that an attack represents an attempt to exploit a weak point.
What do I need? Snort is based on libpcap, the Packet Capturing Library. This can be obtained from http://www.tcpdump.org/. When using --enableflexresp it is necessary to install the libnet library from http://www.netfactory/libnet. Last of all, of course, you need rules, too. These can also be found at http://www.snort.org – click there on "Rule Database". It is advisable to copy these to /etc/snort.conf, as they more or less represent the "configuration" of Snort.
Things to look out for? These rules are obviously based on so-called signatures, which must be known in advance. This means that our IDS (like all others) does include a risk of false alarms. We must differentiate between two sorts of false alarms:
KNOW-HOW
• false positives: normal network activity is classed as an "attack"; • false negatives: A real attack is ignored. Consequently, we still need a human being who will subject alarms to thorough investigations. false negatives are more dangerous than false positives, as they give the user a treacherous feeling of security. Equally, snort can even be used for a DoS (Denial of Service), for example by flooding log files (and thus the disks).
What should I change? In the rules which we have installed by this point under /etc/snort.conf, a few alterations must be made. preprocessor portscan: 10.0.0.1/8 \ 7 1 /var/log/snort/portscan.log specifies how many connections (in this case, 7) per unit of time (in this case 1 second), to which target addresses (the entire 10.x.x.x network) are classified as a port scan. The port scan is logged in /var/log/snort/portscan.log. In the line var HOME_NET 10.0.0.1/24 the local, trustworthy network must be entered, especially as many rules differentiate between machines within and outside the HOME_NET. Here, this is 10.0.0.x. An individual host 10.0.0.1 would consequently be 10.0.0.1/32. In the line preprocessor portscan-ignorehosts: 10.0.0.1/U 30 it is possible to enter the hosts from which port scans should be ignored. There, for example, one could use the same settings as for HOME_NET.
The start It is advisable to activate Snort by means of a start script (for example /sbin/init.d/snort when changing to a run level with network support. I start Snort from /sbin/init.d/snort with: snort -u snort -g snort -D -d -b -s -c /etc/sU nort.conf -l /var/log/snort
Brighter, better, faster! The log files are at first glance truly enormous and there are numerous log file analysers which exist for snort, which statistically process the threats for the administrator.
Rules The format of the rule file is described at http://www.snort.org/writing_snort_rules.htm. A sample rule is: 4 · 2001 LINUX MAGAZINE 49
046snortnmap.qxd
22.11.2000
12:01 Uhr
KNOW-HOW
Seite 50
NETWORK SECURITY
Action ("rule action")
The parameters of snort: -t /snort-chroot snort can be allowed to run similar to BIND-8.x chrooted, in order to minimise the risk of snort being compromised. To do this is it advisable to statically link snort (LDFLAGS=@LDFLAGS@ -s static in the Makefile). Of course, the whole thing only makes sense when snort does not have root privileges: -u snort Start snort with the user-id "snort". As snort processes data from the network, we don't want it to have root privileges – or else an exploit by snort could lead to a root compromise. For that reason, a user "snort" and a group "snort" (to which pnly the user "snort" belongs) must be created. This user should be unable to log in and have no shell. -g snort Start snort with the group-id "snort". -D Start snort in daemon mode. -d Also, log the data of the application layer. -b Writes logged packets in tcpdump format on the disk. This is necessary for performance reasons, especially with 100 MBit networks! -s Write alarms into the syslog. -c /etc/snort.conf Path to configuration- and rule file -l /var/log/snort Path to the directory in which snort stores its log files.
alert: a packet generates an alarm and is logged. log: The packet is only logged. pass: The packet is ignored. In our example an alarm is produced.
The protocol In our example this is an ICMP-packet.
IP addresses IP addresses are stated in the form w.x.y.z/n, where w.x.y.z is an IP address and n is a CIDR block. So 10.0.0.0/8 specifies the whole 10th Class-A subnetwork, and 10.0.0.0/24 merely all hosts from 10.0.0.1 to 10.0.0.254. As operator, the negation operator ! is available. The packets in our example come from $HOME_NET.
Ports Ports can be specified as individual ports, domains or negations. In that case, the key word any stands for any port you like: 1 Port 1
alert icmp $HOME_NET any -> !$HOME_NET any (mU sg:"IDS191 - DDoS - \ barbed wire server-response"; content: "|6U 6 69 63 6B 65 6E|"; \ itype: 0; icmp_id: 667;)
1024: All ports above Port 1024 (inclusive) :1024 All ports below Port 1024 (inclusive) Our example involves ICMP packets, but ICMP dU oesn't know any ports, so we are using any.
Rule Header Every rule starts with a "rule header"; it consists of several fields: alert icmp $HOME_NET any -> !$HOME_NET any
Directional operator The directional operator states in which direction the rules apply:
Table 2: Snort rule headers Option msg logto ttl id dsize content offset depth nocase flags seq ack itype icode
Meaning Generates an alarm and writes in the log. Log to a special file instead of the default file. TTL field in the IP header Fragment-ID field in the IP header Size of the packet content Content of a packet This can be used to specify an Offset for the content option, with which the content will be matched. This can be used to specify the maximum search length for the content option. This is used to make the content option non-case sensitive. TCP-Flags TCP sequence number TCP acknowledgement field ICMP type ICMP code 50 LINUX MAGAZINE 4 · 2001
Option session icmp_id icmp_seq ipoption rr eol nop ts sec lsrr ssrr satid rpc resp
Meaning This can be used to log the application layer information for a session. ICMP-Echo ID field ICMP echo sequence number IP option fields: Record route End of list No op Time Stamp IP security option Loose source routing Strict source routing Stream identifier Check RPC services for specific application or procedure calls This can be used to generate an active reply (for example to prevent disconnection by sending an RST packet).
046snortnmap.qxd
22.11.2000
12:01 Uhr
Seite 51
NETWORK SECURITY
-> On the left hand side of -> is the source, and on the right the target. The bidirectional operator. Network traffic in both directions is acquired. In our example the rule is applied to all ICMP packets leaving our network.
Rule Options After the rule header come the options for the rule, and an overview can be found in Table 2. (msg:"IDS191 - DDoS - Barbed wire \ server-response"; content: \ "|66 69 63 6B 65 6E|"; itype: 0; icmp_id: 66U 7;) In our example, a warning is created (msg:"IDS191 DDoS - Barbed wire server-response";), when the content of the packet contains the above-named sequence of bytes anywhere (content: "|66 69 63 6B 65 6E|";) and the ICMP type 0 is (itype: 0;) and the ICMP echo ID field has the value 667 icmp_id: 667;.
At 19:52:24, ???.???.86.226 started its "port scan" – as the maximum number of connections per unit of time had been exceeded, Snort has characterised the connections as port scans. The attacker could have dodged our port scan preprocessor by simply having a bit more patience, so nmap offers a "timing" option for the speed of a port scan: nmap -T Paranoid or nmap -T Sneaky might possibly not have triggered the preprocessor. The speed of the attack, however, tends to indicate an automatic tool rather than nmap – in the end it was all over in about 3 seconds. The scan succeeded with SYN-FIN packets on ports 53 of xxx.yyy.106.18 and xxx.yyy.106.23; the rule which captured this is: alert tcp !$HOME_NET any -> $HOME_NET any (msU g:"SCAN-SYN FIN";flags:SF;) After that, for both machines, a test was performed to find out if the nameservers support inverse queries : alert udp !$HOME_NET any -> $HOME_NET 53 (msU g:"IDS277 - NAMED Iquery \ Probe"; content: "|0980 0000 0001 0000 0000|"U ; offset: "2"; depth: "16";)
Preprocessors In snort there are a few preprocessors, which apply before the rules; there are: • preprocessor minfrag: 128 This preprocessor recognises fragmented packets under the specified fragment size (in this case: 128). Normally, packets are fragmented on their way from the source to the target by routers, but one may assume from this that no hardware fragments smaller than 512 Bytes are produced. So everything smaller is created artificially. • preprocessor http_decode: 80 8080 With this preprocessor, HTTP URLs can be converted into clear text ASCII. • preprocessor portscan: 192.168.1.0/24 Ports Time /var/log/portscan.log More than "ports"; connections during the period of "time" seconds on the network 192.168.1.0/24 A typical attack sequence, which snort has captured in the network of a customer, can be found in the box "Attacks and Strategies" Explanations: Attacks and Strategies Jun 25 19:52:24 snort[11597]: Jun 25 19:52:24 snort[11597]: Jun 25 19:52:24 snort[11597]: Jun 25 19:52:25 snort[11597]: Jun 25 19:52:26 snort[11597]: Jun 25 19:52:26 snort[11597]: Jun 25 19:52:27 snort[11597]: Jun 25 19:52:27 snort[11597]: Jun 25 19:54:04 snort[11597]: TEALTH Jun 25 19:57:02 snort[11597]: portscan from ???.???.86.226
KNOW-HOW
This indicates that an attempt may be made to exploit a buffer overflow in BIND (http://www.cert.org/advisories/CA98.05.bind_problems.html), which grants the attacker root privileges. For this to work, the server concerned must have the fake-iquery option activated. Finally, the BIND version was queried: alert udp !$HOME_NET any -> $HOME_NET 53 (msU g:"IDS278 - NAMED Version \ Probe"; content: "|07|version|04|bind|00 001U 0 0008|"; nocase; offset: "13";depth: "32";) The above buffer overflow can only be taken advantage of on BIND nameservers with version numbers lower than BIND 4.9.7 (BIND Version 4) and BIND 8.1.2 (BIND Version 8). At 19:54:04 snort then reports the status of the port scan; there were 7 connections or attempted connections, spread over 3 machines on the subnetwork being monitored, 5 of them TCP and 2 UDP.
spp_portscan: PORTSCAN DETECTED from ???.???.86.226 SCAN-SYN FIN: ???.???.86.226:53 -> xxx.yyy.106.18:53 SCAN-SYN FIN: ???.???.86.226:53 -> xxx.yyy.106.23:53 SCAN-SYN FIN: ???.???.86.226:53 -> xxx.yyy.106.25:53 IDS277 - NAMED Iquery Probe: ???.???.86.226:1565 -> xxx.yyy.106.18:53 IDS277 - NAMED Iquery Probe: ???.???.86.226:1568 -> xxx.yyy.106.25:53 MISC-DNS-version-query: ???.???.86.226:1565 -> xxx.yyy.106.18:53 MISC-DNS-version-query: ???.???.86.226:1568 -> xxx.yyy.106.25:53 spp_portscan: portscan status from ???.???.86.226: 7 connections across 3 hosts: TCP(5), UDP(2) SU spp_portscan: End of
4 · 2001 LINUX MAGAZINE 51
046snortnmap.qxd
22.11.2000
12:01 Uhr
KNOW-HOW
Seite 52
NETWORK SECURITY
In addition, the issue of "version.bind" should be prohibited (dig @server version.bind CHAOS TXT), which really does make sense in view of the increasing number of attacks on nameservers in recent times: zone "bind" chaos { type master; file "master/bind"; }; And the zonefile master/bind: $ORIGIN bind. $TTL 1W @ 1D CHAOS SOA host. (
Moral BIND should – if at all – always be installed in the most up to date version. It is precisely the "professional" Unixes which are having problems with this because the patches come out relatively late. The nameserver should only respond to queries from the local network (but also, of course, to all queries which concern primary and secondary zones) hence /etc/named.conf contains the following: acl "trusted" { 134.169.0.0/16; localhost; }; acl "bogon" { 0.0.0.0/8; // Null address 1.0.0.0/8; // IANA reserved, popular faU kes 2.0.0.0/8; 192.0.2.0/24; // Test address 224.0.0.0/3; // Multicast addresses // The following Enterprise networks may or may not be bogus. 10.0.0.0/8; 172.16.0.0/12; 192.168.0.0/16; }; options { allow-query { trusted; // only queries from "trusted" hosts }; allow-recursion { trusted; // only recursive queries from "trusted" hosts }; allow-transfer { none; // no-one can have my zones! }; blackhole { bogon; // I'm not talking to them }; };
52 LINUX MAGAZINE 4 · 2001
CHAOS NS
localhost. root.localU 1 3H 1H 1W 1D ) localhost.
; serial ; refresh ; retry ; expiry ; minimum
It would also be possible to fill the zone with "false" (version) data, in order to attract hackers. Alternatively, one could also install other nameservers such as for example tinydns from Dan Bernstein, which has been proven to be considerably more secure.
The Attacker Is the attacker also a victim? We use nmap to obtain information: # nmap -T Sneaky -O -sS ???.???.86.226 Starting nmap V. 2.54BETA1 by fyodor@insecU ure.org (www.insecure.org/nmap/) Interesting ports on ??????????.???????????U ??.co.jp (???.???.86.226): (The 1511 ports scanned but not shown below aU re in state: closed) Port State Service 21/tcp open ftp 22/tcp open ssh 23/tcp open telnet 25/tcp open smtp 37/tcp open time 53/tcp open domain 70/tcp open gopher 98/tcp open linuxconf 109/tcp open pop-2 110/tcp open pop-3 111/tcp open sunrpc 113/tcp open auth 143/tcp open imap2 5680/tcp open canna TCP Sequence Prediction: Class=truly random Difficulty=9999999 (Good luck!) Remote operating system guess: Cobalt Linux 4.0 (Fargo) Kernel 2.0.34C52_SK on MIPS or TEAMInternet SU eries 100 WebSense
046snortnmap.qxd
22.11.2000
12:01 Uhr
Seite 53
NETWORK SECURITY
MTA % telnet ???.???.86.226 25 Trying ???.???.86.226... Connected to ???.???.86.226. Escape character is '^]'. 220 ??????????.?????????????.co.jp ESMTP SenU dmail 8.8.7/3.7W1.0; Tue, 27 Jun 2000 17:30:4U 7 +0900 QUIT 221 ??????????.?????????????.co.jp closing cU onnection Connection closed by foreign host.
KNOW-HOW
Escape character is '^]'. * OK ??????????.?????????????.co.jp IMAP4revU 1 v12.250 server ready A WU-IMAPD 4.7. See http://oliver.efri.hr/~crv/ security/bugs/Linux/imapd9.html The computer is open like a garden gate and badly patched. Most likely a victim itself – who knows what might be running on that one? An RPC and Ident-scan provides, in addition to our above findings, also: % nmap -P0 -v -v -sT -sU -I -sR ???.???.86.226 ... snip ...
See Bugtraq Vulnerability ID 717 and many others. But this query is somewhat lacking in subtlety. It's much more elegant to send mail to "foobar@??????????.?????????????.co.jp" and put it, for example, in postfix debug_peer_list = ??????????.?????????????.co.jp; then the log process will be seen in /var/log/mail.
FTP Daemon % ftp ???.???.86.226 Connected to ???.???.86.226. 220 ??????????.?????????????.co.jp FTP serveU r (Version wu-2.6.0(1) Thu Oct 21 12:22:27 EDU T 1999) ready. A WU-FTPD. See Bugtraq Vulnerability ID 1387.
Nameserver % dig @???.???.86.226 version.bind CHAOS TXT ;; ANSWER SECTION: VERSION.BIND. 0S CHAOS TXT "8.1.2" An ISC BIND 8.1.2. See Bugtraq Vulnerability ID 983.
POP2/POP3 Daemon % telnet ???.???.86.226 109 Trying ???.???.86.226... Connected to ???.???.86.226. Escape character is '^]'. + POP2 ??????????.?????????????.co.jp v4.5U 1 server ready QUIT + Sayonara Connection closed by foreign host. % telnet ???.???.86.226 110 Trying ???.???.86.226... Connected to ???.???.86.226. Escape character is '^]'. +OK POP3 ??????????.?????????????.co.jp v7.5U 9 server ready QUIT +OK Sayonara Connection closed by foreign host. POP2 is, exceptionally, invulnerable. See Bugtraq ID 283.
IMAP Daemon % telnet ???.???.86.226 143 Trying ???.???.86.226... Connected to ???.???.86.226.
(The 3067 ports scanned but not shown below aU re in state: closed) Port State Service (RPC) OU wner 21/tcp open ftp 22/tcp open ssh 23/tcp open telnet 25/tcp open smtp 37/tcp open time 37/udp open time 53/tcp open domain 53/udp open domain 70/tcp open gopher 98/tcp open linuxconf 109/tcp open pop-2 110/tcp open pop-3 111/tcp open sunrpc (rpcbind V2) 111/udp open sunrpc (rpcbind V2) 113/tcp open auth 143/tcp open imap2 514/udp open syslog 3130/udp open squid-ipc 5680/tcp open canna
Canna Also, canna, a service provider which converts Japanese Kana into Kanji characters, displays numerous vulnerabilities: http://www.securityfocus.com/bid/757Bugtraq ID 757 http://www.securityfocus.com/bid/758Bugtraq ID 758 http://packetstorm.securify.com/advisories/debian/d ebian.canna.txtDebian Security Advisory http://packetstorm.securify.com/advisories/freebsd/F reeBSD-SA-00:31.canna FreeBSD-SA-00:31 ■
The author Since completing his degree in computer science at TUBraunschweig, Ralf Hildebrandt Ralf.Hildebrandt@innominate. de has been working as a systems engineer.
Info [1]http://www.snort.org/ Snort IDS [2]http://www.insecure.org/nmap/ nmap network scanner [3]http://www.securityfocus.com/ security information [4]http://neworder.box.sk/ security information and exploits [5]http://www.faqs.org/rfcs/rfc793.html RFC 793 TCP specification [6]http://www.faqs.org/rfcs/rfc1413.html RFC 1413 identification protocol [7]http://www.faqs.org/rfcs/rfc1812.html RFC 1812 Requirements for IP Version 4 Routers [8]http://phrack.infonexus.com/ Phrack Phrack 51 describes scan techniques [9]http://xanadu.rem.cmu.edu/snort/ Tools from Yen-Ming Chen: [10]http://www.silicondefense.com/snortsnarf/ Silicon Defence ■ 4 · 2001 LINUX MAGAZINE 53
054ifs.qxd
21.11.2000
16:19 Uhr
Seite 54
KNOW HOW
BUILD YOUR OWN LINUX
Linux from Scratch
AL GUSTO THOMAS WALTER
Are you fed up with the quirks of your chosen Linux distribution? Are you worried that migrating to another will just make things worse? If you answer "yes" to both these questions then "Linux From Scratch" may be just what you're looking for. Most experienced Linux users have gone through at least one "Distribution war" and many have actively taken part in them. The story is the same every time "Red Hat's linuxconf hates my xxxx", "SuSE's YaST destroys configurations created manually" or Debian is unsuitable for beginners" and so on. These are just examples, of course, and not personal opinions, so please spare me the flames. But whether you agree or disagree with a particular point of view. The unavoidable fact is that no Linux distributon is perfect. For this very reason, in March 1999 a Linux expert called Gerard Beekmans started a project called "Linux From Scratch" (LFS) see http://www.linuxfromscratch.org/ for more details. His aim was to write a HOWTO in which the construction of a Linux system is described from the ground up. Now justifiably referred to as a book, LFS is aimed at Linux users who want to find out more about the basic parts of their operating system and how these parts function in unison. And while another HOWTO, "From Power Up To Bash Prompt" (http://www.netspace.net.au/~gok/power2bash/) offers a description of the boot procedure and the construction of a minimal system, LFS tells you how to create a complete development system, including a compiler and all the requisite utilities.
Read the recipe book and collect your ingredients Before we go any further, we must point out that for users who are just starting with Linux, especially 54 LINUX MAGAZINE 4 · 2001
those who have only just decided to jump from the Microsoft cap, Linux From Scratch (LFS) is not a recommended option. For a start you'd find it extremely hard to understand what LFS requires you to do in order to set up a working system. If, on the other hand, you are an experienced Linux user, you shouldn't have too much trouble understanding exactly what you need to do and why in order to get up and running. The construction of a complete functioning Linux system solely by compiling the requisite source code packages does requires some knowledge of the fundamental Unix commands, cp, mv, ls and so on, but these should be tools you use on a daily basis. So, if you can keep a cool head when faced by phrases like "make is started with a parameter LDFLAGS=-static" and can create and process text files with the editor of your own choice, then there is really nothing stopping you from leaving the world of commercial distributions and joining the LFS brigade.
beans on toast or 5 star hotel The aim of the LFS book is the step by step installaton of a complete development system including compiler and all other necessary programs. While the usual distributions force you to use one of their directory structures or boot scripts, and usually create their own standards too, with LFS you get the chance to construct a system according to your own wishes – although you simply stick to the suggestions made in the book, which by the way correspond where possible to the Filesystem Hierarchy Standard (FHS – see http://www.pathnae.com/fhs/), you can always do your own thing at any point. A ready-made distribution serves as the basis for an
054ifs.qxd
21.11.2000
16:19 Uhr
Seite 55
BUILD YOUR OWN LINUX
LFS installation, since creating a compiler without compilers would be a little hard to do. Which distribution is used or how old the installed version is doesn't really matter, but it is simpler, and also recommended, to use a distribution that is less than a year old. The installation of an LFS system takes place in several stages: • Stage 1 – This covers basic tasks such a creating a new partition, creating the file system etc. An absolutely minimal basic system is then produced which contains the static versions of all programs necessary for compiling. • Stage 2 – The second stage is devoted to the installation of additional packages into a chroot (change root) environment, which form part of an orderly Linux system. In addition, the static programs already created in Stage 1 are replaced by dynamically linked versions. • Stage 3 – Here the freshly installed system is finally configured, boot scripts are created and, using Lilo, can now be booted.
Am I done? So, you now have a bootable system, and everything is configured. That's it, right? Actually, no. Admittedly, you can and should be very proud of your efforts but you'll soon find yourself missing all your favourite programs. Basic tips on the installation of major packages, such as the XWindow system, KDE, GNOME and Netscape, can be found at http://archive.linuxfromscratch.org/lfshints/, however. And if you need a particular source code package then Freshmeat (http://freshmeat.net/) should be able to help. Indeed, for source code in general this should be your search engine of choice. If you encounter problems at any stage, help is always athand via the very active LFS community. You can usually get help very quickly via one of the mailing lists (see box) or in the LFS IRC (see the web site for details).
KNOW HOW
Automation for dessert A project that is very active at the moment is "Automated Linux From Scratch" (ALFS – http://alfs.linuxfromscratch.org/). The aim here is to create a program package that allows the automatic installation of LFS systems. At present an XML profile is being worked on that contains all the necessar structures for this task. A similar system in the form of a Makefile already exists. Amongst other things, ALFS will allow you to create a profile mimicking your favourite distribution, or to simultaneously set a system up on several networked computers. Most interesting of all, though, an automated installation profile is being worked on that will install a working Linux system that is 100% compatible with the Linux Standard Base (http://www.linuxbase.org/).
Each to his own There's no geting away from the fact that installing an LFS system does require some hard work. And due to the fact that all packages have to be compiled, installing the system also takes a relatively long time. Indeed, some brave souls are installing LFS on very basic platforms, including non-i386 ones, where compilation can literally take days. Compiling glibc alone on the likes of an m68k platform fitted with 8MB RAM takes no less than 68 hours, for example. Nevertheless, for those willing to stick with it, LFS offers many rewards, not least of which probably being more detailed knowledge of the Linux system that you ever imagined you'd want. And once the automatic installation development is finished LFS will start to attract a much wider audience, particularly admnistrators who don't need enormous distributions, want to optimise their system to their processor or because of security concerns want complete control of absolutely every facet of their operating system. ■
LFS Mailing lists The mailing lists shown below serve as discussion forums on all LFS-relevant topics. Subscriptions are handled via e-mail sent to lstar@linuxfromscratch.org. To subscribe, simply send an e-mail with the Subject subscribe <list name>. Similarly, to be deleted from the list you need to use unsubscribe <list name> in the subject line. The list names you can use are as follows lfs-discuss: Discussions specifically relating to the LFS book lfs-announce: Announcements of new more stable versions lfs-config: Discussions on configuration problems with software from the LFS book lfs-appsB>: For problems with software not dealt with in the book alfs-discuss: Discussions on Automated LFS alfs-docs: The ALFS Documentation project group alfs-profile: Development of the ALFS-XML profile and the DTD In addition, archives of previous mailing lists messages can be found at http://archive.linuxfromscratch.org/mail-archives/
4 · 2001 LINUX MAGAZINE 55
056Berlin.qxd
21.11.2000
16:51 Uhr
KNOWHOW
Seite 56
DISPLAY-SERVER
Berlin - Alternative to the X Window System
DOWN WITH THE X-WALL! TOBIAS HUNGER
Linux users are getting more and more spoilt – calls for features such as fontanti-aliasing or alphablending are getting louder all the time. And at the same time, of course, the system has to be high-performance – the X Window system can help only to a limited extent. The Berlin Project, with its modular, objectorientated architecture, is attempting to make a new start.
56 LINUX MAGAZINE 4 · 2001
056Berlin.qxd
21.11.2000
16:51 Uhr
Seite 57
DISPLAY-SERVER
KNOWHOW
More than a decade has now gone by since the development of X-Window. It is not least for this reason that this display system is very robust. Continual new demands from users can be fulfilled with the aid of expansions of the X-protocol. Despite the far-sightedness of its creators though, the X Window system is gradually coming up against its limits. 3D applications can only be used effectively with a complicated GLX/DRI mix. Smoothed character sets are still awaited. X also allows only one ToolKit-related configuration. If you play in a KDE theme, the appearance of the Gimp does not alter for a long time.
New start Berlin offers a central configuration of its appearance. This means that applications present a consistent "Look and Feel" at all times. Gaming fanatics will love the rotating and transparent windows. For programmers the most interesting feature must surely be the deviceindependent graphics output. The best possible quality is always used, regardless of whether a monitor or a printer is employed for output. As a result, there is no need for the print routines necessary for X, or to adapt a program to different colour depths and screen resolutions.
Fig. 1: Whether rotated or enlarged: TrueType- and Bitmap fonts are improved in quality as the result of edge smoothing.
Goals Berlin's goal is to create an alternative to X which can cope better with modern hardware and can be more easily adapted to new input and output devices. The whole system is meant to be modular, so that the actual server is scaled by the selection of suitable modules. Thus the same server should run on both a small PDA and a large 3D graphics
Fig. 2: Example of a structured graphic (Left scenegraph, right result)
Table 1: History - From Interviews to Berlin 1988 InterViews, Stanford University (Linton, Calder, Vlissides) InterViews was a fruitful attempt to combine structured graphics and object-orientation. 1994-98 Fresco, X Consortium Fresco was the successor to InterViews, extending many of its ideas and integrating the individual libraries into a modular framework. The main focus of the development was a combination of distributed objects and "distributed graphical embedding". The internal use of an ORB even accelerated the development of COBRA. The Fresco project no longer exists, however, Berlin now being used to manage the remaining documents and archive (see later). 1997 GGI Project The GGI Project was established in order to obtain a general protocol for writing graphics drivers. By separating the Linux kernel from the programmer interface, it enables access to all the functions of modern graphics hardware in complete safety. 1997 Berlin Project By building on GGI, Berlin was an attempt to produce a very easy, powerful windowing system. Portability was considered important, but speed and efficiency were the biggest priorities. since 1998 Berlin Project, the second generation The establishment of standards such as OpenGL, COBRA and Unicode caused a change in the original Berlin focus, which is now portability and efficient through the use of common standards. In the search for inspiration we stumbled across Fresco, from which we have now taken large parts of the source texts. Indeed, the Berlin of today now has more in common with Fresco than with its own code from before 1998!
4 ¡ 2001 LINUX MAGAZINE 57
056Berlin.qxd
21.11.2000
16:52 Uhr
KNOWHOW
Fig. 3: The interplay of model, views and controllers
Seite 58
DISPLAY-SERVER
workstation. It should also make best use of any available hardware without any changes to its source text. Berlin is trying, by means of abstract interfaces, to develop a system which allows a program to be made usable without alterations in both a truly walk-in 3D environment as well as in
the classic 2D look and potentially even as an "acoustic user interface" for the visually-impaired. The whole system is being developed under the GNU Library General Public License.
Concepts Berlin is essentially based on two concepts. The first is that of so-called "structured graphics", where simple objects such as lines, letters, but also transformational functions such as rotations or crops, are amalgamated into more complex objects. The whole procedure is similar to drafting drawings in vector graphics programs. Figure 2 shows one such (simplified) tree structure and the image created from it. In the example, several glyphs (graphical representations of letters) and a complex vector graphic are combined into a hBox. This element allows all subordinate graphics to be displayed side by side on a common baseline. Model-View-Controller ("MVC") is derived from the programming language Smalltalk and is a second concept which is central for the configurability of the user interface. This means that
Fig. 4: The components of Berlin
58 LINUX MAGAZINE 4 ¡ 2001
056Berlin.qxd
21.11.2000
16:52 Uhr
Seite 59
DISPLAY-SERVER
a program ought to be split into three different function groups. The Model contains the status of the program. That could for example be a number of binary states, a variable value in a given interval or a text. This model is processed by one or more Controllers. As soon as one of these controllers alters the state of the Model, the latter notifies this alteration to all Views involved. The views thus represent the graphical appearance of a program and the controllers its behaviour. In the interests of configurability by the user, Both should be as flexible as possible. The actual program functions and data stay in the model, the logistical backbone. Figure 3 shows how these three components interact. Here, the model consists of three numbers, which represent the red, green and blue parts of a colour. The colour field in the middle observes this model. If that changes, its colour changes correspondingly. The controllers here are the slide controllers. If these are moved, they change the corresponding colour values of the model.
..and their realisation Berlin uses a so-called scenegraph for display. This is a structured graphic stored in the server. Here it is possible to see the strict separation of the model in the client and the associated views in the server. In the tree-like structure of the scenegraph, each client is responsible for one part of the tree. The client can insert, process or delete graphics, thus creating their own illustration. These graphics are demanded by the client from various modules in the server. The entire graphical representation of the clients is found there. Subgraphs (such as a window content) can be affected with the aid of upstream decorator patterns. These patterns are in fact invisible graphics, which affect the appearance of their dependents. These can be displacement, rotation, or a change of fonts or colours. The displacement of a window may be caused by its descriptive decorator pattern being inserted in front of the window subgraphs. This causes little or no communication with the client. The server has all the information it needs to redraw the whole window. Up to this point no assumptions whatsoever have been made about the basic hardware. All details within the scenegraph are abstract. They are also independent of the pixel co-ordinates and colour codings of the hardware. For this reason, the normal application developer no longer needs to worry about colour depths, screen resolutions and print support. Berlin adapts the output accurately to the output device in use, regardless of whether this is now a monitor, a video wall or a printer. Various DrawingKits are used to do this. These run through the scenegraph in a so-called draw traversal and thereby create an output that can be processed by the basic hardware. Currently raster and OpenGL display lists are catered for.
KNOWHOW
A Postscript DrawingKit is planned. Figure 4 and Table 2 describe individual components of Berlin. These exclude DrawingKits (which has already been described) the DesktopKit, which contains functions for control of windows, and the WidgetKit, which provides frequently used graphical user interface and display elements of particular importance. Both of these kits have a similar function in Berlin to the various window managers and GUI-ToolKits in X.
Interaction One part of the scenegraph consists of controllers. These are graphics objects which can receive, Table 2: The components of Berlin Display Server: How the X-Server represents the graphical interface of a client. libBerlin, libWarsaw connect the client or server respectively to the Object Request Broker (ORB).Both are created by a compiler fromBerlin's CORBA interfaces. ORB The CORBA ORB allows communication between client and server, regardless of their respective locations in the network. libPrague contains classes which abstract Berlin from its underlying hardware.This library is intended to allow easy portage of Berlin. Console Another abstraction. The console converts events from external libraries that query the hardware into Berlin events. Kits Kits are dynamic loadable modules, which provide respectively defined functions. Configuration of Berlin is possible by simply exchanging kits during run time.
CORBA CORBA (Common Object Request Broker Architecture) is a standard for the development of distributed systems. In such systems the entire functionality of an application is represented by objects. In such an architecture, the distinction between client and server becomes blurred. Client-components can create objects which behave like servers. The flexibility of distributed systems arises from the fact that all components possess a defined interface. This interface tells the components which services another component provides and how these can be used. As long as this interface remains unaltered, the implementation of a component can alter fundamentally, without the other objects involved being aware of this. With Interface Definition Language (IDL), CORBA provides a standard mechanism for the definition of such interfaces. IDL is not an implementation language – only interfaces between objects can be defined. Source texts are created next from these definitions in the various programming languages that implement these interfaces. Only now do they need to be provided with the program logic. Berlin clients in C++, Python, Perl and Java have already been realised using these features. In addition CORBA offers various services which make it possible to find an object. It also allows communication between different objects (including via address space) and even beyond computer limits. This communication is mediated through one or more ORBs (Object Request Brokers). On the basis of its Object Reference, the ORB can find and contact the object in the network.
4 · 2001 LINUX MAGAZINE 59
056Berlin.qxd
21.11.2000
16:52 Uhr
Seite 60
KNOWHOW
DISPLAY-SERVER
process and if necessary pass on events. So controllers are special decorator patterns, which alter not the appearance, but the behaviour of their dependents. Any graphics you desire can be converted, into a button for example, by adding a corresponding controller. All controllers are combined into another graph, the Controlgraph. A pick traversal is applied to this, to find the right recipient of an event. Events in Berlin are kept more abstract than for example in X in order to be prepared for future input devices. This also makes events easier to synthesise. Used perhaps to simulate a mouse via the keyboard or to enable a pen-based input on a PDA. Since controllers are in the server, many events can be carried out without any communication whatsoever with the client. The displacement of windows is another example here. The responsible controller of the DesktopKit communicates directly with the transformer of the window. CORBA, with all its functions, seems ideal to take over this communication between server and client-objects. The Berlin interfaces defined with IDL
correspond in their function to the X-Protocol. But as a rule, communication via CORBA is slower than via sockets. This frequently leads to the assumption that Berlin must be slower than the X Window system. But since communications between objects which live in the same address space are depicted in C++ as a virtual method call and in Berlin the vast majority of communication takes place in the address space of the server, slower communication between client and server is just a bad memory. Even demo-applications with a high proportion of communication between client and server are not significantly slower than those with a high proportion of communication in the server.
Kits The separation of interface and implementation makes little sense if a programmer can only create elementary objects such as lines, letters or simple controllers. It makes much more sense to create special objects, so-called Factory-objects. This can make and "wire" complex trees of elementary objects in one go. In Berlin there are several such
Compatibility Berlin and X have so few common features that the user cannot simply use his normal applications under Berlin. This is a serious drawback. Who wants to do without his favourite application? So how can Berlin be adjusted to represent existing programs?
Figure 5: X in Berlin in X
Pixel-Level bridge The simplest option for achieving X-compatibility is to run an X-server in a window. This option is technically relatively simple to realise and makes it possible to use all X-applications under Berlin. The drawback is that none of the advantages of Berlin come into play in this conversion. A conversion of this pixel-level bridge is already being worked on. Display is already functioning (see Figure 5), but there is as yet no passing on of events from Berlin to X. Widget bridge In a widget bridge a wrapper library is written to convert calls to an X-based GUI-ToolKit into corresponding Berlin structures. Such a bridge has the advantage that the fundamental characteristics of Berlin (transformations, server-side object communication) are largely retained. However, realisation is very timeconsuming and does not result in any additional function with respect to the Xversion of the GUI-toolkit. High-Level-Bridge Many applications now use GUI description languages, mostly based on XML, such as Glade, XUL and Entity. With such a "global knowledge" about a user interface it may be that better connections are made between Berlin and ToolKit widgets, than is usually the case with the widget bridge.
60 LINUX MAGAZINE 4 ¡ 2001
056Berlin.qxd
21.11.2000
16:52 Uhr
Seite 61
DISPLAY-SERVER
Getting started... Installing Berlin is not totally simple, as we use a few "incomplete" libraries, which have sometimes not yet made an entry in the current distributions. For this reason, there are still no Berlin packages in binary format. The libraries needed are, in detail: * libGGI Version 2.0 beta * Mesa Version 3.1 (with GGI-Support) or * libArt, from the Gnome-CVS-Tree * FreeType Version 2.0 beta 8 * libPNG Version 1.05 * libz Version 1.1.3 All these libraries are really easy to install. Only GGI and Mesa with GGI support occasionally cause problems. The associated demos have to run – otherwise Berlin will not function either! The next thing we need is an ORB. All ORBs with a language connection to C++ which support the POA and provide a name service, are suitable for Berlin. We would advise using omniORB Version 3.0 (or later). So far this is the only one to be "automatically" recognised. With others, manual modification of the Makefile is necessary. The installation of omniORB shouldn't give rise to any problems. After that the name service has to be configured and started. For this, the file /etc/omniORB.cfg is required. In this case, this contains the following lines: ORBInitialHost C3PO ORBInitialPort 8088 Please replace "C3PO" with your own computer name. When this file has been created, omniNames can be started for the first time: omniNames -start 8088 \ -logdir /var/log/ \ -errlog /var/log/omniorb-errors A good test of the configuration of the name service is to call up nameclt list. If this waits for a time-out, then something is wrong. Finally, to compile the sources, we need a C++ compiler.
factory objects. These are all responsible for a specified type of objects and are combined into Kits. These kits are the mechanism on which the whole modularity and configurability of Berlin is based. The server itself has just one function – to reload kits dynamically. It does not even need to know which interfaces a kit makes available to do this. It is enough that the application program knows.
Widgets and taskets One of the most interesting aspects of drafting user interfaces is the interaction between man and machine. Over the course of time certain metaphors, such as icons, buttons and scrollbars, have been developed. If the architecture itself demands a separation of data and presentation (keyword MVC), it can't be that difficult to design
KNOWHOW
The g++ version 2.95.2 is a good choice. Earlier versions can cause problems under some circumstances. You need to bear in mind that the compiler has to cope with multithreading (the compiler itself must have been converted with the option '–enable-threads'). All the more recent distributions should comply with this requirement. All that is needed now is the source code for Berlin. Depending on how adventurous you feel, you can choose between "stable" releases or nightly snapshots. It is also possible to check out the CVS Repository. The releases are split into smaller modules. The packages "Berlin", "Prague", "Warsaw", "Server" and one of the clients will be needed for testing. You're motoring once you've unpacked the packages. A simple make is enough. First the user will be asked some questions. The default answers should usually be appropriate in each case. The compilation will then start immediately. Installation is not yet foreseen – all programs can be executed directly from their directories. Berlin needs a few environmental variables. These can be get using export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:\ `pwd`/lib export BERLIN_ROOT=`pwd` Please take note that these commands have to be executed in the uppermost directory of the Berlin source tree. When using shells other than bash, the commands should be adjusted accordingly. Next, the server can be started with server/server. Depending on whether you are on the console or in X, the screen will either be black, or a black window will appear. At first, nothing else will happen. Now a client can be started. This, too, needs both of the environmental variables mentioned above. The C++ client is started with clients/C++/demo. In the case of problems the Berlin FAQ can be of assistance, and in more difficult cases, the mailing lists will help. Links to both of these can be found on the homepage of the Berlin project.
the presentation objects in such a way that their appearance, as well as their function can be configured. What looks to the user like a complex product, perhaps a scrollbar, is displayed as a structure in Berlin. Elsewhere, objects have defined attributes and status variables. Here these are an arrangement of graphics and controller objects, created with the aid of one or more factory objects. The creating kit is the only authority that knows the precise structure. This is the basis for the selection of different display methods. By exchanging the "WidgetKits", a different appearance is achieved. More abstract levels can also be permitted. When one considers the function of a scrollbar, one notes that it alters a value within given limits. If one only takes these tasks, one reaches the term "Taskets". When a user wishes to find a list with 4 · 2001 LINUX MAGAZINE 61
056Berlin.qxd
21.11.2000
16:52 Uhr
KNOWHOW
Seite 62
DISPLAY-SERVER
given values, he can do this in various ways ranging from menus, up to radio buttons. All perform this same task, so implementations can be one and the same tasket. In addition to the WidgetKit, Berlin also provides another more abstract "TasketKit" enabling the user to seek out his preferred selection method. This can either demand a radio-button group from the WidgetKit or instead do something completely different. The imagination has no limits. A menu is less useful than an acoustic response for the visually impaired. The application developer has the option to either impose the appearance of his/her application, by manipulating elementary graphics objects, or work as usual with Widgets. He or she can decide to work with even more abstract products, such as Taskets.
Development status and prospects
The author Tobias Hunger is a student of computer science at the University of Kaiserslautern. He also runs a company dealing with questions concerning network and computer security.
It may appear that the Berlin Project has done little in recent months. But there have been a few changes in the internal structure. First of all, many dependencies on other projects have been dissolved. Berlin no longer needs MesaGGI because of the libArtDrawingKit. A new hardware abstraction layer, the "console" means that even the dependency on the GGI (General Graphics Interface) has now gone. ORB has now become exchangeable. Apart from this, the whole architecture is more robust. This is the result of improved memory management.
Info [1] Berlin Homepage http://www.berlin-consortium.org/ [2] Fresco Homepage http://www2.berlin-consortium.org/fresco/ [3] CORBA Information http://www.corba.org/ [4] Unicode Standard http://www.unicode.com/ [5] OpenGL Information http://www.opengl.org/ [6] Die LGPL (GNU Library General Public License) http://www.gnu.org/copyleft/lgpl.html [7] GGI-Project Homepage http://www.ggi-project.org [8] Mesa (free openGL-Implementation) http://www.mesa3d.org/ [9] libArt http://www.levien.com/libart/ [10] FreeType Homepage http://www.freetype.org/ [11] PNG Homepage http://www.libPNG.org/pub/png/ [12] zlib Homepage http://www.info-zip.org/pub/infozip/zlib/ [13] omniORB Homepage http://www.uk.research.att.com/omniORB/ [14] Berlin Sourcecode http://www.berlin-consortium.org/install.html ■ 62 LINUX MAGAZINE 4 · 2001
Berlin is now truly stable and a bit faster than in previous versions, although there is still a great deal of room for refinement. Nevertheless, Berlin is not suitable for end users. Apart from a few demos, there are still no applications. There isn't even a complete set of Widgets in order to develop these. At present, Berlin should be regarded as more of an experimentation field for developing man-machine interaction. Since the architecture is now in large sections, work is now slowly beginning on the implementation of additional widgets. Portage to BSD and other systems is in the pipeline, together with the integration of additional libraries such as SDL and GLUT in Berlin. The developers are hoping that this will provide the long awaited "hardware support" for display. Until now, Berlin has had to manage with just software rendering. At the same time, portage onto an SGI Onyx is in the works. The project team members are hoping to be able to try out Berlin in a real, walk-in 3D environment on this machine. In preparation for this a so-called PrimitiveKit is being worked on. This will make it possible to insert simple three-dimensional objects such as spheres and cubes into the scenegraph. Of course, the development of the so-called canvas widget is not standing still, either. This could be used to embed an X-Server in Berlin. The TextKit is currently still in a revision phase, because it still does not provide the bi-directional textflow which would be necessary for complete representation of Unicode symbols. It is obvious that there is still a great deal to be done before Berlin is seen as the dreamed-of alternative to X. The team of the Berlin Project would be delighted to receive any assistance in further development. ■
063perlbablefish.qxd
22.11.2000
12:06 Uhr
Seite 63
TRANSLATING WITH BABEL FISH
KNOW HOW
THANKS FOR ALL THE FISH If you click on the Translate link on altavista.com you’ll find yourself faced with nothing more complex than a Web front end to Babel Fish, a program that understands half a dozen languages and can translate words, complete sentences and even entire Web pages. As the art of machine translation is still in its infancy even after decades of development, Babel Fish can’t work miracles. Still, for if you only need to say ”How do you do?” or ”Give me a beer, please”, in another language, or if you want to get the gist of a foreign-language Web site, it can be very helpful. The Babel Fish Web form on Altavista (accessible directly via babel.altavista.com) allows you to type text directly into a dialog box, or to enter a Web page URL, which will then be translated for you. This is all very well, but wouldn’t it be good if you were able to translate complete documents in a local file with the minimum of fuss, with no re-typing, or uploading to a Web site being required? We certainly thought so, so in this Know How feature we’ll create trans, a Perl script that links with Babel Fish via the Internet and allows you to translate the contents of local files with very little effort. As you might expect, a suitable Perl module that can be used by our script already exists; WWW::Babelfish by Dan Urist, which can be found on CPAN. As well as many other functions, WWW::Babelfish cleverly avoids the 1000 character limit imposed by Bablefish by splitting text into chunks of less than 1000 characters, then sending then individually to the Web site.
Multilingual Agent Babelfish currently supports conversions in both directions between English and either French, German, Italian, Portuguese, Spanish or Russian.
The Web-based Babel Fish translation tool is no linguistic genius, but it can help you to understand foreign language files. In this feature we’ll explain how to create a command line tool that interfaces with it over an Internet link, allowing you to translate local files in a matter of seconds. 4 · 2001 LINUX MAGAZINE 63
063perlbablefish.qxd
22.11.2000
12:07 Uhr
KNOW HOW
Seite 64
TRANSLATING WITH BABEL FISH
Calling trans without any parameters shows which parameters are normally expected: usage: trans \ [efgpirs]2[efgpirs] file ... e: English f: French g: German i: Italian
WWW-Babelfish-0.09.tar.gz and requires the libwww bundle as well as the module IO::String. As always, the installation uses the CPAN shell and
p: Portuguese r: Russian s: Spanish In order for the trans script to know from and into which language it is meant to translate, the first command line parameter indicates the direction: e2g (English-German) translates from English to German, f2e (French-English) translates from French to English, for example. The text to be translated is contained in one or more files, the names of which follow as parameters. The following call, foe example, would translate the French content of the file /tmp/french.txt into English, and then output the result via the standard output: $ trans f2e /tmp/french.txt Following the old Unix tradition, it is also possible to omit the file name, in which case trans retrieves the data from the standard input: $ echo "Der Ball ist rund" | trans g2e The ball is round Listing 1: trans 01 #!/usr/bin/perl -w 02 03 use WWW::Babelfish; 04 05 # Dummy UserAgent 06 use constant AGENT => 07 'Mozilla/4.73 [en] (X11; U; Linux)'; 08 09 # Supported Languages 10 my @languages = qw(English French German Italian 11 Portuguese Russian Spanish); 12 13 # Build hash that assigns language abbreviations 14 # to languages (e=>English, g=>German, ...) 15 foreach my $language (@languages) { 16 my $initial = substr($language, 0, 1); 17 $i2full{lc($initial)} = $language; 18 } 19 20 # All abbreviations in one string (efgpirs) 21 my $chars = join '', keys %i2full; 22 23 # Conversion direction from the 24 # command line (g2e, e2f, ...) 25 my $way = shift; 26 27 usage() unless defined $way; 28 29 usage("Scheme $way not supported") unless 30 ($from, $to) = $way =~ /^([$chars])2([$chars])$/; 31 32 # Read in text to be translated
64 LINUX MAGAZINE 4 · 2001
In the script shown in Listing 1, you’ll note that trans accesses the WWW::Babelfish module in line 3. This must have previously been downloaded and installed: WWW::Babelfish is available on CPAN under
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
perl -MCPAN -eshell cpan> install libwww cpan> install IO::String cpan> install WWW::Babelfish he supported languages are in lines 10 and 11. The list definition operator qw delimits the enclosed string at the word boundaries (spaces and linefeeds) and returns a list that contains every word as an element. In order to be able to access the complete language names (e.g. English) via the abbreviations (e.g. e) in an elegant manner later on, lines 15 to 18 build a hash table %i2full, which contains the abbreviations as keys and the language names as values. For this, the function substr takes the first letter in any language name and the function lc converts it into lower case. Line 21 assembles all available abbreviations into a string $chars to be used later on. This string is
my $data = join '', <>; # Contact Babelfish my $babel = WWW::Babelfish->new(agent => AGENT); usage("Cannot connect to Babelfish") unless defined $babel; # Perform translation my $transtext = $babel->translate( source => $i2full{$from}, destination => $i2full{$to}, text => $data ); die("Error: " . $babel->error) unless defined($transtext); print $transtext, "\n"; ################################################## sub usage { ################################################## my $msg = shift; my $prog = $0; print "usage: $prog ", "[${chars}]2[${chars}] file ...\n"; foreach $c (sort split //, $chars) { print " $c: $i2full{$c}\n"; } exit(1); }
063perlbablefish.qxd
22.11.2000
12:07 Uhr
Seite 65
WITH BABEL FISH TRANSLATING
confined to the current package using my, but is also available in the subfunction usage. $way in line 25 uses shift to retrieve the first command line parameter, which indicates the direction of the translation. If no parameter is present, the user has obviously not understood the syntax of trans, so the function usage provides some operating instructions and aborts the program. The regular expression /^([$chars])2([$chars])$/; in line 30 interpolates with /^([efgpirs])2([efgpirs])$/; and checks whether the direction indicator conforms to the format x2y, where x and y assume the value of e, f, g, p, i, r or s. Since the expression is used in a list context and there is a list to the left with the elements $from and $to, after a successful match this will contain the values within the brackets of the regular expression. For g2e this would be g in $from and e in $to. If the match fails, however, the result is an empty list which is interpreted as false within the Boolean context of unless. Line 33 reads in the text to be translated, either from files named in the command line or from the standard input if no files names are specified. The join function joins the lines into a long string while obviously retaining the linefeeds.
The Babelfish Object Line 36 creates a new WWW:Babelfish object and instructs it (via the agent parameter pair) to pass itself off as a Netscape browser using the constant specified in line 6 with Perl’s use constant. This makes it possible to define functions which look like macros, and that are optimised by Perl in such a way that they are by no means inferior to constant scalars. According to its documentation, WWW:Babelfish returns the value undef if anything goes wrong, which line 37 would take as a cue to abort. Finally, line 41 sends all data to Babel Fish on the Web. The translate method receives the full (English) names for source and destination language (parameter names source and destination), as well as the text to be translated in the form of a string value for the text parameter. The object sends the data to the form, interprets the returned HTML and extracts the result from it, all without any intervention from the user. The result is contained in $transtext. A value of undef indicates an error, which is captured by line 47 and displayed as a message using the WWW::Babelfish object’s error method. Lastly, line 50 sends the result to the standard output.
Operating Instructions In order to make it easy for new users to learn the operation of trans, the usage function defined from line 53 outputs a message and then brief operating
KNOW HOW
instructions. Afterwards, the program is terminated using exit(1). The operating instructions are generated dynamically by usage from the content of the variables $chars and %short, which contain the valid abbreviations and a table listing abbreviations with their corresponding language names. The Perl function split in line 60 splits strings into their components using // as a pattern, and returns an array which contains every character as an element. The function sort sequences the array of lower case letters alphabetically and the hash %short provides the corresponding language names. The sequence of supported languages could also be retrieved using the languages() method of the WWW::Babelfish object, which returns an array containing all current languages. trans does not do this, however, as the range is relatively static.
Great Moments in Translation We thought you’d like to see few examples of Babelfish’s translation capabilities. In all cases we called trans with only the language direction parameter, then we entered the text to be translated via the standard input and finished with ^D (Control+D):
Michael Schilli works as a Web engineer for AOL/Netscape in Mountain View, California. He is the author of „GoTo Perl 5”, published in 1998 by AddisonWesley (and in 1999 as „Perl Power” for the Englishspeaking market). Homepage: http://perlmeister.com.
$ trans g2e Einen Radi und eine Mass Bier, aber schnell! ^D
A Radi and measure beer, but fast! Not too bad, but by no means perfect. Let’s try English to French instead: $ trans e2f waiter, a bottle of your finest English wine please! ^D
serveur, une bouteille de votre vin anglais plus fin s'il vous pla‰t! Or English to German: $ trans e2g waiter, this beer tastes terrible! ^D
Kellner, dieses Bier schmeckt schrecklich! So, there you go. It works. We have to warn you that more complex translations are handled less well, though. Technical information in particular tends to get a bit mangled. It can still help you understand documents that you’d normally have to send off to a translator for interpretation at great cost, however, and all with the greatest of ease. ■ 4 · 2001 LINUX MAGAZINE 65
066gtk.qxd
21.11.2000
17:05 Uhr
Seite 66
PROGRAMMING
USING GTK
Graphic user interfaces with Gtk
GTK IN SHEEP'S CLOTHING TOBY PETERS
When developing graphical user interfaces, objectoriented programming can really demonstrate its strengths. The widely-used Gimp Toolkit is objectoriented in structure even though it is written in C. However, in order to make best use of it with C++ a wrapper is needed, such as Gtk--.
66 LINUX MAGAZINE 4 · 2001
066gtk.qxd
21.11.2000
17:05 Uhr
Seite 67
USING GTK
Anyone wanting to write a program with a graphical user interface for the X Window system is faced with the question of which library to use. Even if you have already decided upon C++ as the implementation language, there are still many different libraries to choose from. Several of the better-known C++ libraries are listed in Table 1, but many more exist. In this article we will introduce the library Gtk-- version 1.2.2. (Version 1.2.0 should not be used, incidentally, since this could cause problems at the next update). Gtk-- is a C++ wrapper round the Gimp Toolkit Gtk+. In other words, this library provides the application programmer with C++ interfaces but uses the C library Gtk+ to do the real work such as drawing objects on the screen or waiting for events. Gtk+ has been used to create the Gnome Desktop. There is also a C++ wrapper around the Gnome widget set called Gnome-- which is built on Gtk--. In this article, however, we shall only be looking at Gtk-- itself.
Of libraries and wrappers Why are we supposed to use a wrapper round a C library anyway? Because it is compatible with C it is possible to use any C library within a C++ application, and in this case, therefore, also Gtk+! A number of C++ applications do this, Abiword being a well-known example. When using a C library, however, there are a whole series of disadvantages and traps waiting for the unwary programmer. To register callbacks a C library like Gtk+ expects a pointer to the function that is intended to be called. This means that the C++ programmer is restricted when using callbacks to global functions and static methods because only they are compatible with pointers to C functions. In a C++ application, however, we also want a method of registering a specific object as a callback. To achieve this, an adapter function must be used which will allow itself to be registered as a callback and then calls up the appropriate method of the object required. The adapter function must know to which object the method belongs and which it is supposed to call up. Gtk+ can store any desired pointer to void as the attribute of a callback and can pass this pointer as a parameter when the callback function is invoked. In other words, we have to cast a pointer to the object initially as void * in order to be able to Table 1: Some GUI Libraries for C++ Library License Gtk-LGPL Vdk LGPL wxWindows LGPL or wxWindows Library License, Version 3 Qt GPL or comercial licence
PROGRAMMING
store it temporarily in the library during the registration of the callback. The pointer, which is received from the library when the callback is invoked, is now of the type void *, and that leads to the next disadvantage. Type checking must be disabled during compilation. In order to make use in the callback function of the object which is referenced by the pointer just mentioned, it has to be cast back and a check made in the process as to whether the referenced object also has the expected type, for example with dynamic cast<T*>. Type tests will therefore not take place until run time. Another disadvantage of C libraries – and a real trap with wrappers – are exceptions, because exceptions cannot be thrown by the C library. If an exception is thrown in a callback, this exception must be caught again before it reaches a function of the C library, because exceptions can't go any further in functions written in C. The small program from Listing 1 consists of two files, one C source file c_exception.c, which simulates a C library function, and a C++ source file c_exception.cc, which takes on the role of a C++ application. This program demonstrates the difficulties with exceptions in this arrangement: gcc -c c exception.c g++ -o c exception c exception.cc c exception.o If it is compiled in this way, the text 0 caught" Listing 1: Exceptions and C /* File c exception.c */ void c func(void(*cxx func)(void)) { cxx func(); // calls up the transferred } // function
/* File c exception.cc */ #include <iostream> extern "C" { void c_func(void(*)(void)); } void thrower (void) { throw int(0); } int main(int, char**) { try{ c_func(&thrower); } catch(int i) { cout << i >> " caught." << end1 ; } }
Platforms Unix, Windows Unix Unix, Windows, Macintosh Unix, Windows
Note C++ code wrapper for Gtk+ code wrapper for Gtk+ code wrapper for Gtk+ and Motif Very good documentation, basis of KDE 4 · 2001 LINUX MAGAZINE 67
066gtk.qxd
21.11.2000
17:05 Uhr
Seite 68
PROGRAMMING
USING GTK
release its resources with the result that the next time it is called it is in an unstable state. It is therefore better to be flexible. Either do without exceptions altogether or take meticulous care in catching all exceptions before one of them reaches a function of the C library or the wrapper.
The basis: Gtk+ Gtk+ is a GUI library written in C but still objectoriented. The developers of Gtk+ have had a hell of a job to implement a class system with support for inheritance and virtual methods in C. Let's take a quick look at how inheritance works in Gtk+, and what consequences this has when using these classes. Classes in Gtk+ are structs which contain as the first element the struct of the parent class: struct Child { struct Parent parent; /* ... attributes ... */ }; A pointer to an instance of Child can be cast as a pointer to a Parent, because both pointers point to the same address in memory. But during inheritance there is something more to be taken into account: the list of virtual methods. Because of this there is no quick way to derive a new class from an existing class in the library. An extract from the class hierarchy of Gtk+ widgets (GUI elements) and the corresponding hierarchy of Gtk– are shown in Figure 1. The methods of the Gtk+ classes are conventional C functions with the name and signature convention. gtk <class name> <action>(Gtk<classname> *, <Arguments>) Fig. 1: Extract from the propagation hierarchies
will not be output. Instead, the program will be interrupted if the exception reaches the C function. Because a wrapper calls the functions of the wrapped library it cannot eliminate this problem either. This is a clear disadvantage of wrappers in relation to pure C++ libraries. There are two ways of getting round this problem. Either you recompile the C library yourself, from scratch, with support for C++ exceptions (using special compiler settings) or you must allow for them in the program design. To use the former method with the GNU C compiler you use the switch -fexceptions. To use this method with the program in Listing 1:
They are always called after their class and expect, as the first argument, a pointer to the object to which the method belongs. For example:
gcc -fexceptions -c_c_exception.c; g++ \ -o c_exception c_exception.cc c_exception.o
GtkButton * button = /* ... */; GtkLabel * label = /* ... */;
Compiled using this command, the exception is caught in main. If this method is used, however, users of the program must also recompile the C library, which is not something they would normally be expected to do. There are other disadvantages, too. After the exception, the C library doesn't
gtk_container_add(GTK CONTAINER(button), GTK_WIDGET(label));
68 LINUX MAGAZINE 4 · 2001
gtk_container_add(GtkContainer*, GtkWidget*) which is a method of the class GtkContainer which packs any other desired widget into the container widget. A button is also a container in Gtk, and can contain another widget. In this way a button can contain a label (text), a graphic or another container which combines both. Here's an example using Gtk+ of how a label can be integrated into a button:
This should now persuade every C++ programmer to use Gtk-- rather than Gtk+ directly. The widgets would in this case have to
066gtk.qxd
21.11.2000
17:05 Uhr
Seite 69
USING GTK
be explicitly cast using macros to the anticipated type, because otherwise the program cannot be compiled. A check on whether the casts are permissible at all will, however, only take place at run time. In addition, it should be borne in mind that the method add was introduced as a method of GtkContainer, and not, for example, as a method of GtkBin (see the class hierarchy in Figure 1). The class in which a method was introduced will influence the name of the function which is to be called and the cast which is to be applied to the object.
PROGRAMMING
Now the good news. Using Gtk-- the same code extract looks like this: Gtk::Button button; Gtk::Label label(/* ... */); button.add(label);
Aims of Gtk-Gtk-- tries to wrap Gtk+ entirely. For each Gtk+ widget there is a C++ class. The class hierarchy of the C++ classes in Gtk-- corresponds exactly to the
libsigc++: Type-secure dynamic callbacks in Standard C++ Thanks to the compile-time type safety checks performed by the C++ compiler a great many program errors can be detected by the compiler. This type checking should also be applied to callbacks. To maximise reusability, classes from different parts of a program should be decoupled from one another as far as possible. Type security and decoupling are two aims of program development that tend to conflict with one another. But with the aid of libsigc++, both can be achieved. Libsigc++ generates binder elements in standard C++ between the sender and receiver of a message, which the compiler can then check for compatibility. Sender and receiver need know nothing of each other; the only consideration is that the type of message (signature) which they send and receive must be identical. The binding element on the sender side is the signal: SigC::Signal#<return type, parameter type1,…, parameter type#>. In this situation, the #-sign stands for the number of call-up parameters. Such a signal is a normal data type, an instance of which can be deposited in a class which is intended to send information. The binding element on the receiver side is the slot. Slots treat function and method calls in the same way, and are generated by a "slot factory." We have, then, the two sides, sender and receiver, who know nothing of one another. From a third place in the program, from which both the sender (Signal#<201>) as well as the receiver function or method are visible, the connection can now be made:
Fig. 2: The program from Listing 2
sig.connect(SigC::slot(&function)); sig.connect(SigC::slot(&object,&class:µethod));
SigC::slot is the "slot factory" mentioned. A class whose methods are to be called up in this way must be derived from SigC::Object. The connect calls are only allowed by the compiler if the signatures of the signal and slot match. The slots are called by the sender using the signal instance: r = sig(params); Several slots can be connected using the same signal, or none at all. Several slots may be called up one after another: the return value of the last slot is then returned. If this procedure isn't satisfactory it can be changed: The signals are additionally parameterised to the call-up signature using a marshaller class. An object of such a marshaller class is fed with the return values of the slots when they are called up, and from this generates a total return value. In addition to this, this object can decide after each slot call-up whether further slots are to be called up, or whether the call-up of further slots is to be suppressed. The marshaller class installed and used as standard in libsigc++ will ensure that all slots are called up and that the return value of the last slot is used as a total return value. If there is no slot at all connected to a signal it returns an instance of the return type created using the default constructor. If another procedure is desired you can create your own marshaller class and use this as the last template argument of the signal instance. The connections established using connect() can also be released if the return value of connect() is stored and its method SigC::Connection::disconnect() is called. Also, if the signal instance or the object is destroyed, the connection will be released automatically.
4 · 2001 LINUX MAGAZINE 69
066gtk.qxd
21.11.2000
17:06 Uhr
Seite 70
PROGRAMMING
USING GTK
Listing 2: hello.cc -- "Hello World" for Gtk-/* hello.cc A "Hallo World" program for Gtk--. This program initially defines a HelloWindow class derived from Gtk::Window, which arranges two buttons and a label in a window in the following way: +--------+-------+ | Button | Label | +--------+-------+ (To determine the arrangement, | Button | an HBox and a VBox are used) +----------------+ In main () an instance of this class is generated and used. */ #include <iostream>
// constructor. The buttons and the label are initialised with // the strings which are passed over. (Button has a comfort // constructor, which produces a label and inserts it in the buttoU n.) : hello button(hello string), world label (world string), bye button (bye string { // Insert the top left button into the HBox: hbox.add(hello button); // All widgets must be made visible with show(): hello_button.show(); // Insert the top right-hand label into the HBox next to the butU ton: hbox.add(world label); world_label.show();
// Headerfile for Gtk::Window, a main window for X11 applications: #include <gtk--/window.h> // Headerfile for Gtk::HBox, Gtk::VBox, two containers, which arrU ange // any desired widgets next to or on top of one another: #include <gtk--/box.h>
// Insert the HBox into the VBox: vbox.add(hbox); hbox.show(); // Insert the bottom button beneath the HBox, which contains thU e other button and the label: vbox.add(bye button); bye_button.show();
#include <gtk--/label.h> // Gtk::Label #include <gtk--/button.h> // Gtk::Button // Headerfile for Gtk::Main. Each Gtk-- application must instancU e an // object of this type precisely. #include <gtk--/main.h> // Instead of the individual header files, we would also have // been able to write only #include <gtk--.h>. This will allow // all the header files to be read in. For larger projects, howevU er, // this is not allowed because of the extended translation time.
// Insert the VBox into the application window (*this): add(vbox); vbox.show(); // Connect the buttons with the callbacks (see box about libsigU c++): hello_button.clicked.connect(SigC::slot(this,&HelloWindow::saU y hello)); bye_button.clicked.connect(SigC::slot(this,&HelloWindow::say gU oodbye)); }
// The new class which is inherited from an empty application windU ow: class HelloWindow : public Gtk:Window { Gtk::VBox vbox; Gtk::HBox hbox; Gtk::Button hello_button; // the button top left Gtk::Label world_label; // the label top right Gtk::Button bye_button; // the bottom button
void HelloWindow::say hello(void) { cout << "Hello!" << end1; }
protected: // We overwrite a virtual function which is called up automaticaU lly // if it is intended that the application window should be closed // by the window manager: virtual gint delete event impl(GdkEventAny*);
// The window is to be closed by the window manager: gint HelloWindow::delete event impl(GdkEventAny*) { Gtk::Main::quit(); // Exit event loop
public: // The constructor receives three strings as arguments, which // are indicated by the buttons (strings 1 and 3) or the label. HelloWindow(const string & hello string, const string & world string, const string & bye string); // Callback method, which should be called up // when the top left-hand button is clicked. void say hello(void); // Issues "Hello!" on the terminal.
void HelloWindow::say goodbye(void) { cout << "Good bye!" << end1; Gtk::Main::quit(); // Exit event loop }
// Return value true prevents the window being destroyed immediaU tely // after the return. (In this case, this would not actually mattU er, // because the program will then be ended in any event. return true; } int main(int argc, char ** argv) { // An instance of Main is created. It seeks through the commanU d line // elements and removes those which are processed by the Toolkit. Gtk::Main kit(argc, argv); // Create and display an instance of the application window. HelloWindow hello("Hello,", "World!","Good" "\n" "bye!"); hello.show();
// Callback method, which should be called up // when the bottom button is clicked. voidsay goodbye(void); // Issues "Good Bye" and ends the program. }; HelloWindow::HelloWindow(const string & hello string, const string & world string, const string & bye string) // The HBox and the VBox are initialised by the default 70 LINUX MAGAZINE 4 ¡ 2001
// Event loop. The callbacks are called up from this function. kit.run(); return 0; }
066gtk.qxd
21.11.2000
17:06 Uhr
Seite 71
USING GTK
PROGRAMMING
class hierarchy of Gtk+. Your own classes can be derived from these classes by inheritance with no problem. Type safety at compile time is a declared aim of Gtk--. For callbacks the signal-slot system of the library libsigc++ (see box) guarantees type safety. This system was initially developed as a part of Gtk-and can now be used independently of it. It is intended that Gtk-- should remain as slim as possible, but it should not be too thin. If the API of Gtk+ can support a C++ specific improvement, this will be implemented. Examples of this are the consistent use of std::string instead of char *, and the possible use of the Standard Template Library's container API for every type of container in Gtk.
Hello World It's time for the obligatory example program. Listing 2 shows a complete "Hello World" program for Gtk--. A screen shot of this can be seen in Figure 2. The program is compiled using: g++ gtkmm-config --cflags \ --libs -o hello hello.cc There are a number of points of interest in the source code:
Packed in the container At no point in the source code is the size of widgets (in pixels) specified. In Gtk, container widgets are always just sufficiently large enough to accommodate the widgets contained in them. The widgets located in a container in turn, as a rule, expand so that they take up all the space which the container provides for them. In the example, this means: "The button with the text 'Hello' is just large enough to be able to accommodate the label, whose size is determined from the font and the contents. The HBox which contains this button and the label next to it must now be at least as high as the button. The button fills the entire height of the HBox and is placed at the centre of it. The width of the HBox is determined from the widths of the button and the label. Because this HBox is inserted into a VBox, the VBox must also have at least the same width. The button with the inscription "Good bye!" contains a two-line label and is therefore taller than the other widgets. It occupies the full width of the VBox. If the user now enlarges the window displayed by the program, the widgets automatically take the additional space. There are still a few refinements which can be done differently when packing the container in order to achieve specific effects, but there isn't the space to go into greater detail here. Refer instead to the Gtk-- Tutorial on the Web, which describes in detail how widgets are packed in boxes and presents all the other containers.
Dialogs In Listing 2 all the widgets of the program are defined as data members of one class, this class being derived from the Window class. Because it is easy in C++ to derive a new class, this is the recommended method for creating a dialog. All the widgets of a dialog, or, if the dialog becomes too complex, all the widgets of a logical sub-unit of the dialog, are contained in one class. This class is derived from the container widget which contains all the other widgets. For a complete dialog, then, you can derive a class from a Gtk::Window. It is possible, for example, to derive part of a dialog based on an index card widget (Gtk::Notebook) from a box or a table (Gtk::Table) if all the other widgets are located within this box or table. In this way you can create specialised dialog widgets with the desired functionality. The file selection dialog supplied with Gtk, for example, was created in this way (although at the level of Gtk+.) If the new classes contain all the other widgets as data members, as in the example program, they can become very large. The size can be problematic in low-memory situations if the address space of the process is fragmented and there is no sufficiently large single memory area available to create an instance of the class. One way out of this is to work with pointers to the widgets instead of with the widgets themselves, creating these dynamically in the constructor and destroying them again in the destructor. Gtk-- (or libsigc++) provides a mechanism which makes the handling of the dynamically created widgets much easier: the function manage(). Many widgets, once they have been created and placed in a container, are no longer referred to in the source code of the program. In this case, instead of storing a pointer to the widget just in order to be able to destroy it again later, this task can be left to the library. If you give the function manage() a pointer to a widget, it will be marked in such a way that it will automatically be deleted by the library when the 4 ¡ 2001 LINUX MAGAZINE 71
066gtk.qxd
21.11.2000
17:06 Uhr
Seite 72
PROGRAMMING
USING GTK
container which holds the widget is destroyed. manage is defined in $PREFIX/include/sigc++/object.h (read in automatically from the Gtk– header files) as template <class T> T* manage(T*), so there may be no need to store a pointer to the object created temporarily in the constructor. somecontainer.add(*manage dget(/*…*/)));
(new Gtk::SomeWiU
inserts the newly created widget directly into the container. A version of the "Hello World" program, which uses manage is provided on the CD with this issue of the magazine.
Callbacks For callbacks, the signal-slot system of the library libsigc++ was developed (see the box "libsigc++"). The widgets react to user interaction by emitting signals. The button, for example, contains a signal such as Signal10<void> clicked, which is sent when the user clicks the button using the left-hand mouse button. In Listing 2 in the constructor of HelloWindow, the last two statements connect these clicked signals with other methods of the class. There is yet another way of calling up callbacks: virtual methods. Each widget in Gtk-- which can emit a signal also contains a virtual method which is called up each time this signal is emitted. The name convention for these methods is <signalname> impl. If you are interested in a signal from a widget from which you are deriving a new class it may be simpler to override this virtual method in order to obtain the desired functionality. Unlike with signals and slots, event and reaction are then securely coupled to one another. This might impair the reusability of the derived class. In the example program the method delete event impl is overridden in this way such that the program is terminated when the user closes the window. If methods are overridden it is important to take account of the fact that important functions of Gtk-- are carried out in these methods. It may therefore be necessary to call the corresponding method of the parent class explicitly from an overridden method in order for everything to work as it is supposed to. If you don't want to look into this any further, take it as a general rule of thumb to end the names of methods with * event impl in order to call the method of the parent class.
With style: Styles An object of type Gtk::Style is allocated to each widget, which determines the appearance of the widget. As a rule, several if not all the widgets share the same style object. You should never change the style of a widget if you don't know which other widgets are also using this style. 72 LINUX MAGAZINE 4 · 2001
New styles can be created by copying an existing style using Gtk::Style * Gtk::Style:Copy() const or creating standard style using static Gtk::Style * Gtk::Style:Create(). In the new style you can then change colours and fonts before assigning it to other widgets. The colours which a style defines are principally foreground colour ("fg"; for widgets with editable text "base") and background colour ("bg"; for widgets with editable text "text"). A widget can adopt different states. For each state, each of the colours can be different. GTK_STATE_NORMAL denotes the basic state; with GTK_STATE_PRELIGHT the mouse pointer is located above the widget, as is the case with GTK_STATE_ACTIVE, although in this case the left-hand mouse button is also pressed. In addition to this, there is GTK_STATE_INSENSITIVE and GTK_STATE_SELECTED. It is possible to play around with styles, colours and fonts in the program. This would mean that the colours and fonts would be hard-coded. There is a simple mechanism in Gtk which allows the appearance of the widgets to be determined at runtime: gtkrc files. Using these files, users are given the ability to change the look of programs to suit themselves.
Self-determination for all! In gtkrc files you can define "styles" and then assign them to a group of widgets. Styles are defined here as follows: style "<name>" [ = "<optional other sty le name>"] { … } where … is a selection of instructions: bg[<state>] = {<r>,<g>,<b>} fg[<state>] = {<r>,<g>,<b>} base[<state>] = {<r>,<g>,<b>} text[<state>] = {<r>,<g>,<b>} bg pixmap[<state>] = "<xpm filename>" font = "<fontname>" fontset = "<fontnames>" <state> designates one of the widget states; possible values are NORMAL, PRELIGHT, ACTIVE, INSENSITIVE and SELECTED. <r>,<g>,<b> are colour values between 0.0 and 1.0. It's important to ensure that a decimal point appears in the values otherwise the value will not be recognized and zero will be used (i.e. write 1.0 and not 1). Xpm-files are sought in directories specified by: pixmap path = "<directory1:directory2:dirU ectory3...>" at the start of the gtkrc file. Finally, styles defined in this way are allocated to a group of widgets. The following assignments apply: class <classname> style widget class <class path> style widget <path> style
<stylename> <stylename> <stylename>
066gtk.qxd
21.11.2000
17:06 Uhr
Seite 73
USING GTK
In the above, <stylename> is the name of a defined style and <classname> is the name of a class to which a is a designation pertains. Examples of class names are "Button" or "Widget". <class path> is a list of exact class names, separated by dots, of the containers in which a widget in this sequence is contained (for example "Window.HBox.Button.Label"). A <class path> usually starts with "Window.*". <path> is the same as <classpath>, unless a name has been given to one of the widgets using the method set name(), in which case this name should be used in the <path> instead. The class names "Button", "Widget", etc. are a feature of Gtk--. The corresponding class names of the Gtk+ widgets in a C program are "GtkButton", "GtkWidget" and so on. <class name>, <class path>, and <path> may contain the wildcards * and ?.
Putting it to use If you intend that a widget should be able to be configured in this way, a name which is as unambiguous as possible should be allocated to it in the program, for example: my button.set name("Hello Button"); In the gtkrc file, which is provided with the program, the desired style is defined and the button allocated to it: style "hello button style" { bg[PRELIGHT] = { 0.9, 0.2, 0.2 } } widget "*Hello Button" style "hello button stU yle" The asterisk here is a wildcard for all containers which might contain the button. A style is allocated to a widget at the moment at which its set name() method is called, or when it is packed into a container. Before this happens, the program must read in the desired gtkrc file: Of course, the documentation for the application will need to specify which widgets have which names so that the user knows what to change in the gtkrc file in order to obtain the desired result. Refer to the GNOME developer web site for more information on gtkrc files.
More documentation There are more than 80 widget classes in Gtk– and the Tutorial makes an effort to present all of them. In this article that is unfortunately not possible. Anyone whose appetite has been whetted by this article should read this Tutorial as the next step. What other documentation is there? First, there are the reference pages which are automatically produced when installing Gtk--. This reference is unfortunately still very incomplete. After installation
PROGRAMMING
it is found under <gtkmm-source>/docs/gtk/class index.html. There is also an example program for almost every widget which demonstrates its use. The example programs are located under <gtkmmsource>/examples. Because Gtk-- is just a wrapper it is possible to make something of a start with the documentation for Gtk+. The book "Gtk+/Gnome Application Development" by Havoc Pennington is also worth having. It can be downloaded or read on the Net, though we would recommend buying a copy of the printed version. The book "Developing Linux Applications with Gtk+ and Gdk" by Eric Harlow is rather heavy going but there are a number of low-level situations which it explains well. Before buying a copy, be sure to leaf through it carefully to get an overall impression, because the start of the book is really intended for C programmers and has nothing of direct relevance to Gtk+. It is often helful to take a look at existing applications which use Gtk--. Terraform is a program for creating fractal landscapes and cardwords is a crossword puzzle game. Other application examples can be found on the Web. Gtk-- is not only usable, it is being used. The project has been around for almost as long as Gtk+ itself. It has come a long way from its origins as a simple mapping of all the C functions of Gtk+ to become a sophisticated wrapper without which you will never want to use Gtk with C++ again. ■
Info Homepage of Gtk--: http//gtkmm.sourceforge.net/ Homepage of Vdk: http://vdkbuilder.sourceforge.net/vdk.html Homepage of wxWindows: http://www.freiburg.linux.de/-wxxt/ Homepage of V: http://www.objectcentral.com/vgui/vgui.htm Homepage of Qt: http://www.trolltech.com/products/qt.html For compatibility of QPL and GPL: http://www.gnu.org/philosophy/license-list.html Homepage of Fltk: http://www.fltk.org/ List of X11 libraries: http//sal.kachinatech.com/F/5/index.shtml List of GUI libraries: http://atai.org/guitool/ Homepage of Abiword: http://www.abisource.com/ Homepage of libsigc++: http://libsigc.sourceforge.net/ Tutorial for Gtk--: http://gtkmm.sourceforge.net/tutorial/tutorial.html gtkrc: http://developer.gnome.org/doc/API/gtk/gtk-resource-files.html Havoc Pennington: "Gtk+/Gnome Application Development" http://developer.gnome.org/doc/GGAD/GGAD.tar.gz Homepage of Terraform: http://terraform.sourceforge.net/ Homepage of cardwords: http://www.crosswinds.net/-cardwords Other example applications: http://gtkmm.sourceforge.net/extra.html#applications ■ 4 · 2001 LINUX MAGAZINE 73
074midgard.qxd
22.11.2000
9:52 Uhr
PROGRAMMING
Seite 74
MIDGARD APPLICATION SERVER
Dynamic websites with Midgard
PHP INSIDE JOCHEN LILLICH
Modern websites are dynamic – their contents come from databases, not just static HTML pages. Midgard Web Application Server is designed to help you create just such a site and will save you a lot of boring programming Modern websites need to have comprehensive and, most importantly, up-to-date information – not just a pretty lot pictures and some boring text. PHP has established itself as a powerful language in the development of database-enabled websites, but you’ll soon find that performing even routine functions can be a real pain. Indeed, editing text and other database contents, creating templates for separating content and layout, and creating interfaces for updating the database and so on require you to do a great deal of work. These basic functions are therefore often achieved via some form of middleware that sits between the database and the web application. One fairly new representative of such an application server, as it’s often known is Midgard. This was written just over a year ago as the basis of an editorial system for a Finnish online magazine, hence its Norse mythological name. Since then, Midgard has become an international Open Source Software Project and is developing rapidly. Have a look at http://www.midgard-project.org for more details.
Teamwork Midgard is an expansion of the widely-used LAMP combination: Linux (L) as operating system, Apache (A) as webserver, mySQL (M) as database and PHP 74 LINUX MAGAZINE 4 · 2001
(P) as programming language. Midgard adds important building blocks to this combination by providing PHP with a pre-defined, yet expandable, data model. This data model splits the individual applications of a Midgard server into ”Hosts”, in ”Styles” and ”Groups” data. ”Content” refers to he actual information required from a website. For this Midgard supports text (raw text or HTML), calendar entries and binary data. ”Styles” are freely definable style and page elements. This means there is complete separation in Midgard between application logic, contents and layout. Which users can process which parts of these is defined in ”Groups”, the management of user accounts and user groups.
Installation steps Before installing Midgard you should already have an Apache webserver and a my SQL database running on your system. As Midgard brings with it an expanded PHP3, any PHP module already installed for Apache must first be removed. From http://www.midgardproject.org/download/ you’ll need to download the midgard-data, midgard-lib, midgard-PHP and mod_midgard packages. These should each be unpacked, compiled and installed in a working directory. The Library Midgard-lib contains the basic Midgard functions and is installed as follows: The parameter ”--with-mysql” should now refer to the directory in which the Include files and Libraries of the database can be found.
074midgard.qxd
22.11.2000
9:52 Uhr
Seite 75
MIDGARD APPLICATION SERVER
tar xvzf midgard-lib-1.2.5.tar gz cd midgard-lib-1.2.5 ./configure --with-mysql=/usr make make install mod_midgard adds a Midgard interface to Apache. The configuration parameter ”--with-apache” refers to the configuration directory of the webserver, and ”--with-midgard” indicates where the Midgard libraries have been filed. tar xvzf mod_midgard-1.2.5.tar.gz cd mod_midgard-1.2.5 ./configure--with-apache=/etc/httpd \ --with-midgard=/usr/local make make install
PROGRAMMING
Midgard expansions in the httpd.conf LoadModule midgard_module libexec/mod_midgard.so LoadModule php3_module libexec/libphp3.so LoadModule midgard_module libexec/mod_midgard.so AddModule mod_php3.c AddModule mod_midgard.c AddType application/x-httpd-php3 .phtml .php3 .php DirectoryIndex ndex.html index.shtml index.php3 \ index.phtml index.php MidgardEngine on MidgardRootfile /usr/local/midgard/root/midgard-root.php3 <Directory /usr/local/midgard> Order allow,deny Allow from all </Directory>
midgard-php now contains the new PHP functions. tar xvzf midgard-php-1.2.5.tar.gz cd midgard-php-1.2.5 ./configure --with-apxs=/usr/sbin/apxs \ with-mysql=/usr \ --with-idgard=/usr/local --enabletracks-vars \ --with-system-regex make make install To enable the connection between Midgard and the Apache webserver, the configuration file normally found in /etc/httpd/httpd.conf has to be expanded by a few lines (see box). Some of these new lines should already have been added by the procedure we’ve already outlined, but do make sure that these have been entered at the right place and not, for example, in an/ifdef/block. Finally we need to deal with the Midgard database and the websites (see box). After a new log-in to the database, using the command mysql -u midgard -pmidgard midgard, this time as user ”midgard”, we enter the two webhosts: mysql> update host set name=’localhost’, online=1, port=8101 \ where id=1; mysql> update host set name=’localhost’, onlne=1, port=8099 \ where id=2; All that is left now is to copy the webserver data. The file midgard-root.php3 specifies the basic structure of a Midgard page and should be moved into its own directory: mkdir -p /usr/local/midgard/root mv /usrlib/apache/midgard-root.php3 \ /usr/local/midgard/root/ Using cp -r htdocs /usr/local/midgard/ we can then copy the graphics for the pre-installed Midgard sites and start the Apache server again, but that’s it. All being well, you should find sample website http://localhost:8099 and an administration website at http://localhost:8101.
<Directory /usr/local/midgard/oot> require valid-user AuthName Midgard AuthType Basic </Directory> NameVirtualHost localhost:8101 Listen localhost:8101 <VirtualHost localhost:8101> ServerName localhost Port 8101 DocumentRoot /usr/local/midgard/htdocs </VirtualHost> NameVirtalHost localhost:8099 Listen localhost:8099 <VirtualHost localhost:8099> ServerName localhost Port 8099 DocumentRoot /usr/local/midgard/htdocs </VirtualHost>
Instllation of the Midgard database $ tar xvzf midgard-data-1.2.5.tar.gz $ cd midgard-data-1.2.5.tar.gz $ mysqladmin create midgard $ mysql midgard < midgard.sql $ mysql mysql mysql> insert into user (host, user, password) \ values (‘localhost’, ‘idgard’, password(‘midgard’)); mysql> insert into db (host, user, db, select_priv, \ insert_priv, update_priv, delete_priv) \ values (‘localhost’, ‘midgard’, ‘midgard’, ‘y’, ‘y’, ‘y’, ‘y’); mysql> flush privileges;
For access to the latter you need to enter a user name of ”admin” and a password of ”password”.
Now the fun starts To show you how the whole thing works, let’s create a simple dynamic site – a Midgard Club homepage. Our ”Club for Midgard Users”, CMU for short (you can guess why we didn’t opt for Midgard User’s Club as a name), wants to provide general information about itself, news about the club and the dates of special events. 4 · 2001 LINUX MAGAZINE 75
074midgard.qxd
22.11.2000
9:52 Uhr
PROGRAMMING
Seite 76
MIDGARD APPLICATION SERVER
The club’s committee are an impatient lot, so let’s get straight down to business and use our browser to call up the Midgard admin-site, http://localhost:8101. As you’ll see, navigation is easy and detailed information just about everything is available (see Figure 1). We’ll start by setting up some users – this is easily done using the ”New Person” option. Next we’ll set up a new group for the administrators of the site using the ”Group Administration” option. Having selected this option, clicking on ”New group” displays an input form in which we can enter information about the administrator group. As a name, we’ll select ”CMU-Admis”, and at the bottom, in the member list, we can allow any or all the people we set up previously who we want to act as administrators. Since the layout defines important elements of our new club site, the next thing to do is establish a main style that will apply for the entire website. This is made easy for us thanks to the ”New top level style” option in ”Layout Administration”. We only have to give it a name, so it seems sensible to select ”CMU-Layout”. Now we need to define a new host for the application logic. To do this, we go to ”Host Administration” and click on ”New host”. Let’s name our host ”CMU-Site” and specify that it should be accessible on local host, Port 8110. We set the status to ”online” and the authentication to ”not necessary”. As owners of the site we also select the ”CMU-Admins” and the style ”CMULayout”. The ”Root Page”, in other words the start page for our application, is created from new with ”new root page”. This then also gets named ”CMU-Site”. We also, of course, have to attach this new host to the Apache server. To do this, before restarting the server, edit /etc/httpd/httpd.conf as follows:
the three main topics – ”Info”, ”News” and ”Events”, as a New subtopic” under ”CMU Content”. Other settings can be kept the same as the parent topic using the ”same as parent” option. At this point we can start filling the individual topics using the ”New article” option. In the article fields, bear in mind that the title entered will later appear as the title of the HTML page, but the name has merely internal significance. For the articles on events, the fields ”Start date” and ”End date” can be used in order to show the start and end of the event. By entering to or three articles per topic, you can get yourself a bit of practice in handling the administration interface. All we need do now is program the application logic, which ensures that our carefully updated contents also appear in the appropriate places of the website. To this end we’ll set up the sub-pages to which the links from the root page refer to, in each case as a ”New subpage”. As a name, the respective link name should be entered ”info”, ”news” or ”events”. For the title we can enter meaningful phrases, and again we can inherit the style from the
NameVirtualHost localhost:8110 Listen localhost:8110 <VirtualHost localhost:8110> ServerName localhost Port 8110 DocumentRot /usr/local/midgard/vnm </VirtualHost>
<? } else { ?>
We’ll also want to change the sample information pre-configured in the Root Page, and to do this we just click on the ”Modify” link. Here we’ll change the title to ”Welcome to the CMU!” and enter the content from Listing 1. Now we come to the content; on the starting page, represented by the Midgard Root Page, we offer links to club info, news and events. All these contents can be filed, thanks to the comprehensive data model, as normal Midgard articles. Midgard organises articles hierarchically into ”Topics” and in this way builds a contents tree. Let’s create such a tree called ”CMU-Content” owned by ‘CMUAdmins” in ”Content Administration” using the ”New top level topic” option. We can then set up 76 LINUX MAGAZINE 4 · 2001
Listing 1: Starting page <h1>Welcome to the CMU!</h1> <p><a href=”/info”>info</p> <p><a href=”/news”>news</p> <p><a href=”/events”>events</p>
Listing 2: Display of current events <? if ($article) { ?> <h1>&(article.title);</h1> <p>&(article.alcalendar);<p> <p>&(article.abstract);</p> &(article.content:h);
<h1><(title)></h1> <!— Sort events by calendar date —> <? $calendar = mgd_list_topic_calendar_all(17); if ($calendar) { while ($calendar->fetc()) { ?> <p> &(calendar.acalendar);<br> <strong><a href=”&(calendar.id);.html”>&(calendar.title) ;</a></strong><br> &(calendar.abstract); </p> <? } } } ?>
074midgard.qxd
22.11.2000
9:52 Uhr
Seite 77
MIDGARD APPLICATION SERVER
parent site. As we want to use some PHP for these pages, in order to read the events from the database, for example, we must set the type to ”active”. With us so far? Good. Now, using the events page, we can learn about programming with Midgard: The content of the events page ”events” is to be taken from Listing 2. In this code, a check is first made as to whether the object is defined as an $article or not. If it is, some HTML is created from its fields ”title”, ”alcalendar” and ”abstract”, in order to display the appropriate article. ”&(object.field);” is the Midgard syntax for quickly calling up information on a Midgard object. In article.content ”:h” has also been appended in order to show that this field contains HTML, which must be interpreted by the browser. Without an ”:h” the field content would be displayed word for word, including the HTMLtags. On opening the ”Events” page the user should be given a list of events to choose from, so he has yet to select any specific articles. In this situation the else-branch is executed. Next, the page title, as entered in the host administration, is displayed. After that all calendar contents are queried under the topic ”Events”: $calendar = mgd_list_topic_calendar_all(17);
PROGRAMMING
Listing 3: code-init <? if ($argc == 1) $id = $agv[0]; if ($id && !mgd_is_article_in_topic_tree(17,U $id)) $id = 0; if ($id) $article = mgd_get_article($id); if ($article) $author = mgd_get_person($article->author); ?> The parameter ”17” is the numerical identifier of the topic ”Events”. Such identifiers are created when topics and articles are created and therefore differ depending on the user. The correct identifier can be found by displaying the corresponding topic in the content administration. With the while loop, we now get $calendar to show us articles. Using $calendar->fetch we then call the next article and output its ”acalendar” (date) and ”title” fields, using a link to an URL consisting of its ID with the suffix ”.html”. So, if the user clicks on ”/events”, on the link to the event with the ID ”22”, the page ”/evnts/22.html” will be queried. Midgard reacts to this by again calling the active content of the page ”events”, but this time with the additional parameter ”22”. The next step is therefore to ensure that article No. 22 is retrieved and its data is filed in the object $article mentioned above. We file the logic necessary for this in a page element of the
Figure 1: Simple administration by web browser
4 · 2001 LINUX MAGAZINE 77
074midgard.qxd
22.11.2000
9:52 Uhr
PROGRAMMING
Seite 78
MIDGARD APPLICATION SERVER
site ”Events” named ”code-init”. This page element is always executed before the actual page content is dealt with (see midgard-root.php3) and can therefore pre-process $article. To store the page element we click on the Host Administration of the page /events on ”New page element” and enter the title ”code-init” and the content from Listing 3. First we check whether a parameter is available and store this in $id. For security reasons a check is then made as to whether this ID does in fact belong to an article from the part-tree ”Events”. If everything is correct, the function mgd_get_article ensure that its data is retrieved and stored in the object $article. The data on the article’s author is filed in $author. And that’s it! A visitor to our site will find a list of our events and at a click of a button can get further information. The calendar logic of Midgard, by the way, automatically drops events on dates prior to the current one. So now all we’ll ever have to do is regularly update the events using content administration, so that the homepage of our club is always able to provide the latest information. The pages for information and news of our club can be created in a similar manner to the events page but will use a different topic ID. As you can plainly see, developing dynamic websites with Midgard is really easy: Once you get used to web administration, creating a website from database contents and a separate layout will take you very little time. And if topic or article structure provided suffices for your own purposes, you won’t even have to worry about even one single SQL instruction, sidestepping a potential trouble-spot. Having said we’ve finished, though, we have to admit that our site is a bit lacking in style. This is Figure 2: A wide range of layout styles can be used with Midgard
78 LINUX MAGAZINE 4 · 2001
what Layout Administration is for (Figure 2), though, and we’ll leave it to you to create something individual for your CMU test site. In doing so, note that layout can, starting from the ROOT” element, be broken down into building blocks known as „Style elements”. Subordinate elements are then simply integrated in the form <[element]>.
Midgard evolution In order to prevent Midgard’s data model from acting as a restriction, the Midgard development team is currently working on a data model that can be expanded as required. The current developer versions already contain support for inary data (BLOBs) and sophisticated calendar management (for example for assigning people to events). If several Midgard hosts are running on one server they must each be administered separately. After all, a host administrator or even a customer should only be able to access his own data. With the site group concept, which made its debut in Version 1.4 beta, this is now possible without any problems. Another task that the Midgard developers are working on is a universal database interface. While Midgard at present only supports mySQL, for Version 2.0 of the application the choice is expected to be extended to cover a wide variety of databases and even other backends, such as LDAP. This is all very exciting, and also very useful, so this Web Application Server undoubtedly has a very interesting future ahead of it. ■
080smpbasics.qxd
21.11.2000
17:21 Uhr
FEATURE
Seite 80
SMP PRINCIPLES
Symmetrical Multiprocessing under Linux
MORE DILITHIUM CRYSTALS FOR THE WARP DRIVE BERNHARD KUHN
Despite the fact that amazingly fast processors are now available, some situations require more power than even 1GHz or faster CPUs can offer. The solution, of course, is to link more than one CPU together. More complex hardware arrangements mean higher the demands on the operating system and its programmers, however, as you'll find out here.
Multiprocessor systems can be used to great effect in many ways (see box). In the simplest case, several users are logged onto the same multi-processor computer (via X-terminals, for example) and running programs that are not themselves optimised for multiprocessor machines. In such a case the kernel scheduler must distribute user processes optimally over its available CPUs. But if the machine is only intended to deal with a single task, its implementation must be done in parallel in order to be able to make use of all the processors. 80 LINUX MAGAZINE 4 · 2001
The Linux kernel offers two system calls for this; fork() and __clone() fork() creates one copy each of code, data and stack elements of the process to be retrieved. Communication between the processes can only occur with the aid of shared memory and IPC calls – both of which are complex and greedy for computer time. For this reason, __clone() allows child processes to run in the same address space as the parent process, but each child needs its own stack. Listing 1 shows a simple example of this. The processes here follow notional parallel-running “threads”.
POSIX Threads The distribution of tasks is only the beginning: Threads sometimes have to be able to synchronise themselves, maybe to protect against accesses to critical resources by other threads. This is done with the aid of what's known as semaphores and mutexes. To make the programmer's life easier, Xavier Leroy has developed a Linux Thread Library, the basic functions of which conform to POSIX 1003.1c. This implementation does have its drawbacks compared to commercial Unix systems. For a start, threads are suposed to display the same process number (PID) in the process table as the parent process (using the flag CLONE_PID), but the Linux kernel doesn't withstand this, as large parts of
080smpbasics.qxd
21.11.2000
17:21 Uhr
Seite 81
SMP PRINCIPLES
the system assume that each process number has been issued only once – a minor, but significant flaw. A much more serious problem is the fact that threads are controlled as regular processes and therefore have to be taken into account in every kernel scheduling cycle. Other Unix systems allow the POSIX Thread Library to administer the partial tasks in the user space – with correspondingly lower context interaction times (there is only one regular process per processor and application). The Linux kernel developers, however, have foregone this performance-enhancing feature in favour of stability: simpler implementation makes for more robust code.
Kernel Threads for the user space Apart from user space processes and threads, tasks relating to the system can also be performed in the address space of the kernel, where the context interaction times are considerably shorter. In this case there is no need to reprogram the memory management unit. The “kernel applications” (for example kflushd and kswapd) are in fact controlled in the regular process table, but are given preferential treatment – if there is work queuing for them. Although spectacular performance is possible using kernel threads, the kernel web server “tux 1.0” being a good example, “true” applications should always be laid out as user space program for the sake of system stability. In addition, as we've mentioned elsewhere, the kernel thread API does not conform to POSIX and thus makes it harder to port applications.
FEATURE
Behind the scenes Every processor has its own kernel scheduler, which differs only slightly from that of a single processor system. If one processor is always more heavily loaded than another one, processes are automatically redistributed. There are patches to bind processes permanently to processors, though. The rumor on the mailing lists at the moment is that this “processor-set
Listing 1: Clone Demo /* clone.c, compile with */ /* gcc -o clone clone.c -D_REENTRANT */ #include sched.h int loop(void *arg) { /* determine number of clones */ int x=(int)arg; /* Closed loop */ for(;;) printf("%i\n",x); }; main() { /* Stacks for the clones */ void* stack1[4000]; void* stack2[4000]; /* activate clones */ __clone(loop,stack1+4000,CLONE_VM,1); __clone(loop,stack2+4000,CLONE_VM,2); /* Closed loop */ loop(0); };
Symmetrical Multiprocessing or Cluster Computing? Algorithms to run distributed processing in parallel are only half the story. It matters at least as much whether lot of data is to be exchanged between the processing units or not. The computer system needed for a computer animation, for example, might use what's known as a “render farm”. This consists of individual computers linked by Fast Ethernet (a loosecoupled cluster). A computer used for weather simulation is likely to be the completely different, however. Because of the way finite element analysis works, massive communication needs to takes place between processing nodes so such tasks can only be run on multiprocessor systems. Indeed, since the node to node communications requirements are so high, only multiprocessing supercomputers can handle this kind of job, the Wildfire GS320 supercomputer, for example, offering node to node data transfer rates of a stagering 51.2GB/s. It therefore makes sense to use multiprocessor systems if the applications can actually be run in parallel, but do not permit distribution over several computers. The classic Apache Webserver is a good example of this: the parent process launches several child processes, which wait for incoming HTTP requests and respond to these independently of each other. This means that exactly as many queries can be processed at the same time as there are processors available. This task could of course also be dealt with by a cluster of cheaper single computers, but with an upstream load-balancer and downstream server for the common database, performance can go through the floor: high I/O performance is also a benchmark for a good SMP system. Classic Unix systems are another good example of the domain of application for multiway computers: many users can log onto a server and start their applications via an X-terminal. The operating system itself then takes care of load distribution.
4 · 2001 LINUX MAGAZINE 81
080smpbasics.qxd
21.11.2000
17:21 Uhr
FEATURE
Seite 82
SMP PRINCIPLES
Fig. 1: Comparison between Giant Lock in kernel 2.0, Spin Lock in kernel 2.2 and Read Write Spin Lock in kernel 2.4 (see text).
MESI and APICs make for cache coherence and exchange of messages.
scheduling” will get into the next developer kernel (Version 2.5). With the exception of the scheduler, by the way, the processors share all the data structures in the kernel. Unlike a single processor system, though, the process structure in an SMP kernel contains two additional items, these relating to the processor to which the application was most recently assigned. In addition to everything else, a protection mechanism has to be in place in multi-CPU systems for what's known as “critical areas”. Device drivers in particular have such areas, which are simply code fragments that, during their execution, access system resources – the program sequence for initialising a DMA transfer is a good example of this. If this type of code fragment were to be run on more than one processor at the same time, the most likely outcome would be a system crash.
Giant Lock: the tale of the slow Linux SMP Symmetrical multiprocessing in the Intel IA32 With only a few exceptions, all Linux platforms offer SMP support. The essential basic features of the hardware requirements are covered in the Intel Multiprocessor Specification (MPS) 1.4: • Cache coherence • Inter-processor communication Cache coherence mean that a specific piece of data in the cache of any CPU displays the same value. This means that if an altered value is written back to the main memory, then the other processors, with the aid of the MESI protocol (named after the four statuses Modified, Exclusive, Shared and Invalid), check to see whether the data is in their cache and, if appropriate, take on the new value. The so-called “local APICs” take care of inter-processor communication: each CPU has an Advance Programmable Interrupt Controller, and with its help can trigger an “Inter Processor Interrupt” in another processor. This is done in order to show that a new message is waiting for it (maybe to initiate a re-scheduling). According to MPS v1.4 this means a maximum of 16 processors can talk to each other. In addition to this, an I/O-APIC integrated in the host bridge announces peripheral interrupts queuing to one or more processors.
82 LINUX MAGAZINE 4 · 2001
In kernel version 2.0, the protection of critical areas was achieved by means of a simple trick: At any time, only one processor was able to be active at kernel level – other CPUs were temporarily prevented from entering kernel mode (see Figure 1). This “Giant Lock” mechanism had a particularly bad effect on system performance when running I/Ointensive applications since in such cases the processes might need to be in kernel mode especially frequently. For this reason mechanisms were introduced in kernel 2.2 that only block a processor if it wants to go into a critical area that at that same moment is being processed by another CPU.
Atomic Operations One critical area, for example, is the manipulation of a value. The C-Compiler will interpret the instruction cnt=cnt+1 as follow: “Read value from memory, add 1, then write value back”. If two processors do this at the same time then there could well be a problem, with the resulting value of cnt
080smpbasics.qxd
21.11.2000
17:21 Uhr
Seite 83
SMP PRINCIPLES
FEATURE
Cache in on multiple processors In practice, one hundred per cent increases in performance in dual processor systems compared to single processors ones are normally only achieved when running server applications. In theory, however, it is even possible to more than double the speed. This is because n processors have n times as much cache memory as a single CPU, and in cyclical processes, this therefore makes displacement of data more unlikely. For example, each byte of a 4 Mbyte field is to be increased cyclically by the value 1. If only one processor with one megabyte of cache handles this task, then the fast buffer memory is practically ineffective. But, if the task is distributed over four CPUs, then each processor keep its “Working Set” completely in the cache and executes the operations at a corresponing faster speed.
not being as expected. In order to prevent this effect, assembler instructions an enable “atomic execution”, which means the manipulation cannot be interrupted. The code for the above example can be found in the kernel file /usr/src/linux/include/asm-i386/atomic.h: static __inline__ void atomic_inc(atomic_t *v) U{ __asm_ __volatile__(LOCK "incl %0" : "=m" (v->counter) : "m" (v->counter));} Source and target are in the memory and are processed by only one command – so no other processor has a chance to disturb the manipulation.
Spin Locks: in the queueloop Frequently, critical areas of a more complex nature are executed as atomic operations, our DMA transfer code sequence mentioned previously is a good example of this. Each of these critical areas is assigned what's known as a Spin Lock: If a processor goes into a critical area, the lock is (atomically) activated. If the lock was already occupied by another processor, then the CPU affected checks the lock continually in a program loop, until the critical area has been left by the other processor and the lock has been deactivated. The processor does squander valuable computing time in the queue loop, but normally the block is much too short to make it worthwhile transferring other tasks from the CPU.
Read Write Spin Locks Very often, processors dealing with critical areas only need to read data – this can obviously be done by several CPUs at the same time: for this purpose a rwlock is able to block only processors which want to actively write in the critical area. This fact was all but ignored by the driver developers with kernel 2.2 and Read Write Spin Locks were therefore seldom used. This was remedied in 2.4 and therefore is another reason the later kernel can offer better performance – particularly in computers with eight or more processors.
SMP in practice The increase in speed brought about by the use of several processors largely depends on the application. In a dual-Celeron system, for example, the Skyvase-Benchmark (pvmpov) runs some 60 per cent faster than with just one CPU. With the kernel compilation option MAKE=”make -j3” this can be increased to as much as 90 per cent. Under some circumstances two processors can, as the result of caching effects, even end up being be more than twice as fast as a single processor (see box - Cache in on multiple processors). Linux SMP has a great deal to offer and can increase application execution speeds, particularly server applications, to a greater extent than you might think. Its development is far from over, though, and you can expect to see enhencements in future kernel releases that will make it even more efficient. ■
Further reading Linux-Threads FAQ: http://pauillac.inria.fr/~xleroy/l inuxthreads/faq.html Linux-SMP HOWTO: http://www.irisa.fr/prive/dmen tre/smp-faq/smp-howtohtml Intel MPS v1.4: http://developer.intel.com/desi gn/PentiumII/manuals/ ■
Mutexes, Semaphores and Status Variables Mutexes MUTual EXclusions serve to reserve resources exclusively for threads. By doing this a mutex can only ever be acquired by a single thread – if additional threads attempt to claim this mutex for themselves (pthread_mutex_lock), they will be blocked until the current claimant releases the mutex again (pthread_mutex_unlock). The fact that acquisition occurs atomically (see later) also ensures that only one thread can ever occupy a mutex at any one same time. Condition variables Condition variables serve to await the onset of specified conditions and/or to display their fulfilment. They are therefore used to synchronise threads. Condition variables are linked to mutexes in order to ensure that he conditions can only ever be altered by one thread at a time. Modification of the condition variables is reported to the waiting threads with pthread_cond_broadcast() with the aid of pthread_cond_wait . Semaphores Semaphores (or lighthouses) are the more general versions of Mutexes and condition variables. Unlike mutexes, semaphores don't just allow two conditions (acquired/released), but as many as required, where the following counting operations are allowed: • atomic incrementing he counter by one followed by waiting until value becomes zero again • atomic decrementing the counter Semaphores were originally developed to avoid the problem of “lost signals”.
4 · 2001 LINUX MAGAZINE 83
084wgs320.qxd
22.11.2000
10:04 Uhr
FEATURE
Seite 84
SUPERCOMPUTING
Linux and Compaq's GS320 Server
GREASED LIGHTING PETER RIVAL
Venturing beyond servers, computing clusters and embedded systems,Linux now reaches new domains – super computing! After several announcements from Hewlett Packard (SuperDome),SGI (Origin 3000-IA64) and IBM (Numa-Q), Compaq/DEC is one of the first manufacturers to demonstrate Linux running on a super computer platform.
The behemoth stands almost 2 meters tall and 3.5 meters wide and weighs in at over 2000 pounds. Its green panel reads "Cpu-32 Mem-256 Pci-64". Then you realize that it's running Linux. As disk lights blink and the two large drum fans hum, the reality of Linux in the enterprise hits home. The system is certainly a far cry from the 80386-based PC that Linus Torvalds first used to write Linux. But then, Linux today is a far cry from the first version posted all those years ago.
The Hardware Compaq first introduced the AlphaServer GS series earlier this year as the new high-end of their AlphaServer line. Architecturally, the system is a unique mix of supercomputer and general business computer. It is the first ccNUMA (cache-coherent Non-Uniform Memory Access) system in the AlphaServer line, eschewing the traditional SMP model for the scalability advantages of a NUMA 84 LINUX MAGAZINE 4 · 2001
architecture. The higher CPU count, memory capacity and I/O bandwidth also represent quantum leaps forward in the AlphaServer line. Perhaps the most unique aspect of the new GS series is the completely modular "building block" design, enabling greater scalability and making future upgrades easy. The cornerstone of this modularity is the Quad Building Block, or QBB. Each QBB contains up to four Alpha EV67 CPUs, four memory modules containing up to 8 GB each, an I/O port, a Global Port for attaching to other QBBs and a high-speed switch to connect all of these modules together (see Figure 1). The EV67 CPUs currently clock at 731 MHz, with upgrades in the near future to over 1GHz. Each QBB with attached PCI I/O drawer, is fully capable of running a separate instance of Tru64, OpenVMS or Linux. One of the most critical design decisions in the QBB is that there is no tradeoff between CPU slots and memory slots as is common in many high-end systems - a fully
084wgs320.qxd
22.11.2000
10:04 Uhr
Seite 85
SUPERCOMPUTING
configured QBB can have the maximum of both CPUs and memory. Each QBB provides 6.4 GB/sec of memory bandwidth, 1.6 GB/sec of I/O bandwidth and 17.6 GB/sec of raw interconnect bandwidth. Two QBBs communicate directly through their Global Ports. When connecting more than two QBBs a high-speed, low-latency Hierarchical Switch is used. This switch provides many critical functions, including maintaining a cache coherency directory and enforcing hardware partitions. The bandwidth between two QBBs is 1.6 GB/sec in each direction. The bandwidth increases by a factor of four with each QBB added; a fully configured GS320 provides an aggregate bandwidth of 51.2 GB/sec. The two-level switch hierarchy is responsible for the linear scalability of per-CPU bandwidth, as compared to standard bus-based systems where the more CPUs that are added, the less memory bandwidth each has available to it. This switch hierarchy is then matched with a highly scalable memory interleave strategy, aggressive memory resource scheduling and aggressive data link bandwidth management to provide a huge memory system bandwidth with a capacity to handle hundreds of outstanding references. Because of this design, the impact of remote memory accesses to be lower than many other ccNUMA products - just under a factor of 3:1 over local memory access (330 ns local access latency vs. 960 ns remote latency). These components are impressive separately, but when integrated into a fully configured GS320, they bring their separate technologies are consolidated. Combined with the QBB and Hierarchical Switch in a complete system are a fully redundant and hot-swappable power subsystem, a collection of master and slave PCI drawers including software power control and a host of environmental controls to help ensure peak availability. A comparison of various GS series configurations can be found in Table 1.
The Software "I remember being intimidated by a machine that takes 15 minutes to power-up, and has a console that manages consoles". Perhaps this sentiment, by Jay Estabrook of Compaq, sums up the state of Linux on massively scalable systems at this point particularly in light of the fact that the porting work has been completed. The system is currently being used for performance and NUMA optimization work, the impact of which should soon be seen in the Linux kernel itself. Initially, the porting work was spurred on by an encounter at CeBIT in Germany between Andrea Arcangeli, Anas Nashif and Stefan Fent of SuSE and David Mitchel of Compaq. It just so happened that a prototype GS system normally used for training was available and all of the players were able to join together. Joining Andrea, Anas and Stefan were Jay Estabrook and Larry Sendlosky of Compaq. The
FEATURE
whole process of reaching a complete boot on this system took only a single week of full time work. As Andrea mentions, "I finally reached the alpha userspace for the first time using an ATAPI bootable CDROM in the last hour of the last day we had available". From this initial success, more work was still to be done to get the kernel to boot correctly on a revenue-class system configured with 16 CPUs and 16 GB of memory. At this point, this was the largest single Alpha system Linux had ever attempted to boot on. Finally, after a few weeks of work and some hands-on help from the GS series architects, a GS160 was fully useable under Linux. It was believed by most that knew of the achievement at the time that this was about as high as Linux would scale without heavily involved re-architecting of core components of the kernel. At this point, sights were set on discontiguous memory and proper NUMA support. Just as coincidentally as the original port had started, the author was asked if he would like to try Comparison of System Features Feature GS80 QBBs 2 CPUs 8 Partitions Supported 2 Memory (GB) 64 Bandwidth (GB/sec) 12,8 PCI boxes/slots (64 bit) 4 / 56 Bandwidth (GB/sec) 3,2
Figure 1. Quad Building Block Components (CPU-Board and Memory-Unit)
GS160 4 16 4 128 25,6 8 / 112 6,4
GS320 8 32 8 256 51,2 16 / 224 12,8
4 ¡ 2001 LINUX MAGAZINE 85
084wgs320.qxd
22.11.2000
10:05 Uhr
FEATURE
Seite 86
SUPERCOMPUTING
Figure 2. Eight QBBs connected via hirachical switches. With this configuration, Linux is able to manage 32 CPUs and 256 Gigabyte of main memory
Read Further The initial boot log of Linux on a GS320 can be found here: http://www.alphanews.net/?o p=displaystory&sid=2000/8/28/ 141244/404 More information on the AlphaServer GS series can be found here: http://www.compaq.com/alph aserver/gs_series.html
to see if Linux would boot on a prototype GS320. Never one to pass up an opportunity such as this, a bootable disk was quickly created and the first attempt was quickly made. After several painful minutes as the system built up various memory management maps and other tables for a system of this size, a login prompt was on the screen. Despite even the most hopeful assertions that some changes would be necessary, the same kernel that had booted on a GS160 worked cleanly on a fully configured GS320.
Future Directions Even as the computer industry continues to grow and shift at a blindingly rapid rate, Linux seems to grow and shift at an even faster rate. While simultaneously making strong inroads into the handheld and embedded markets, Linux is quickly
■
The Author Peter Rival is a Software Engineer at Compaq Computer Corporation. He spends most of his time trying to wring cycles from the Tru64 and Linux kernels, as well as being a Linux advocate both within and without Compaq. He can be reached at frival@zk3.dec.com.
[root@sundown2 /root]# cat /proc/cpuinfo cpu : Alpha cpu model : EV67 cpu variation : 7 cpu revision : 0 cpu serial number : system type : Wildfire system variation : 0 system revision : 0 system serial number : cycle frequency [Hz] : 730794500 timer frequency [Hz] : 1000.00 page size [bytes] : 8192 phys. address bits : 44 max. addr. space # : 255 BogoMIPS : 1488.97 kernel unaligned acc : 0 (pc=0,va=0) user unaligned acc : 0 (pc=0,va=0) platform string : Compaq AlphaServer GS320 6/731 cpus detected : 31 cpus active : 31 cpu active mask : 00000000ffffff7f Impressive: cpuinfo of a GS 320
86 LINUX MAGAZINE 4 · 2001
evolving into a strong contender in the enterprise market. While still lacking some of the enterprise reliability and management components of other commercial UNIX offerings, the availability of Linux on such high-end systems as the GS320 and those from IBM, HP, SGI and Sun should help to rapidly increase the development of such tools. Still to come for the GS series is support for discontiguous memory and NUMA optimizing various critical parts of the Linux kernel. Despite the fact that Linux runs on a GS320, and in fact is quite useable, the system will not be ideally used without supporting these critical technologies. While Compaq has currently not committed product support on the GS Series, Linux running on such high-end systems provides a base for further enterprise capability development and hopefully help Linux on all systems large and small. In particular, Compaq will make use of Linux on the GS320 to analyze aspects of Linux such as lock scaling and algorithm assessment. These investigations should lead to advances in both performance and stability even in smaller systems. For example, locking designs that do not scale at the high end also usually are not scaled well on lower-end systems, but while the impact is less noticeable it is usually still present. Also, with all of the RAS features inherent in the GS series, this presents a prime opportunity to extend the support for advanced technologies such as hot-swap and hot-add components as well as system and application partitioning. The Compaq AlphaServer GS320 has been designed with scalability and reliability as core components. In introducing the GS series of Alpha servers, Compaq has extended the high end of their server line to a new level. Linux support of this architecture will provide a critical opportunity for enhancing enterprise-level RAS features in Linux as a whole, as well as helping to bring Linux to new levels of scalability. Even as fast as the computer industry is moving, Linux is more than keeping pace. ■
087UserIntro.qxd
21.11.2000
17:30 Uhr
Seite 87
CONTENTS Welcome to the LinuxUser section where we focus on beginners' topics and interesting software packages for Linux. Have you ever needed to repartition your hard drive to allow for Linux installation? GNU Parted, a fairly new partitioning tool, is much more than the usual fdisk clone you get on most operating systems. Its specialty: Parted will resize DOS/Windows FAT and Linux ext2 partitions. What else do we have for you in this issue? tear is a command line MP3 creation tool, that automatically rips your audio CDs. It will also fetch the artist and track name data from a CDDB server to set correct MP3 tags. Have a look at new GNOME programs in our Gnomogram section, and learn how to work with RPM and Debian packages. Software installation is so much easier when you know the tricks of the trade. Before leaving you to digest this issue's articles, we'd like to make a request – please send us feedback. What do you think about the LinuxUser section? What other topics or aspects would you like to see covered? Check the cover CD-ROM for some really useful files. Many articles in this section have a CD-ROM icon to indicate you will find program sources or installable binaries (RPM packages) in the LinuxMagazine subdirectory. Enjoy the LinuxUser pages, Hans-Georg Esser hgesser@linux-user.de
88 BEGINNERS
107
88 KDE themes workshop part 3 Here's more of our series describing how to alter the appearance of KDE by tailoring and making desktop themes. Here we cover implementing sounds into your themes.
107Gnome News and Programs It's been busy in the world of Gnome and here's where you'll find the latest news and programs for one of the most popular graphical interfaces. 110KDE 2.0 The latest version of KDE is here and we take an in-depth look. It's based on a raft of technologies that interlock to provide a seamless user experience – unlike earlier Linux (and Unix) desktops – and promises much. 117Explore2fs If you dual boot with Windows then you may be faced by the familiar problem of accessing Linux partitions when running Linux. Explore2fs is the solution – read about it here. 120Out of the box Every month we search out the best utilities that your Linux system is simply incomplete without. This time we take a look at tear, a useful MP3 creation tool. 121K-Splitter All the gossip and news from the world of KDE, including the pitfalls involved in downloading version 1.92 of KDE, codenamed Korner, and how Gnome and KDE developers don't hate each other after all.
95 GNU Parted Although many Linux users consider themselves brave, mention partitioning and they'll run a mile. Luckily Parted can come to the rescue – learn how to use it here. 100Packet installation So you've installed Linux afresh and are getting on fine. But new packages are released every day – how can you keep up to date? Here's our guide to Debian and other distribution packet managers. 104On command Few true Linux lovers can avoid using the command prompt, despite XFree86 making life easy. So here's guide to processes, including ps, kill and consorts.
SOFTWARE
4 · 2001 LINUX MAGAZINE 87
088kthemes3.qxd
22.11.2000
10:28 Uhr
SOFTWARE
Seite 88
WORKSHOP: KDE THEMES
KDE Themes Workshop, Part 3
ON THE EMPEROR’S NEW CLOTHES BY HAGEN HÖPFNER
KDE’s ability to alter its appearance rapidly by means of so-called themes is probably fairly well-known by now. This series describes how to create your own themes. Theme: The word theme describes a pot-pourri of different audio-visual elements. These all relate to a common theme in terms of content. A rock group fan could combine a digitised photo of his/her favourite band as a background image with parts of their music as acoustic signals into a theme. Desktop Environment: Under Linux there are several graphical desktop environments in existence (the bestknown being CDE, KDE, GNOME). Unlike pure window managers, with which desktop environments are often falsely equated, these usually provide additional functionalities such as drag & drop, session management and a panel bar. .wav-Format: WAV stands for Wave. It is an uncompressed and thus very memory-hungry form of audio data storage. ■
It is highly likely that before this last part of the series comes out, the first stable version of the Desktop Environment KDE 2 will appear. This article is intended to complete the trilogy on KDE Themes. Themes for KDE 1.1.2 can also be used under KDE 2. This will be discussed briefly at the end of this article. First we shall concern ourselves with the last three items on our to-do list. • Start list • Background image • Icons • Window-buttons • Window-title bars • Window-frames • System sounds • Colour schemes • KFM settings We shall be expanding the file already used in the first two parts in the individual steps, eclipse.themerc (see Listing 1).
And so it goes ... At this point I would like to refer again to the central significance of the KDE Design manager
88 LINUX MAGAZINE 4 · 2001
kthememgr and the file eclipse.themerc. This knowledge is fundamental to the complete series of articles. If your knowledge of these crucial points has already faded somewhat, it’s best to reacquaint yourself with the two previous parts before continuing.
Wired for sound In order to be able to build system sounds into our themes, a basic theoretical prior knowledge of sound processing is helpful. Acoustic signals serve as the background for events on the Desktop. To do this, KDE uses audio files in .wav format. Sometimes files from the Windows(r) world differ from those of (other) operating systems. WAV files under Windows can display a reversed bit arrangement. If one wishes to use such files under Linux, they have to be converted by means of sox windowsfile.wav linuxfile.wav. Audio files can be obtained from a wide variety of sources (Audio-CD, self-recording etc). For recording the sounds, the KDE tool krecord (see Figure 1) can be used. If you want to record sounds with this program, this is how to do it:
088kthemes3.qxd
22.11.2000
10:28 Uhr
Seite 89
WORKSHOP: KDE THEMES
1. Start from krecord by clicking on the corresponding entry in the sub-item Multimedia on the Start menu 2. Start the recording by a left click on the ”Record button” (red spot) 3. Record 4. End recording by a left click on the ”Stop button” (black rectangle) 5. Call up the memory dialog by a left click on the diskette symbol 6. Define the name of the file 7. Store the data in a .wav file by left-clicking the OK button. The raw material (which we have now recorded) must be reprocessed. The KDE tool kwave is used for this purpose (see Figure 2). It’s a good idea to experiment a little with this tool. Once our sounds have now been reprocessed as necessary, we must enter them into our configuration file (cf. lines 064 to 094 in Listing 1). The individual parameters of this section [Sounds] can be found in Table 1. By the way, the system sounds in this sample theme were played direct by guitar. For those interested: The chord which sounds when the logout dialog is called up is a Dm9 (in guitar notation (x x 7 7 6 0)). Table 1: Sounds Section title Activate the system sounds Start the audio server Audiofile for activating first virtual desktop Audiofile for activating second virtual desktop Audiofile for activating third virtual desktop Audiofile for activating fourth virtual desktop Audiofile for activating fifth virtual desktops Audiofile for activating sixth virtual desktop Audiofile for activating seventh virtual desktop Audiofile for activating eighth virtual desktop Audiofile for log-out from KDE Audiofile for message before log out Audiofile for starting KDE Audiofile for activating a window Audiofile for closing a window Audiofile for deiconifying a window Audiofile for iconifying a window Audiofile for maximising a window Audiofile for end when moving a window Audiofile for start of moving a window Audiofile for opening a window Audiofile for end of resizing a window Audiofile for start of resizing a window Audiofile for shading down a window Audiofile for shading up a window Audiofile for sticking on a window Audiofile for ending a dialogue window Audiofile for opening a dialogue window Audiofile for restoring original size of a window Audiofile for unsticking a window
SOFTWARE
Fig. 1: krecord is suitable for recording sounds
Colourful adjustments Many things are simpler than one thinks. So KDE offers a good, dialog-driven colour selection. Figure 3 shows this dialog, which can be found in the start menu under settings/desktop/colours. In the above section, the elements of the
[Sounds] ConfigInstallCmd=enableSounds ConfigActivateCmd=kwmcom syssnd_restart Desktop1=file name Desktop2=file name Desktop3=file name Desktop4=file name Desktop5=file name Desktop6=file name Desktop7=file name Desktop8=file name Logout=file name LogoutMessage=file name Startup=file name WindowActivate=file name WindowClose=file name WindowDeIconify=file name WindowIconify=file name WindowMaximize=file name WindowMoveEnd=file name WindowMoveStart=file name WindowOpen=file name WindowResizeEnd=file name WindowResizeStart=file name WindowShadeDown=file name WindowShadeUp=file name WindowSticky=file name WindowTransDelete=file name WindowTransNew=file name WindowUnMaximize=file name WindowUnSticky=file name 4 · 2001 LINUX MAGAZINE 89
088kthemes3.qxd
22.11.2000
10:28 Uhr
SOFTWARE
Seite 90
WORKSHOP: KDE THEMES
surface can be selected. To do so, select these in a dialog, which appears after clicking on the button with the current colour. If all colours have been set, one can store one’s own colour scheme using the Add button. As shown in Figure 4, by clicking on this button a dialog appears. Here one can enter the name of the colour scheme. The colour scheme is stored and the little name dialog closed by simply clicking on the OK button. A click on the OK button of the colour scheme dialog and our colour scheme is accepted. How do we get this colour scheme into our file eclipse.themerc (cf.: lines 095-109 in Listing 1)? This is very simple. In the directory in which the colour scheme data are stored (~/.kde/share/apps/kdisplay/color-schemes), the file eclipse.kcsrc can be found. We simply attach the content of this file (cf. Listing 2) to our eclipse.themerc. I have deleted the Comment (line with the symbol # at the beginning) in List 1. For the sake of an overview, Table 2 describes the entries in the section [Colours]. The simplest way to create a theme consistent with this article is to copy out by hand the few lines from Listing 1 into the eclipse.themerc.
[top] Fig. 2: kwave is a tool for reprocessing sound recordings
KFM-settings If KDE was ”only” a window manager and thus ”only” concerned with displaying windows, this last point would be superfluous. But KDE is more than just a window manager. It is the basis for a variety of programs for almost every domain of application. KDE programs usually work together better using Drag and Drop than is usually the case with X11 applications. You can search the file system by
[right] Fig. 3: Colour scheme dialog
Comment: Comments serve exclusively as information for those who have to deal in more detail with the content of a file. They are introduced by specific symbols and ignored during the execution or processing of this file. Under Linux/Unix the hash sign (#) is normally used. KFM: //KFM stands for K File Manager and is the standard file manager in KDE 1.x. Drag and Drop: Drag and Drop refers to the dragging of an icon object from one application into another. The target application is given a file, which can then be opened automatically by the latter. ■
Table 2: Colours Section title Text colour for normal text Text colour for selected text Second colour for the Title bar of active windows (colour shade) Colour for text selection Colour for the title bar of inactive windows Name of the colour scheme Contrast Background colour Colour for the title bar of active windows Second Colour for the title bar of inactive windows (colour shade) Text colour for text in inactive windows Text colour of the menu item clicked on Text colour of menu entries Colour of menus
[Colours] foregroundColour selectForeground=Colour activeBlend=Colour selectBackground=Colour inactiveBackground=Colour name=eclipse contrast=Contrast value background=Colour activeBackground=Colour inactiveBlend=Colour inactiveForeground=Colour activeForeground=Colour windowForeground=Colour windowBackground=Colour
Table 3: File Manager Section title Backgroundfile Standard background colour for HTML view Standard Text colour for HTML view Standard colour for Links in HTML view Standard colour for links already visited in HTML view
[File Manager] backgroundImage=file name htmlBackground=Colour htmlForeground=Colour htmlLinks=Colour htmlFollowedLinks=Colour
90 LINUX MAGAZINE 4 · 2001
088kthemes3.qxd
22.11.2000
10:28 Uhr
Seite 91
WORKSHOP: KDE THEMES
SOFTWARE
Fig. 4: Naming the colour scheme
going into the Personal Directory in the Start menu. We’ll now customize this window to our theme. Table 3 contains the necessary details on possible parameters. The corresponding entries in eclipse.themerc can be found from line 110 onwards in Listing 1. Figures 5 and 6 clarify the distinction between a ”themed” file browser and one without special adaptations. Since background images have already been covered in the first part of this series, you should refer to the explanations there. The question of finding the desired colour entries has also already been dealt with in detail.
Fig. 5: KFM without theme adaptations
So far, so good This concludes the series on creating one’s own KDE themes. Figure 7 shows us once more, how our KDE looks with the eclipse theme.
Entering the theme in KDE.THEMES.ORG KDE.THEMES.ORG is an Internet collection (see Figure 8) of KDE themes. Since this series of articles has, hopefully, laid the foundation for the development of many thousands of themes, I will not deny you this last point. This is how to proceed: 1. Register as a user at http://www.themes.org/ newuser.phtml (Figure 9) 2. You will be sent an ID by e-mail. 3. Log in with the ID and your chosen user name 4. Enter the new theme (cf. Figure 10) stating the following information: • Theme Name: Name of theme • Theme Category: Heading under which the theme should be classified. The following headings can be chosen: Animals, Animation, Art, Cartoons, Computers, Engine, Fantasy, Holiday, Misc, Movies, Music, Nature, Operating Sys, People, Pixmap, Places, Plain, Products, Science Fiction, Sports, Uncategorized, Vehicles, Video Games, and Web Sites. • Theme Description: description of theme • Screenshot File: screen shot of the display with the theme (see Info on shooting screen shots)
Fig. 6: KFM with theme adaptations
• Theme File (xxx): TAR-Archiv of the theme packed with gzip. 5. Press the Submit button and ... 6. ... send an e-mail to everyone you know, telling them a brand new, really wild theme is now available for downloading.
Info: Shooting screenshots To shoot screen shots one can use, what else, e.g. ”The Gimp”. This is how to proceed: 1. Start ”The Gimp” 2. Start the screenshot dialogue via file/get/screen shot... 3. Select record entire screen 4. Click on the Record button 5. Save the file as a .jpg file
TAR-Archiv: tar is a program which was originally intended to perform data back-ups on a tape drive. But in addition it also offers the option of archiving a number of files combined into a single one. In this procedure no data compression is performed. To save space, such archives are usually still compressed using gzip or b2zip. ■
4 · 2001 LINUX MAGAZINE 91
088kthemes3.qxd
22.11.2000
10:28 Uhr
SOFTWARE
Seite 92
WORKSHOP: KDE THEMES
Deleting themes Sadly, kthememgr is unable to delete themes cleanly. Hence the individual images have to be deleted by hand before changing the theme. This is done by means of the three commands:
Fig. 7: KDE 1.1.2 with our eclipse theme
rm ~/.kde/share/icons/* -rf rm ~/.kde/share/apps/kwm/pics/* rm ~/.kde/share/apps/kpanel/pics/* -rf Don’t worry, the Design manager keeps a copy of the files. If the theme is reused they are available again.
KDE 1.1.2 Themes and KDE 2
[top] Fig. 8: KDE.THEMES.ORG – Starting page [below] Fig. 9: KDE.THEMES.ORG Make new user
If it has not already happened by the time this issue of is published, then it will certainly happen in the foreseeable future: KDE 2 will supersede KDE 1.1.2. At the time of writing, I’m already using the truly stable KDE Version 1.92 (Beta 3). This version now also supports Widget themes, which you may already know from GTK toolkit. Since this widget
support was not yet available in KDE 1.1.2 and the options arising as the result are enormous, let’s leave this to one side for the moment. Sadly I do not yet know of any additional tools for transferring complete themes simply. Therefore we’ll go the manual route.
integrating the background image In order to integrate our background image in KDE 2, this is what to do: 1. Call up the background-dialog via the start list and following sub-items: settings/display image/desktop/Background 2. Change to the register card Background image 3. Activate joint background and deactivate more 4. Select mode and set Scaled 5. Using the Select button and following dialog, change to the eclipse directory and select our background file bg.jpg 6. By clicking on the OK button accept the changes. And our solar eclipse is now ”shining” in the background.
Using the colour scheme If the directory ~/.kde2/share/apps/kdisplay/colorschemes is not yet available, we shall create it with the command mkdir ~/.kde2/share/apps/kdisplay/color-schemes. Now we can copy our already existing file, shown in Listing 2, eclipse.kcsrc into this directory. To activate the colour scheme, this is how to proceed: 1. Call up the colour scheme dialogue via the Start list and following sub-items: settings/displayimage/Colours 2. Select the eclipse colour scheme in the list 3. Click on the OK button to accept the changes If you now look at the links on your desktop, you will notice that they are shown with black text. As this is hard to read, we shall change this colour as follows: 1. Call up the corresponding dialog via the Start list and the following sub-items: settings/displaysimage/desktop/general 2. Change to the register card display image 3. Set colour for normal text as ”White”
Fig. 10: KDE.THEMES.ORG - Enter new theme 92 LINUX MAGAZINE 4 · 2001
088kthemes3.qxd
22.11.2000
10:28 Uhr
Seite 93
WORKSHOP: KDE THEMES
Listing 1: eclipse.themerc 001 [General] 002 name=eclipse 003 author=Hagen Hoepfner 004 email=Hagen.Hoepfner@gmx.de 005 description=A dark sun for KDE (made witU h gimp and its Firetext-plugin) 006 version=0.3 007 008 009 010
[Display] CommonDesktop=true Wallpaper0=bg.jpg WallpaperMode0=Scaled
011 [Panel] 012 background=panel.xpm
013 014 015 016 017 018 019
[Icons] PanelGo=go.xpm:mini-go.xpm PanelExit=exit.xpm PanelKey=key.xpm Home=kfm_home.xpm Trash=kfm_trash.xpm TrashFull=kfm_fulltrash.xpm
020 021 022 023 024 025 026 027 028 029 030 031 032 033 034 035 036 037 038 039 040
[Extra Icons] Extra1=kfind.xpm Extra2=image.xpm Extra3=sound.xpm Extra4=action.xpm Extra5=kwrite.xpm Extra6=folder.xpm Extra7=kcontrol.xpm Extra8=kdehelp.xpm Extra9=kmail.xpm Extra10=kfm_refresh.xpm Extra11=folder_open.xpm Extra12=3floppy_mount.xpm Extra13=3floppy_unmount.xpm Extra14=5floppy_mount.xpm Extra15=5floppy_unmount.xpm Extra16=core.xpm Extra17=document.xpm Extra18=input_devices_settings.xpm Extra19=kab.xpm Extra20=kvt.xpm
041 042 043 044 045 046 047
[Window Titlebar] CloseButton=close.xpm MaximizeButton=maximize.xpm MaximizeDownButton=maximizedown.xpm MinimizeButton=iconify.xpm StickyButton=pinup.xpm StickyDownButton=pindown.xpm
048 049 050 051 052 053 054
[Window Button Layout] ButtonA=Menu ButtonB=Sticky ButtonC=Off ButtonD=Close ButtonE=Maximize ButtonF=Iconify
055 056 057 058 059 060 061 062 063
[Window Border] shapePixmapTop=wm_top.xpm shapePixmapBottom=wm_bottom.xpm shapePixmapLeft=wm_left.xpm shapePixmapRight=wm_right.xpm shapePixmapTopLeft=wm_topleft.xpm shapePixmapTopRight=wm_topright.xpm shapePixmapBottomLeft=wm_bottomleft.xpm shapePixmapBottomRight=wm_bottomright.xpm
SOFTWARE
064 [Sounds] 065 ConfigInstallCmd=enableSounds 066 ConfigActivateCmd=kwmcom syssnd_restart 067 Desktop1=eclipse.switchdesk.wav 068 Desktop2=eclipse.switchdesk.wav 069 Desktop3=eclipse.switchdesk.wav 070 Desktop4=eclipse.switchdesk.wav 071 Desktop5=eclipse.switchdesk.wav 072 Desktop6=eclipse.switchdesk.wav 073 Desktop7=eclipse.switchdesk.wav 074 Desktop8=eclipse.switchdesk.wav 075 Logout= 076 LogoutMessage=eclipse.LogoutMessage.wav 077 Startup=eclipse.Startup.wav 078 WindowActivate= 079 WindowClose=eclipse.WindowClose.wav 080 WindowDeIconify=eclipse.WindowDeIconiU fy.wav 081 WindowIconify=eclipse.WindowIconify.wav 082 WindowMaximize=eclipse.WindowMaximize.wav 083 WindowMoveEnd= 084 WindowMoveStart= 085 WindowOpen=eclipse.WindowOpen.wav 086 WindowResizeEnd= 087 WindowResizeStart= 088 WindowShadeDown=eclipse.WindowShadeDoU wn.wav 089 WindowShadeUp=eclipse.WindowShadeUp.wav 090 WindowSticky=eclipse.WindowSticky.wav 091 WindowTransDelete= 092 WindowTransNew= 093 WindowUnMaximize=eclipse.WindowUnMaximiU ze.wav 094 WindowUnSticky=eclipse.WindowUnSticky.wav 095 [Colors] 096 foreground=0,0,0 097 selectForeground=255,255,255 098 activeBlend=0,0,0 099 selectBackground=164,151,132 100 inactiveBackground=0,0,0 101 name=eclipse 102 contrast=5 103 background=180,167,145 104 activeBackground=122,112,94 105 inactiveBlend=213,197,172 106 inactiveForeground=175,180,159 107 activeForeground=255,255,255 108 windowForeground=0,0,0 109 windowBackground=255,255,255 110 [File Manager] 111 backgroundImage=eclipse_konsole.jpg 112 htmlBackground=239,226,196 113 htmlForeground=0,0,0 114 htmlLinks=0,0,0 115 htmlFollowedLinks=122,112,94 Listing 2: eclipse.kcsrc # KDE Config File [Color Scheme] foreground=0,0,0 selectForeground=255,255,255 activeBlend=0,0,0 selectBackground=164,151,132 inactiveBackground=0,0,0 name=eclipse contrast=5 background=180,167,145 activeBackground=122,112,94 inactiveBlend=213,197,172 inactiveForeground=175,180,159 activeForeground=255,255,255 windowForeground=0,0,0 windowBackground=255,255,255
Info [1] KDE Homepage: http://www.kde.org [2] The sample theme ”eclipse”: http://kde.themes.org/themes. phtml?cattype=inc=trad=0=1= eclipse [3] KDE Themes Homepage: http://kde.themes.org [4] The Gimp Homepage: http://www.gimp.org [5] KDE Designmanager:ftp://ftp.kde.o rg/pub/kde/unstable/apps/the mes/kthememanager-1.0.0src.tar.gz [6] Mosfet’s widget theme HOWTO:http://www.mosfet.or g/widgettheme-tutorial/ [7] sox Homepage: http://home.sprynet.com/~cba gwell/sox.html [8] krecord Homepage: http://me.inberlin.de/~kraxel/krecord.html [9] kwave Homepage: http://fs.spinfo.unikoeln.de/~kwave/ ■
The author Hagen Höpfner is studying computing at the Otto-vonGuericke University in Magdeburg. In his spare time he is an enthusiastic family man and plays the guitar in a rock band (http://www.gutefrage.de). 4 · 2001 LINUX MAGAZINE 93
088kthemes3.qxd
22.11.2000
10:29 Uhr
SOFTWARE
Seite 94
WORKSHOP: KDE THEMES
4. Click on the OK button to accept the changes. The whole thing is seen at its best when using the standard widget theme. In particular, this does not impose any pixmaps on the widgets.
... and the icons Fig. 17. KDE 2 ”with eclipse theme”
Widget: The word Widget refers to all graphical elements which occur in programs, buttons, input boxes etc. GTK: The Gimp ToolKit, originally created in the frame of the development of our dearly beloved image processing program Gimp, is a sort of program library containing prefabricated program parts and programming templates. GTK has been massively expanded (GTK+) and forms the basis, like Qt in the KDE world, for GNOME applications.
Manual rearrangement is just as much work as creating icons. Nevertheless it is possible. Hence it is explained here by the example of the 3.5” diskette icon. 1. Right click on the corresponding icon 2. Left click on Properties 3. A dialog box opens, in which both icons for the mounted drive (see Figure 11), or the unmounted drive (see Figure 12) can be selected. 4. By left clicking on the icon illustrated there the dialog box in Figure 13 opens. 5. After selecting Other Symbols and left-clicking on the browse button a dialog box appears in which the requisite symbol can be selected. (Figure 14) 6. If the symbol has been selected, a left-click on OK takes you into a further dialogue box (Figure 15). 7. All that’s left is selection of icons by a simple leftclick on them and confirmation of the change by a left-click on the OK button. These steps should now be performed for all the icons to be changed – or else you could wait until kthememgr is ported onto KDE 2.
Start menu The icons in the start menu are selected in the Menu editor (Figure 16), which can be found in the Start menu under System/Menu/Editor. The procedure is similar to that for normal icons and needs no further explanation.
So much for KDE 2 It’s OK, but it’s still too awkward. At this point we must settle for the hope that kthememgr will yet be ported onto KDE 2 and leave it up to the individual to decide whether he/she really wants to perform all settings by hand. Figure 17 shows how KDE 1.92 looks when the settings just mentioned have been done and KDE has been restarted.
So that’s about it You should now have a bit of an insight into the workings of your KDE. It is hoped that the tips and tricks will be useful to you when you come to develop your own themes. Who knows, maybe these instructions will even be used to create themes for other desktop environments and/or window managers. ■
■
Fig. 11. KDE 2 – Icon selection dialog for mounted drive
Fig. 12. KDE 2 – Icon selection dialog for unmounted drive
Fig. 14. KDE 2 – Searching for desired symbol 94 LINUX MAGAZINE 4 · 2001
Fig. 15. KDE 2 – Other Symbols
Fig. 13. KDE 2 – Drive symbols
Fig. 16. KDE 2 – Menu Editor
095parted.qxd
21.11.2000
17:40 Uhr
Seite 95
PARTITIONING
BEGINNERS
GNU-Parted
PATCH WORK MIRKO DÖLLE AND KARSTEN GÜNTHER
Partitioning hard disks under Linux is still regarded as the hardest task for beginners and tedious for advanced users. Reason enough to get to grips with the relatively new partition editor, parted.
When we talk about partitions, this usually means individually administered parts of a hard disk. Every partition as such is independent of other parts of the hard disk. So it is especially interesting when you want to use several operating systems – each system is based on its own partition and does not as a rule bother the others. It is as if you had installed several hard disks. There are some limitations on the number of partitions and their arrangement. So any hard disk can have a maximum of four partitions. If you need more, you will have to use one of the four partitions as an extended partition. You can split this into logical partitions. The four actual partitions are also referred to as "primary partitions" and differ from the logical ones in that it is possible to boot from them. Logical partitions can only exist within an extended partition. All in all, you can only use a single extended partition per hard disk. This can contain a maximum of 59 logical partitions – which, together with the four primaries, makes a total of 63 partitions per hard disk. Linux simply numbers the partitions in sequence, by appending the so-called "Minor Device Number" onto the name of the hard disk. The four primary partitions on the first hard disk at the first IDE controller (thus /dev/hda) are given fixed names with /dev/hda1 to /dev/hda4. The logical partitions from /dev/hda5 on, are always moved up. If you have assigned the logical partitions /dev/hda5, hda6 and hda7 and now delete hda5, hda6 and hda7 will now move up one, so there is no gap. If on the other hand you have assigned the primary partitions hda1 to hda3 and now delete hda2, the numbering of the other partitions remains unchanged. In
practice, 63 partitions are rarely needed. In the standard system only the minor device numbers 1 to 15 are available, though you can assign others if necessary. You don't normally format your hard disk (though that's all right in principle). Usually, only individual partitions (which can of course for their part encompass the whole of the hard disk) are formatted. When this happens, a file system is written on the partition to allow the data to be administered. All current distributions offer during installation to divide up the hard disk at the discretion of the manufacturer or by hand ("partitioning") and then to put in the desired file system – with Linux this is usually ext2 ("Second Extended File System") for the data and swap as the swap partition. It is not practical, after every change to the partitioning of the hard disk, for you to have to reformat the partitions concerned and thus lose all the data inside. Until now, the thing to do was to select hard disk partitioning so that it can be kept forever. But beginners can scarcely be expected to know what the optimal partitioning for their home PC is. Even more advanced users have to wrestle now and again with the decision which was taken on first installation. This is where the partition editor Parted, from Andrew Clausen, comes in. It offers extensive options for installing the three commonest types of partitions, Linux-native, Linuxswap and FAT/VFAT from new, to test them, delete them, copy file systems between different partitions and a few other things, too. At present Parted has no graphical interface. But don't worry, there's no need to remember fiddly 4 · 2001 LINUX MAGAZINE 95
095parted.qxd
21.11.2000
17:40 Uhr
Seite 96
BEGINNERS
PARTITIONING
Table 1: Features of Parted in overview Linux-native (ext2 only) install partitions yes delete partitions yes test partitions yes, but better to use e2fsck copy partitions only into partitions of same size or larger move partition limits only upper limit
Linux-swap yes yes yes yes yes
hide/show partition
no
no
FAT/VFAT yes yes yes yes educed as required, increased to a limited extent yes
Large and small numbers A great mystery, especially for beginners, are the Major and Minor Device Numbers, which you may come across for example in the /dev directory, but also in the file /etc/conf.modules. Under Linux many names are fairly meaningless, especially those of the device files such as /dev/hda or again, /dev/audio. If you ever enter ls -l /dev/audio, you get the following line: crw-rw-rw-
1 root
root
14, 4 Jul 26 1998 /dev/audio
What is unusual about this representation is that ls states, in the file size field, "14, 4". The "14" here stands for the Major Device Number, the "4" is the Minor Device Number of the device file /dev/audio. The first letter on the left, the file type, also differs from those of other inputs, as can be seen in the Table "filetypes", /dev/audio is a "Character Special File". The Major Device Number tells the kernel which device driver is responsible when a character file with this number is accessed. At this point the automatic module loader of the kernel and the file /etc/conf.modules come into play. Make a search using the command grep "char-major-14" /etc/conf.modules for all definitions for the Character Major Device Number 14. Here are four examples: alias alias alias alias
char-major-14 char-major-14 char-major-14 char-major-14
off soundcore es1371 sb
The lines mean that when a device file is accessed with char-major-14 the kernel module behind it must be loaded automatically, so it is not already in the memory. The "off" statement from the first example means that no module is being loaded – the driver is either contained in the kernel or is loaded manually. Take note that the type of a device file is dictates which driver is used – a "Block Special File" has a Block Major Device Number and is used by a different driver as a "Character Special File" with the same Character Major Device Number. If the Major Device Number states the driver to be used, then the driver, on the basis of the Minor Device Number can recognise which device is intended, if a special type of treatment is desired. So the Block Major Device Number 3 is used for /dev/hda and /dev/hdb. From the Minor Device Number the associated IDE-driver can tell that 0 means /dev/hda, and 1 to 15 stands for the partitions hda1 to hda15. The number 64 addresses /dev/hdb, and 65 to 79 stand for hdb1 to hdb15. Another example is /dev/st0 with "9, 0" and /dev/nst0 with "9, 128". Behind both of these is the first SCSI streamer, with the difference that in the case of minor-128 the tape is not rewound after every access. The fact that the device names as such have no special meaning for Linux is shown by the following example, which you can try out. As root user, put a second audio device into the /tmp directory: mknod /tmp/myaudio c 14 4 Now you can use cat /etc/conf.modules > /tmp/myaudio to make a bit of a racket: if you happen to have an au-file to hand, you can listen to this. With rm /tmp/myaudio you then delete the newly set up device file again. Table: file types Abbreviation Designation regular d directory l ymbolic link s socket c b
character special block special
p
pipe special
Use Normal file directory Symbolic Link communication tunnel, often used by programs in order to understand each other device file which can be read or described as characters device file which can be read or described in blocks of a specified length device file from which the data can be read in exactly the sequence they were written in
96 LINUX MAGAZINE 4 · 2001
Example track1.wav, /etc/passwd, /bin/bash /etc, /usr, /tmp /dev/cdrom, /usr/X11R6/bin/X /dev/log /dev/ttyS0, /dev/nst0, /dev/audio /dev/hda, /dev/fd0, /dev/sda /dev/initct
095parted.qxd
21.11.2000
17:41 Uhr
Seite 97
PARTITIONING
parameters, the developers have built in an interactive text interface à la fdisk.
Installation of Parted Most distributions unfortunately come without Parted, so we must install the partition editor ourselves. To do this, you can either use the RPM (included on the CD) or compile the sources from the CD yourself. You can find installation instructions in the box. You can find the latest version of Parted on the Internet at http://www.gnu.org/software/parted/ and ftp://ftp.gnu.org/gnu/parted. If you start parted without additional parameters, the program tries to find the standard hard disk, and reports this, for example with Use /dev/hda. When starting Parted it is best to specify at the same time the hard disk to be treated, as it is too easy to overlook what Parted is using as standard and it's possible to treat the wrong drive. The
BEGINNERS
following example uses the second hard disk on the first IDE controller: parted /dev/hdb Careful, never put the name of a partition such as /dev/hdb1. Parted assumes that /dev/hdb1 refers to an entire hard disk and will try to provide the partition with partitions again – a pointless undertaking. You will be asked to check the hard disk's geometry in the BIOS every time a program is started. The is because Parted is falling back on the data recognised by the kernel and makes all changes on the basis of these figures. Another system which uses the BIOS data (but also bootloaders such as LiLo or GRUB) can fall into false geometry and later deny you service. So it pays to copy the hard disk data from the BIOS start screen, or to look directly into BIOS. The numbers within Parted correspond to the Minor Device Numbers of the respective hard disk, giving "1" for hda1 or hdb1. You absolutely must ensure that the
Installation The RPM archive parted-1.2.9-0.i386.rpm is installed using rpm -i parted-1.2.9-0.i386.rpm This should work with all RPM-based distributions, we tested SuSE 7.0, RedHat 6.2 and Mandrake 7.1. If you would like to reduce your Windows partitions to install Linux, but your distribution does not provide this option, we have enclosed an extract from a boot diskette with parted. You can write the extract file under Linux with dd if=partboot.img of=/dev/fd0 This will copy the necessary files onto a diskette in the first drive. If you only have access to Windows or DOS, use the program enclosed in the sub directory rawrite, by simply retrieving it and specifying the extract file and the disk drive to be used. If you want to convert the sources, first unpack the file parted-1.2.9.tar.gz from the CD and change to the directory: tar xvzf parted-1.2.9.tar.gz cd parted-1.2.9
In addition you will need the libraries libreadline.so and libuuid.so, which are usually in the directory /lib. The next steps are preparing for conversion, compilation and then installation. ./configure --prefix=/usr make make all-recursive make install The parameter --prefix=/user ensures that Parted is classed as a normal system program and does not end up in /user/local as intended by the programmers. For installation you should be logged in as root. Error messages during configure are problematic and indicate missing packets or a directory structure not expected by parted. The most frequent error is that the library libuuid which is responsible for file system accesses, is missing. The file is in the development packet for ext2fs, often named as ext2fs_d or ext2fs-devel . After installation is complete you can delete the directory from parted.
4 · 2001 LINUX MAGAZINE 97
095parted.qxd
21.11.2000
17:41 Uhr
BEGINNERS
Seite 98
PARTITIONING
Fig. 1: Partitioning table after set up
partitions to be handled are not being used in any way (i.e. not mounted). You can get a list of the partitions being used with mount. Unlike fdisk Parted takes all actions immediately and not only when quitting. There is almost no way back once you have deleted a partition.
Show and test partitions First take a look at your current partitioning with p. The start and end of the individual partitions are not specified in the form of cylinders (as with fdisk) but in megabytes. Parted rounds up whole cylinders internally, as the partition table of the hard disk requires. The result of this is that the sizes entered often differ from the figures entered. Parted has a test function for ext2, swap and FAT/VFAT at its disposal. In the case of ext2 it is advisable to use the noticeably more powerful e2fsck. This comes with every distribution. Parted makes no bones about it if errors are found when checking the second partition with "check 2" for instance. It refers directly to e2fsck as a means of assistance. Even if things run through without a hitch, it points out that this is just a superficial test and e2fsck is the better alternative. If you have found a faulty ext2 partition, it is advisable to make a repair using e2fsck. You must close down Parted first or change to a different console in order to do this. In the simplest case you can leave it to e2fsck to take all the steps, as here on the first logical partition: e2fsck -c -p -v -y /dev/hda5 The sample retrieval makes for an automatic correction of any errors found. If the partition is still mounted, e2fsck will ask whether you really want to start the test – in this case you should always answer "No". Otherwise the threat of a system crash and/or loss of data is presented. For FAT- and VFAT-partitions you can use the program dosfsck as an alternative to the Parted98 LINUX MAGAZINE 4 · 2001
Check. The following call up (again, in the system and not from Parted) automatically tests and corrects a FAT or VFAT partition: dosfsck -a -t -v /dev/hdb3 Depending on the distribution dosfsck may not be part of the standard installation and will have to be installed later.
Set up partitions Parted has three commands for setting up partitions. You set up a new partition with mkpart. The following lines first set up an extended partition and then a logical ext2 partition: mkpart extended 130 1128 mkpart logical ext2 130 1000 The extended partition begins at 130 MB and goes up to 1128 MB, where the details relate to the total size of the hard disk. The logical partition is made within the extended one and goes from 130 to 1000 MB. Since the logical partitions are automatically numbered in sequence, no partition numbers need be stated – the next onefree is used. In principle the logical partitions must lie within the extended ones. This means there is as much room available for all logicals as you have reserved for the extended partition. Optional partition types for mkpart are primary, extended and logical. As file system ext2, linux-swap or fat can be stated. A look at the new partition table in Figure 1 shows that Parted has done some rounding off. Parted often asks whether the boot-loader GRUB is to be installed. As GRUB is still at an early phase of development, it's better if you use Lilo. GRUB will play a big role in future, as it allows selection menus. You can find out more about this at http://www.gnu.org/software/grub. Next, install the desired file system on the new partition:
095parted.qxd
21.11.2000
17:41 Uhr
Seite 99
PARTITIONING
BEGINNERS
mkfs 5 ext2
mkpartfs primary ext2 1 599
The command mkpartfs is called up exactly like mkpart and combines both steps:
Parted is still having problems with processing ext2 partitions. Using these you can alter the upper limit but not the lower, at present.
mkpartfs logical ext2 60 90
Deleting and copying
Bootable partitions
To delete a partition all you need to know is its partition number:
A partition must be marked as bootable to be able to boot from it at all. So you need such a partition on the hard disk from which you normally start. Under Parted you can mark this as bootable with boot and the corresponding partition number. This can (as described earlier) only be one of the four primary partitions. With the following command, make the first primary partition startable, in our case this is Windows:
rm 5 You thereby rid yourself of the first logical partition. But take care! As described above, Parted makes changes immediately. There's no going back. Plus, the logical partitions behind are all moved up. This can cause problems when the system is restarted if you do not adapt the file /etc/fstab and move up the partition numbers there by hand. One special feature of Parted is the option of copying the content of whole partitions into another partition or onto another hard disk. In the following example, the content of the first logical partition is copied into the second logical. The content of the second logical is copied onto the first logical partition /dev/hdb: cp 5 6 cp 6 /dev/hdb 5 Warning, the target partitions must be already set up, cp does not make a new one itself. They must also be large enough for the content to fit into them completely. You can also only copy ext2 partitions into ext2 partitions of the same size or larger, regardless of how much of the original partition is used.
All change Certainly the most used function in Parted is enlarging and reducing partitions. This allows space to be created on a hard disk fully taken up with Windows for Linux. resize allows the borders of a partition to be changed. To do this, we must first set up a large Windows partition: mkpartfs primary vfat 1 1200 We can move the end of the Windows partition (the first primary partition here) further forward, in order to create space for a Linux partition. Or, as in the example, the start can be moved further back so that Linux stands in front of Windows. resize 1 600 1200 It is not, by the way, necessary to defragment a Windows partition which has been used before reducing. Parted cannot work miracles yet, you can only reduce the Windows partition as far as space is available. Parted may warn you if necessary. Once reduction is complete, you now have room for the Linux partition:
boot 1
parted 1.2.9 LinuxUser/parted/ rawrite LinuxUser/parted/rawrite/
Fresh hard disks If you have a new hard disk or have formatted your hard disk, you can put in a new, completely empty partition table with mklabel. Take care, as this command used on a full hard disk irrevocably overwrites the old partition table. You can never get your data back. It may be advisable to print out your partition data and store it somewhere safe in the can hope that an expert might be able to help you. The following example prints out the partition data of the first hard disk on the standard printer: fdisk -l /dev/hda | lpr
Hide and seek Finally, there are two more, previously unmentioned features to be pointed out. (V)FAT partitions can be hidden under Windows, so that when starting they are not assigned a drive letter. Parted supports this feature by the commands hide and unhide. For Linux, however, this game of hide and seek is meaningless.
Conclusion For those migrating from Windows to Linux, Parted is useful in order to be able to retain Windows. Unfortunately, most distributions are still using their own programs or the timehonoured fdisk, with which Windows partitions can usually only be deleted, but not reduced. And yet, Parted is not a universal panacea, because it is precisely in connection with Partition-Magic that SuSE is reporting problems. This is one more reason to back up your data, before you go to work with Parted. There is still hope that in future versions, Parted will become more stable and flexible and get an easy-to-use interface. Perhaps then it will win through as the standard tool for almost all distributions. ■
Info GNU-Parted Homepage: http://www.gnu.org/software/ parted/ FTP-Download: ftp://ftp.gnu.org/gnu/parted/ ■
4 · 2001 LINUX MAGAZINE 99
100Packages.qxd
21.11.2000
17:50 Uhr
Seite 100
BEGINNERS
PACKAGE INSTALLATION
Packet Installation
GETTING THE FEEL OF DEBIAN AND RPM PACKAGES BY HEIKE JURZIK AND HANS-GEORG ESSER
Linux is constantly in development. What applies to the kernel, is also true of the countless number of additonal packages. Every day various programs are updated and require updates. It's easy with the right package management tools for RPM and Debian packages.
Debian Using dselect it is possible to select, install, configure and cleanly delete Debian packages. So much for the short version, but what really goes on, in and behind this program? First of all, it's important that a specific sequence of work steps is proposed. If you want to cleanly install or delete individual packages, you should not omit any of these steps: • Updating available packages • Selection of packages to be installed or deleted • Installation and updating • Configuration (where necessary) • Uninstalling the packages to be deleted As soon as one of these work steps has been successfully completed, dselect jumps automatically to the next point. Before you start the 100 LINUX MAGAZINE 4 · 2001
program for the first time (which by the way goes in an xterm exactly as on the console) ensure that you are root. If you forget, the program will remind you – Read-only access: only preview of selections is available!
First retrieval – step by step through the menu If you start the program as root, you will see a listing of the possible actions. The seven items are quickly explained: [A]ccess tells the program where to look for the Debian packages. The default is apt , but ftp, nfs or floppy are also possible. Using [U]pdate the package directories are read from the previously-specified source, with [S]elect you choose from the selection. In the penultimate step, [I]nstall, the program is used which was previously specified
100Packages.qxd
21.11.2000
17:50 Uhr
Seite 101
PACKAGE INSTALLATION
under [A]ccess. To resolve the problem of dependencies of Debian packages, [I]nstall and [C]onfig work hand in hand. Packages that could not be correctly configured during installation, are here "processed" once again. [R]emove tkes out any packages no longer needed, [Q]uit ends the program.
BEGINNERS
recent one is available and a longer description of the package. Too many symbols? This can all be easily explained using an example: EIOM Pri Section Package Inst.ver l.ver Description ... *** Opt admin sudo 1.6.2p2-1 2p2-1 Provides limited ...
AvaiU
1.6.U
The key to the door... For the third step (the selection of packages) you should remember a few important keyboard commands with which you can navigate rapidly and surely through the program. If you confirm the item [S]elect with the return key, it can take a moment before the next page is displayed – have a bit of patience, especially with slower computers. The first help page appears. In the bottom line you can see how it continues. With ? you can get help at any time. With the space bar you leave it again. The full stop is used for paging. Now activate the space bar to get to the main package listing (see Figure 1). You can confirm the selection at any time and return to the main menu by pressing the return key. Before you get cracking, take a closer look at the window. In the top lines, the most important keyboard commands are listed for use (see Table 1):In the second ine, next to the letters EIOM ("Error", "Installed", "Old" – old marking, "Marked" – present marking) you will also see details on the priority (e.g. "Required" or "Optional"), the installed version, whether a more
The solution to the puzzle: There is no error in the package "sudo", it is installed and still selected. If you would like to uninstall it, type in, as shown above, - or _ (see Table 1). Now the marking has been removed: EIOM pri Section Package Inst.ver l.ver Description ... **- Opt admin sudo 1.6.2p2-1 2p2-1 Provides limited ...
AvaiU
1.6.U
It can sometimes happen that a package needs another one. In that case, after selection the screen content changes with +. In the top line of the help menu it should say Help: Introduction to conflict/dependency resolution sub-list. Press the space bar, and you will see which conflicts with other packages arise or which should be additionally installed. At this point, packages which you do not wish to install can be proposed ("suggests"). Using the command Q you can force dselect to suppress such messages. Always bear in mind that Linux systems do exactly what the
Debian package: This generic term combines all necessary information on installation, uninstallation and execution of programs. The file names are composed as follows: packagename (e.g. xskat), version number and file ending .deb. So the file is called: xskat_3.2-1.deb. Apt: Stands for Advanced Package Tool. This is in fact a whole system of tools for retrieving, installing and deleting packages. Using the Apt functions, complete system updates can be performed. Buffer memories can be installed and managed for packages. ■
Fig. 1: Package selection by dselect
4 · 2001 LINUX MAGAZINE 101
100Packages.qxd
21.11.2000
17:50 Uhr
BEGINNERS
Seite 102
PACKAGE INSTALLATION
Now dselect jumps to the [C]onfig item. Here again you should press Return, and on it goes. Again a message appears on the command line: running dpkg --pending --configure ... A similar message appears at the menu item [R]emove: running dpkg --pending --remove ... These messages will be explained in the next section.
Glimpse behind the scenes
Fig. 2: kpackage can be used on either RPM or Debianbased systems
administrator tells them. If you want to play safe, it's best to accept the system defaults. If you have finished selecting all packets, press Return to go back to the main menu. If you now go to the item [I]nstall and confirm with Return, you will see that something is happening on the command line: asteroid:># dselect Reading Package Lists... Done Building Dependency Tree... Done The following NEW packages will be installed: libgd1g libwxxt1 linuxconf linuxconf-i18n lU inuxconf-x 0 packages upgraded, 5 newly installed,0 to U remove and 0 not upgraded. Need to get 0B/3744kB of archives. After unpaU cking 13.5MB will be used. Do you want to continue? [Y/N] Here you can thus check again whether you have correctly selected everything. If so, type y and you will be asked about the installation medium, (CDROM for example). During the installation status messages will be output on the console: 23% [Working] (Reading database ... Unpacking libgd1g (from .../libs/libgd1g_1.7U .3-0.1.deb) ... Setting up libgd1g (1.7.30.1) ...
Table 1: Keyboard commands in main selection Key definition + selects the package = replaces the package deletes the package _ deletes the package with its configuration files v switches between more detailed and briefer display d pages down the long description of the package u pages up the long description of the package I changes the distribution of the screen 102 LINUX MAGAZINE 4 · 2001
If you take a look at the man page of dpkg, it says: dpkg – a medium-level package manager for Debian GNU/Linux. This program is the actual package tool of Debian, dselect is a frontend to it. Unlike dselect it works completely on the command line. It also offers more powerful options. If you have downloaded the file xskat_3.2-1.deb from the Internet, you can investigate this in detail before you begin with the installation. For example try out dpkg -c xskat_3.2-1.deb. The parameter -c (short for --contents) shows you exactly which components would be filed: ... drwxr-xr-x root/root 0:54 usr/ drwxr-xr-x root/root 0:55 usr/games/ -rwxr-xr-x root/root 40:55 usr/games/xskat drwxr-xr-x root/root 0:54 usr/share/ ...
0 1999-10-10 17:4U 0 1999-10-10 17:4U 341872 1999-10-10 17:U 0 1999-10-10 17:4U
'Not sure whether you have already installed the package? The call dpkg -s xskat gives information on the package name, status (either cleanly deleted or never installed), priority (necessary or optional) an associated domain (e.g. games). If you would now like to install the game XSkat, you can check whether everything will run smoothly first. Try dpkg --no-act -i xskat_3.2-1.deb and the system will tell you about potential dependency problems. Everything has gone smoothly? Leave out the option --no-act in the next call, and you will get the same messages on the command line as with dselect. And for uninstalling, you can use dpkg. Here again you need to decide if you want to completely delete the configuration files. If so, use the call dpkg -P packagename (short for --purge). If the settings under /etc remain, select dpkg -r (for --remove).
RPM Just as Debian's package tools all implement the command line program dpkg, in RPM-based distributions, too, there is a basic management tool for the console, which significantly enough is
100Packages.qxd
21.11.2000
17:51 Uhr
Seite 103
PACKAGE INSTALLATION
BEGINNERS
known as rpm. It offers options with similar performance to dpkg, with which you can install, delete or update packages. The most important ones of these are: rpm -i package-1.23-1.i386.rpm rpm -U package-1.23-1.i386.rpm rpm -e package With the first option "-i" (short for "--install") of rpm a package is newly installed, which is not yet on the computer. Here the full file name of the RPM package must be specified. Correspondingly rpm when using the option "-U" executes a package update. An installed package is thus replaced with more recent version. rpm ensures at this point that the old version has first been completely deleted. This update option, by the way, functions even when no older version exists. You can generally use "-U" instead of "-i". In the third command call, a package is to be removed ("-e" for "--erase"). Only the basic name of the package without version numbers needs to be specified. RPM packages always have names of the form packet-1.23-1.i386.rpm. "1.23" in this case is the version number of the program, the "-1" specifies how many times an RPM package has been built from the sources, and "i386" designates the processor architecture, for which the packet was compiled. Useful additional options for installation with rpm are "--nodeps" and "--force": the first forces rpm to ignore package dependencies (e.g. required libraries) and to install a package even when a requisite additional package is not available. With the second you can instruct rpm to ignore package conflicts and install the package even if this would mean overwriting files of the same name from another package. A command in the form, rpm -U --nodeps --force package-1.23-1.rpm should thus always lead to installation. You should weigh up the consequences first, if a simple "rpm -U package..." brought an error message. rpm also gives an overview of installed packages without any great fuss. With rpm -qa you get a list of all packages on the system, rpm -q packagename displays whether a specific package exists. If so, with rpm -qi package you get more information on the package, and rpm -qil package additionally issues a list of all files forming part of the package.
have the entire functional range of the powerful rpm program.
For RPM professionals: rpmlevel Anyone familiar with he command line tool rpm should also take a look at rpmlevel (Homepage: http://www.coralys.com/products/rpmlevel.shtml, Download: ftp://coralys.com/pub/free/rpmlevel-1.21.noarch.rpm – it offers an expansion of the range of functions of rpm and at the same time takes into account all changes with respect to the first installation of the distribution. This means that you can always get an overview on how far your current system differs from the original system with rpmlevel. It's also easy to update all installed packages, rpmlevel --sync redhat61 performs all necessary updates on a Red Hat 6.1 system; with rpmlevel --report u redhat61 you get a list of all packages which have been updated since first installation.
So much more... Graphical RPM tools For the two popular desktop systems KDE and GNOME, there environments are easy to use RPM package tool. These are called kpackage (KDE) and gnorpm (GNOME). With these package tools you have access to frontends which display an overview listing installed packages and (like rpm itself) allow installation, updating, and deletion of packages. Both tools also offer the option of ignoring dependencies or package conflicts, but doesn’t
Fig. 3: The name is program: gnorpm works only with RPM packages
In this article we have only been able to take a brief look at the multiplicity of functions of package management tools. In a quiet moment, have a look at all the options of this program (in the case of rpm, dselect and dpkg in the respective man pages, or else in the online help). Experiment with them a bit. It's good to know that under Linux you can retain control over all installed software, and it makes no difference whether your distribution is Debian or RPMbased. ■
RPM: The Red Hat Package Manager is the package management tool created by the distributor Red Hat. It is used by almost all the "big" distributions (apart from Debian and the classic Slackware). RPM does however also stand for the packageformat itself; so RPM packages always end in .rpm. ■
4 · 2001 LINUX MAGAZINE 103
104cmdline.qxd
22.11.2000
10:35 Uhr
BEGINNERS
Seite 104
COMMAND LINE
Take command
AN INTRODUCTION TO PROCESSES PS, KILL AND CONSORTS BY HEIKE JURZIK
Even if lots of things can easily be controlled using graphical interfaces like KDE or GNOME, anyone wanting to get the most out of his Linux system cannot avoid using the command line. Apart from that, there are also many other situations where it's a good thing to know your way around the jungle of command lines.
Linux is capable of multitasking – in other words, a number of programs or processes can be executed by the processor at the same time. These processes are not actually dealt with simultaneously though; they are actually allocated a bit of computing time (a few fractions of a second) one after the other. The impression given however is that all the programs are running at the same time. This series is concerned with the management of processes and with tools which help you to do this.
Monitoring processes You can find out which processes are running on your Linux system at any given moment using the command ps. If you type ps x, all processes currently running will be displayed: 104 LINUX MAGAZINE 4 · 2001
chicken@asteroid:~$ ps x PID TTY STAT TIME COMMAND 353 ? SW 0:00 [.xsession] 380 ? S 0:00 /usr/bin/ssh-agent /U home/chicken/.xsession ... 391 pts/1 SW 0:00 [bash] 392 pts/0 S 0:00 -bash ... 16798 pts/5 S 0:00 ./zombie 16799 pts/5 Z 0:00 [zombie <defunct>] ... 16802 pts/0 R 0:00 ps x Here you can see various pieces of information at a glance: the PID (Process Identification), the terminal in which the process was started, and the present status or condition of the program. The letters beneath STAT are fairly simple to understand: S means "sleeping", R means "running", SW means that the process is not only "asleep", but has also been moved out into the SWap memory . You can also tell this from the square brackets ([ ]). Any process which is currently running must be in the RAM. If there isn't enough memory for the active processes, programs which are not currently running can be moved out into the Swap memory to make room for others. The obvious first choices for swapping out are the processes which are "sleeping" anyway and aren't actually doing anything. In the list, you can also see another status flag: Z. This stands for "Zombie". A Zombie process is one which has stopped but has so far been unable to give back its return status to its parent process . Apart from S, R, SW and Z there are some more letters which describe the current status. For example, if there is a D there, this is a process which
104cmdline.qxd
22.11.2000
10:36 Uhr
Seite 105
COMMAND LINE
can no longer be "awoken" again. This type of thing can happen if the intention is to write into a file which is on a system mounted via NFS which has crashed in the meantime. You can stop and restart your own processes yourself. Of course, you can't interfere with system processes, but if you want to stop a program, you can do it using kill -STOP PID (kill -19 PID). If the process is meant to continue to run, it is possible to convince it to do so using kill -CONT PID ("continue") (kill -18 PID) . A practical example: If, as root you wish to stop the gpm ("general purpose mouse" – mouse support on the console), you should first look for the process number (e.g. with ps x | grep gpm), then invoke kill -STOP PID . This process is now given a T as its status flag, which stands for "traced".
In the background, too – the shell as process manager The shell receives inputs on the command line and decides whether these are internal commands or external programs. External programs are started as new processes. To the extent that these are dependent on keyboard inputs and screen outputs, they temporarily replace the shell in the terminal. For example, if one starts the program ncftp, this is in the foreground and receives the commands typed in. It is only when the program is ended that the shell comes into use again. There are, of course, also programs which are not dependent on user inputs. If you want to carry on working in the shell, you can use "program & to" put the program into the background immediately. If the program is already running, the key combination [Ctrl+Z] and the following command bg (short for "background") have the same effect. With fg (short for "foreground"), it runs in the foreground again. Here's another trick: You can also put several programs into the background. If you then type in jobs, you will be given details of everything that's going on behind the scenes of the shell: chicken@asteroid:~$ jobs [1]- Running xkoules & [2]+ Running xskat & Here you can see directly, as the first piece of information, the internal job ID (which is issued separately by each shell). This means the jobs can be managed, e.g. pushed individually into the foreground or background. Using the command fg 1 you can for instance bring xkoules back to the front. This feature is a hangover from the days when you'd have to work at a single terminal. If there were two interactive programs, this was of course much easier to handle – you could for example put a text editor into the background while compiling the edited program, instead of shutting it down.
BEGINNERS
Not a forest, just one tree The command ps obviously has any number of options with which you can control various selection options or properties. For example ps au also shows the processes of other users which are linked to some terminal or other. The u in this case ensures that additional details are displayed, including among other things the name of the process owner: USER PID %CPU %MEM VSZ AT START TIME COMMAND root 307 0.0 1.0 1996 16:58 0:00 -bash ... chicken 1427 0.0 1.5 2272 17:04 0:07 vim befehl ... easter 16914 8.3 1.5 2628 23:44 0:00 ps au
RSS TTY
STU
672 tty1
S U
1000 pts/3
SU
988 pts/5
RU
This also makes it clear what the current computing time percentage is (under %CPU), the proportion of memory (%MEM) or the time when the program starts (START); in older processes, instead of the time, the started date is displayed. With ps r only the processes running are displayed, and with ps U username, only those of a specified user. Another useful option is ps l (with "l" as in list), which enables you to find out something about the PPID ("parent process ID"). However a nicer overview of which process stems from which parent is delivered in a tree view, using the command pstree: chicken@asteroid:~$ pstree init-+-atd |-bash |-cron |-kdm-+-XF86_SVGA | `-kdm---.xsession-+-fvwm2 | |-ssh-agent | |-xclock | |-xeyes ...
Swap memory: To enlarge the total amount of memory available, it is possible to supplement the physical working memory (RAM) with special areas on the hard disk called swap partitions or swap files. These are made by root with the command mkswap (see also the man page on this command). Parent process: Every process, with the exception of the very first one (init), has been started by another. This other process is called the parent process, and the newly started one is called the child. If the child has been terminated, it gives back its status to the parent. If the latter has in the meantime been terminated itself, the reverse succession goes back to init. ■
This type of overview can also be produced using ktop from KDE (see Fig. 1), if you have clicked on the option show tree . ps offers so many parameters that it is not possible to list them all here. Take a look at the man page and "knit" your own output format. The program top periodically conveys a useful selection. For GNOME, too, there is top with a graphical interface (see Fig. 2) with the practical additional function Filesystems (free). If you ever lose control over a process, you can terminate it by force. This is where the command kill comes into play. This can – as already mentioned – send all possible signals to processes. There are various signals for ending a process, which differ from each other as to whether they can be ignored or intercepted and processed by the process. With kill -l (with "l" as in list) you get an overview of all possible signals, including the ones used internally 4 · 2001 LINUX MAGAZINE 105
104cmdline.qxd
22.11.2000
10:36 Uhr
BEGINNERS
Seite 106
COMMAND LINE
• Also of interest is kill -HUP PID (kill -1 PID), to read in modifications in configuration files again. For example a kill -HUP on the inetd-PID forces the Internet daemon to read in anew its configuration file /etc/inetd.conf.
killall means you get them all... As a rule you will not know the ID of a process which you want to terminate: You see something like a frozen Netscape window and would prefer to close this using kill -9 PID . Equipped only with the tools ps and kill, you must now first use ps aux | grep netscape to search for the process-ID of Netscape and then include this in the kill command – but there is a simpler way: a killall -9 netscape achieves precisely that (always assuming that the running program is also called netscape and not e.g. netscape-communicator ). But be careful: This will actually terminate all matching processes; so for example killall bash shoots down all bash shells on the computer – including the one in which you have entered the killall command.
Nice try!
[top] Fig. 1: KDE's ktop offers a nice illustration of the tree structure [above] Fig. 2: gtop is GNOME's front-end for process monitoring
by the system (e.g. SIGSEGV for the universallypopular memory overwriter): chicken@asteroid:~$ kill -l 1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP 6) SIGABRT 7) SIGBUS 8) SIGFPE 9) SIGKILL 10) SIGUSR1 11) SIGSEGV 12) SIGUSR2 13) SIGPIPE 14) SIGALRM 15) SIGTERM 17) SIGCHLD 18) SIGCONT 19) SIGSTOP 20) SIGTSTP 21) SIGTTIN 22) SIGTTOU 23) SIGURG 24) SIGXCPU 25) SIGXFSZ 26) SIGVTALRM 27) SIGPROF 28) SIGWINCH29) SIGIO 30) SIGPWR 31) SIGSYS You've already met SIGSTOP and SIGCONT – and there are two more which are of practical interest. • With SIGTERM (15) you can "ask" a program to terminate itself (it can still process the signal internally). • With SIGKILL (9) on the other hand the program is unconditionally "shot down". This can be achieved with either kill -9 PID or with the long form kill -KILL PID .
106 LINUX MAGAZINE 4 · 2001
Now take another look at the output from top : Here the letters NI appear at one point – decrypted, this stands for "nice". With the command of the same name, processes can be assigned execution priority: Normal users can only reduce the priority, but root is allowed to increase it too. A program running at a lower priority is only then given computing time if this is not required by a process are started with a higher priority. By default, programs with the nice value 0, a value of -20 means top priority, +19 is the lowest. If no value is stated, nice starts programs with the value 10. If you start top e.g. with nice top, you will see for this process: PID USER PRI NI SIZE RSS SHARE STAT U LIB %CPU %MEM TIME COMMAND 17827 chicken 19 10 1168 1168 704 R N U 0 2.1 1.8 0:01 top If top is intended to run at the lowest priority, you take nice -19 top (for the highest level nice --20 top). If you don't like the double minus sign, you can also use the option "-n" and write for instance nice -n 19 ... or nice -n -20 ... . The tools discussed here do of course have more options besides those mentioned. In particular ps can easily confuse you, because differing ps versions are in circulation, with different options. Should anything not function as expected, then – as usual – the best thing to do is look in the manual. ■
107gnomogram10.qxd
21.11.2000
17:56 Uhr
Seite 107
GNOMOGRAM
SOFTWARE
News and Programs involving GNOME
GNOMOGRAM BY BJÖRN GANSLANDT
GNOME and GTK (the basic GNOME library) have been attracting more and more devotees in recent years. There are now programs for almost every task, with new ones being introduced daily. Each month in the Gnomogram column, we will present the GNOME gems and report on the latest GNOME gossip.
GNOME Foundation The establishment of the GNOME Foundation was officially announced at the Linux World Expo in San Jose, three days before the third birthday of GNOME. This had already been decided at GUADEC. Speeches went out live via Realaudio and were also typed in on channel #press at irc.gnome.org Members of the GNOME community elect the board of the GNOME Foundation. This will act as the contact point for companies and the press. It will also offer GNOME financial and legal support if necessary. You can find out more about the GNOME Foundation at the second address listed below. This document is still being written. The introduction of the GNOME Advisory Board was also announced. The Board is composed of firms which wish to support GNOME. At present these include Helix Code and Eazel and also big names, such as IBM and Compaq. The firms announced how they will be supporting GNOME. Compaq will port GNOME onto the new IPAQ PDA, as reported here last month. In addition, Sun and HP will, in future, be implementing the GNOME desktop on Solaris and HP-UX instead of CDE. This is a significant step for GNOME – it means that GNOME has an opportunity to unite Linux and Unix from the interface. Naturally, StarOffice plays an important role in the future of GNOME. The entire press conference can be heard at the fifth address listed below.
Documentation and translation It's not just programmers who can contribute to GNOME. Anyone interested can document or translate existing programs. Documentation of GNOME is written in the Docbook format. This syntax is very similar to that of HTML and quick to learn. You will find an introduction to GNOME documentation at developer.gnome.org/projects/gdp/handbook.html.
Evolution The Evolution program (number eleven on the list below) combines mail-client, a calendar and an address manager. If this reminds you of Outlook, you're right. The Look & Feel is based on the Microsoft program. The mail program in particular already has some interesting features, despite the low version number. You can make almost all the settings easily using a wizard, which guides you through the configuration. So it is possible to arrange messages according to specified features without having to learn a special syntax, as in Procmail. Evolution supports virtual mail folders, in which all messages are sorted corresponding to a specified search pattern. Thanks to the Ibex library, Evolution can search very quickly in the file view for specified messages, where only the
Evolution 0.4.1 LinuxMagazine/gnomogram/evolution/ Galeon 0.7.2 LinuxMagazine/gnomogram/galeon07.2-1.i386.rpm Bubblemon 0.9.11 LinuxMagazine/gnomogram/bubblemo n-0.9.11-1.i386.rpm
4 · 2001 LINUX MAGAZINE 107
107gnomogram10.qxd
21.11.2000
17:56 Uhr
SOFTWARE
Seite 108
GNOMOGRAM
responsible for the user interface. This means that the user could write a web interface to Evolution for example. The calendar provides the usual functions such as month, week and 'day at a glance' as well as todo-lists. The address manager also has the typical features. Addresses can be displayed in card form or in a list. As under GNOME, it is possible to print with a preview from all views. Synchronization with a Palm Pilot is possible, with some outlay. To do this, you'll also need pilotlink and gnome-pilot from CVS. This must then be compiled using the option --enable-oaf. The latest source texts are always centrally stored in the GNOME CVS. I would, however, advise against using CVS, unless you are familiar with the system. Evolution can be installed very easily. Anyone who has the Helix Updater can easily select Evolution Mirror, to install the latest version (only for Red Hat at the time of going to press). Updater installs the many libraries needed by Evolution at the same time. Anyone who does not have Updater can download the source text archive at the eleventh address below. Although the interface of Evolution does tend to mislead on this point it is not yet ready for everyday use. In any case, one ought to do a back-up before using any mail programs since Evolution still crashes a lot. If this happens, the users can end all components still in the memory with the command killev.
Galeon
[top] Evolution in action [above] Galeon on its own homepage
All in the green zone
actual text and no MIME-coded appendices are taken into account. HTML mail is displayed by Evolution on the basis of GtkHTML. If GPG/PGP is installed, Evolution can now cope with encrypted messages. Evolution falls back on Aspell in order to check spelling when creating messages. Vcards can be displayed at the end of the mail and stored in the address book. Addresses can be loaded from LDAP servers. One of the most interesting libraries used by Evolution is Bonobo. Specified parts of Evolution can be used in other programs using Bonobo. So if another program needs a mail interface, it simply falls back on parts of Evolution. In Evolution, also, the actual work of backends is dealt with, while a frontend is
108 LINUX MAGAZINE 4 ¡ 2001
Galeon is a new browser for GNOME. What's special about this program is that Galeon is really just a browser and hence much smaller and faster than Netscape and Mozilla. Galeon now offers almost everything one expects of a browser and is relatively stable. Actual HTML representation is something Galeon leaves to Gecko, the rendering engine of Mozilla. This is the snag in the program. Galeon integrates Mozilla via the gtkmozembed widget in the main window. This of course means that in addition to Galeon, it is also necessary to install Mozilla. Not necessarily ideal for someone who wants a small browser because he/she hasn't much memory space. The current Mozilla RPMs can be found at people.redhat.com/blizzard/software/RPMS/. After these have been installed, you still have to set the variable $MOZILLA_FIVE_HOME using the command export MOZILLA_FIVE_HOME=/usr/ lib/mozilla/ (or wherever Mozilla is installed), in the Mozilla directory. Although Galeon uses its own XML bookmark format, it can import bookmarks from Netscape. Other features such as a history of sites visited and intelligent address completion are now supported. The size of the fonts in the site can be adjusted
107gnomogram10.qxd
21.11.2000
17:57 Uhr
Seite 109
GNOMOGRAM
SOFTWARE
using zoom. To download files Galeon again falls back on another program, the GNOME Transfer Manager. Galeon starts GTM automatically, when a file is loaded who file type has been configured in Settings/Documents/MIME-type as Save to disk.
Bubbling Load monitor The Bubbling Load monitor is a small applet displaying the current system load. The water level in the applet represents the assigned memory. The water changes colour from blue to red, depending on how full the swap memory is. The processor load is displayed by means of little bubbles. Because of this unusual display the applet is relatively compact and an interesting alternative to the standard processor and memory load applet.
Nautilus Nautilus is a graphical shell, which in future is intended to replace the file manager GMC. What's special about Nautilus are the many little features that make life sweeter for the user. Nautilus not only displays images reduced in the icon overview of a directory – it also has a little preview for text files. MP3s can be displayed and arranged in a list with information from the Id3-tag in a meta view. These can also be played without leaving Nautilus. Information on RPMS can be displayed directly in the meta view, and a direct installation is possible. HTML is displayed by Nautilus as an option with gtkhtml or, like Galeon, with gtkmozembed. Nautilus can thus be used as a browser. All icons displayed by Nautilus can be freely scaled by the user or provided with special emblems such as "Important". Apart from these emblems, Nautilus displays the read or write privileges on the file. Another interesting feature is that one can zoom in the directory view. The higher the enlargement factor, the more information on the files is displayed. The respective settings of the directory view are filed by Nautilus in the file nautilus-metafile.xml in each directory. In this file, apart from the enlargement factors for individual icons the background for the icon view can be defined, for example. Nautilus can handle its own links which refer to programs, websites or directories. In ~/Nautilus/ a few of these links can be found, which refer among others to the hardware overview. In the panel on the left side of the main window, Nautilus displays the usual tree structure of the directories. It also offers a list of the help files present on the system and the option of writing a memo. It is also possible to search using a search engine and to generate a history, as usual with browsers. The icons and backgrounds which Nautilus uses, are of course not static. The user can redesign everything using drag & drop and load complete
themes. Nautilus is capable of different settings for beginners and advanced users and depending on the choice, makes available more or fewer options. It is planned to extend all these features even more by using the services of the development company Eazel. This means you'll be able to update your software or create a backup on Eazel’s Server. Eazel can also be of general assistance in system administration. New services can easily be added as the result of the component architecture of Nautilus. Like Evolution, Nautilus is based on Bonobo. This means that Nautilus can load modules from other programs, in order to display specified file types. Nautilus also uses gnome-vfs, a library which allows fully transparent access to various local or remote file systems. With the aid of the Medusa library, which creates an index of the hard disk, Nautilus can find files very quickly. ■
Nautilus in icon view
The author Björn Ganslandt is a student and a passionate bandwidth squanderer. Under the nickname Ansimorph he can often be found at irc.gnome.org.
URLs [1] www.guadec.ens.fr/ [2] www.decrem.com/gnomefdn.html [3] www.handhelds.org/Compaq/index.html [4] www.openoffice.org/ [5] www.videonewswire.com/GNOME/081500/081500.html [6] developer.gnome.org/projects/gdp/handbook.html [7] developer.nome.org/projects/gtp/translate-gnome/index.html [8] l-faq.de/po/status.php3 [9] http://developer.gnome.org/projects/gtp/ [10] http://developer.gnome.org/projects/gdp/ [11] www.helixcode.com/apps/evolution.php3 [12] developergnome.org/tools/cvs.html [13] galeon.sourceforge.net [14] people.redhat.com/blizzard/software/RPMS/ [15] gtm.sourceforge.net [16] www.student.nada.kth.se/~d92-jwa/code/ [17] http://nautilus.eazel.com/ ■ 4 · 2001 LINUX MAGAZINE 109
110kde2.qxd
22.11.2000
11:02 Uhr
Seite 110
SOFTWARE
DESKTOP
KDE 2.0 Review
THEY ARE BACK CHARLIE STROSS
Some of us fondly remember the golden days of the command prompt, but now with X-Windows comes a new dawn – KDE. Charlie Stross discusses how to get the most out of it…
KOffice – shown here editing a KWord document – is a neat integrated office suite, new with KDE 2.0
When you turn on a computer, these days you expect to see a graphical desktop with folders, windows, icons, and the usual panoply of a mousedriven interface. Linux is based on UNIX, which predates the graphical desktop: but Linux, too, can have a desktop. It’s just that the Linux desktops are separate from the Linux operating system (as 110 LINUX MAGAZINE 4 · 2001
Windows used to be separate from DOS), and you’ve got a choice of desktops. Probably the most popular desktop for Linux today is KDE (short for ”K” Desktop Environment – nobody’s really sure what the K stands for), followed by GNOME. All current consumer Linux distributions come with one of KDE or GNOME systems pre-installed.
110kde2.qxd
22.11.2000
11:02 Uhr
Seite 111
DESKTOP
SOFTWARE
KOffice – shown here editing a KWord document – is a neat integrated office suite, new with KDE 2.0
(SuSE, Mandrake, Corel, Storm and Caldera use KDE; Red Hat uses GNOME but supplies KDE as an alternative. Debian comes with GNOME.) Both GNOME and KDE share a common ancestry. In 1996, a bunch of Linux hackers got annoyed by the lack of high-quality integrated desktops for Linux. They started on a project to develop KDE – the K Desktop Environment. To build this, they used the Qt widget set from Troll Tech, a small Norwegian company. Qt is a very useful set of tools written in C++; unfortunately they weren’t 100% free open source products at that time. For this reason, a group of dissident developers set up the rival GNOME project. In 1999, Troll Tech announced that Qt release 2.0 would be available under the GNU General Public License on open source operating systems; this effectively means that versions of KDE based on Qt 2.0 or later are true open source (although the earlier KDE versions 1.0 through 1.2, which relied on Qt 1.44, are not officially open source). The newest release of KDE, KDE 2.0, came out in October 2000. KDE 2.0 is a substantial re-write of KDE 1.2, and is based on the Qt 2.2.1 widget set (making it fully compatible with the open source definition).
DCOP is a communications protocol used for message passing between KDE applications; it also allows KDE programs to be driven by remote control using an XML-RPC to DCOP gateway. (This basically serves a purpose equivalent to OLE on a Windows system; KDE applications can farm tasks out to each other, or be scripted by a language with a DCOP
Point Konqueror at a web page and suddenly it’s a web browser! Integrated web desktops come to Linux.
Under the hood KDE 2.0 is based on a raft of technologies that interlock to provide a seamless user experience – unlike earlier Linux (and UNIX) desktops. The core technologies behind KDE are the Desktop COmmunication Protocol (DCOP), the I/O libraries (KIO), the component object model (KParts), an XML-based C++ class for specifying user interfaces, and a standards- compliant HTML rendering engine (KHTML). 4 · 2001 LINUX MAGAZINE 111
110kde2.qxd
22.11.2000
11:02 Uhr
Seite 112
SOFTWARE
DESKTOP
Konqueror can handle plugins to display different types of image; here we see it displaying a Postscript file.
interface, such as VeePee (the Visual Python environment now in development: see http://www.thekompany.com/projects/vp/ for details). Bindings for C, C++ and Python, as well as experimental Java bindings, are available. The KIO libraries are designed to get data in and out of KDE programs as efficiently as possible. They’re designed to be network transparent and hence can be used to access files locally and over the internet using HTTP (web), FTP, POP, IMAP, NFS, SMB, and LDAP. It’s designed to be modular so that developers can plug in extra protocols such as WebDAV, which will then automatically be available to all KDE applications. KIO is also capable of helping applications open files with different mime content-types; if it can identify the mimetype of a file it can call a separate KPart object to open it, embedded within the current application. KParts is probably the most exciting element of KDE 2.0. Since Apple’s abortive OpenDoc technology in the mid-nineties, developers have been looking for a way of replacing the monolithic applications we use today with a document-centred object oriented system. Wouldn’t it be nice if, when you insert a table in your word processed report, you had access to the full powers of a spreadsheet for editing it – and vice versa? KParts is a component object model (like ActiveX or OpenDoc) which allows an application to embed another within itself. The model handles all aspects of the embedding, such as positioning toolbars and inserting the proper menus when the embedded component (for example, that spreadsheet in the middle of the word processed report) is activated or deactivated. KParts can also interface with the KIO 112 LINUX MAGAZINE 4 · 2001
trader to locate available handlers for specific mimetypes or services/protocols: for example, you can insert a Postscript file in a KWord document, and if everything is set up properly the Postscript viewer will show you the file properly as well as enabling it to print. KHTML is an HTML 4.0 compliant rendering and drawing engine. It supports JavaScript, Java (if you have an external JVM installed on your computer), HTML 4.0, CSS-2 (Cascading Style Sheets), SSL (Secure Socket Layer for secure communications) and Netscape Communicator plugins (if your copy of KDE was built with LessTif – these allow you to view Flash, RealAudio, RealVideo, and other proprietary technologies). KHTML is used by Konqueror and any other application that needs to display HTML. KDE 2.0 uses XML to create and position menus, toolbars and possibly other aspects of the user interface – an approach pioneered by the Mozilla web browser and now becoming ubiquitous. This in turn makes it easier to configure these user interface elements across applications and achieve compliance with the KDE Standards and Style Guide even if the standards are modified.
Behind the steering wheel At first sight, KDE 2.0 looks very similar to KDE 1.2 – or indeed to Windows 98. When you first fire it up, it displays the usual splash screen and prints some startup messages then shows you a desktop with a toolbar at the bottom. It’ll also pop up an annoying Wizard with some unhelpful hints about using KDE, but you can get him to go away easily enough.
110kde2.qxd
22.11.2000
11:02 Uhr
Seite 113
DESKTOP
SOFTWARE
KMail is the standard built-in email client for KDE.
Understanding graphical desktops on Linux Unix and Linux don’t have a built-in graphics system. Instead, Linux runs a piece of software called the X Window System. X (now at version 11, release 6) isn’t a graphical user environment like MacOS or Windows – it’s a programmer’s toolbox for drawing windows and bitmaps on a screen. Raw X11 isn’t usable by humans: there are no mice or scroll bars and no way of controlling the user interface. We put up with X11 for three reasons. Firstly, it’s the standard UNIX graphics system – it’s been around for nearly fifteen years. Secondly, it provides powerful features that other graphical systems don’t have: for example, an X application running on one machine can display its user interface on a different machine elsewhere on the network. And thirdly, when we combine X11 with a thing called a Window Manager, we get something we can work with: a window manager and a bunch of other utilities combine to make a desktop environment. A window manager is an X application that manages windows. It draws pretty borders around them, with scroll bars and the other decorations we take for granted. It supplies menus, it controls what happens when we click the ”minimize” button on a window (or any other buttons), and it lets us click on a window and drag it around. (Raw X doesn’t even let you drag windows – it isn’t configured to do so!) The window manager supplies a ”personality” (or set of policies, in X11-speak) for the X window system. It also lets you launch other programs, running under X, and keeps track of where their windows are displayed. A desktop environment consists of a bunch of programs that, with a window manager, give you a working environment. These tools obey the same set of policies so
that you can transfer data between them, they all behave the same way, and there’s an appearance of consistency (which on another operating system would be mandatory). There are tools equivalent to the Windows Explorer that let you navigate among folders, tools to edit or view files, and programs that do everything from browse websites to edit spreadsheets. There’s also a toolbar program (equivalent to the Windows Start menu, or a Macintosh’s Apple menu) to give rapid access to all these tools, and a control panel application for configuring everything. Unlike Windows or MacOS, Linux doesn’t need all this stuff – but it makes life more comfortable. X application environments differ from Windows or MacOS in one major respect: widget sets. A widget set is a collection of high-level programmer’s tools (for example, buttons, window frames, dialog boxes, and menus) that programs are constructed with. Windows and MacOS come with a single core widget set, along with their standard user interface policies. But there’s no standard widget set for X. Instead, each window manager uses a different one – and so do X applications. Different widget libraries have different look and feel characteristics; programs using different ones look as if they come from different operating systems. But they all run on X, which is one reason X has been described as the Frankenstein’s Monster of graphical user interfaces. In the late eighties and early nineties, the UNIX world was dominated by a single desktop – CDE, the Common Desktop Environment. CDE used the Motif widget set, and the Motif Window Manager; on top of this platform it added a toolbar and a bunch of extra programs. Unfortunately, Motif was (until very recently) the commercial and expensive property of the X/Open Group, and CDE even more so; this ruled it out for use on cheap Linux systems. In addition, CDE hasn’t changed in look and feel since about 1992, and now looks antiquated.
4 · 2001 LINUX MAGAZINE 113
110kde2.qxd
22.11.2000
11:02 Uhr
Seite 114
SOFTWARE
DESKTOP
KDE’s Control Centre, shown here, has acquired masses of extra control panels since the last release. Here are some of the Control Panel options for Konqueror, the integrated web browser – showing how we’ve allocated Netscape plugins to handle special mime types.
The toolbar is similar to that of GNOME, or any other Linux desktop environment. At the left is the ‘K’ menu, which does pretty much what you’d expect (it’s equivalent to the Windows ‘Start’ button). To the right of it are icons for a list of current open windows (you can choose which one to bring to the top), a button to show the desktop (by temporarily making any open windows invisible), then buttons to take you to your home 114 LINUX MAGAZINE 4 · 2001
directory, open a console window, run the KDE Control Panel, start up the online help browser, and start the Konqueror web browser. Beyond the buttons lies a set of virtual desktops: unlike Windows (but like all UNIX window managers) KDE lets you maintain a number of desktops which you can flip between by clicking on the pager. Actually, there are two shortcuts to the Konqueror web browser in the toolbar; the web
110kde2.qxd
22.11.2000
11:03 Uhr
Seite 115
DESKTOP
button and the home directory button. Konqueror isn’t just a web browser: it’s a file manager as well. If you click on the home directory icon you’ll see a file manager window pop up, giving you an explorer-style display of your home directory. At the top of the window, however, is a location: toolbar – enter a URL and the file manager suddenly turns out to be a fully functional web browser. By default, it shows you a directory navigation window to the left: you can get rid of this via the ”Window” menu. And then you’re using an integrated desktop web browser, just like Windows 98. There are other nice aspects of Konqueror’s integration. Select a URL (web address) in any window then mouse over the web icon in the toolbar and a popup menu will ask if you want to open it with Konqueror, or Netscape: but why you’d want Netscape is a mystery. Konqueror is one of the better style-sheet compatible browsers available on Linux. Konqueror also supports KDE components, including those of KOffice – if you click on a KOffice document in Konqueror (as a file manager) it will load and display
SOFTWARE
it. It can also load and display Acrobat (PDF) files, postscript files, TeX DVI files, and a number of different KParts components. The Control Centre icon brings up a very much expanded version of the old KDE Control Centre. KDE 2.0 is almost drowning in features for you to configure. From version 2.0, the underlying Qt library is fully themable; it’s possible to reconfigure the look and feel of KDE (and the sounds it makes) extensively. The Power Control panel, to name but one, now has facilities for controlling what your KDE 2.0 laptop will do when the battery runs low; the Network control lets you set up Windows disks and printers to share, and the Information control tells you more about your machine’s hardware than you believed possible. KDE 2.0 comes with the usual surplus of desktop utilities, games, multimedia tools, mp3 players, and so on. But the jewel in KDE’s crown is KOffice. Go to the K menu, select the ”Office” submenu, and pick the ”Office Workspace” option. This fires up a KOffice document window, within
Downloading and installing KDE 2.0 KDE doesn’t yet have the same sort of installation wizard as Helix GNOME, although one is promised for later this year (after KDE 2.0 is released). Unless you are running Debian Linux or a server distribution you probably already have KDE 1.1 or 1.2 installed; you’ll therefore need to download and compile KDE 2.0. You can find KDE’s main web site at www.kde.org (or a local mirror at www.uk.kde.org). This includes links to mirror sites and the FTP server where files are stored for download. If you have difficulty finding it, point your FTP client or web browser at ftp://ftp.sunsite.org.uk/Mirrors/ftp.kde.org/pub/kde/stable/, where the latest stable version is available for download. If you have a current RPM-based distribution such as Red Hat 7 or SuSE 7.0, you’ll need to look in the directory distribution/rpm for a subdirectory that corresponds to your system. You then download the binary RPM packages, and install them. You will need to look in the subdirectory latest/distribution for the subdirectory best suited to your needs – there are separate directory trees for Caldera, Red Hat, Corel, SuSE, Debian, and others. You can either download binary RPMs (typically with i386 in their name, for Intel hardware) or Source RPMs (with .src.rpm in their filename); the latter will need recompiling to a binary RPM before you can install them. One point to note is that you need to install more than just the KDE packages to get your desktop. To start with, you need a modern Linux distribution based on Glibc 2.1; this means SuSE 7.0, Red Hat 7, Caldera 2.4 LTP, or Debian Potato. (You can just about get KDE 2.0 to install on an earlier release such as Redhat 6.3, but you’ll need to upgrade lots of packages by hand before it will compile.) In addition to the base Qt RPM file you’ll need the Qt-devel and Qt-Xt packages. It’s also necessary to install the Flex parser generator’s 2.5.4 release and lib-mng (used for
animated PNG graphics). Optionally, the Konqueror web browser can use Netscape plug-ins to display special types of data; if you want this to be available you’ll need to install either a precompiled set of KDE RPM files or make sure that the development packages for Lesstif, the GNU Motif clone, is installed on your system. There are detailed explanations of which packages you need, and how to install them, at http://www.kde.org/documentation/. (You should read the whole document before getting started – the process is fairly complicated.) In a nutshell, after installing Qt and the ancilliary libraries noted above, you should set the environment variable QTDIR to wherever Qt is installed (typically somewhere like /usr/lib/qt-2.1.1), then install the Kdesupport package. After Kdesupport, you should install Kdelibs. Next, install Kdebase, which contains the basic KDE desktop kit. Thereafter, install the rest of the KDE packages in any order – you can ommit things like games or graphics or multimedia if you don’t want them. You will then want to set the environment variable KDEDIR to wherever you’ve installed KDE 2.0 before you run it for the first time; this is usually set globally in the file /etc/profile (or in /etc/profile.d/kde.sh if you’re running a recent Red Hat release). To install the binary RPM files, you can use a tool such as gnorpm (on Red Hat) or YaST (on SuSE) to select the RPM files and install them; alternatively, open a terminal window, become root (using su), then type: rpm -Uh packagename.rpm. At this point, the rpm tool may warn you of a conflict with files installed by an earlier version of KDE; you can override this by using the --nodeps and --force options: rpm -Uh --nodeps -force packagename.rpm. To rebuild KDE from the source RPM files, use rpm --rebuild packagename.rpm to install the RPMs. This unpacks the source code under /usr/src/redhat/SOURCES (or /usr/src/suse/SOURCES) and recompiles them, then creates binary RPM files in /usr/src/redhat/RPMS/i386. You’ll need to install these as described above.
4 · 2001 LINUX MAGAZINE 115
110kde2.qxd
22.11.2000
11:03 Uhr
Seite 116
SOFTWARE
KDE has a fairly powerful text editor as well as the office applications; here we see the Advanced Editor working on some Perl source code, with a view of the directory we’re editing
DESKTOP
which you can create a variety of types of file – anything, in fact, for which a KPart component is available. Currently this includes word processing files, spreadsheets, equations, charts, diagrams
(using the Kivio diagram tool, which is still in development and isn’t part of the stable KDE 2.0 release), and so on. This is KOffice’s first public release; a number of features aren’t yet ready, such as file import and export filters for KWord. It’s also not as stable as it should be, yet: KOffice feels like a beta release. Nevertheless, it’s an impressively neat little integrated office application suite. All of this comes at a price. It’s probably a bad idea to try and run KDE 2.0 on a machine with less than 64Mb of RAM and a P166 processor – and the installation takes roughly 100 Mb of disk space. This is not a lightweight, pared-down desktop system. However, it’s well on the way to becoming the sort of desktop you could turn an office worker loose on without worries; once it’s fully integrated into a mainstream distribution such as SuSE or Redhat, all you need to do is add StarOffice (until KOffice is mature enough for prime time use) and you’ve got a working office desktop that will integrate well with Windows file servers, provide decent web access (and mail, via KMail, and messaging using the Kit client for AOL Instant Messenger, and a host of other tools), and let them get the daily work done. KDE 2.0 really is a mature desktop environment – don’t let anyone tell you otherwise.■
How to start KDE There are two ways to start X and a desktop environment on the console of a Linux system. You can start your machine up in text-only mode, log in, then type the command ”startx”, or you can configure your machine to display a graphical login prompt (using the xdm – X Display Manager – program, or the kdm replacement that comes with KDE). The mode your machine starts up in – graphical or text-only – is controlled by the init system, a mechanism for controlling startup and shutdown of Linux. (This is configured by the file /etc/inittab, and if you open a terminal session and type ”man init” you’ll get some documentation that explains how this happens.) Most current Linux distributions (including Red Hat, SuSE, Corel, and Caldera) set up X during the installation process and then configure init to start the graphical login system automatically whenever you reboot. The xdm login system uses configuration files in /etc/X11/xdm. You can find documentation on xdm by typing man xdm at a shell prompt – be warned, xdm is complex, because in addition to logging in users at the console, it has support for running multiple X sessions, and X session running on X terminals (special graphical terminals that allow multiple users to run X on the same server computer at the same time). Kdm is configured from a single file, typically /usr/share/config/kdmrc; this is created by the KDE Control Centre (click on ”Login Manager” under ”Applications”; you need to be running the Control Centre as root for this to work). If you’ve configured kdm, you can swap from using xdm to kdm by editing /etc/inittab and replacing the line that starts xdm with one that runs /usr/bin/kdm (or whatever the path to kdm is) in its place, then tell init to re-read the inittab file (type init q.) If your computer is giving you a text-mode login prompt, you can start X11 using the xinit system. Type the command startx; this script will then set up various parameters and run xinit, a wrapper that is designed to start up an X session and a window manager. You can customize the programs that are run when you start up X using xinit by editing a file in your home directory called .xinitrc; create this by copying /etc/X11/xinit/xinitrc, and edit it. The last thing that the xinitrc script does is start a window manager. If you have installed KDE on a previously KDE-free system, you need to replace exec fvwm or exec twm (or the final failsafe window manager) with exec startkde (or whatever the path to the startkde script is). startkde is a script that comes with KDE and ensures that all the necessary programs – including the window manager – are started up in the right order.
116 LINUX MAGAZINE 4 · 2001
117explore.qxd
22.11.2000
12:24 Uhr
Seite 117
INTEGRATION
SOFTWARE
Explore2fs
A PEEK OVER THE FENCE JULIAN MOSS
When you’re trying out Linux it’s common to install it alongside Windows on the same hard disk. When you do that you often want to access one operating system’s files from the other. Accessing Windows files from Linux is easy, but Windows provides no way to access your Linux partitions. It’s still easy, though, if you use a free utility called explore2fs. Most newcomers to Linux experience some configuration problem or other early on, and need to seek help. When this happens, often you don’t yet have Internet access set up under Linux so you need to use your Windows mail, news and web browser programs to look for help. In the process, you need to refer to various Linux configuration files, and it can be very frustrating that you can’t read them while you’re running Windows. The reason you can’t access Linux drives from Windows is that Linux stores its data on disk using a filesystem that Windows doesn’t recognise. Windows 95 and 98 can only read and write their own native FAT and FAT32 filesystems. In addition, Windows NT can use disks formatted to use a system called ”NT filesystem” (NTFS). In order to read and write Linux ext2 partitions transparently – in other words, to have them accessible through Windows Explorer – Windows would need a special ext2fs driver to be installed, just as it needs drivers to read CD-ROMs, DVDs and other disk formats. But no such driver exists. However, there are tools that let you read (and even write to) Linux drives from Windows. Of those, undoubtedly the easiest to install and use is John Newbigin’s Explore2fs. Explore2fs, in common with other tools that have been developed to enable access to Linux files from
Windows and DOS, doesn’t use a special driver. Instead, the Linux partitions are accessed ”raw” using functions provided by the PC’s BIOS, and all the knowledge of how to interpret this raw data as directories and files is built into the program itself. This means that explore2fs doesn’t make Linux files accessible from other programs such as Windows Explorer. Instead, as the name suggests, it is a complete ”Explorer” for ext2 filesystems in its own right. Explore2fs is very easy to install. Just download the Zip archive containing the software from the address shown in the Info box – at the time of
Filesystem: The format used by an operating system to store the information contained in directories (folders) and files on a disk. The standard format used by Linux is called ext2, whilst Windows systems mostly use a much less sophisticated system called FAT or FAT32. Windows NT systems may use NTFS. BIOS: ”Basic Input/Output System”. It is a primitive interface to the basic devices in the system – disks, keyboard and screen – that is built into the computer. It is a 16-bit programming interface, so 32-bit operating systems like Linux (and Windows) normally bypass it using their own 32-bit drivers instead. The BIOS functions are normally only used during boot-up (before the operating system is loaded) and under MS-DOS. ■ 4 · 2001 LINUX MAGAZINE 117
117explore.qxd
22.11.2000
12:24 Uhr
SOFTWARE
Fig. 1: Explore2fs lets you explore your Linux drives whilst you are running Windows
Seite 118
INTEGRATION
writing the latest version was called explore2fs1.00-pre4.zip – and extract the files contained in it to the directory from which you intend to run the program. Besides the program itself there is just a simple Readme.txt, a license agreement – explore2fs is released under the GNU GPL and its source code (written using Borland’s Delphi, as a matter of interest) is free for you to examine and modify if you wish – and a list of changes. The easiest way to find out how to use the program is to try it. After you start explore2fs you will see – assuming, of course, that you have Linux partitions on your hard disk – a window that looks similar to Figure 1. In the left-hand pane are icons representing your Linux partitions which you can expand to show the directories and sub-directories, just as in Windows Explorer. If you select a directory, its contents are shown in the pane on the right. Using the toolbar you can switch between icon, list and details views. Right-clicking a file brings up a context menu from which you can inspect its properties (view all its attributes), view its contents using whatever Windows program is associated with files of that type and export the file (i.e. copy it) to Windows. Explore2fs isn’t quite like Windows Explorer: double-clicking a file doesn’t open it by default. But you can drag Linux files and drop them into Explorer folders, which is very convenient.
118 LINUX MAGAZINE 4 · 2001
Explore2fs understands users and groups under Linux too. A good thing to do right from the start is to locate your /etc directory and then drag copies of the files passwd and group to the directory where explore2fs is kept. Then, using the Users tab of the Options dialog box (selected from the View menu) select these two files (Figure 2). This will enable explore2fs to show the user and group names in directory lists in place of ID numbers. The other options of the program are also worth exploring. On the View tab (Figure 3) you can choose what files are listed and whether the toolbar and status bar are displayed. You can also specify how partitions are described. Explore2fs doesn’t seem to be able to tell what drive, and of which type, a partition is on, so partitions are labelled by default ”hdx”. You can change this so that the same designation is used as Linux uses, so for example if you have a SCSI drive you could change the partition prefix to ”sda”. The General tab (Figure 4) lets you choose whether to scan floppy drives. This is useful if you have any floppy disks or other removable disks (Zip cartridges, for example) formatted as ext2. The ”Use Extended Int 13” option is needed to allow access to partitions on large hard drives. You can also specify a viewer program to be used for files of unknown type. This is still pre-release software, and may contain bugs. The Debug tab contains various
117explore.qxd
22.11.2000
12:24 Uhr
Seite 119
INTEGRATION
Fig. 2: By showing explore2fs copies of your passwd and group files, the program can display user and group names instead of IDs
SOFTWARE
Fig. 4: ”Use Extended Int 13” option is needed to allow access to partitions on large hard drives.
Fig. 3: The View options let you choose how various things are displayed.
options for obtaining debugging information which may be useful if you need to send the author a bug report. Also on this page is the option ”Enable write support.” The author stresses that the support for writing to your Linux partitions is experimental. It doesn’t use the real Linux ext2fs code that has been tried and tested on millions of systems over many years. A bug that causes something to be written incorrectly
could trash the filesystem, so use this option at your own risk! Most Linux users won’t find it much of an inconvenience to leave write support turned off and keep your Linux partitions safe. The ability to read files on your Linux system easily from Windows is, however, very useful if you habitually use both operating systems. If you do, you’ll quickly find explore2fs becoming indispensable. ■
Info Explore2fs http://uranus.it.swin.edu.au/~j n/linux/explore2fs.htm ■
ad 4 · 2001 LINUX MAGAZINE 119
120ootbtear.qxd
22.11.2000
11:23 Uhr
SOFTWARE
Seite 120
OUT OF THE BOX
Out of the box
AUTOMATING
MP3 BY CHRISTIAN PERLE
One of the best things about Linux is the amazing number of tools and utilities that have been written for it. With so much available, though, it can be hard to decide what’s worth the download and what isn’t. Each month, Out of the box trawls through them all to find a ”must have”, or at least an underrated program than deserves a place on your system, and shows you how to install and use it. This month it’s the turn of tear, an automatic MP3 creation tool. MP3: An abbreviation for MPEG 1 Audio Layer 3, a process which compresses CD quality audio data to around an eleventh of its original size without noticeable audio deterioration. WAV: A normally uncompressed audio format first widely used on Windows platforms. Perl: The ”Practical extraction and report language”, a very powerful script language used on a variety of platforms. Frontend: a program which serves as the interface for another program in order to simplify its use. Compile: A program in source text form is not yet ready to be executed by the operating system. This must be compiled (translated) using a compiler to convert it into the form of a program that can be executed by whatever type of processor your system is based around. One great advantage of source code is that it can be compiled for use on various platforms (Intel, Sparc, Alpha and so on) - as long as, that is, the code has been written in such a way as to make it portable across platforms in the first place. ■
It can take absolutely ages to convert your CD collection into MP3 format: First you normally have to capture each track on each CD and save it as a WAV file. Then you have to convert them to MP3 format. Finally you have to give them all meaningful names. You needn’t do things like this if you have the right tool, though, and tear is just such a tool. It even offers automatic track naming by using CDDB, an online database where title information on countless CDs is stored.
Undemanding tear, whose name stands (in the best GNU tradition), for ”tear encodes and rips”, is not the first nor only program to automate CD to MP3 conversion. It is, however, unusually undemanding in terms of the resources it requires. Indeed, it only requires Perl, the Perl module CDDB_get, cdparanoia, and lame. Perl is present on every normal Linux system, and the last three are included in the tear package, which can be downloaded from http://tear.sourceforge.net/. A graphical frontend isn’t amongst tear’s features, but one isn’t really necessary as the program does all the essential tasks itself.
package. However, you may well find that you already have them installed, or that they are provided as optionally installable packages with your distribution. We’ll assume that you don’t already have cdparanoia, lame and CDDB_get compiled and installed in your system. To do so, having downloaded the package to your system, enter the following commands: tar xzf tear-0.2.tar.gz cd tear-0.2/misc/cdparanoia ./configure && make su (enter root password) make install ; exit cd ../lame make && strip lame su (enter root password) cp lame /usr/local/bin ; exit cd ../CDDB_get perl Makefile.PL make su (enter root password) make install Finally the tear Perl script must be copied into the /usr/local/bin directory, as follows: cd .. cp tear /usr/local/bin ; exit
Into the system
Warning, recording!
The components necessary to run tear can be compiled from the source code contained in the
Having completed the installation we can now test the new program. To do so, insert an audio CD in
120 LINUX MAGAZINE 4 · 2001
120ootbtear.qxd
22.11.2000
11:23 Uhr
Seite 121
OUT OF THE BOX
SOFTWARE
your CD-ROM drive and start a terminal emulator (xterm, rxvt, Eterm or whatever) and enter the following command: tear N b 128 tear will then read the complete CD using cdparanoia (Figure 1). Before the last track is read you should ensure that your computer has a connection to the Internet, as once tear has finished reading your CD it will attempt to interrogate the CDDB database. The N option we gave the program tells it to run in a more verbose than normal mode, while b 128 specifies the bit rate to be used by lame. You’ll be glad to know that the MP3 files created this way will have full and correct ID3 tags without you lifting a finger. tear also supports several other options, an overview of which can be displayed using tear h. Once it has done all the work we’ve asked it to, tear will have created an mp3 directory with additional sub-directories. This is where our MP3 music files can now be found.
Not much room? Ala, not all of us can afford the latest 80Gb hard disks, so you’ll often find you don’t actually have
Fig. 1: tear uses cdparanoia
enough disk space to accommodate a complete album in WAV format (which is the first step taken by tear in order to eventually produce your MP3 files). For this reason, tear has a B option, which tells it not to perform ”batch processing”. With this option, tear completely processes just one track at a time, deleting the WAV file used once the MP3 file for the track has been created. Our next example uses this option, disables verbose output mode, and requests a higher bit rate than before: tear B b 160 And that’s about all there is too it – CD to MP3 in just a few keystrokes. Before long you’ll find your computer is no longer just a computer, but a jukebox too! ■
Bit rate: MP3 files can be created with various bit rates (often specified in KBit per second). At very low bit rates an MP3 file can be compressed more, but there is greater loss of sound quality. Conversely, at high bit rates you get less compression but better sound quality. In practice, bit rates between 128 Kbps and 192 Kbps offer a good balance between quality and compression. ID3 tag: A special addition to an MP3 file that can be used to store data such as year of publication, music genre and so on. Most MP3 players read this information and display it when playing files. ■
K-splitter
MOTLEY BY STEFANIE TEUFEL
Who says there’s no place for gossip and scandal in a Linux magazine? K-splitter dishes the dirt on what’s happening in the K-World and noses around behind the scenes.
Penguin invasion Anybody who couldn’t wait a few more weeks until the final release of KDE 2.0 and downloaded KDE Beta 3 (”Korner”, aka KDE 1.92) will have been both disappointed and amused. Disappointed because the developers neglected to provide the widely announced Freeze feature in it, and amused to find Icon Themes specifically aimed at all penguin lovers (see Figure 1). Users of the previous beta versions, Confucius and Cleopatra, can have a look at the amusing
little fellows too. Go to http://ftp.kde.org/pub/kde/ Incoming/, or the KDE mirror of your choice, grab the theme-penguins.tar.gz package and unpack it in the $HOME/.kde/share/icons directory. All that now separates you from your new desktop pals is a small entry in $HOME/.kde/share/config/kdeg lobals. Just open kdeglobals in any editor you like and add:
Fig. 1: Penguins as far as the eye can see
[Icons] Theme=penguins
$: The dollar symbol before a variable name tells the shell that you want to use the named variable’s content. The shell variable HOME refers to your home directory.
And that’s it. Each KDE application you start from
■
4 · 2001 LINUX MAGAZINE 121
120ootbtear.qxd
22.11.2000
11:23 Uhr
SOFTWARE
Seite 122
KORNER
baby is hidden in the K-menu under the System option (see Figure 2). When using the importer option, the first thing you’ll need to do specify a path to the theme want to import (in most cases your GTK themes will be found at /usr/share/themes). Next you’ll need to christen your imported theme with a more expressive name (see Figure 3), which in future KDE will show you in the control centre as a selection option. The end result can really look great, as the new look of the KDE control centre in Figure 4 shows!
Attempted outbreak
Fig. 2: Importing themes made easy
Fig. 3: Import me!
The author Stefanie Teufel is a graduate political economist and works as an online editor at the Business Channel. She is also absolutely passionate about Linux, so in her spare time she writes books on the subject, not to mention articles for Linux Magazine!
Fig. 4: Doesn’t it look great?
now on will be a fully paid-up member of Penguin Lovers of the world.
And they do see eye to eye If you were to believe many a Usenet posting, you might think that KDE and GNOME developers hate each other’s guts. This can’t be the case though, as the second innovation of the KDE 2 beta 3 proves. At long last, all those nice GTK-Themes that GNOME users know and love can be used by KDE aficionados. How is it done? Well, quite simply by using a new Legacy Theme Importer tool. Just to be different, you won’t find this in the KDE control centre like most other configuration tools. This little
Anyone who uses Microsoft’s Outlook Express under Windows will be especially pleased with yet another new arrival in the KDE camp – Kmailcvt. The current version for KDE 1.1.2 and beta versions for the 2.0 series can be found at http://calypso.wolmail.nl/~ac6730/kmailcvt/. This neat little tool makes the changeover from Outlookto the KDE KMail email client a lot less traumatic, as it allows you to import your old folders (ending in .dbx) into Kmail. It also lets you import MS Exchange Personal Addressbook(.pab-)files into the KDE address book. This is all done with little more than a mouse click (see Figure 5).
Portals A portal all developers interested in KDE should look at is http://www.ksourcerer.org/, whose aim is to collect everything that can possibly make programming for and under KDE even easier in one place. If you like the idea, please do your bit to help. If you stumble across a nice bit of documentation or a scrap of code on your travels across the Web, let the lads at KSourcerer know by sending them an email at team@ksourcerer.org. There’s an awful lot there already, including great tools from programmers such as Burkhard Lehner, the author of the book KDE and Qt programming. ■
Fig. 5: Make them see the light – convert Outlook email! 122 LINUX MAGAZINE 4 · 2001
123gnuworld.qxd
22.11.2000
11:36 Uhr
Seite 123
BRAVE GNU WORLD
COMMUNITY
The monthly GNU Column
BRAVE GNU WORLD GEORG C. F. GREVE
Welcome to Brave GNU World. This month we have got several small projects covering a wide spectrum of applications: Lolix, GtkLP, GNU FaXile, KBasic, Colibri and PPCBoot
Lolix in action
Welcome once again to Georg’s Brave GNU World. I’ll begin this month’s issue with a project originating in France.
Lolix The Lolix project by Rodolphe Quiedeville is based on a webpage on which job seekers in and around Free Software can get together with possible employers. It follows the tried and tested concept that companies register their job openings parallel to IT specialists listing their profiles. Both categories can
be browsed with a search engine for possible matches. The search engine is pretty interesting, as it allows fine-tuning of the search parameters to produce better matches. A high quality of technical implementation is very important to Rodolphe. He perceives this to be one of the major advantages of his project. At the moment the technical part is being assisted by Loic Dachary and Raphael Rousseau. Of course all the code is published under the GNU General Public License. Originally limited to the French job market, Lolix has been offering its services in the United States 4 · 2001 LINUX MAGAZINE 123
123gnuworld.qxd
22.11.2000
11:36 Uhr
COMMUNITY
Seite 124
BRAVE GNU WORLD
GNU FaXile
Print with ease using the CUPS frontend GtkLP
since September 2000. The goal is to support other markets and to translate the webpage into other languages. The English translation is not yet complete and could see some improvement. For this task, the protagonists are still looking for contacts in the different countries. They are also seeking to improve functionality and online help. Because of its specialization on Free Software, this project is very interesting. One can only hope that the UK job market will be represented soon.
GtkLP The GtkLP project is a graphical frontend for the Common Unix Printing System (CUPS). As the name suggests, it is based on the GTK+ toolkit which ascertains an especially seamless integration into the GNOME desktop. The advantages of such a project for ”standard” users should be obvious as a lot of people lose track of the different commandline parameters. This project under the GNU General Public License has been written by Tobias Mueller, a mathematics and computer science student. The only thing really missing is support for passwordprotected printers and the special options - all the CUPS standard options are already completely implemented. Adding the extended functionality is the next task - support for more languages would also be nice. Either way, this is a project that can definitely make life easier. 124 LINUX MAGAZINE 4 · 2001
Wolfgang Sourdeau created the GNU FaXile project. It’s goal is to implement a complete fax environment for the GNU system. Even if the name suggests it, GNU FaXile is not yet an official GNU Project making it one is currently being discussed. This shouldn’t pose any major problems as it is already published under the GNU General Public License. Even the library uses the GPL because Wolfgang Sourdeau is very much opposed to proprietary software benefiting from his work. The goal - a complete, high-performing and user friendly fax environment based on Free Software, is still quite some time away. The only part working right now there is the fax viewer. But this one already looks quite nice. Regarding the technical implementation, one of the goals is to keep the package independent of the transport method. GNU FaXile will support HylaFAX as well as mgetty and efax. For all of these it will not only provide a GNOME GUI but also text-based interfaces. One further goal is to re-implement some components of HylaFAX and mgetty, making them better and more usable. Besides the fax viewer, the complete package will provide a dialog for sending faxes, an administrative frontend and a GNOME panel applet. Pretty much all of the non-GUI components will be provided for other programs within a modular library, too. There is a second project with the goal of creating a fax environment based on Free Software which is GNOME-GFax by George Farris. Since both projects seek to achieve something remarkably similar, Wolfgang Sourdeau, George Farris and Till Bubbeq, one of the very active participants for GNOME-GFax, came together to discuss merging both projects. So far this has been quite successful and a joining of forces can be expected. After merging the code the next common goal will be a strong GNOME integration; especially the connectivity to gnome-print and the GNOME address book. Additionally functions like an activity log are to be implemented. But before this happens, it is very important for Wolfgang to see GNU FaXile become an official part of the GNU Project in order to justify the name. His long term plans are to implement an OCR engine, but that is definitely not to be expected within the next few months. Before the real work can begin, some concepts have to be sketched out and discussed - ideas and support by other developers are very much welcome for this. After these projects (which mainly appeal to the end-user) I will now enter the area of software development.
KBasic The KBasic project is working on a very easy to use development environment in the kind of MS Visual
123gnuworld.qxd
22.11.2000
11:37 Uhr
Seite 125
BRAVE GNU WORLD
Basic. Graphical user interfaces can be assembled with the mouse. The original author and current maintainer, Bernd Noetscher, discovered that he was unable to find a good BASIC IDE under GNU/Linux. For C/C++ one can use projects like Glade (GNOME) or KDevelop (KDE), but he failed completely when looking for something like it based on BASIC. Even if BASIC does not have the best reputation among experienced developers, it very often is the first language people learn because it is easy. KBasic makes it possible for relatively inexperienced programmers to create functional GUI programs without a lot of work. Right now KBasic is still alpha grade software, the first stable release is due to come out next year. The rather big development team still has a lot of work up to that point and additional programmers with C++ and/or Visual Basic experience are definitely welcome. Tommy Scheunemann, being developer and documentation author within the KBasic project, would like to emphasize that although KBasic will provide a functionality similar to that of MS Visual Basic, it will not be able to run Visual Basic programs. The reason for this is the proprietary nature of Visual Basic. KBasic is of course being developed under the GNU General Public License.
COMMUNITY
Colibri Colibri has been created by Christian Liesch during his computer science studies. It is a developer framework for ASCII-based applications published under the GNU GPL. This project is probably especially interesting for developers of ASCII based applications in the embedded area or for dedicated servers with small displays. The project allows building an ASCII GUI with an XML description - so it could be understood as a kind of ”ASCII Glade.” Although it has been written in C, an objectoriented structure has been chosen. For interpretation Colibri uses the Expat XML parser which cannot handle Document Type Definitions at the moment. In the case of faulty XML files this can crash the program. This is its biggest weakness as far as Christian can see. His further plans include DTD support and then colors in the GUI as well as a developer kit for WYSIWYG click-by-click creation of the interfaces. Of course he’d always welcome help with it although he would have to write down the guidelines for that first. The project has its origin in the control software for a measurement station which had a small 1/4 VGA display. To realize this, Christian created a
GNU FaXile should soon be capable of optical character recognition
4 · 2001 LINUX MAGAZINE 125
123gnuworld.qxd
22.11.2000
11:37 Uhr
COMMUNITY
Seite 126
BRAVE GNU WORLD
Although still at the alpha test stage, KBasic is already usable
menu to run processes. This menu was based on a description file. The menu slowly turned into a widget collection. The description file is being written in XML now.
java2html & cpp2htm The projects java2html and cpp2html have been written by Lorenzo Bettini, the maintainer of gengetopt which has been introduced in the previous issue. The programs take Java or C/C++ source code and create HTML files with syntax highlighting. These tools can be extremely useful, especially for explanation & visualization of source code in presentations or web pages. Their main advantage compared to similar projects is that they also run under MS Windows - so they can be used in heterogeneous environments. The output is very customizable and can make use of CSS - unfortunately it does not support hyperlinking to other source code HTML files. According to Lorenzo this is the biggest weakness and is on top of the list of things to do. Most probably the rest of the work will be finding and fixing the remaining bugs - which is definitely something he would like some help with. About the licensing: both projects are official parts of the GNU Project and are being published under the GNU General Public License.
PPCBoot The Embedded PowerPC Linux Boot Project (PPCBoot) is based on the 8xxROM project by 126 LINUX MAGAZINE 4 · 2001
Magnus Damm which has been extended for fads823 boards. Its goal is to create an easy and extensible standard boot-solution for embedded devices focusing on the 4xx/5xx/8xx Motorola processors. Support for other processor types is not explicitly excluded but does depend on the support the project will receive. The major problem is that products in the embedded area hardly stick to any standards which requires a very customizable interface. In order to keep other users from reinventing the wheel, it is also necessary to provide a maximum number of examples. Working on these has a relatively high priority. Besides the developer already mentioned, there is an ever-growing group of active programmers; Wolfgang Denk, Duncan Palmer and Dan A. Dickey in particular, should be mentioned here. At the moment Wolfgang Denk is working on BOOTP and TFTP support to gain flexibility in the methods of booting a kernel. Especially for devices with small flash cards this can be very handy as the Kernel doesn’t have to be written to the Flash-ROM for every trial. On top of this the support of PCMCIA for IDE, Ethernet, ISDN or modem devices is being thought about. By the way: Raphael Bossek would like it to be known that PPCBoot follows a completely modular concept - every unnecessary or unwanted feature can be left out. He also emphasized that the project depends very much on sponsorship. Siemens Austria approached Wolfgang Denk and asked how much work would have to go into a boot solution for their boards. Wolfgang replied that it would take him about a month under the GNU General Public
123gnuworld.qxd
22.11.2000
11:37 Uhr
Seite 127
BRAVE GNU WORLD
License and about two months otherwise, as he would have to rewrite several things. Siemens very quickly settled for the GPL solution that has now become part of PPCBoot. Of course the rest of PPCBoot is also GPL’ed.
COMMUNITY
don’t hesitate to let me know at the first items listed below. This is also the address under which you can suggest projects to feature. ■
Software patents Finally I would like to approach the topic of patents on software. Why can’t patents be applied to software in a useful way? In the pre-decision about software patents, the result was one vote in favor of software patents. This may seem to warrant a certain degree of hope as only one year ago it would have been much more clearly in favor of software patents, but the work is still far from over. It is of paramount importance that this is mooted now. It is dawning on the people responsible for this development that software patents might actually be a bad idea. On this topic there is an excellent document by the League for Programming Freedom with the title ”An Industry at Risk”. I can only recommend reading this document as it uses a very factual approach to disassemble the arguments of software patent advocates. The United States have had to suffer from the slowing of innovation by software patents for several years now. Although it is already 6 years old, this document is almost frighteningly up-to-date. Personally I would like to ask each and every one of you to sign the EuroLinux Petition against software patents in Europe and to ask others to do likewise. It is also important to disseminate knowledge about this topic - use every opportunity to talk about it with others. Recently, it has often happened that software patent advocates tried to avoid the discussion by offering exceptions for Free Software. But they are usually committing the cardinal mistake of thinking about the price and not about the freedom the community it is built around. The basic principles of Free Software quite deliberately do not make a difference between commercial and non-commercial software. A significant part of the important projects is at least partially commercial - and none of the projects is solely commercial. This interwoven structure creates a positive interaction that is one of the fundamentals for the current success of Free Software. If this feedback loop is broken, the damage could be immense. For this reason it is essential that all exceptions for Free Software must explicitly include commercial and non-commercial Free Software. We can and must not accept less.
That’s it Alright, that’s it for this month. If you have questions, suggestions, ideas or comments, please
Converting java to html files
Info [1] Send ideas, comments and questions to Brave GNU World <column@brave-gnu world.org>, mailto:column@brave-gnu-world.org [2] Home page of the GNU Project http://www.gnu.org/ [3] Home page of Georg’s Brave GNU World http://brave-gnu-world.org [4] ”We run GNU” initiative http://www.gnu.org/brave-gnuworld/rungnu/rungnu.en.html [5] Lolix Project http://www.lolix.org/ [6] GtkLP home page http://www.stud.uni-hannover.de/~sirtobi/gtklp/ [7] GNU FaXile home page http://www.ultim.net/~wolfgang/gfv.html [8] GNOME-GFax home page http://www.gmsys.com/gnome-gfax.html [9] KBasic home page http://www.kbasic.de/ [10] Colibri home page http://colibri.sourceforge.net/ [11] java2html home page http://www.gnu.org/software/java2html/ [12] cpp2html home page http://www.gnu.org/software/cpp2html/ [13] Embedded PowerPC Linux Boot Project http://ppcboot.sourceforge.net/ [14] ”An Industry at Risk” by the ”League for Programming Freedom” http://lpf.ai.mit.edu/Patents/industry-at-risk.html [15] Eurolinux petition against software patents http://petition.eurolinux.org/index.html ■ 4 · 2001 LINUX MAGAZINE 127