So I wiped out a directory that I thought I no longer needed. Turns out there was a 900K file that I didn't have copies of anywhere else in that directory. :(
So I quick googled on undelete for ext3 filesystems and found numerous posts on how its not possible. Funny thing it is possible ...
I eventually found http://code.google.com/p/ext3grep/ which was my lifesaver.
I'm not going to go into how to use this tool because there is already a great writeup @ http://www.xs4all.nl/~carlo17/howto/undelete_ext3.html
Suffice it to say I got my file back and I'm happy!
Friday, November 6, 2009
Friday, September 4, 2009
animate your desktop in linux
I've always wanted to have a slideshow of pictures for my desktop instead of just having 1 static image. I now know of 2 ways to do this. One I scripted myself, and another is program I found and learned to utilize which works better and is better.
First I'll detail my script, but be sure to continue to read further down as a better solution exists!
I initially created a script for GNOME that I was able to point to a directory full of images and have it randomly display a picture from the directory of images as my background. I then created a cronjob to execute the script so about every couple hours I would have a new backgroup.
NOTE: This will only work in GNOME 2.x as the script utilizes gconftool-2. I'm sure it can be modified to work with other versions of GNOME as well.
First I'll detail my script, but be sure to continue to read further down as a better solution exists!
I initially created a script for GNOME that I was able to point to a directory full of images and have it randomly display a picture from the directory of images as my background. I then created a cronjob to execute the script so about every couple hours I would have a new backgroup.
NOTE: This will only work in GNOME 2.x as the script utilizes gconftool-2. I'm sure it can be modified to work with other versions of GNOME as well.
- Create the script!
- vi chgBackground.sh
- #!/bin/sh
PID=$$
PHOTO_DIR=$1
if [[ -z ${PHOTO_DIR} ]]; then
echo "You must specify a directory that has your photos."
exit 1
fi
if [[ ! -d ${PHOTO_DIR} ]]; then
echo "Directory '${PHOTO_DIR}' does not exist."
exit 1
fi
# Look for files with extension .jpg or .png
PIC_COUNT="`find ${PHOTO_DIR} -iregex ".*\.\(jpg\|png\)$" | wc -l`"
if [[ ${PIC_COUNT} -eq 0 ]]; then
echo "No pictures found!"
exit 1
fi
find ${PHOTO_DIR} -iregex ".*\.\(jpg\|png\)$" > /tmp/chgBackground.${PID}
RANDOM=${PID}
RAN_VAR=`echo $[(${RANDOM} % ${PIC_COUNT}) + 1]`
BKG_PATH=`head -${RAN_VAR} /tmp/chgBackground.${PID} | tail -1`
/opt/gnome/bin/gconftool-2 -t string -s /desktop/gnome/background/picture_filename ${BKG_PATH}
rm -f /tmp/chgBackground.${PID}
- vi chgBackground.sh
- Set perms to execute the script
- chmod +x chgBackground.sh
- Run the script!
- chgBackground.sh /path/to/pics
- Schedule in crontab to run automatically
- crontab -e
- Add the following to change every hour:
- 0 * * * * sh -x /path/to/script/chgBackground.sh > /dev/null
- Download xwinwrap from http://tech.shantanugoel.com/projects/linux/shantz-xwinwrap
- unzip the downloaded file
- /path/to/xwinwrap -fs -st -sp -b -ov -- /usr/lib64/xscreensaver/glslideshow -window-id WID -duration 8 -pan 8 -fade 2 &
- -fs : parameter for xwinwrap to run fullscreen
- -st and -sp : I set these so that when xwinwrap runs it does not show up with a program window in the "Workspace Switcher" applet
- -b : This has xwinwrap run below GNOME panels
- -ov : This allows xwinwrap to run in all virtual desktops
- -- /usr/lib64/xscreensaver/glslideshow -window-id WID -duration 8 -pan 8 -fade 2 : This is an argument passwed to xwinwrap of the command you pass to xwinwrap to be run over your desktop
- -window-id WID : parameter for glslideshow to run fullscreen in your GNOME window
- -duration 8 : parameter for glslideshow on how long to have a single photo displayed
- -pan 8 : how long to pan the image for (if less then duration it will pan the image over 2 cycles for same image)
- -fade 2 : parameter for glslideshow on how to to fade between images
- & : allows xwinwrap to run in the background
- vi ~/.xscreensaver
- edit/add the line containing "imageDirectory" to point to the directory of images
- EXAMPLE:
imageDirectory: /path/to/images
- EXAMPLE:
- edit/add the line containing "imageDirectory" to point to the directory of images
Sunday, August 23, 2009
linux pptp configuration with MS vpn
I've been trying for a while to configure pptp to connect to my work vpn which uses an MS vpn server. Turns out configuration is fairly straightforward and that my main issue was really simple actually... anyways, the errors I was getting when trying to debug it were the following:
First I am going to go through the information we will need and setup some "variables" so you know where to use them in your configs. I'll post configs with the "variable", and a config with sample data.
Packages Needed:
The followingm packages are needed to be installed:
If you are not getting connected, you can start your pptp with the following command for debugging output:
root@mclittle:/etc/ppp# pon myvpn debug dump logfd 2 nodetachAnyways, here is what I did on an ubuntu system to get it to work, should be pretty much the same for other distributions.
pppd options in effect:
debug # (from command line)
nodetach # (from command line)
logfd 2 # (from command line)
dump # (from command line)
noauth # (from /etc/ppp/options.pptp)
refuse-pap # (from /etc/ppp/options.pptp)
refuse-chap # (from /etc/ppp/options.pptp)
refuse-mschap # (from /etc/ppp/options.pptp)
refuse-eap # (from /etc/ppp/options.pptp)
name jdoe # (from /etc/ppp/peers/myvpn)
user jdoe # (from /etc/ppp/peers/myvpn)
remotename PPTP # (from /etc/ppp/peers/myvpn)
# (from /etc/ppp/options.pptp)
pty pptp vpn.domain.com --nolaunchpppd # (from /etc/ppp/peers/myvpn)
crtscts # (from /etc/ppp/options)
# (from /etc/ppp/options)
asyncmap 0 # (from /etc/ppp/options)
lcp-echo-failure 4 # (from /etc/ppp/options)
lcp-echo-interval 30 # (from /etc/ppp/options)
hide-password # (from /etc/ppp/options)
ipparam myvpn # (from /etc/ppp/peers/myvpn)
proxyarp # (from /etc/ppp/options)
nobsdcomp # (from /etc/ppp/options.pptp)
nodeflate # (from /etc/ppp/options.pptp)
require-mppe-128 # (from /etc/ppp/peers/myvpn)
noipx # (from /etc/ppp/options)
using channel 26
Using interface ppp0
Connect: ppp0 <--> /dev/pts/2
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x556ea98d> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x0 <mru 1400> <auth eap> <magic 0x20e4721> <pcomp> <accomp> <callback CBCP> <mrru 1614> <endpoint [local:e7.d1.73.2d.b1.7b.49.5b.bc.41.b8.ae.36.14.95.be.00.00.00.00]> < 17 04 19 f5>]
No auth is possible
sent [LCP ConfRej id=0x0 <auth eap> <callback CBCP> <mrru 1614> < 17 04 19 f5>]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0x556ea98d> <pcomp> <accomp>]
rcvd [LCP TermReq id=0x1 02 0e 47 21 00 3c cd 74 00 00 03 97]
sent [LCP TermAck id=0x1]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x556ea98d> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x556ea98d> <pcomp> <accomp>]
^CTerminating on signal 2
sent [LCP TermReq id=0x2 "User request"]
Child process pptp vpn.domain.com --nolaunchpppd (pid 5494) terminated with signal 2
Modem hangup
Connection terminated.
First I am going to go through the information we will need and setup some "variables" so you know where to use them in your configs. I'll post configs with the "variable", and a config with sample data.
Packages Needed:
The followingm packages are needed to be installed:
- pptpd
- pptp-linux
- ppp
- sudo apt-get install ppp pptpd pptp-linux
- PPTP server name: ${VPN_SERVER}: vpn.doamin.com
- VPN User Name: ${USERNAME}: jdoe
- VPN Domain: ${DOMAIN}: USA
- VPN Password: ${PASSWORD}: jpass
- Connection name: ${CONFIG_FILE}: myvpn
- Password Alias: ${PASS_ALIAS}: myvpnalias
- First lets configure our username/password that will be used for the VPN. We will edit /etc/ppp/chap-secrets:
- SAMPLE:
${DOMAIN}\\${USERNAME} ${PASS_ALIAS} ${PASSWORD} * - EXAMPLE:
USA\\jdoe myvpnalias jpass *
- SAMPLE:
- Now we will create a connection config file. This file is to be created in /etc/ppp/peers/. With our example data that would mean /etc/ppp/peers/myvpn
- SAMPLE:
pty "pptp ${VPN_SERVER} --nolaunchpppd"
name ${DOMAIN}\\${USERNAME}
user ${DOMAIN}\\${USERNAME}
remotename ${PASS_ALIAS}
require-mppe-128
file /etc/ppp/options.pptp
ipparam ${CONFIG_FILE} - EXAMPLE:
pty "pptp vpn.domain.com --nolaunchpppd"
name USA\\jdoe
user USA\\jdoe
remotename myvpnalias
require-mppe-128
file /etc/ppp/options.pptp
ipparam myvpn
- SAMPLE:
- We can now connect to our pptp server:
- pon ${CONFIG_FILE}
- pon myvpn
- Watch your /var/log/messages file on the status of your connection
- When connected, you should have a new IP provided by the VPN server on a ppp0 device
- To disconnect your vpn connection:
- poff ${CONFIG_FILE}
- poff myvpn
- poff ${CONFIG_FILE}
If you are not getting connected, you can start your pptp with the following command for debugging output:
- pon ${CONFIG_FILE} debug dump logfd 2 detach
- pon myvpn debug dump logfd 2 detach
Monday, August 10, 2009
eee 901 hang during ubuntu linux suspend
My eee 901 was randomly hanging when entering a suspend mode. What would happen is when I try to resume it would just sit at a black screen. I would need to hard reset my system to bring it back online. Searching the web, I found the following that seems to be working for me.
References:
- vi /etc/pm/sleep.d/55hddpause
Add the following:
#!/bin/bash
case $1 in
suspend)
echo "Is my script running???"
sync
sleep 10
esac
- chmod +x /etc/pm/sleep.d/55pause
References:
hp ilo and self-signed certs with firefox 3
A very annoying thing I've encountered is that on our intranet we use to access hp iLOs the iLOs use self signed certs. Using firefox 3 to access these iLOs causes firefox to freak out and initiate a 4 step process to bypass the "unsecure" certificate. I got sick of wasting time for this since we manage hundreds of servers. I found the following plugin the brings the 4 click process down to 1 click:
Obviously (or maybe not), don't use this for a browser that you are using to serf the internet with ... only use it on a browser that you are using to access a secure and private network.
If someone knows of a way to eliminate the "Secure Connection Failed" warning page altogether, please leave a comment and let me know!
Obviously (or maybe not), don't use this for a browser that you are using to serf the internet with ... only use it on a browser that you are using to access a secure and private network.
If someone knows of a way to eliminate the "Secure Connection Failed" warning page altogether, please leave a comment and let me know!
Monday, August 3, 2009
class com.hp.ilo2.remcons.remcons.class not found
Working on an HP system I administrate I ran into the following java error message when trying to pull up the remote console in firefox on my linux workstation
- class com.hp.ilo2.remcons.remcons.class not found
- Close All Firefox Windows
- cd $HOME/.mozilla/firefox/*.default/
- rm -rf Cache
Tuesday, July 14, 2009
Ubuntu linux hibernation to file
The most recent project on my netbook was to get Ubuntu to hibernate correctly. Since netbooks are made for portability and conserving battery as much as possible is important I wanted to get this working badly. However, whenever I pressed the "Hibernate"button in the power options, it would just complain of not enough swap. So I decided to try and setup a file to use to hibernate to. In my situation this may not be the best option, but it was fun figuring it out. Here is what I ended up doing to get it to work.
Setup swapfile and some configuration for hibernation
Instead of rewriting a huge section, follow the instructions from: http://ubuntuforums.org/showpost.php?p=6570140&postcount=1
Additional configuration items
You can try to hibernate your system at this point now if you want. However, for me there was more work to be done. Here are the additional steps I had to take to take hibernation to completion.
Enable swap for hibernate then disable it after resume
Setup swapfile and some configuration for hibernation
Instead of rewriting a huge section, follow the instructions from: http://ubuntuforums.org/showpost.php?p=6570140&postcount=1
Additional configuration items
You can try to hibernate your system at this point now if you want. However, for me there was more work to be done. Here are the additional steps I had to take to take hibernation to completion.
Enable swap for hibernate then disable it after resume
- Create file /etc/acpi/suspend.d/01-swapctl.sh with the following:
- #!/bin/sh
swapon - Make sure to make it executable:
- chmod +x /etc/acpi/suspend.d/01-swapctl.sh
- #!/bin/sh
- Create file /etc/acp/resume.d/99-swapctl.sh with the following:
- #!/bin/sh
swapoff - Make sure to make it executable:
- chmod +x /etc/acpi/resume.d/99-swapctl.sh
- #!/bin/sh
- Create file /etc/acpi/suspend.d/56-kill-wpa_supplicant.sh with the following:
- #!/bin/sh
killall wpa_supplicant
sleep 5 - Make sure to make it executable:
- chmod +x /etc/acpi/suspend.d/56-kill-wpa_supplicant.sh
- #!/bin/sh
- Open gconf-editor:
- gconf-editor
- uncheck gnome_keyring_hibernate under path /apps/gnome-power-manager/lock
- gconf-editor
- Create file /etc/acpi/suspend.d/63-NetworkManager.sh with the following:
- #!/bin/sh
/etc/init.d/NetworkManager restart - Make sure to make it executable:
- chmod +x /etc/acpi/suspend.d/63-NetworkManager.sh
- #!/bin/sh
- First we'll make a backup of the original script:
- cp /usr/lib/hal/scripts/linux/hal-system-power-hibernate-linux /usr/lib/hal/scripts/linux/hal-system-power-hibernate-linux.orig
- Now we will wipeout the original:
- > /usr/lib/hal/scripts/linux/hal-system-power-hibernate-linux
- Now put the following contents into /usr/lib/hal/scripts/linux/hal-system-power-hibernate-linux:
- #!/bin/sh
/etc/acpi/hibernate.sh
exit $RET
- #!/bin/sh
- http://ubuntuforums.org/showpost.php?p=6570140&postcount=1
- http://ubuntuforums.org/showpost.php?p=4450536&postcount=106
- http://ubuntuforums.org/showthread.php?p=2875529
Labels:
file,
hibernate,
hibernation,
linux,
ubuntu
Thursday, July 2, 2009
Tethering blackberry 8830 on Ubuntu Linux with Bluetooth
Figuring out how to get my blackberry to tether with Ubuntu linux was a pain. I had to reference several different websites and take a little information from each to come up with a working solution. Here are the steps I took in order to get it to work for me. Some steps may be 'extras' as I did a lot of different things before coming to a working solution. I have not went through to figure out exactly what got it working. I may come back to clean this up a little later.
Pairing your blackberry with your computer over bluetooth
Figuring out device MAC with blueman:
Configuring rfcomm.conf
Initiate Blackberry Tether
Listed are the links that I referenced and combined information from to get to this point.
Pairing your blackberry with your computer over bluetooth
- Install Blueman Bluetooth manager (replacing bluez):
- echo "deb http://ppa.launchpad.
net/blueman/ppa/ubuntu jaunty main" | sudo tee -a /etc/apt/sources.list
- gpg --no-default-keyring --keyring /tmp/awn.keyring --keyserver keyserver.ubuntu.com --recv 947C4F7371932C794B153F0F6B15AB91951DC1E2 && gpg --no-default-keyring --keyring /tmp/awn.keyring --export --armor 947C4F7371932C794B153F0F6B15AB
91951DC1E2 | sudo apt-key add - && rm /tmp/awn.keyring
- sudo apt-get update
- sudo apt-get install blueman bluetooth bluez bluez-alsa bluez-cups bluez-gstreamer bluez-utils libbluetooth3 libbluetooth-dev bluez-compat bluez-pcmcia-support
- echo "deb http://ppa.launchpad.
- run blueman-manager or reboot if you don't know how
- Make sure bluetooth is enabled on your blackberry
- Make sure your blackberry is discoverable
- Right-click on the bluetooth icon in the taskbar, select Setup New Device…
- Click "Forward" button to proceed with searching for bluetooth devices
- Find your blackberry, select it and then click the "Forward" button
- Select "Don't connect" and click the "Forward" button
- Choose a pin to send to blackberry
- Enter pin on blackberry
- This should pair your blackberry with your computer
Figuring out device MAC with blueman:
- Click on the blueman applet
- You will see a list of bluetooth devices. Each displays a MAC address. Write down the MAC address for your blackberry
- On the host (the computer that will connect to the BlackBerry), run:
- hcitool scan
- The output will return a MAC address and device name. Write down the MAC address for your blackberry.
Configuring rfcomm.conf
- We need to get the channel for the DUN service provided by your blackberry:
sdptool search DUN
- You should see something similar to the following output:
Service Name: Dialup Networking
Service RecHandle: 0x10000
Service Class ID List:
"Dialup Networking" (0x1103)
"Generic Networking" (0x1201)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 1
Profile Descriptor List:
"Dialup Networking" (0x1103)
Version: 0x0100
- From the example above, we would use Channel 1. Yours may be different.
- Now let's edit /etc/bluetooth/rfcomm.conf. It should by similar to the following, replacing the channel and MAC with your values:
//Change to rfcomm1, rfcomm2, etc., if necessary
rfcomm0 {
# Automatically bind the device at startup
bind yes;
# Bluetooth address of the blackberry device
device 00:11:22:33:44:55;
# RFCOMM channel for the connection
# This should match the channel number from the sdptool output
channel 1;
# Description of the connection (whatever you want to call it)
comment "BlackBerry DUN";
}
- Now restart bluetooth:
- /etc/init.d/bluetooth restart
- Check that /dev/rfcomm0 exists:
- ls -l /dev/rfcomm0
- If it doesn't, create it manually:
rfcomm bind 0 your-phone-mac-address your-phone-rfcomm-channel
- You can then release it (delete /dev/rfcomm0) by:
rfcomm release 0
- You can then release it (delete /dev/rfcomm0) by:
- First we will create the chatscript that PPP will use. The following steps should work for ATT/Cingular. Different providers will require different contents for the chatscript. You can reference the following link for some ideas for other carriers: https://help.ubuntu.com/community/BluetoothDialup#Carrier%20specific%20configuration%20info
- Start editting a file
- vi /etc/chatscripts/att
- Add the following to the file:
# Activate the device and pause before sending additional AT commands.
'' AT+CFUN=1
'' AT
# Verify GPRS Attach prior to attempting PDP Context negotiation.
'' AT+CGREG=1
# Define the PDP context. THIS WILL BE DIFFERENT FOR DIFFERENT CARRIERS.
OK AT+CGDCONT=1,"IP","isp.cingular"
# Set the dialing string and specify which PDP Context definition to use.
# THIS WILL BE DIFFERENT FOR DIFFERENT CARRIERS.
OK ATDT*99***1#
# Attempt to connect.
'' CONNECT
- Start editting a file
- Now we will setup the PPP password file(s) to authenticate with the provider over the tether. Again, this information is specific to ATT/Cingular as a provider:
- vi /etc/ppp/chap-secrets
- Add the following information:
WAP\@CINGULARGPRS\.COM * CINGULAR1
- vi /etc/ppp/pap-secrets
- Add the following information:
"WAP@CINGULARGPRS.COM" * "CINGULAR1"
- Now we will setup the PPP script that, again specific to ATT/Cingular:
- vi /etc/ppp/peers/att
- Add the following information:
lcp-echo-failure 0
lcp-echo-interval 0
hide-password
noauth
connect "/usr/sbin/chat -v -f /etc/chatscripts/att"
debug
/dev/rfcomm0 115200
defaultroute
noipdefault
user "WAP@CINGULARGRPS.COM"
remotename att.new
ipparam att.new
usepeerdns
Initiate Blackberry Tether
- Check if you have any routes setup
- route -n
- If you have routes in your routing table, disable all of the devices (under column Iface). We need a clear routing table to have this work correctly.
- route -n
- Now we will turn on the PPP for att.net
- pon att.new
- You can watch /var/log/messages to see if it works correctly or errors with a code/description
- You can watch /var/log/messages to see if it works correctly or errors with a code/description
- pon att.new
- If everything worked, you should now have a pan0 and ppp0 interface in your network list
- ifconfig -a | grep -P 'ppp|pan'
- Check your routing table to make sure routes are setup for this new ppp device:
- route -n
- Take your connection on a test drive!
- To disconnect you need to turn off ppp:
- poff att.new
- poff att.new
Listed are the links that I referenced and combined information from to get to this point.
Subscribe to:
Posts (Atom)