run-parts: failed to exec /etc/cron.weekly/ntping: Exec format error

0 comments
source : debian-user-digest # 1155.

when a job is been run by cron then I get :

/etc/cron.weekly/ntping :
run-parts: failed to exec /etc/cron.weekly/ntping: Exec format error
run-parts: /etc/cron.weekly/ntping exited with return code 1

when I launch at command prompt, then :

/etc/cron.weekly/ntping
12 Jul 13:20:10 ntpdate[10915]: step time server
aaa.bbb.ccc.ddd offset 2.974808 sec


Try adding a shebang to the top of your file :

#!/bin/sh
 
 
Creative Commons License
This work by maniac.vardhan is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
 
 

holding back packages with aptitude

0 comments
source : debian-user-digest # 1165,1170.


A common use case with aptitude ( interactive mode ) / apt-listbugs is :
a) order an upgrade
b) aptitude downloads packages
c) apt-listbugs reports some serious bug in a package
d) I decide not to install / upgrade the problematic package, after reading the short bug description, or looking it up in the BTS
e) hit 'n' to abort the installation / upgrade
f) search for the package via something like '^first-few-letters-of-package', and keep looking until I find the right one.
g) hold with '='
h) reorder the upgrade


Solution :
a) -e) as above

f) hit 'g' to see the actions preview again.

g) Scroll to the buggy packages in the actions preview, where they are easy to find, and use 'F' to forbid upgrades to the buggy versions. ( You can also use '=' to hold if you prefer; I like forbid-version better because it means that I do not have to remember to remove the hold once a newer, hopefully fixed, version is available. )

h) press 'g' again to go ahead with the upgrade of all other packages.
 
 
Creative Commons License
This work by maniac.vardhan is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
 
 

wpa_supplicant authentication may have failed, wicd with wpa2wpa_supplicant authentication may have failed, wicd with wpa2 fails

0 comments
source : debian-user-digest # 1174,1175,1176,1183.

[ A ] : try removing network-manager.

[ B ] : Try starting "wp_supplicant" in debug mode to make the log more verbose about that error. It seems failing at some point of the authentication.
Also, try to lower the security a bit by choosing WPA-PSK ( TKIP ) or WPA2-PSK ( AES+TKIP ) instead just AES. Stronger encryption requires better coberture so devices can "dialogue" smoothly.

[ C ] : It might be better to put away wicd for a moment and invoke wpa_supplicant directly with the -d switch. You may have to set the ssid first with iwconfig(8).

[ D ] : Reviwer your "/etc/dbus-1/system.d/wpa_supplicant.conf" or whatever the config file is. AP and wpa_supplicant settings must match.

[ E ] : One thing I've done a few times, that may help here, is to create a temporary wrapper script to run some command.

That is, go to the executable file location, rename it, say xx.orig, and create a short script named xx, that will start the xx.orig with the debug options you want. You probably want to use as the last arg the form "$@" ( include the quotes ), which will supply any arguments from the script to the real program exactly as they were given to the script.

In case there's some std* output from the original that doesn't get written to a log file, you can add this at the top of the script, to capture that output in your own log file :
exec >/tmp/xx.orig.$$.log 2>&1

Or just put everything after the 'exec' above, after the xx.orig command line. The advantage of using the 'exec' form is that any output the script generates for any problem will also be written to the file ( syntax errors, other commands failing, etc ).
 
 
Creative Commons License
This work by maniac.vardhan is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
 
 

restrict xsane on replacing lprng with cups

0 comments
source : debian-user-digest # 1166.

# aptitude -R install xsane
 
 
Creative Commons License
This work by maniac.vardhan is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
 
 

how to reread changed udev rules without rebooting ?

0 comments
source : debian-user-digest # 1183,1200.

[ A ] : Try removing the kernel module responsible for the card and installing it again.

[ B ] : There is a 'udev' script in '/etc/init.d'.
Maybe doing a restart on it will do the trick.

reload would also do the trick there. And create less work for the system. It only asks udevd to re-read the rules.
 
 
Creative Commons License
This work by maniac.vardhan is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
 
 

restrict home directory view from another profile

0 comments
source : debian-user-digest # 1189.

By default files in the home are readable but not writable.

$ chmod o-rwx ~/

