Posted by rga on November 30, 2007
Hello,
IF you want to delete dos chars using Vim instead of installing external tools like dos2unix,tr,sed,awk etc.. you can do that using Vim syntax like this:
:set ff=unix //to unix file
:set ff=dos //to windows file
See you!
UPDATE
If you want to do mass conversions, you can use this command lines switches and let vim do the work :)
vim +"set ff=unix" +wq $DOS_FILE
Posted in Oneliner, Tips, Unix, Windows | 2 Comments »
Posted by Vide on November 29, 2007
If you are using a vanilla maildrop in a classic postfix (or another MTA) environment, you will have your master.cf to look like this:
maildrop unix - n n - - pipe
flags=DRhu user=vmail:vmail argv=/usr/bin/maildrop -d ${user}@${nexthop} ${user} ${nexthop} ${sender}
for example. And with this configuration, maildrop will not elaborate at all your /etc/maildroprc directive file. Why? Very simple (once you discover it): because we are using the -d switch which implies the Delivery mode. And it’s even written in the maildrop man page! Look:
Delivery mode
maildrop is the mail server’s mail delivery agent. maildrop runs in delivery mode when no filename is specified on the command line. maildrop
changes the current directory to the user’s home directory, then reads /etc/maildroprc, then $HOME/.mailfilter.
so, what’s happening here? Maildrop check if the ${user}@${nexthop} home directory exists and since it doesn’t, it simply exits spitting in your face :) So, no maildroprc rule applies, so you cannot create on-the-fly the homedir.
Now, there are two solutions:
- create manually (well, in the user-creation script) the home directory plus the Maildir with something like this:
mkdir -p /home/vmail/domains/$DOMAIN/$USER
maildirmake /home/vmail/domains/$DOMAIN/$USER/Maildir
chown -R vmail:vmail /home/vmail/domains/$DOMAIN/$USER
- edit master.cf to be like this (in the maildrop part):
maildrop unix - n n - - pipe
flags=DRhu user=vmail:vmail argv=/usr/bin/maildrop /etc/maildroprc ${user} ${nexthop} ${sender}
then give 0600 permissions and vmail ownership to /etc/maildroprc and finally append this to it (if you want to enable maildrop filter capabilities)
USERMAILDIRFILTER="/home/vmail/domains/$DOMAIN/$USER/.mailfilter"
DEFAULT="/home/vmail/domains/$DOMAIN/$USER/Maildir/."
`[ -f $USERMAILDIRFILTER ]`
if ( $RETURNCODE == 0 )
{
include $USERMAILDIRFILTER
}
PS: Gentoo maildrop version is affected by this “problem”. On the other hand, Debian’s one seems to be “immune”
Posted in Linux, Postfix, Postmaster, Tips | Tagged: Linux, maildrop, Postfix, Postmaster, Tips | 3 Comments »
Posted by Vide on November 23, 2007
Today I was debugging a problem I had with keepalived not discovering that a real server behind a virtual IP it manages, had died.
The problem was really strange because the check was very, very simple
real_server 192.168.1.65 3306
{
TCP_CHECK
{
connect_port 3306
bindto 192.168.1.65
connect_timeout 2
}
}
This configuration was created after reading keepalived.conf man pages, that talk about these 3 options for the TCP_CHECK, without going in deeper details. So I assumed that bindto IPADDR has to be used to indicate to which IP address we should connect to do the check. But I was wrong, because with this configuration if the real server behind dies, keepalived doesn’t notice anything at all. This is because the “bindto” option, I guess, is used to choose to which local (to the LVS director) IP address bind to check the external IP:port.
So, changing the configuration to looks like this:
real_server 192.168.1.65 3306
{
TCP_CHECK
{
connect_port 3306
connect_timeout 2
}
}
fixed the problem. Keepalived is a great product and works quite well, but it’s documentation is a bit disappointing.
Posted in Fixes, LVS, Linux, Networking | Tagged: fix, keepalived, LVS, tcp_check problem | Leave a Comment »
Posted by rga on November 16, 2007
Hello,
If you are tryin’g to install Gentoo using a VMware and you get a error like this:
!! Block device /dev/sdaX is not a valid root device…
!! The root block device is unspecified or not detected.
Please specify a device to boot, or “shell” for a shell…
boot() ::
Solution is to pass option “doscsi” to kernel at boot, since doscsi loads all necessary scsi modules.
We use genkernel and our grub.conf looks like this:
title=Gentoo Linux 2.6.22-r9
root (hd0,0)
kernel /boot/kernel-genkernel-x86-2.6.22-gentoo-r9 root=/dev/ram0 init=/linuxrc ramdisk=8192 real_root=/dev/sda3 udev doscsi
initrd /boot/initramfs-genkernel-x86-2.6.22-gentoo-r9
See you!
Posted in Gentoo, Linux, Tips | Leave a Comment »
Posted by Vide on November 15, 2007
If you want to install a new Gentoo server (no graphical system at all), this is the quickest way I’ve found after lots of installations :)
- First, boot the machine with a live CD
- create the partitions you want with fdisk/cfdisk/partition tool you like. In our example we create 3 partions (swap, /boot and /) on our disk /dev/sda
mkfs.ext2 /dev/sda1
# mkswap /dev/sda2
# mkfs.ext3 /dev/sda3
# mkdir -p /mnt/gentoo && cd /mnt/gentoo
# wget http://www.gtlib.gatech.edu/pub/gentoo/releases/x86/current/stages/stage3-x86-2007.0.tar.bz2
# wget http://www.gtlib.gatech.edu/pub/gentoo/snapshots/portage-latest.tar.bz2
Note: if you are on a different architecture, please use a different release
tar xvjpf stage3-*.tar.bz2
# tar xvjf /mnt/gentoo/portage-latest.tar.bz2 -C /mnt/gentoo/usr
# nano -w /mnt/gentoo/etc/make.conf
# cp -L /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
# mount -t proc none /mnt/gentoo/proc
# mount -o bind /dev /mnt/gentoo/dev
# chroot /mnt/gentoo /bin/bash
# env-update
# source /etc/profile
# export PS1="(chroot) $PS1"
# emerge --sync
# cp /usr/share/zoneinfo/Europe/Paris /etc/localtime
# USE="-doc symlink" emerge gentoo-sources
# emerge genkernel
# genkernel all --menuconfig
# nano /etc/fstab
# nano /etc/conf.d/hostname
# nano /etc/conf.d/net
# passwd
# echo "tts/0" >> /etc/securetty
# nano /etc/rc.conf
# nano /etc/conf.d/keymaps
# nano /etc/conf.d/clock
# emerge syslog-ng && rc-update add syslog-ng default && emerge vixie-cron && rc-update add vixie-cron default && emerge logrotate && emerge slocate && emerge ntp && rc-update add ntpd default && rc-update add ntp-client default && modules-update
# emerge gcc
# emerge world
# emerge grub
# nano /boot/grub/grub.conf
# grep -v rootfs /proc/mounts > /etc/mtab
# grub-install /dev/sda
# exit
# cd
# umount /mnt/gentoo/boot /mnt/gentoo/dev /mnt/gentoo/proc /mnt/gentoo
# reboot
NOTES: when it’s indicated “nano $SOMEFILE” it means you have to edit and adjust the settings to your own taste.
When you are creating /etc/localtime, use a source file according to your local timezone
And here it is a basic make.conf configuration:
CFLAGS="-O2 -march=i686 -pipe"
CHOST="i686-pc-linux-gnu"
CXXFLAGS="${CFLAGS}"
USE=”-X -qt -gtk -gnome -kde bash-completion -snmp sockets threads latin1 -berkdb -ipv6 snmp perl”
PORTDIR_OVERLAY=”/usr/local/portage”
Posted in Gentoo, Howtos, Linux | Tagged: Gentoo, howto, Install, Linux | 3 Comments »
Posted by Vide on November 15, 2007
We have got a couple of Dell PowerEdge SC1435 (Dual Opteron) with a lspci output like this:
00:01.0 PCI bridge: Broadcom HT1000 PCI/PCI-X bridge
00:02.0 Host bridge: Broadcom HT1000 Legacy South Bridge
00:02.1 IDE interface: Broadcom HT1000 Legacy IDE controller
00:02.2 ISA bridge: Broadcom HT1000 LPC Bridge
00:03.0 USB Controller: Broadcom HT1000 USB Controller (rev 01)
00:03.1 USB Controller: Broadcom HT1000 USB Controller (rev 01)
00:03.2 USB Controller: Broadcom HT1000 USB Controller (rev 01)
00:04.0 VGA compatible controller: ATI Technologies Inc ES1000 (rev 02)
00:07.0 PCI bridge: Broadcom Unknown device 0140 (rev a2)
00:08.0 PCI bridge: Broadcom Unknown device 0142 (rev a2)
00:09.0 PCI bridge: Broadcom Unknown device 0144 (rev a2)
00:0a.0 PCI bridge: Broadcom Unknown device 0142 (rev a2)
00:0b.0 PCI bridge: Broadcom Unknown device 0144 (rev a2)
00:18.0 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] HyperTransport Technology Configuration
00:18.1 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Address Map
00:18.2 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] DRAM Controller
00:18.3 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Miscellaneous Control
00:19.0 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] HyperTransport Technology Configuration
00:19.1 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Address Map
00:19.2 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] DRAM Controller
00:19.3 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Miscellaneous Control
01:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5721 Gigabit Ethernet PCI Express (rev 21)
02:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5721 Gigabit Ethernet PCI Express (rev 21)
03:0d.0 PCI bridge: Broadcom HT1000 PCI/PCI-X bridge (rev c0)
03:0e.0 IDE interface: Broadcom BCM5785 (HT1000) PATA/IDE Mode
it may happen that, when there is disk activity, tha SATA disk just disconnects, causing the processes using the disk to freeze for 30-60 seconds. The output in /var/log/messages could look like something like this:
ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x40000000 action 0x2 frozen
ata1.00: cmd ec/00:00:00:00:00/00:00:00:00:00/00 tag 0 cdb 0x0 data 512 in
res 40/00:01:00:4f:c2/00:00:00:00:00/00 Emask 0x4 (timeout)
ata1: port is slow to respond, please be patient (Status 0xd0)
ata1: soft resetting port
ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
ata1.00: configured for UDMA/133
ata1: EH complete
SCSI device sda: 312500000 512-byte hdwr sectors (160000 MB)
sda: Write Protect is off
sda: Mode Sense: 00 3a 00 00
SCSI device sda: write cache: enabled, read cache: enabled, doesn't support DPO or FUA
The solution is to put
pci=noacpi
in your Grub/Lilo configuration as parameter of the kernel you’re using. I’ve experienced this problem with kernels 2.6.18 and 2.6.20, both 32 and 64 bit
EDIT:
I’ve spoken too early, it seems that the trick doesn’t work, so we are here again with this SATA problem on these machines. Any idea from the web?
Posted in Fixes, Linux | Tagged: Dell, fix, Linux, sata problem | 2 Comments »
Posted by Vide on November 7, 2007
Today I was looking for a way to give a user access to edit, and nothing more, a remote file on a Linux box (Debian, to be correct). There were lot of options:
- vim: too complex to use
- emacs: just overkill
- ee: looks simple but in the end it is no
- joe: same as above
- nano: it was the better choice but I’d prefer something in ncurses
Enter le. It has all what I wanted for my user: color output, ncurses-based interface when exiting (it displays a cute dialog asking if you want to save the modified file), it even supports easy mouse-based copy&paste in a putty session!
So, after a few script lines and passwd changes, I have it the way I wanted.
Posted in Linux, Tips, Unix | Tagged: Linux, ncurses, text editor, Tips | Leave a Comment »