2007.05_Ask Klaus.pdf

(2478 KB) Pobierz
056-058_ask-klaus.indd
KNOW-HOW
Ask Klaus!
ASK
Klaus Knopper is the creator of
On a system in which the computer
is using the onboard audio incorporated
on the motherboard, the audio chipsets
have limitations. Usually the Linux sys-
tem sound server is running, and thus
the ports are locked.
The only access to sound is through
the Linux Sound Server (because it’s
running). Xine-based players default to
Alsa or OSS, which can’t access the
cheap soundcard because the port is
locked and not open.
Xmms will work using the arts plugin.
It also depends on how the Linux system
sound is accessing the card. The Linspire
sound server system uses Jack, so pro-
grams using Jack will work with these
limited soundcards (or arts). Anyway,
onboard motherboard audio or a cheap
audio card isn’t the best hardware setup
for a standard Linux distro.
is being stored into memory, and the
address is sent to the soundchip DMA
controller, so it plays a certain amount
of sound at a time, from the given start
to the given end address.
Some cards have an internal buffer for
sound, so you can send a limited
amount of sound data to that buffer first,
which is then played by the card.
This method is usually used for stor-
ing instrument patches or fast effect
sounds. More expensive soundcards may
support multiple buffers or DMA chan-
nels that are first filled and then mixed,
at once, using the soundcard’s own me-
chanics. The usual sound hardware has
one stream that is supported at a time,
so naturally most sound drivers are de-
signed to lock the software-side port, the
sound device file, once the card is play-
ing a sound.
If you would really be able to write
concurrent sound data to the same ad-
dress, the result would not sound similar
to any of these two sound streams. In
the best case, you would get some ran-
dom noise. In the worst case, it will be
really loud noise.
So, if only one input stream is really
supported by the hardware, what could
be done from the software side is mixing
different sound resources in memory
first, like:
Knoppix and co-founder of the
LinuxTag expo. He currently
works as a teacher, program-
mer, and consultant. If you have
a configuration problem, or if
you just want to learn more
about how Linux works, send
your questions to:
klaus@linux-magazine.com
Soundcards
I always read your articles, and
I love Knoppix, I was curious
about your answer in Febuary
2007 to a user having problems playing
back audio from his DVDs. A common
problem for any Linux distro is a com-
puter in which the soundcard(s) cannot
share the audio hardware ports. Mainly
the onboard audio chipsets on most MBs
cause this problem; they cannot share
the ports due to hardware limitations.
I’ve found that soundcards for Linux
installations need to have chipsets that
can leave their ports open. Most sound-
cards that work on this level are Creative
Labs, M-Audio, Turtle Beach, etc. Linux
works great with these soundcards.
The problem that you describe
(the fact that a soundcard can
just be “opened for write” by
one program at a time) is more subtle. A
“failed open” on /dev/dsp or /dev/snd/
pcm* indeed means that another process
has that device open.
The most “apparent” solution
would be just allowing the sound
driver concurrent “open” accesses.
However, there is a reason for
locking the sound device exclu-
sively for one program, and that
has to do with the way sound
output works.
You cannot just write a wave
or MP3 file to the sound hard-
ware directly, like you would do
on a tape or printer device. The
way it works is that sound data
56
ISSUE 78 MAY 2007
WWW.LINUX- MAGAZINE.COM
056-058_ask-klaus.indd 56
08.03.2007 11:11:45 Uhr
KLAUS!
56
592838506.007.png 592838506.008.png 592838506.009.png
Ask Klaus!
KNOW-HOW
sound_out = U
( sound_1 + sound_2 ) / 2
Every time Linux boots up it
asks for a password. This is obvi-
ously most annoying.
Can it be set up not to ask for
this password?
And what happens if you lose
the password? How is a user able
to get into the system without
have to reformat the HDD and
then reloading Ubuntu?
and sending the result to the card. Or a
different plan would be to create a
queue, like you have for sending print
jobs to the printer, and play each sound
after the other.
This can be important if you don’t
want to lose any information that can be
given with sound, like in text-to-speech.
There is even a “speech-dispatcher”
available with a scheme that allows you
to interrupt spoken text with more im-
portant spoken text and continue with
the old text later.
One or both of these approaches are
what sound servers like artsd and esd
are supposed to do. But once they are
running, the sound device is completely
blocked for other programs until the
server releases the device; it is not a
good solution when there are programs
that are not aware of sound servers.
To find the process that is guilty of
blocking your soundcard, you can use:
I do get a lot of email
asking me to explain all
of modern computer
technology in just a few sen-
tences that will be easy for be-
ginners to understand, but this is
unfortunately not possible. I’m
just a computer user, too, and I
have to look up information
every now and then myself. The
Internet is a good source of infor-
mation on Linux.
Ubuntu provides online help in several
forms. See page 19 of the magazine in
which you got the DVD for a summary
of support sites.
The first thing to understand when
you are learning to find your way around
Linux is that “Linux” is a computer oper-
ating system , which is something most
users don’t “use” directly.
More often, you will probably be using
an application, like OpenOffice for writ-
ing documents, GIMP for professional
photo postprocessing, or Firefox and
Thunderbird for accessing services on
the Internet.
Be as specific as you can about what
application you actually need help with
before going to books and online help
sources. Keep your focus on knowing
what you want to do with the computer
as a tool, rather than learning the techni-
cal details of how a computer works.
The specific details are not really that
important unless you happen to be inter-
ested in them.
When you are watching TV, for in-
stance, you probably don’t want to know
what kind of electrical components are
inside and what they are doing. (Of
course, some people do find that kind
of thing extremely interesting.)
You have to decide first what you want
to do, then choose from the many possi-
ble tools for accomplishing that goal. I
would need to know more about your
modem to help you configure it.
Figure 1: Enabling password-free login in Ubuntu.
A good starting point is the Linux
Modem-HOWTO, which is available
through the Linux Documentation
Project ( http://tldp.org/HOWTO/
Modem-HOWTO.html ). Check Ubuntu
sites for Ubuntu-specific information.
Yes, it is possible to configure your
Linux system so you can log in without
a password. Every distribution has a
way to do this.
You don’t mention which version of
Ubuntu you are using.
In Ubuntu 6.06 “Dapper Drake” you
can select System in the main window
and choose Login Window . You’ll then
have to provide a password to access ad-
ministrative functions.
In the Login Window dialog, you will
select the Security tab and check Enable
Automatic Login (see Figure 1). Make
sure your account is selected in the User
box. Next, click Close to close the Login
Window dialog.
You can still make your system usable
again if you lost or forgot all passwords,
provided you have physical access to the
storage media and you did not encrypt
the data.
This type of troubleshooting is an
important reason for live CDs such as
Knoppix. (The April 2007 issue of Linux
Magazine includes a Knoppix DVD.)
It is even possible to use a Linux sys-
tem for rescuing data from and repairing
Windows installations, but again, the
details will depend upon your situation.
Users who are considering a change
fuser -v /dev/dsp
( /dev/dsp is, in the ALSA driver case,
the OSS-compatible device when the
snd-oss-pcm module is active).
Some of the ALSA drivers are capable
of (almost) realtime mixing of different
sound resources. This allows seemingly
concurrent and parallel access to the
sound device and “blended” sound out-
put.
There is a (built-in) plugin, dmix, for
ALSA that does this. The dmix setup is a
little more complex and also depends on
the type of card used.
More information on how to set up
dmix is on the ALSA unofficial wiki at:
http://alsa.opensrc.org/index.php?title=
DmixPlugin .
Desperation
Can you help me please? I am
desperate. I want to escape the
clutches of Microsoft and re-
cently loaded Linux Ubuntu from the CD
that came with your magazine. However,
how does one use Linux? There is no
help or manual that I can find.
I want to access the Internet. How
does one do this? How does one set up
the modem, etc.? I cannot find any way
to do this in the menus.
WWW.LINUX- MAGAZINE.COM
ISSUE 78 MAY 2007
57
056-058_ask-klaus.indd 57
08.03.2007 11:12:02 Uhr
57
592838506.010.png 592838506.001.png 592838506.002.png 592838506.003.png
KNOW-HOW
Ask Klaus!
from Windows to Linux may be inter-
ested in a document titled “Linux Is Not
Windows,” by Dominic Humphries:
http://linux.oneandoneis2.org/LNW.htm .
nodns
nonisdomain
Malware
Attacks
Why is it
so hard to
find arti-
cles about security
in Linux? Is Linux
free from spyware,
viruses, and mal-
ware attacks? If
not, how do I pro-
tect my system? Is
there a scan pack-
age available, at
least for spyware?
DHCP Woes
I have broadband with Optus in
Australia. Optus provided me
with a Siemens modem with
pppoe built in. I originally set it up with
Windows. Most live CD and DVD distros
wouldn’t connect, however, Gentoo
2006.1 did. The difference seems to be
that it uses dhcpcd rather tham pump
or dhclient.
I have since tried several 2.6 live CDs,
and if I mount my Gentoo partition and
invoke its dhcpcd ./dhcpcd -h `host-
name` , they will connect. pump or dhcli-
ent must be stopped first, of course.
Is there a way to get pump or dhclient
to work since dhcpcd is working? The
modem has upnp enabled.
Figure 2: The Common Vulnerabilities and Exposures Project (CVE)
provides updates on recently discovered exploits.
It’s not too hard to find informa-
tion about Linux security, or
rather, Free and Open Source
software security. There are many secu-
rity portals and “Bug of the month”
mailing lists, for virtually every part of
Linux. GNU/Linux, like any complex
system, is not free of errors or bugs, se-
curity flaws, and possibilities for circum-
venting malformed security restrictions.
But, because of its open source nature,
bugs are found and eliminated quickly,
and you don’t have to wait for a “patch-
day” to make your system secure again.
Viruses are very rare (if not even non-
existent) in Linux because of the very
strict privilege separation in Unix sys-
tems. Trojans and Worms usually need
some kind of interaction with the system
administrator in order to get installed, or
at least they require very weak permis-
sion settings (like global write access to
device files).
Some Worms try to exploit flaws like
buffer overflows in software running
with root permissions. But systems with
a higher security level, like a restrictive
SElinux setup, are even
immune to that. (I
would not say that it’s
impossible to break in,
but it’s at least very
hard, even if you have a
lot of knowledge about
system internals and
possible exploits.)
All in all, no operat-
ing system I know of is
absolutely immune, but
a well-known fact is
that “Security by Obscurity” has never
worked. The closed-source practice of
keeping errors and information about
weaknesses secret does not make an op-
erating system secure. Secretiveness just
puts crackers at an unfair advantage be-
cause they get to know break-in possibil-
ities first, weeks prior to the system ad-
ministrators who could have fixed the
problem had it been published properly.
Check the security page for your Linux
distro for periodic updates on security
problems. (See the “Insecurity News” on
page 16 for more on obtaining security
updates for popular Linux variants.).
You’ll also find information on exploits
at the Common Vulnerabilities and Ex-
posures project at http://cve.mitre.org/ .
A number of tools help system admin-
istrators check for potential problems
and identify break-in attempts (even
successful ones). I recommend Nessus
( http://www.nessus.org/ ) for checking
for open ports and vulnerable network
services running on your computers,
Tiger ( http://www.net.tamu.edu/
network/tools/tiger.html ) or Tripwire
( http://www.tripwire.org ) for local secu-
rity and file system integrity checks, and
Snort ( http://www.snort.org ) as an intru-
sion watchdog.
Several virus-checking tools are avail-
able for Linux. One popular solution is
the open-source ClamAV anti-virus tool-
kit. For more information, visit: http://
www.clamav.net/ .
You could try some of the set-
tings mentioned in the pump
manpage. Unfortunately, there
does not seem to be a specific program
that always works best. In some cases,
pump does fetch IP addresses when dh-
client or dhcpcd fail. pump may require
some cards to be activated with the com-
mand ifconfig eth0 0.0.0.0 up (replace
eth0 is the actual device name).
You may also want to experiment with
some settings in /etc/pump.conf :
# Number of retries
retries 16
# Giving up after this time
timeout 60
# Skip nameserver (if running U
a local cache with a fixed U
/etc/resolv.conf entry)
Send your Linux questions to
klaus@linux-magazine.com.
58
056-058_ask-klaus.indd 58
08.03.2007 11:12:05 Uhr
592838506.004.png 592838506.005.png 592838506.006.png
Zgłoś jeśli naruszono regulamin