For more information :
$ man chmod
 
 
Creative Commons License
This work by maniac.vardhan is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
 
 

how to mount or umount a usb storage device

0 comments
source : debian-user-digest # 1200.

# mount -t vfat /dev/<proper device name> <where you want to mount it> 

You may want to look into using the automount package, if you wanted to have your usb or other udev devices mounted automatically.
 
 
Creative Commons License
This work by maniac.vardhan is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
 
 

lighttpd : howto move php error messages from error.log to the browseragain ?

0 comments
source : debian-user-digest # 1222.

you have to set display_errors in php.ini to
display_errors = on
 
 
Creative Commons License
This work by maniac.vardhan is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
 
 

how to search for packages by architecture using dpkg ?

0 comments
source : debian-user-digest # 1256.

Replace Architecture with architecture name, e.g. i386
$ dpkg-query -W -f='${Package}\t${Architecture}\n' > /$HOME/Desktop/arch.txt
 
 
Creative Commons License
This work by maniac.vardhan is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
 
 

how to repeatedly mount a specific iso

0 comments
source : debian-user-digest # 1258.

Add the following line /etc/fstab :
/home/user/data.iso /mnt/ iso9660 ro,loop,user,noauto 0 0

To umount the .iso file:
/dev/loop0 /mnt iso9600 ro,loop,user,noauto 0 0
 
 
Creative Commons License
This work by maniac.vardhan is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
 
 

udev : renamed network interface eth0 to eth1

0 comments
source : debian-user-digest # 1260.

Take a look at /etc/udev/rules.d/70-persistent-net.rules and verify that the rule for your card ( check its MAC ) is consistent with the naming scheme you want.
 
 
Creative Commons License
This work by maniac.vardhan is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
 
 

how to download a directory using wget

0 comments
source : debian-user-digest # 1266.

Replace http:// with your choice of url.
$ wget -r -np http://
 
 
Creative Commons License
This work by maniac.vardhan is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
 
 

how to download a directory along with its subdirectories using wget

0 comments
source : debian-user-digest # 1266.

Replace http:// with your choice of url.
$ wget -r -np -l1 http://
 
 
Creative Commons License
This work by maniac.vardhan is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
 
 

backup script example of a server

0 comments
source : debian-user-digest # 1283.

[ A ] : 1.) GZIP's everything but: proc, sys and others,
2.) signs said backup and then encrypts it and
3.) an SSH cert to the other server and the time to make said simple script.
You can even use Perl or PHP, both of which support being daemonized so you can do incremental backups or backups of specific files based on changes.

#!/bin/bash -e

