Archive
January 23, 2008
By default, sudo keeps the password in “memory” for 5 minutes (at least under Ubuntu).
If you want to change that value
$ sudo visudo
Add the following line before the other “Defaults” line :
Defaults timestamp_timeout=2
Or simply append “timestamp_timeout=2″ to the existing Defaults line like :
Defaults !lecture,tty_tickets,!fqdn,timestamp_timeout=2
This will set the timeout to 2 minutes…
Set to 0 to always require the password
Set to “-1″.. you will only have to prove you know the password once.
Options on the Defaults line are system-wide settings.
If you want to apply settings to particular users add :
Defaults:johndoe timestamp_timeout=-1
If you don’t want to be prompted for the password at all, you must have a rule like
johndoe ALL=(ALL) NOPASSWD: /bin/mount
This would never require the password for the command “mount”.
If you don’t want to ever be asked for the pass when using sudo :
johndoe ALL=(ALL) NOPASSWD: ALL
January 22, 2008
This used to work in Ubuntu 7.04..
Here’s the fix until the feature works again (See bugreport 156226 in launchpad)
- Open gconf-editor
- Enable /apps/gnome-power-manager/lock/use_screensaver_settings
You should also enable “blank-screen” in the same section, I noticed the screen doesn’t go blank when the lid is closed without it
Solution provided by Pedro Villavicencio in the comments of the bug report (permalink)
January 21, 2008
Ubuntu 7.10 Desktop Edition
Laptop specs :
Dell XPS M1330
WLED screen
Webcam 0.3 Mpixels
Fingerprint scanner
Media Card Reader Ricoh
Wireless Intel iwl4965 AGN
Cpu : T7500 2.2 Ghz
Memory : 3 GB RAM 667 Mhz
HDD : Seagate 200 GB 7200 RPM
Sound : SigmaTel STAC9228
lspci :
00:00.0 Host bridge: Intel Corporation Mobile PM965/GM965/GL960 Memory Controller Hub (rev 0c)
00:01.0 PCI bridge: Intel Corporation Mobile PM965/GM965/GL960 PCI Express Root Port (rev 0c)
00:1a.0 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Contoller #4 (rev 02)
00:1a.1 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #5 (rev 02)
00:1a.7 USB Controller: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #2 (rev 02)
00:1b.0 Audio device: Intel Corporation 82801H (ICH8 Family) HD Audio Controller (rev 02)
00:1c.0 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 1 (rev 02)
00:1c.1 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 2 (rev 02)
00:1c.3 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 4 (rev 02)
00:1c.5 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 6 (rev 02)
00:1d.0 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #1 (rev 02)
00:1d.1 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #2 (rev 02)
00:1d.2 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #3 (rev 02)
00:1d.7 USB Controller: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #1 (rev 02)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev f2)
00:1f.0 ISA bridge: Intel Corporation 82801HEM (ICH8M) LPC Interface Controller (rev 02)
00:1f.1 IDE interface: Intel Corporation 82801HBM/HEM (ICH8M/ICH8M-E) IDE Controller (rev 02)
00:1f.2 SATA controller: Intel Corporation 82801HBM/HEM (ICH8M/ICH8M-E) SATA AHCI Controller (rev 02)
00:1f.3 SMBus: Intel Corporation 82801H (ICH8 Family) SMBus Controller (rev 02)
01:00.0 VGA compatible controller: nVidia Corporation GeForce 8400M GS (rev a1)
03:01.0 FireWire (IEEE 1394): Ricoh Co Ltd R5C832 IEEE 1394 Controller (rev 05)
03:01.1 Generic system peripheral [0805]: Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter (rev 22)
03:01.2 System peripheral: Ricoh Co Ltd R5C843 MMC Host Controller (rev 12)
03:01.3 System peripheral: Ricoh Co Ltd R5C592 Memory Stick Bus Host Adapter (rev 12)
03:01.4 System peripheral: Ricoh Co Ltd xD-Picture Card Controller (rev 12)
09:00.0 Ethernet controller: Broadcom Corporation NetLink BCM5906M Fast Ethernet PCI Express (rev 02)
0c:00.0 Network controller: Intel Corporation PRO/Wireless 4965 AG or AGN Network Connection (rev 61)
lsusb :
Bus 007 Device 004: ID 05a9:7670 OmniVision Technologies, Inc.
Bus 007 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000
Bus 004 Device 002: ID 045e:007d Microsoft Corp. Notebook Optical Mouse
Bus 004 Device 001: ID 0000:0000
Bus 006 Device 002: ID 0483:2016 SGS Thomson Microelectronics Fingerprint Reader
Bus 006 Device 001: ID 0000:0000
Bus 005 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 005: ID 0a5c:4503 Broadcom Corp.
Bus 002 Device 004: ID 0a5c:4502 Broadcom Corp.
Bus 002 Device 003: ID 413c:8126 Dell Computer Corp.
Bus 002 Device 002: ID 0a5c:4500 Broadcom Corp.
Bus 002 Device 001: ID 0000:0000
webcam : works out of the box (if not, see links)
sound : microphone doesn’t work out of the box
1. Enable gutsy-proposed repository
2. Install linux-backports-modules-2.6.22-14-generic
3. Disable gutsy-proposed repository
In sound preferences, enable every channels, in the option tab select “Digital Mic 1″ as Digital Input Source
I set my hardware volume keys to control the “front” channel (don’t forget to set the tray volume icon to display the front volume as well : right click, preferences).
2nd front headset jack isn’t working properly, see http://linux.dell.com/wiki/index.php/Ubuntu_7.10/Issues/Second_Headphone_Jack_Does_Not_Work
Temperature probes : install sensors-applet, the ACPI CPU sensor is available out of the box
Install hddtemp and make it run at boot.. sensors-applet will then be able to monitor the HDD sensor.
Other sensors can be used :
• with i8kutils and “modprobe i8k force=1″
• with coretemp, “modprobe coretemp” and cat /sys/devices/platform/coretemp.?/temp1_input
sensors-applet doesn’t support nvidia probes in Ubuntu 7.10
http://aldeby.wordpress.com/2007/10/26/compiling-gnome-sensors-applet-with-nvidia-support/
I’ve built sensors-applet with nvidia support for i386 : http://www.wains.be/pub/sensors-applet_2.2.1-1_i386.deb

