Thursday, June 28, 2012

Linux Start Application on Boot

Since being in the army I haven't had a lot of time to mess around with my personal computers.  However, I am back in the states and settled down for a bit so I decided to built myself a desktop computer.  I didn't have a lot of money, so older hardware and Linux was the route I took.

On a recommendation from a friend I researched a program called Synergy which was supposed to allow you to use a single mouse, keyboard, and clipboard across multiple computers and OSs via TCP-IP.

I cobbled together three older machines with about one gig of RAM a piece and loaded Lubuntu ( a lite version of Ubuntu Linux ) on each of them.  The Synergy program worked great and I was able to have a three monitor three machine system that felt much like one machine when using it.

Unfortunately, I ran into a small headache.  Every time I restarted a machine Synergy would shutdown.  On windows it has the option to start with the computer, but Linux is pretty much all manual configuration.  Some versions of Linux GUIs now have session managers which allow users to setup custom programs through a nice GUI app, but Lubuntu doesn't yet come with that.  After a little research I came across a website with a very nice detailed answer, which is copied below in case their site goes down.

There are two main steps:


  1. Create a text file named firefox.desktop in your ~/.config/autostart directory. (~ represents the current users home directory, typically /home/user; you will also have to click on View/Show Hidden in the File Manager to see folders starting with a period.)
  2. Fill the new file with contents.


Obviously rename the first part of the filename to whatever description best fits the program you are trying to start.  Below are 4 different examples to start up various programs, firefox and thunderbird were the examples on the site, chromium and synergy are the files I built for my needs.  Use or modify them to fit your needs.

One additional bonus, by creating this file you will also make an entry appear in the "Start menu"/Preferences/"Desktop Session Settings" program allowing you to easily toggle it on or off without having to delete and recreate the file.


[Desktop Entry]
Version=1.0
Name=Firefox Web Browser
Comment=Browse the World Wide Web
GenericName=Web Browser
Exec=firefox %u
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=firefox


[Desktop Entry]
Version=1.0
Name=Thunderbird Email Client
Comment=Email Client
GenericName=Email Client
Exec=thunderbird -%u
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=thunderbird


[Desktop Entry]
Version=1.0
Name=Chromium Web Browser
Comment=Access the Internet
GenericName=Chromium
Type=Application
Exec=/usr/bin/chromium-browser %U
Terminal=false
X-MultipleArgs=false



[Desktop Entry]
Version=1.0
Name=Synergy Client
Comment=Connect to the keyboard network
GenericName=SynergyC
Type=Application
Exec=synergyc 192.168.111.114
Terminal=true
X-MultipleArgs=false



Thursday, May 31, 2012

Lubuntu on an old Compaq machine

I recently decided I wanted to fire up an old compaq machine for a spare computer.  Due to life circumstances I was down to one machine and really needed to start building the collection back up.

After a little research on stripped versions of Linux I settled on Lubuntu, primarily because of its association with Ubuntu.  I figure with the development support behind the Ubuntu distro there would be updates and fixes coming out for it for awhile still.

I burned a live CD of Lubuntu and started up the Machine:
512MB RAM
120GB HD
AMD Sempron processor 3400+

It had previously run Windows XP very successfully, so I was fairly confident that I wouldn't have any problems.  True to expectations it booted and ran very well off of the CD.  So I clicked the install button figuring that this would be the easiest setup ever.  But the installer couldn't make it past the partitioner, it gave a couple of different errors and refused to format the HD.  After trying every configuration I could think of I gave up for the day.

The next day, on a hunch, I started the computer back up with the live CD, launched a terminal window, and used fdisk to manually format all the partitions on the drive to a Linux format.  After that the installer ran perfectly with no problems.

My next issue came when I tried to boot the newly installed OS.  It would let me into the command prompt on first boot after taking the CD out, but after that it wouldn't even let me get that far.  The error it was throwing was:
drm_crtc_helper_set_config failed crtc:6

After Googling for awhile I finally found someone else who had a similar issue and had posted a fix.
Their post can be seen here.. I have copied the steps below:

There is no other way than adding a parameter to the kernel line before booting. In your case it is probably "nomodeset" or "nomodeset noapic".
1. Restart your PC
2. Hold down SHIFT (if it doesn't work, try 'Esc' or any other key) to display the hidden menu during boot (Note: SHIFT only works for single-OS systems)
3. When you see GRUB menu, highlight the Linux Mint entry and press the 'E' key
4. Use the cursor keys to navigate to the line that ends with "quiet splash", and add nomodeset (like this: quiet splash nomodeset)
5. When you are done editing the kernel line, press Ctrl-X to boot


I held the shift key, got to the Grub menu, pressed E and was on my way.  The line I needed to edit didn't End with "quiet splash" there was a variable after that text, I inserted "nomodeset" between the quiet splash and the variable.  When I pressed Ctrl+X the system booted normally.

Friday, February 3, 2012

Google Voice and Secondary IPs

Have you ever had a problem getting your google voice and video to work?  Perhaps you can make the call but the other side can't see you, or you can try videoing but you can't see each others video feeds.

So far I have found two things to try to fix this issue.  One is a definite issue, the other is a suspected issue.

First, the definite issue:
If you add a secondary IP address to your computer ( I was using 172.160.0.100 to connect to a secondary private device ), then it causes this issue.  Remove the secondary ip and your problem should be resolved.

Second, the suspected issue:
I was putting off running my windows updates which had been downloaded and were waiting to be installed.  I did try restarting my computer during the troubleshooting.  After fighting with the Google voice issue for awhile I installed the updates and restarted fixing the issue.  This particular problem was more likely an issue specific to one of the updates that was installed rather than an issue with the Microsoft update service itself.

Monday, December 26, 2011

TSocks with Ubuntu Linux

So it turned out that a simple SSH Tunnel doesn't always accomplish what is needed.  An SSH Tunnel is great for applications that are able to redirect their own packets to a different proxy, but what about applications that don't natively support proxies?

One alternative is to use a VPN Tunnel, in most cases this will work great, but in some networks VPN packets are restricted.  Also VPN networks doesn't typically run on natively installed software.  To solve this issue I turned once again to Linux which seems to have the best collection of geeky programs natively installed.

Step 1: I downloaded VirtualBox which is an OS simulator.
Step 2: I downloaded an ISO file of Ubuntu linux.
Step 3: Download the tsocks .deb file, you may need a normal SSH tunnel if web traffic to that site is being blocked:
   Go to this website, scroll to the very bottom, and click on the link for the correct version of linux and 32 vs 64 bit OS.
   Under the Download Mirrors section click on "select mirror".
   Click on the binary package link to download the .deb file.
Step 4: Install the tsocks .deb file.
Step 5: Edit the tsocks file, first rename the default file then modify the original file.
   sudo mv /etc/tsocks.conf /etc/tsocks.conf.old
   sudo nano /etc/tsocks.conf
Step 6: Add the following two lines to the file:
   server = 127.0.0.1
   server_port = 6060
   these lines tell tsocks to redirect all traffic fed through it to the local loopback ip using port 800.
Step 7: Start up a ssh session accepting traffic on the port that tsocks is now configured to send it on.
   ssh -C -D6060 -v -v user@www.domain.us
   The -v -v are two levels of verbose troubleshooting, you only need to use them if you want to watch what is happening inside the tunnel.
Step 8: Open another command prompt, and startup a firefox session through tsocks. I used firefox simply because it is a decent browser and is the default one installed on linux. Use the following command at a command prompt.
   sudo tsocks firefox

With this setup all firefox's child processes should be tunneled through the tsocks connection as well which includes things like voice calls or video chats started from the web browser but running on different ports.  Replacing firefox with the command for other applications you can try tunneling them through the tsocks connection as well.

Steps 7 and 8 will need to be repeated every time you want to initiate the tunnel from now on.

Getting your audio, and other USB devices to work correctly through the virtual machine is a whole different issue.  If you have too many problems with this try using a regular Linux install instead of a virtual box.


Thursday, December 22, 2011

Cancel a remotely initiated shutdown

If a shutdown of your system has been initiated remotely you will see a dialog similar to this:

systemshutdown

To kill this dialog and cancel the shutdown, open up a command prompt window as administrator.  Then issue the following command:

shutdown -a

The "a" stands for abort.  You can also use the shutdown command to initiate your own shutdown of remote systems.  You can send messages and manipulate many different aspects of the windows shutdown procedure with this command and its parameters.

Thursday, December 15, 2011

Cancel restart from automatic updates

Have you ever been working on a very important project and needed to put off the forced restart that many system administrators have setup on their domain?

As long as you have local admin rights it is a simple process of running the following command from the command prompt.

sc stop wuauserv

Sc.exe is part of the windows resource toolkit, it is called Service Control and can be used for all sorts of service manipulation.  The stop word is fairly self explanitory.  The final word is simply the name of the service to be stopped, in this case the service running the windows update that controls the annoying dialog.

Monday, December 12, 2011

Secure Shell Tunneling

Recently I have had need to get to some websites that were not reachable from my current network location.  They weren't bad websites, just a password storage site and some school related information.

So I started looking around at the various proxy solutions to see what they had to offer, unfortunately, most free proxies have been blocked on many networks in the US for the obvious reason that they help people bypass browsing limitations placed on them.  You can find a listing of many such proxy ips here at: http://hidemyass.com 

This site also offers another kind of proxy called the web-based proxy which allows you to tell their website where you want to go and it will act as a wrapper fetching the content you want inside of itself.  The downside to this method is the ways that the page masks it's content from DNS and IP blocker often leaves the page unusable if the destination page is complex enough.

Fortunately there is a third solution which I was recently taught about called SSH tunneling.  I already love dealing with remote servers so this plays right into my skill-set and has become an easy favorite.  Skill-set might be pushing it a bit far since there really is no skill-set required to implement the tunnel, all the required server software is already naively built into *nix servers and the client end can be downloaded for free.

To route your web traffic over an ssh tunnel first you need some form of ssh client, I use windows so I typically use putty.exe.  Other methods can be read about here: Free SSH.  You will need an account on a remote SSH/*nix server that you can reach.  If you don't have one you can risk using a free one from a list such as this: SSH Proxy List; keep in mind that any server you log into could potentially be tracking or reading any and all data you send through it, including passwords to all your accounts.


  1. With your remote account and putty.exe in hand, start up putty.
  2. Under Connection/SSH/Tunnels create a new source port, can be any port you choose that is not being used; for destination choose dynamic.
  3. Under Session type in the IP or host name as well as Port number (typically 22 for SSH connections).
  4. Choose a connection type of SSH and click open.
  5. It will probably prompt you to store the key in the registry, go ahead and do it.
  6. Login to the remote server with your username and password.
  7. Next, in your web browser, get into its settings/network connections/proxy servers; you will want to configure a manual proxy server and set the SOCKS Host to 127.0.0.1 (which is your own computer that now has an open ssh connection)
  8. Enter the port you choose when you created the tunnel configuration in putty.
  9. And save.


You should now be able to reach any website that you can resolve a name to an ip for.  If you need a free and open DNS server you can use Googles: 8.8.4.4 or 8.8.8.8.