echo $(date): [Info] Starting backup of server_name >> /var/log/backups.log
tar cvpjf server_backup.tar.bz2 --same-owner \
--exclude=/proc/* \
--exclude=/media/* \
--exclude=/dev/* \
--exclude=/mnt/* \
--exclude=/sys/* \
--exclude=/tmp/* \
--exclude=/usr/tmp/* \
--exclude=/lost+found/* \
--exclude=/server_backup.tar.bz2

You'll of course want to remove server_backup.tar.bz2, generate a certificate to sign and encrypt and move that certificate to your personal PC too and make more log entries throughout the process so you can diagnose a missed backup, but other than that it's pretty simple.


[ B ] : my clients need verbose lists of files that were backed up in certain places and we grep that out for their automatic emails.

In case the OP wants to know what we're on about, and so we don't stray to far off topic here is an example of piping tar to SSH :

#!/bin/bash -e

echo $(date): [Info] Starting backup of server_name >> /var/log/backups.log
tar cvpjf server_backup.tar.bz2 --same-owner \
--exclude=/proc/* \
--exclude=/media/* \
--exclude=/dev/* \
--exclude=/mnt/* \
--exclude=/sys/* \
--exclude=/tmp/* \
--exclude=/usr/tmp/* \
--exclude=/lost+found/* \
--exclude=/server_backup.tar.bz2 | ssh client_operator@backup.domain.com "dd of=server_backup.tar.bz2"
 
 
Creative Commons License
This work by maniac.vardhan is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
 
 

different ways to determine which disk is failing

0 comments
source : debian-user-digest # 1207,1208,1209.

[ A ] : cat /proc/mdstat can help but you need to get the serial numbers. Do this :

# hdparm -i /dev/sda

[ B ] : Are any USB communication errors being logged along with the md and ext3 errors ?
Are you sure it's a disk drive problem and not an issue with the kernel drivers, system BIOS, USB controller, cabling, or a combination thereof ?
How long ( days, weeks, months, years ) did this exact setup function properly
before you started seeing these problems ?
Did you recently perform any major software upgrades ( kernel/drivers ) shortly before this problem surfaced ?

[ C ] : you could also try smartctl -a /dev/sda to get the disks serial numbers.

[ D ] : You might try lsusb - to list devices on your usb bus. That might help you identify specific devices.
Also try nosing around in the sub-directories under /dev/disk.
And, perhaps an obvious question, but does the drive maker provide any device-specific drivers or utilities that might help ?

[ E ] : Both external drives are native SATA correct ? I think your best course of action at this point would be to purchase a $15-20 two port PCI SATA card based on a SiI 3512 chipset, any internal SATA data/power cables you'd need, and move the drives inside the PC. This will allow smartmontools, hdparm, and other utils to identify the drives, and you'll likely get a nice speed boost as well, especially if that PC has a 66MHz 32bit PCI slot, which will allow full bandwidth to both drives simultaneously.
 
 
Creative Commons License
This work by maniac.vardhan is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
 
 

how to make an entry of swap file in fstab

0 comments
source : debian-user-digest # 1380.

/path/name none swap loop,sw 0 0
 
 
Creative Commons License
This work by maniac.vardhan is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
 
 

can't acquire dhcp lease

0 comments
source : debian-user-digest # 1386.

Issue : What might be the problem that my laptop can't acquire dchp lease from Linux while Windows can ?
this a dual-boot machine. So same machine, same MACs, same spot, same line. Only difference is the OS, which they do have different hostnames though.

Solution :

Then your dhcp server is probably requiring that hostnames be sent.
By default the dhcp3 client doesn't send hostnames unless it is configured to do so.
Read : http://www.debian.org/doc/manuals/reference/ch05.en.html#_the_network_interface_served_by_the_dhcp
Add the hostname directive as described in that reference.

During the dhcp time your /var/log/syslog will be logging a trail of information about the network connection. What it says there would be useful information.
$ grep dhclient /var/log/syslog
 
 
Creative Commons License
This work by maniac.vardhan is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
 
 

gateway or router configuration example

0 comments
source : debian-user-digest # 1425.

/etc/network/interfaces
# the Internet interface, assuming a static config
# as received from the Internet provider
iface eth0 inet static
address xxx.xxx.xxx.xxx   # this is your Internet IP address
netmask 255.255.255.0
gateway xxx.xxx.xxx.xxx   # this is your gateway to the Internet
dns-nameservers xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx

# internal network, where this computer is the gateway
iface eth1 inet static
address 192.168.0.1
netmask 255.255.255.0

Install resolvconf, shorewall, dnsmasq.
For shorewall first you need the files contained in /usr/share/doc/shorewall-common/default-config to /etc/shorewall/ and then adjust a few of them according to the example in /usr/share/doc/shorewall-common/examples/two-interfaces ( all paths from memory as both gateways I administer remotely are currently shut-down ). Also don't forget to set IP_FORWARDING=On ( instead of Keep ) in /etc/shorewall/shorewall.conf.

On a client machine you only need the package resolvconf and :
/etc/network/interfaces
iface eth0 inet static
address 192.168.0.xx    # anything else but 192.168.0.1
netmask 255.255.255.0
gateway 192.168.0.1
dns-nameservers 192.168.0.1 # yes, the gateway, because we have dnsmasq

If you want your gateway to also provide DHCP just uncomment one example that suits you in /etc/dnsmasq.conf and restart dnsmasq.

On the client side you only need :
# iface eth0 inet dhcp

To connect multiple computers you need an Ethernet switch, preferably with auto-crossover or even Gigabit capabilities ( a hub would also do, but I doubt you can still buy one... ). You can also add a network card for each additional internal computer and use bridge-utils to create a bridge. This way your gateway will also act as a switch ;)

This setup is very flexible and can be extended in several ways depending on your needs.
 
 
Creative Commons License
This work by maniac.vardhan is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.