After installing sensors-applet with nvidia support (CPU, HDD, nvidia)
With the default nvidia restricted drivers installed by ubuntu, the sensor said the graphic card is always around 68-70°C
After installing version 169.07 using envy, the sensor reports values anywhere between 52°C and 60°C.. not sure if it’s the old drivers reporting the wrong value or anything.. can’t hear a difference from the fan.
Screen : the monitor dims automatically when not using the computer for 1 minute (apparently a problem with gnome power saving thing, if I set the brightness to 100 % and access Gnome Power settings, the monitor dims immediately).
Hibernation : After hibernation, CPU cores are always running at 2.2 Ghz (there’s a fix, see links)
Dell keyboard shortcuts : working. I configured the dell “home” key to open my home directory in nautilus (gnome keyboard settings)
Wireless : works out of the box
Wifi Catcher apparently doesn’t work when Ubuntu is installed
Wifi LED doesn’t turn on under Linux (Bluetooth does)
Fingerprint scanner : can work with thinkfinger (see links)
Card Reader : SD works out of the box, Memory stick doesn’t, other media not tested
Useful links :
https://wiki.ubuntu.com/InstallingUbuntuOnADellXPSM1330
http://intr.overt.org/blog/?page_id=56
http://doc.ubuntu-fr.org/dell_xps_m1330
http://doc.ubuntu-fr.org/thinkfinger
http://blog.higherthings.org/borghardt/article/3077.html
https://wiki.ubuntu.com/ThinkFinger
http://www.atlas95.com/blog/tag/xps-m1330/
http://linux.dell.com/wiki/index.php/Ubuntu_7.10#Dell_OS_Reinstallation_7.10_DVD_ISO
January 18, 2008
I can never seem to remember that command.. always starting the command with alt.. then tab-tab-tab for autocompletion.. but nothing relevant shows up..
Here it is :
sudo update-alternatives --config editor
Under Red Hat, both update-alternatives and alternatives commands work.
Or one can always manually symlink editor to vim under /etc/alternatives
January 14, 2008
Not something I do on a daily basis, so here it goes :
$ svn switch --relocate file:///home/old/path/to/svn/ file:///home/new/path/to/svn/
You may also want to update the SVN repository URL in your TRAC environments…
$ vim /path/to/trac-env/conf/trac.ini
Update the variable named repository_dir
When done you need to resync the environments…
$ trac-admin /path/to/trac-env/ resync
January 10, 2008
From : http://www.bind9.net/manual/bind/9.3.2/Bv9ARM.ch06.html#id2566761
BIND Master File Extension: the $GENERATE Directive
Syntax: $GENERATE range lhs [ttl] [class] type rhs [ comment ]
$GENERATE is used to create a series of resource records that only differ from each other by an iterator. $GENERATE can be used to easily generate the sets of records required to support sub /24 reverse delegations described in RFC 2317: Classless IN-ADDR.ARPA delegation.
$ORIGIN 0.0.192.IN-ADDR.ARPA.
$GENERATE 1-2 0 NS SERVER$.EXAMPLE.
$GENERATE 1-127 $ CNAME $.0
is equivalent to
0.0.0.192.IN-ADDR.ARPA NS SERVER1.EXAMPLE.
0.0.0.192.IN-ADDR.ARPA. NS SERVER2.EXAMPLE.
1.0.0.192.IN-ADDR.ARPA. CNAME 1.0.0.0.192.IN-ADDR.ARPA.
2.0.0.192.IN-ADDR.ARPA. CNAME 2.0.0.0.192.IN-ADDR.ARPA.
...
127.0.0.192.IN-ADDR.ARPA. CNAME 127.0.0.0.192.IN-ADDR.ARPA.
More about the options on the site mentionned above
1. Grab firmware : http://www.slug-firmware.net/d-dls.php
2. (optional) Install UpSlug2 on your computer : http://www.nslu2-linux.org/wiki/Main/UpSlug2
UpSlug2 is a tool to flash your NSLU2 from a computer on the same network.
This is required if you are reinstalling an already Debianized NSLU2, otherwise you can use the web management on a new unit.
3. Install Debian : http://www.cyrius.com/debian/nslu2/
In order for the install to complete as fast as possible, unselect any package group (even base).. took less than 1 hour to complete that way.
When done (optional) :
4. Reducing memory usage : http://www.cyrius.com/debian/nslu2/reducing-memory.html
/etc/inittab and comment "T0:23:respawn:/sbin/getty -L ttyS0 115200 linux"
5. Follow the useful hints from (scroll halfway down) : http://svn.debian.org/wsvn/pkg-nslu2-utils/trunk/debian/README.Debian?op=file
/etc/default/rcS and set FSCKFIX=yes
/etc/default/bootlogd and enable bootlog
6. In case you’re running the OS from a USB drive (limited write cycles) : http://www.nslu2-linux.org/wiki/HowTo/UseAMemoryStickAsMainDrive
disable MARK logs : /etc/defaults/syslogd and set SYSLOGD="-m 0"
mount / with noatime : /etc/fstab and add option noatime for the / mount point
7. In case the NSLU2 uses a static IP
apt-get remove dhcp*
8. Generate UTF-8 locales
Accents in the filesystem are not displayed correctly (while OK when accessing files remotely)
apt-get install locales
dpkg-reconfigure locales
Select an UTF-8 locales to fix the problem (had to reboot for changes to be taken in account, not sure if there’s a way to avoid rebooting)
9. Emit 3 beeps when NSLU2 has started
apt-get install beep
Edit /etc/rc.local and add :
/usr/bin/leds beep; sleep 1; /usr/bin/leds beep; sleep 1; /usr/bin/leds beep
January 9, 2008
I installed Debian on an NSLU2.
The system is running off a USB thumb drive.
In order to maximize the lifetime of the drive, I need to limit the number of writes to it.
– MARK — entries in the logs are (from my understanding) pretty useless for that system, here’s how to disable them.
Edit /etc/defaults/syslogd
Change the SYSLOGD option to the following :
SYSLOGD="-m 0"
Restart syslogd :
invoke-rc.d sysklogd restart
January 5, 2008
man -t rsync | ps2pdf -> ~/Desktop/rsync.pdf
Thanks to my buddy Seb for the command
Today, I had to recover some data from a (badly) failed drive.
The drive was coming from a laptop. I first tried to recover stuff using the Ubuntu Live CD on the laptop, but it didn’t work. Whenever I was trying to install the necessary tools in the Live CD environment, the system was hanging and throwing IO errors from the failed drive.
I attached the drive (using a 2″1/2 to 3″1/2 adapter) to my desktop machine and booted under Ubuntu.
It was impossible to mount the drive directly (returning IO errors immediately).
dd was not able to copy the content of the drive, because of the bad sectors.
The tool dd_rescue (from the package ddrescue) came to help.. It found errors at around 2.8 GB and 13 GB but kept going. I’m now in possession of a file that can be mounted and I can recover the precious files.
Usage : dd_rescue -l errors.log /dev/sdc1 /path/to/destination/diskdump
Here’s the description of ddrescue : copies data from one file or block device to another
dd_rescue is a tool to help you to save data from crashed partition.
It tries to read and if it fails, it will go on with the next sectors
where tools like dd will fail. If the copying process is interrupted
by the user it is possible to continue at any position later.
It can copy backwards.
gddrescue, dcfldd and rdd are apparently similar tools. I haven’t tested them.
Searching for the word “forensic” in Synaptic returned some interesting tools.
foremost : Forensics application to recover data
This is a console program to recover files based on their headers and
footers for forensics purposes.
Foremost can work on disk image files, such as those generated by dd,
Safeback, Encase, etc, or directly on a drive. The headers and footers
are specified by a configuration file, so you can pick and choose which
headers you want to look for.
Usage : foremost -t jpg -i diskdump
This would recover jpg files from diskdump and copy the recovered files in the current directory
vinetto : A forensics tool to examine Thumbs.db files
A tool intended for forensics examinations. It is a console program to extract
thumbnail images and their metadata from those thumbs.db files generated under
Windows. Used in forensic environments.
Usage : vinetto Thumbs.db -o /tmp/dir
This would recover the cached preview images from Thumbs.db into /tmp/dir
sleuthkit : Tools for forensics analysis
The Sleuth Kit (previously known as TASK) is a collection of UNIX-based
command line file system and media management forensic analysis tools.
The file system tools allow you to examine file systems of a suspect
computer in a non-intrusive fashion. Because the tools do not rely on
the operating system to process the file systems, deleted and hidden
content is shown.
You can use “autopsy” as front-end to sleuthkit.
gdmap : Tool to visualize diskspace
GdMap is a tool which allows to visualize disk space. Ever wondered why your
hard disk is full or what directory and files take up most of the space? With
GdMap these questions can be answered quickly. To display directory
structures cushion treemaps are used which visualize a complete folder or even
the whole hard drive with one picture.
The purpose here was to recover files from a failed drive.. not doing forensics, so only dd_rescue was really needed today.
I’ll try to keep a list of useful recovery/forensics tools in this post.
If you have suggestions about tools, technique, etc. drop me a line.