User talk:Balsa: Difference between revisions

From SlackWiki
Jump to navigation Jump to search
Line 92: Line 92:


--[[User:Balsa|Balsa]] 16:15, 20 February 2011 (EST)
--[[User:Balsa|Balsa]] 16:15, 20 February 2011 (EST)
== Exim - local mail only - setup and testing ==
Setup: not written yet.
Testing / Debugging:
The following are draft quality only.
ps -efw | grep -i -e exim | grep -v grep
#Lists running exim processes.
netstat --inet -anp | grep -i -e exim -e 25 -e mail
#See if anything is listening on port 25.
ls -l /var/log
look for mail or exim4 directory, and mail.??? and mail.???? files.
ls -l /var/
look for mail, queue, or spool.
Do a ls -l in any directories found above.
Mail might be in ~/Mail
Read the Mutt HOWTO on slackwiki.org.
Read the qmail HOWTO as well.
tail -f /var/log/exim4/mainlog (if it exists)
The -f flag makes tail follow the file, so its best used on another virtual console or with screen.
There are numerous guides for screen.  My suggestion is to printout the most common commands on paper and keep it near your monitor.
Try the mail command out.
man mail
echo "Testing local mail, sent on `date` to the local system" \
| mail -s "Test of Local Mail" username@localhost.localdomain
Note that username@localhost.localdomain may not work.
Try hostname --fqdn
look in /etc/hosts
Testing the MTA with telnet on a certain port:
telnet localhost 25
HELO localhost
MAIL FROM: username@localhost.localdomain
RCPT TO: username@localhost.localdomain
DATA
SUBJECT: Testing mail via telnet
This is the message body.
Check if it worked with your favorite mail reader or by
looking in the files listed above.
End message body with a "." on a line by itself.
.
QUIT
Once local mail delivery works, you can setup cron jobs (see cron page on slackwiki, and man cron) and the output (if any) will be mailed to you.

Revision as of 22:24, 20 February 2011

Hi.

Balsa 03:28, 3 February 2011 (EST)


ALSA

/etc/asound.names
Gives names and descriptions for ALSA hardware devices. Very useful when using arecord and its '-D, --device=NAME' command line options.

/etc/asound.conf
I do not know what this is currently.

/etc/asound.state
Ditto.

strace - handy utility to see what programs are doing. strace -e file [some program and its args if relevant] - only shows file related stuff.

arecord - ALSA utility to record sound. It's what I'm having trouble with, and is the subject of most of this page.

sox - "Sound eXchange, the Swiss Army knife of audio manipulation" - (man sox; GNU General Public License)

strace -e file arecord -v -d 5 -t au test4.au ----> <snip>
Recording Sparc Audio 'test4.au' : Unsigned 8 bit, Rate 8000 Hz, Mono <snip>
Very interesting, indeed. This gives us the default ALSA device used by arecord, in my case it was /dev/snd/pcmC0D0c. Cross referencing with /etc/asound.names doesn't get us far, because I still don't know the mappings between that file and the stuff in /dev/snd. Some speculation may be in order.

grep -i capture -B 1 /etc/asound.names -->
name 'hw:0,4'
comment 'Physical Device - ALC268 Analog (Capture)'
--
name 'plughw:0,4'
comment 'Physical Device With Conversions - ALC268 Analog (Capture)'

Hmm.

Lets try: strace -e file arecord -v -d 5 -t au -D hw:0,4 test5.au
This opens /dev/snd/pcmC0D4c, and says "Recording Sparc Audio 'test5.au' : Unsigned 8 bit, Rate 8000 Hz, Mono" but exits with "arecord: set_params:954: Sample format non available".

strace -e file arecord -v -d 5 -t au -D hw:0,0 test5.au
Same deal, but opens /dev/snd/pcmC0D0c instead. Strange, since that is the same as the default.

TODO: Look at source code. Edit: nevermind.

Let's try one more thing - that /etc/asound.names gave me an idea...
strace -e file arecord -v -d 5 -t au -D plughw:0,0 test5.au
Hot dog it worked!
open("/dev/snd/pcmC0D0c", O_RDWR|O_NONBLOCK) = 4
open("test5.au", O_WRONLY|O_CREAT|O_LARGEFILE, 0644) = 3

sox test5.au -d --> Lots of clipping, noisy.
sox au: header size 24 is too small

Input File  : 'test5.au'
Channels  : 1
Sample Rate  : 8000
Precision  : 8-bit
Duration  : 00:05.00 = 40000 samples ~ 375 CDDA sectors
Sample Encoding: 8-bit Signed Integer PCM

100% 00:05.00 [00:00.00] of 00:05.00 Out:240k [!=====|=====!]Hd:0.0 Clip:182k
sox effects: rate clipped 120593 samples; decrease volume?
sox sox: alsa: output clipped 61507 samples; decrease volume?
Done.

Aha! The recording is unsigned 8bit, but the playback was signed 8bit. How does one change this?

man sox

sox -u test5.au -d
sox formats_i: `test5.au': overriding encoding type
Sample Encoding: 8-bit Unsigned Integer PCM
OK, it plays as unsigned 8bit. Success.

Simple tests from command line

netstat - man netstat

look for services that you don't know, read their manual pages. See if the service would be better listening to fewer interfaces [like localhost]. Use the ps command to figure out what's running. Try the netstat flags "--inet -anp" and read what they mean in the netstat manual.

look at /etc/fstab

man fstab man mount

Read a security article [fixme] about this file and the options. Skim the LVM and partitions pages here on slackwiki. Read about the noexec option (don't use this without understanding the consequences)

Try "hostname --fqdn" and see what it does. Check the exim page or qmail page to see about local mail delivery. Some security tools (and other stuff too) will email you when important events occur.

Read about the sudo and su commands.

--Balsa 16:15, 20 February 2011 (EST)

Exim - local mail only - setup and testing

Setup: not written yet.


Testing / Debugging:

The following are draft quality only. ps -efw | grep -i -e exim | grep -v grep

  1. Lists running exim processes.

netstat --inet -anp | grep -i -e exim -e 25 -e mail

  1. See if anything is listening on port 25.


ls -l /var/log look for mail or exim4 directory, and mail.??? and mail.???? files.

ls -l /var/ look for mail, queue, or spool. Do a ls -l in any directories found above.

Mail might be in ~/Mail

Read the Mutt HOWTO on slackwiki.org.

Read the qmail HOWTO as well.

tail -f /var/log/exim4/mainlog (if it exists) The -f flag makes tail follow the file, so its best used on another virtual console or with screen. There are numerous guides for screen. My suggestion is to printout the most common commands on paper and keep it near your monitor.


Try the mail command out. man mail

echo "Testing local mail, sent on `date` to the local system" \ | mail -s "Test of Local Mail" username@localhost.localdomain

Note that username@localhost.localdomain may not work.

Try hostname --fqdn

look in /etc/hosts


Testing the MTA with telnet on a certain port:

telnet localhost 25

HELO localhost

MAIL FROM: username@localhost.localdomain

RCPT TO: username@localhost.localdomain

DATA

SUBJECT: Testing mail via telnet

This is the message body.

Check if it worked with your favorite mail reader or by looking in the files listed above. End message body with a "." on a line by itself. .

QUIT


Once local mail delivery works, you can setup cron jobs (see cron page on slackwiki, and man cron) and the output (if any) will be mailed to you.