BackupPC can’t backup cPanel host
You probably noticed that BackupPC fails to backup your cPanel host over rsync with the following error:
Got fatal error during xfer (fileListReceive failed)
Nothing else. Nada.
If you increase the ssh verbosity, you will see that there is an error stdin: is not a tty.
It turns out that cPanel adds mesg y to your .bashrc and /etc/bashrc, which somehow messes up the remote rsync data channel over ssh.
To overcome this issue, add on top of your .bashrc and /etc/bashrc on cPanel host:
if [ $(expr index "$-" i) -eq 0 ]; then
return
fi
Nagios: check_imap_login
Since I didn't find a check_imap Nagios plugin with the login feature, response time measurement with perfdata output, as well as flexible warning and critical thresholds, a colleague of mine and I have modified an existing check_imap_login plugin by Bertera Pietro and uploaded it on Github:
https://github.com/isavcic/check_imap_login
Options:
check_imap_login -u-p -H [-s] -w -c
-s is for using IMAPS
Debian: online network interfaces reconfiguration with fallback to previous values
While inside screen:
/etc/init.d/networking stop; sleep 5; /etc/init.d/networking start; sleep 30; cp interfaces.old interfaces; /etc/init.d/networking stop; sleep 5; /etc/init.d/networking start
Limiting apt-get download speed
create file /etc/apt/apt.conf.d/76download with content:
Acquire
{
Queue-mode "access";
http
{
Dl-Limit "25";
};
};
That limits apt-get to 25KB/s
I’m just an old chunk of coal, but I’m gonna be a diamond some day
A good ol' from Ubuntu *and* Debian bugs:
Dimitrios Symeonidis wrote on 2008-10-14: (permalink)
this bug will soon celebrate it's 3rd birthday. it's marked as confirmed, high importance, and reported upstream (debian). are we going to do something about it, or are we just waiting for debian to resolve this?
(Emphasis added for extra lulz)
SoX, yeah!
ls -1 *.wav | while read FILE; do sox "$FILE" -r 22050 "NOVO/$FILE" compand 0.001,0.15 -28,-inf,-24,-24 -0.3 0 0 resample -qs; done
Remove comments and empty lines sed one-liner
sed -e 's/#.*//' -e 's/[ ^I]*$//' -e '/^$/ d'
...so I don't have to think of it again.
Deluge Torrent and Etch Backports
Simply wonderful.
I don't have to get it from testing and "break" my stable box with mixed trees!
backports as default, stable as fallback
Add to /etc/apt/sources.list:
deb http://www.backports.org/debian etch-backports main contrib non-free
Add to /etc/apt/preferences:
Package: *
Pin: release a=etch-backports
Pin-Priority: 750
Package: *
Pin: release a=stable
Pin-Priority: 700
Add to /etc/apt/apt.conf.d/00Cache:
APT::Cache-Limit "33554432";
APT::Default-Release "etch-backports";
Do:
apt-get update
apt-get dist-upgrade
htmldoc
htmldoc --size a4 --linkstyle plain --webpage --no-jpeg --tocheader ... --tocfooter ... --top 0 --bottom 20 --right 20 --left 20 -f book.pdf *.html
Nice webserver uptime
Just checked:
imp@extweb:~> uptime
2:34pm up 674 days 3:03, 1 user, load average: 0.02, 0.11, 0.09
Apt pinning: installing unstable packages on stable Debian
Minimal sources.list configuration.
/etc/apt/sources.list:
deb http://security.debian.org/ etch/updates main contrib
deb-src http://security.debian.org/ etch/updates main contrib
deb http://ftp.de.debian.org/debian stable main non-free contrib
deb http://ftp.de.debian.org/debian testing main non-free contrib
deb http://ftp.de.debian.org/debian unstable main non-free contrib
When updgrading, stable versions of packages need to stay on stable. unstable versions are usually newer, so they overwrite stable versions if this is not properly handled with using Pin-Priority as stated below. If not explicitly requested, "apt-get install" installs stable version of a package.
/etc/apt/preferences:
Package: *
Pin: release a=stable
Pin-Priority: 700
Package: *
Pin: release a=testing
Pin-Priority: 650
Package: *
Pin: release a=unstable
Pin-Priority: 600
To install f.e. unstable version of a package with dependencies from unstable as well (preferred method, AFAIK), do the following:
apt-get install package -t unstable
To install the same package, but to resolve it's deps from stable:
apt-get install package/unstable
Ubuntu 7.04: first thoughts
So, I am about to replace the Linux distro on my desktops, on my laptop and desktop machine, so I'm considering my choices... Debian-based is the way to go, so it's either Debian or Ubuntu.
I wouldn't go pure, vanilla Debian because of it's "correctness" (ok ok, I can add other repositories to the system, but it simply doesn't feel... "native" enough?). I've tried Kubuntu, but it simply didn't feel polished enough; it felt like Ubuntu's bastard child, management wise (Adept, KDE based apt frontend, crashed on me several times, dist-upgrade from 6.10 depended on some GTK stuff which wasn't installed automagically, so I had to figure out "by hand" what to install -- more info on that on my Launchpad bug report, etc).
That lead me to try Gnome-based, good ol' Ubuntu, and I have to say that so far, few glitches aside, it looks good. I haven't used Gnome for some time now and it seems really nice. Gnome itself and Nautilus, as a file manager, really feel snappy and stable. Gnome Terminal looks nicer than before and more usable.
Anyway, as a regular nitpicker, few downsides. First, LILO didn't install properly (Grub was complaining about residing on XFS, which is a no-no, eh?), so I had to manually edit lilo.conf, only to find out that some vital options are left out, such as "prompt", "lba32" and "compact", framebuffer "vga" line, too, and I had to add the timeout... Hmm, some really pretty much expected stuff? Why are they left out? Beats me. Then, in fstab, vfat partition had fs_passno = 1, so it was checked on every boot. Onward to Gnome itself. Ugly, anti-aliased fonts? Unlike KDE, Gnome Font preferences don't include an option to exclude some font size ranges from anti-aliasing, so everything is anti-aliased. Ok, I edited it by hand only to find out that the fonts that came with Ubuntu look terrible when not anti-aliased. I installed MS fonts and... what? They look ugly, too? Hmmm... I remember that Freetype has some bytecode interpreter option that makes those fonts look just like in Windows, but it is, to quote Freetype site, "potentially patent infringing", so it's disabled by default in Ubuntu... Damn that correctness. I found on Ubuntu forums a source for bytecode interpreter-enabled version of Freetype, so I installed that and FINALLY fonts looked BEARABLE. Then, the system doesn't have Adobe Flash player installed as default. Ok, I can understand that, that perhaps in the licence it doesn't allow automatic installation, or even inclusion in some other form like a Linux distro, but SuSE somehow managed to pull it off: the installer asks you whether you want to install that plugin nicely.
That's it for the first thoughts, more on Ubuntu later (perhaps) heh.
Linux 2.6.20
Oooooh, WHAT THE FUCK?
Used the config file from 2.6.17, did a "make oldconfig", answered to 20-sh questions (about new stuff), only to find out that it panics because it can't find root FS..!? Hmm, booted the old kernel, did menuconfig, only to find out that CONFIG_BLK_DEV_PIIX was moved to another option tree and wasn't properly selected as "Y" from the old config, so SATA wasn't available. When I fixed that, I found out that NAT and most of previous iptables functionality (from the previous kernel) simply.. wasn't there. After some Googling, I found out that the kernel devs made a major reorganization of the option trees, for some unknown reason (to me at least). The jump was almost like from 2.4 -> 2.6..
Crazyness! Lunacy!
Postfix and virtual mailboxes
Solved a nasty configuration error on Postfix with only virtual users/domains where a domain was listed in $mydestination, causing mail received for that domain to be treated as local and for local user delivery instead of virtual. Whoops. Learning new stuff every day...
DVD ripping under GNU/Linux
First identify the part of the dvd containing the video:
-Most of the time this is dvd://1
-If not try try dvd://2, dvd://3 etc.
-The command would be mplayer dvd://1 -dvd-device /dev/hd*
-* is your adress of the dvdrom
Get all the information of the movie:
-mplayer dvd://1 -dvd-device /dev/hd* -vo null -ao null -frames 0 -v 2>&1 | grep sid >log.txt && mplayer dvd://1 -dvd-device /dev/hdd -vo null -ao null -frames 0 -v 2>&1 | grep aid >>log.txt
Use vobcopy to copy the disc:
-vobcopy -l -t video.vob
-Make sure you're dvd-drive is mounted or it may complain
-Copy the .IFO file beloning to the movie part (dvd://number) from pathtodvd/VIDEO_TS/VTS_number_0.ifo
Detect the black borders:
-mplayer video.vob -vf cropdetect
-Skip through the video to let it do it's work
-Note the suggested crop values in log.txt
Detect the filelength (for I never see the credits)
-mplayer video.vob -osdlevel 3
-Skip to the end, note down the time where the video ends in log.txt
-If you want to include the credits, please ignore this step, it will cost quality though
Run the first pass of Xvid (fast):
-mencoder video.vob -endpos hh:mm:ss -nosound -o pass1.avi -sws 2 -vf crop=xxx:xxx:xx:xx,scale=576:320 -ovc xvid -xvidencopts pass=1:chroma_me:max_bframes=2:bvhq=1:vhq=1:trellis
-Your endpos is in your log.txt
-The cropvalue in in your log.txt
If the size of the first pass is reasonable, you can encode the audio and then run the second pass.
-The size is reasonable if the resulting video-only file has to be about < =30% smaller.
-Don't forget some MB for the audio
-If the resulting file has to be bigger, increase the resolution in steps of 32. For example try 640:352. Rerun the first pass with changed settings.
-If the compression would be higher than 30%, rerun the first pass with a denoise filter or decide to go for 2 CD's. Recommended denoise filter: hqdn3d=2:1:3 (Put it right after cropping with a ",")
-Based on the amount the video has to compress, choose a quality for the audio. I recommend using vorbis for movies. For hard to compress movies use vorbis at q0, otherwise stick to q2, or with real good compression q4. (Higher has no usage, for you won't possibly hear, if you insist just use the AC3 file)
Encode the audio:
-mplayer -vo null -vc dummy -ao pcm -aofile 2channels.wav video.vob -aid 128
-oggenc -q2 2channels.wav
-vorbisgain 2channels.ogg (Pumping up the volume without distortion)
-The -aid number you want is in your log.txt
Rip the subtitles:
-mencoder video.vob -ifo movie.ifo -vobsubout subtitles -vobsuboutindex 0 -sid 0 -ovc frameno -nosound
-for every extra subtitle you want to rip, increase vobsuboutindex with 1. With sid you can specify the languages found in your log.txt
-One subtitle usually costs you about 1,5 MB (compressed)
-Best way to measure the final size is to mux the subtitles only in a matroska file --> see end of instructions
Compute the bitrate:
vbr=(totalsize-audiosize-subtitlesize)*fps*8/frames
vbr=(734003200-62861936)*25*8/150750
vbr=870926
-These are examplevalues
-Bitrate is quite good, usually an undersize of about 1-2 MB.
-We'll use this bitrate for the second pass
Run the second pass:
mencoder video.vob -endpos hh:mm:ss -nosound -o pass2.avi -sws 2 -vf crop=xxx:xxx:xx:xx,scale=576:320 -ovc xvid -xvidencopts pass=2:bitrate=870926:chroma_me:max_bframes=2:bvhq=1:vhq=1:trellis
Now mux it all together and check for audio sync:
-Use mkvtoolnix (mmg to start)
-Open from mmg: pass2.avi, 2channel.ogg and subtitle.idx
-Set aspect-ratio of the video according the information outputted at the end of pass1/2
-Mux!
-Check if the audio is in sync with mplayer (mplayer pass2.mkv)
-Use control + or control - to see if it's getting better
-Redo the muxing with an other audio offset. This is positive if you used control +.
Enjoy your new quality rip!
Linux newbies
How to spot a Linux user who (recently) switched from Windows?
When something goes wrong, he reinstalls the whole system.
Fun with archaic machines
My PentiumII sidekick-machine, avatar, was supposed to receive a CPU upgrade today with a Celeron 633 MHz CPU, but alas, PCB revision which supports CPUs faster than 400 MHz must be at least v2.0 and my mobo is only v1.7. Crap.
avatar had a nice uptime of 88 days, but then the HDD failure happened and it's offline since then. 300 MHz have really did a nice job running fluxbox over TightVNC and monitoring the network with Cacti, among other things, including doing the print serving job... I must get a new hard drive for it.
Gentoo in comparison
Windows: A car with everything welded shut and you can only buy MS Gasoline and MS Oil.
Other Linux Distros: You can run any brand of Gas or Oil but your parts all come from the same company. You can tinker with the engine (compile your own software) but it voids your warranty. It comes with leather seats but they don't match with the rest of the interior.
Gentoo Linux: The car comes to you in pieces and once assembled, you find yourself constantly tuning the carbs, checking exhaust back pressure, tuning mixtures. You can choose any kind of seat covering, but if it is leather, you have to shoot the cow yourself. But perhaps the car is easier to drive and add new parts.
;)
(from Gentoo Forums)
sendxmpp
Nice application for sending all kinds of text (ie. cron outputs and warnings on machines you administer) directly to your JID or even chatroom!
Example:
[code]cat SOMETHING | sendxmpp -u SRC-USERNAME -p SRC-PASSWORD -j SRC-SERVER -t -s "SUBJECT" DST-USERNAME@DST-SERVER[/code]
New category, thinking of blogging in english
I added a new category today, GNU/Linux. There I'll post stuff related to OSS and GNU/Linux, Gentoo especially. I'm doing some thinking whether to blog in english or not. The reason is simple: english-speaking blog visitors. Most serbian-speaking people can understand English very well and therefore there shouldn't be any problems. The only problem is my grammar, but this blogging in english can only help. So, see you soon with some new posts.