Saturday, November 5, 2016

Linux and Window computers unable to browse home network

Hi have a home network that consists of an ADSL router and a wireless access point.

Among the 4 smart phones, 5 tablets and 4 RaspberryPis I have 1 Linux Mint 18 desktop, 1 Ubuntu 16.04 server, 1 Linux Mint laptop, 3x Windows 10 laptops and 1 Windows 10 desktop. (I know to many for a household of 4 people but it is what I do for a living)

Recently I installed Windows 10 onto a laptop and suddenly was not able to browse the network from any of the network browsers (Linux or Windows). The strange this was that I was able to connect (from linux) using smb://192.168.1.3/ShareName and (from Windows) \\192.168.1.3\ShareName

After searching for the solution and trying many, many of the solutions I was not successful. I shutdown all the devices and started the Linux mint machines first then started the Windows machines (which was a real PITA) but nothing worked.

What finally DID WORK!

On the windows machines I opened a command line as administrator and ran the following:

  1. Click on Start button.
  2. Type Cmd in the Start Search text box.
  3. Press Ctrl-Shift-Enter keyboard shortcut to run command prompt as Administrator. Allow elevation request.
  4. Type netsh winsock reset in the Command Prompt shell, and then press the Enter key.
  5. Restart the computer.

Afterwards I was able to browse the network from both the windows machines as well as the Linux ones.

What netsh winsock reset command does are it resets Winsock Catalog to a clean state or default configuration. It removes all Winsock LSP (Layered Service Providers) previously installed, including the potential malfunctioned LSP that causes loss of network packets transmission failure. So all previously-installed LSPs must be reinstalled. This command does not affect Winsock Name Space Provider entries. (Shamelessly copied from here)

Wednesday, March 26, 2014

SSL Keystore cheat sheet

I often find myself scouring the net for how to create a selfsigned certificate and then how to actually use it.  So I have now created a Cheat Sheet.



JAVA: how to obtain keystore file for a certification (crt) file

Create store with temporary key inside:
keytool -genkey -alias temp -keystore yourkeystore.jks -storepass Hello1
Then delete existing entry:
keytool -delete -alias temp -keystore yourkeystore.jks -storepass Hello1 
Now you've got empty store. You can check that it's empty:
keytool -list -keystore yourkeystore.jks -storepass Hello1
Then import your certificate to the store:
keytool -import -alias alias -file cert_file.crt -keypass keypass -keystore yourkeystore.jks -storepass Hello1




  • I like to create a directory to keep my certificates in separately. (for this doc I'll use C:\SSL)
  • Open a command prompt and cd to that dir. (cd c:\ssl)
  • Generate the keystore as follows
keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore.jks -storepass myPass -keysize 2048

  • You will need to fill in the prompts that follow
                Password: 
                        Use something you will remember.
                First & Last Name:  
                        Use the domain or IP that you will be using to
                        access the site with.
                        If you're only hitting tomcat from the local machine
                        use "localhost".
                        If you don't, the user will be warned that the certificate
                        is for a different domain.
                Organizational Unit: 
                        SXI
                Name of your organization:
                        SXI
                Name of your city:
                        Johannesburg
                Name of your state or province.
                        Gauteng
                The two letter contry code for this unit.
                        Make sure it's upper case ("ZA")
        You will be shown all of your entries and asked to confirm.
        (Is CN=localhost, OU=SXI, O=SXI, L=Johannesburg, ST=Gauteng, C=ZA correct?)
                Hit enter.
        You will be asked for your password again with the option to 
        just hit enter.
                Hit enter

  • You should now have a keystore.jks file in C:\SSL



TO Configure Tomcat to use this keystore


1. Open server.xml, located in TOMCAT\conf. 
(Or right click on the tomcat server in netbeans and click on edit server.xml)
        
2. Find and uncomment the SSL <Connector port entry.
        NOTE: XML uses the "<!--" start and "-->" end symbols 
                to begin and end comments.
        NOTE: There is a comment just above it that looks like this:
         <!-- Define a SSL HTTP/1.1 Connector on port 8443 -->

3. Add two more attributes to this tag:
        keystoreFile="C:\SSL\kekstore.jks"
        and:
        keystorePass="myPass"
4. Restart Tomcat.

Example of the section to configure in the server.xml file:

    <!-- Define a SSL HTTP/1.1 Connector on port 8443 -->
    <Connector port="8443"
               maxHttpHeaderSize="8192"
               maxThreads="150"
               minSpareThreads="25"
               maxSpareThreads="75"
               enableLookups="false"
               disableUploadTimeout="true"
               acceptCount="100"
               scheme="https"
               secure="true"
               clientAuth="false"
               sslProtocol="TLS"
               keystoreFile="c:\ssl\keystore.jks"
               keystorePass="myPass" />




Export the generated server certificate in keystore.jks into the file server.cer

keytool -export -alias selfsigned -storepass myPass -file server.cer -keystore keystore.jks

(NB: the alias >selfsigned< must exist in the keystore)



To add the server certificate to the truststore file sxi.jks 

Run keytool from the directory where you created the keystore and server certificate.

keytool -import -v -trustcacerts -alias selfsigned -file server.cer -keystore /path/to/keystoredir/myServersKey.jks -keypass myPass -storepass myPass

/path/to/keystoredir is obviously the path to where the keystore that your application is going to use (In java you set this property as follows:

System.setProperty("javax.net.ssl.trustStore", "/path/to/keystoredir/myServersKey.jks");
       
If you get keytool error: java.lang.Exception: Input not an X.509 certificate check that the server.cer is not 0 bytes

I hope I can refer to this many times and not have to get the into from loads of different sites in the future again ;)

Friday, February 21, 2014

Ubuntu 13.10 connect to MS VPN Server

I was not able to make a VPN connection to a MS site. I tried Cisco Anyconnect (openconnect), Cisco Compaitble VPN (vpnc ), OpenVPN or PPTP (the default)

This was a real source of frustration and the "IT guy" kept telling me that I should just install Windows and have done with it.

Turns out that this is SIMPLE to fix.

Setup a new PPTP Connection Type.

Click the "Advanced" button.  I disabled EAP but when I clicked Use Point-to-Point encryption(MPPE) under "Security and Compression" the window above for "Allow the following authentication methods:" changed and EAP was greyed out.

I then selected "128-bit (most secure)" from the "Security:" drop down menu and clicked OK

I was then able to successfully connect to a MS VPN Server.

Hope this helps... I know in the future it will definitely save me time and effort when setting this up again.

So there Mr. MS "IT guy" ... 

Thursday, February 20, 2014

Netbeans 7.4 bold menus in Ubuntu

I have suffered with this problem many times when using Netbeans in Ubuntu and I finally decided not get to the bottom of it.

The problem started only after I installed Wine.  Wine install a whole load of fonts so this was definitely where to look for the problem.

I found out that if I remove the fonts-unfonts-core package my menus go back to normal.  to remove the package run the following

sudo apt-get remove fonts-unfonts-core


I still had a smaller problem in that the menus don't have a border and when they are drawn over a busy development screen it takes me longer to find the item I am looking for.

I found the following tip when trying to fix the bold menu issue and have now made all my netbeans installations look the same.  I think this is a much cleaner theme for netbeans.  It makes it far easier for me to use netbeans at least.

You need to run netbeans with the following switch "
--laf Nimbus


So your command to launch will look as follows

"/home/whatever/netbeans-7.4/bin/netbeans" --laf Nimbus

Wednesday, October 9, 2013

Mount my SD Card in Ubuntu 12.04

I had several problems mounting my SD Card in Ubuntu.  From NOTHING happening (my worst case of issue ... How can some-one troubleshoot with NO, ZERO messages etc ... to the partitions being mounted but readonly ... So I could never install Raspbmc (or any distro for that matter) onto my  Raspberry Pi 
Until I came across a post on Ask Ubuntu which pointed me in the right direction.
Turned out to be a permissions issue. 
First thing to do is to check the permissions on the hardware device mounting your card. You'll need to find the device name. To do this run the following command:
sudo fdisk -l
Your device will probably be something along the lines of /dev/sdb1, in my case the SD Reader was /dev/mmcblk0p1.
Next you need to get the permissions on this device:
sudo ls -l /dev/mmcblk0p1
Replace "/dev/mmcblk0p1" with your device location. The output will look something like this:
brw-rw---- 1 root disk 179, 1 Feb 3 21:58 /dev/mmcblk0p1
This tells us the device is owned by User 'root' and group 'disk' You need to be a member of group 'disk' to be able to write to the SD card. You can check which groups your a member of with
groups username
In my case I was not a member of the 'disk' group, I rectified this with
sudo usermod -g disk username
This adds you to the group 'disk' which should allow you to now read & write to the SD card
The BIG thing for me was adding my user to the Group 'disk' which sorted everything out.  Thanks to Cage for pointing this out.
Hope this helps.
73

Tuesday, March 12, 2013

Reading .eml files in Win7

I use webmail (Google) however some of my colleagues insist on using MS Outlook.

 Often when I get an email from them that contains another email that they forwarded the additional message arrives in an attachment called noname.eml

 This freaks me out ... and I have spent much time looking for an app that will read these files (there are some available but I can't really recommend any that stand out as being an elegant solution for me).

I stumbled onto a very simple solution today.
  1. Simply download the file (noname.eml) from your original email
  2. Rename it to noname.mht 
  3. Open it with Internet Explorer 
 No need for any additional software .... which suits me.


Saturday, July 21, 2012

Ubuntu Server Disable screen blanking

This is so simple however I always seem to forget how to do it.

I have an Ubuntu server and often want to run htop over a few days while testing something. The problem is though that the screen keeps going blank. This is fine but then I quickly want to see what the current performance is at a glance while walking past. I don't want to have to press a key to get the screen live again.

As root run the following

setterm -powersave off -blank 0


Here are a few more interesting things you can do with setterm.

Thursday, July 12, 2012

Custom menus in Windows Start Menu

I like to keep bunch of portable utility apps on my Windows machines that I use from time to time. Normally I store these apps in C:\Utils and then just access them via Explorer but recently I have been using one of my new favourite apps (MobaXterm), to access my Linux media centers, a lot and it's becoming a bit of pain to always go via Explorer.

So with that in mind I decided to see if I could create a custom menu in my Start menu and guess what, you can.


To do this all you need to do is:


Right click the Start button and select Properties.
Click the Customize... button


Select one of the following menus that you are not using.
Documents, Downloads, Music, Pictures, Recorded TV or Videos.
I went with Recorded TV.
You can either use Display as a link or Display as a menu.
A link will just be a shortcut to your folder but a menu will display a pop out list, I chose menu because it's one less click.


Click the Start button and you will see the new menu, right click it and select Properties.
Add the folder or folders, you which to appear in your new menu, with the Include a folder... button. While you're there remove any default folders you don't want to appear.


Lastly right click on the new menu again and select Rename to give it a nice name and with that you are done.

Wednesday, July 4, 2012

Fix VirtualBox Time Sync

Today I needed to do some testing on a VirtualBox VM to ensure that our software handles crossing over midnight correctly, this meant that I either needed to change the time on my VM or wait until midnight to do my testing (yeah that's not going to happen).

That's no problem you might say, ah but you'd be wrong for if you change the time and wait a few seconds then the time will reset itself. Once again I hear you say "no problem, disable 'synchronisation with the Internet time server" and once again you'd be wrong and the reason for this is that VirtualBox syncs the time between your Host and Guest machines.
To prevent this from happening you need to stop your VM and run the following command:

vboxmanage setextradata "VMs Name" "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" "1"

Just replace VMs Name with the registered name (how it appears in VirtualBox) of your VM and voilà problem solved.

Note: If that doesn't work you can also modify the vbox file of your VM manually. Open the file with your favourite text editor and add the following line

<ExtraDataItem name="VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" value="1"/>

under the <ExtraData> element.

Friday, June 22, 2012

My customizations to an Ubuntu Server 12.04 LTS

I have been toying with the idea of setting up an Ubuntu Server to run my media server at home.  Each time I go down this route there are several tweaks I do until I am happy.  The following is a list of the things I have to search the web to find most often.
I have also found some awesome suggestions for tools for xfce at their wiki.
Table of Contents
  1. Screen Resolution
  2. Console Font
  3. Set line numbers to always appear in vi
  4. Change command prompt to include colour
  5. Some additional aliases
  6. cp with a wget style progress bar
  7. Lightweight xfce4 gui
  8. phpMyAdmin for the mysql db
  9. phpPgAdmin for the PostgreSQL db
  10. Install Oracle JDK 6
  11. Webmin

  1. Screen resolution.
  2. This is simply done by editing the /etc/defaults/grub file like so
    sudo vi /etc/defaults/grub

    find the line that says GRUB_CMDLINE_LINUX="" and change it to look as follows
    GRUB_CMDLINE_LINUX="vga=773"

    save the file and REMEMBER to run
    sudo update-grub

    This will give you a console resolution of 1024x768
    You can chose other resolutions based on the following table

    VGA Resolution Codes for GRUB & Lilo<
    --- Depth --

    Colorsbits640x480800×6001024×7681152×8641280×10241600×1200
    2568vga=769vga=771vga=773vga=353vga=775vga=796
    32000?vga=784vga=787vga=790vga= ? vga=793vga= ?
    6500016vga=785vga=788vga=791vga=355vga=794vga=798
    16.7M24vga=786vga=789vga=792vga=795vga=799vga= ?

    All you need do then is reboot and you should see your server with the new resolution.

  3. Console Font
  4. Still trying to find a permanent solution to this - The closest I have come is here but this setting gets lost after a reboot.

  5. Set line numbers to always appear in vi
  6. In you home directory create a file called .vimrc and add the following line to it
    set number

    Save the file and the next time you open vi each line will automatically be numbered.

  7. Change command prompt to include colour
  8. I use this in case I login as root or if I have su'ed to root so I won't forget who I am running as at the moment. If I am running as root I want my user to appear in bright red otherwise in bright green. I also want the directories to be displayed after the username in dull green and if I am root in dull red.
    For my normal user (The green one) I edit my .bashrc file in my HOME dir
    vi ~/.bashrc

    and add the following at the end of it.
    # Set prompt: " username@hostname/directory/tree $ " (with colors)
    export PS1="\[\e[32;1m\]\u\[\e[0m\]\[\e[32m\]@\h\[\e[36m\]\w \[\e[33m\]\$ \[\e[0m\]"

    For the root user I add the following to the end of roots .bashrc
    # Set prompt: " username@hostname/directory/tree $ " (with colors)
    export PS1="\[\e[31;1m\]\u\[\e[0m\]\[\e[31m\]@\h\[\e[31m\]\w \[\e[33m\]\$ \[\e[0m\]"


  9. Some additional aliases
  10. I have some other aliases that I make use of also that I add to the end of my .bashrc file
    alias ver="cat /etc/lsb-release"
    alias free="free -m"
    alias update="sudo apt-get update"
    alias install="sudo apt-get install"
    alias upgrade="sudo apt-get upgrade"
    alias remove="sudo apt-get remove"


  11. cp with a wget style progress bar
  12. When I am copying files I like to see the speed and progress of the copy. To do this I create a file in my home dir called cppv which look as follows

    #!/bin/bash

    set -e

    if [ $# -lt 2 ]; then
    echo "cppv - copy files with progress bar and rate limiting ability"
    echo "Usage: cppv source_file[s] destination_file_or_directory"
    echo "No other non-positional command line arguments can be given"
    echo "Always recurses like find"
    echo "You can change copying speed limit on the fly with \"pv -R\" if you find out pv's PID"
    echo "Use FIND_OPTS, PV_OPTS, CPIO_O_OPTS, CPIO_I_OPTS to override arguments to the pipeline parts"
    echo "Examples:"
    echo " cppv a b # Copy file a to b. Just calls \"pv a > b\""
    echo " cppv a d/ # Copy file a to d/a. Calls \"find a | cpio -o | pv | (cd d && cpio -i)\""
    echo " cppv *{01..26}*.mkv /mnt/usb/ # Copy all matching files to /mnt/usb/."
    echo " cppv dir1 dir2 # duplicate dir1"
    echo " PV_OPTS=\"-L 1M\" cppv . /tmp/ # Limit copying rate to 1M"
    echo " cppv /home/vi/bin /tmp/ # Warning: Copy /home/vi/bin to /tmp/home/vi/bin"
    exit 1
    fi;

    true ${CPIO_O_OPTS:="-H newc -0o"}
    true ${CPIO_I_OPTS:="-0diu --no-absolute-filenames"}
    true ${FIND_OPTS:="-depth -print0"}

    ARGS=( "$@" );

    DEST="${ARGS[$#-1]}"
    unset ARGS[$#-1];

    if [[ ( "${1:0:1}" == "-" && ! -e "$1" ) || ( "${DEST:0:1}" == "-" && ! -e "$DEST" ) ]]; then
    echo "There should not be any command line options. Only file names." >&2
    exit 1;
    fi

    DIRMODE=0

    if [[ $# > 2 || "${DEST:${#DEST}-1:1}" == "/" || -d $DEST ]]; then
    DIRMODE=1
    elif [[ -d "$1" && ! -d "$2" ]]; then
    DIRMODE=1
    mkdir "$DEST";
    DEST=`readlink -f "$DEST"`;
    cd "$1";
    ARGS=(".")
    fi

    if [ $DIRMODE == 0 ]; then
    pv "$1" > "$2" && exit 0;
    fi;

    if [ ! -d "$DEST" ]; then
    echo Not a directory: "$DEST" >&2
    exit 1
    fi

    if [ "${1:0:1}" == "/" ]; then
    echo "Warning: it will do a bit different thing than usual cp" >&2
    echo " For example, copying $1 to $DEST$1, not to $DEST/`basename $1`" >&2
    fi

    SIZE=`du -sb "${ARGS[@]}" | perl -ne '/^(\d+)/ and $q+=$1; END{print $q}'`

    find "${ARGS[@]}" $FIND_OPTS | cpio $CPIO_O_OPTS | pv -s $SIZE $PV_OPTS | (cd "$DEST" && cpio $CPIO_I_OPTS)


    I also create a static link in the /usr/bin dir to this file so I don't have to keep adding the path before the command. The command to create a static link looks like so:
    sudo ln -s ~/cppv /usr/bin/cppv


  13. Lightweight xfce4 gui

  14. From the CLI terminal, we will install a few software packages to make our life easy
    1. Install the Xfce desktop environment (a GUI for using the server) :

    2. sudo apt-get install xfce4 xfce4-terminal xauth xorg

    3. Install the Gnome Display Manager (which includes a GUI login manager) :

    4. sudo apt-get install gdm

      Alternately (what I prefer to do is) install lightdm

      sudo apt-get install lightdm-gtk-greeter

    5. If you find you have some icons missing try this to fix the problem. Also check under
      "Applications Menu->Settings->Appearance" under the icon tab and make sure you are using an icon theme.

    6. sudo apt-get install tango-icon-theme tango-icon-theme-extras gnome-icon-theme

    7. I change the font of my terminal to use "Monospace" size 10
      "Edit->Preferences->Appearance"

    8. I want my terminal window to use more real estate so I edit the "~/.config/Terminal/terminalrc" file and change the MiscDefaultGeometry setting to look as follows.

    9. MiscDefaultGeometry=100x40

    10. OPTIONAL: Install the Synaptic package manager (a GUI for installing software) :

    11. sudo apt-get install synaptic

    12. OPTIONAL: Install the Update manager (a GUI for updating software) :

    13. sudo apt-get install update-manager

    14. OPTIONAL: Install the Gnome System Tools (which includes a GUI for user administration) :

    15. sudo apt-get install gnome-system-tools

    16. Now reboot the server, so that you can login to the Xfce GUI environment :

    17. sudo shutdown -r now

    When the server reboots, there will now be a GUI login screen
    Select the xfce-session, the username and enter the password
    The Xfce desktop environment will be displayed with the menu panel on top and a few icons on the desktop screen

  15. phpMyAdmin for the mysql db

  16. If I have installed mysql I normally install phpMyAdmin to make manipulation and admin of the database easier. This is easily done by following the setup found here. But basically you need to run the following with some configuration.

    sudo apt-get install libapache2-mod-auth-mysql phpmyadmin

  17. phpPgAdmin for the PostgreSQL db

  18. If I have installed PostgreSQL I normally install phpPgAdmin to make manipulation and admin of the database easier.

    The following instructions will get PostgreSQL accessible from a remote server on your lan

    If PostgreSQL is not installed already:

    sudo apt-get install postgresql

    Log into PostgreSQL and create an account and a database for the user:

    sudo -u postgres psql template1
    psql> create user acme with createdb password 'abcd';
    psql> create database acme with owner=acme; psql> \q


    Leave out the createdb option in the CREATE USER statement if you do not want to grant the user the privilege to create databases.

    By default PostgreSQL server does not accept remote connections. To enable remote connections (which is necessary for servers like CS3 but not for servers like CSNS), modify /etc/postgresql/9.1/main/postgresql.conf so:

    listen_addresses = '*'


    And modify /etc/postgresql/9.1/main/pg_hba.conf so that:

    host all all 0.0.0.0/0 md5
    host all all ::0/0 md5


    To install phpPgAdmin:

    sudo apt-get install phppgadmin

    By default phpPgAdmin only allows local access. To allow remote access, edit /etc/phppgadmin/apache.conf so that

    #deny from all
    #allow from 127.0.0.0/255.0.0.0 ::1/128
    allow from all

    Then restart Apache2. After that phpPgAdmin can be accessed at http://host/phpmyadmin/ .

    NOTE:I was looking for the quickest way to manage PostgreSQL I was not testing the security of the admin tool.

  19. Install Oracle JDK 6

  20. I followed this link to install the Oracle JDK6 onto my Ubuntu Server.
    I also add the following to my .bashrc
    # Java environment variables
    export JAVA_HOME=/usr/lib/jvm/java-6-oracle
    export PATH=$PATH:$JAVA_HOME/bin

  21. Webmin

  22. I can't believe I didn't remember to talk about installing Webmin. Firstly you'll need to have some dependancies installed. You can do this by running the following from the command line.
    apt-get install perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions python

    Official instructions can be found here, but basically there are 2 ways to install webmin.
    1. Via APT
    As root edit /etc/apt/sources.list and add the following lines
    deb http://download.webmin.com/download/repository sarge contrib
    deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib

    You will then need to install the GPG key which you can do using the following as rootcommand
    wget http://www.webmin.com/jcameron-key.asc && sudo apt-key add jcameron-key.asc
    Once you have update the sources file you can install webmin using the following commands.
    sudo apt-get update
    sudo apt-get install webmin

    2. Manually Download the latest webmin archive.
    wget http://www.webmin.com/download/deb/webmin-current.deb

    Install webmin with following command:
    sudo dpkg --install webmin-current

    You can connect to webmin by pointing your browser to:
    http://server-host-ip-address:10000/

Wednesday, June 3, 2009

Get Rid of "Tunnel adapter Local Area Connection* ##" Entries in Vist

Shamelessly stolen from here as this was something that was REALLY becoming a pain in my backside.

Get Rid of "Tunnel adapter Local Area Connection* ##" Entries in Vista

Vista seems to have an annoying habit of creating several "Tunnel adapter Local Area Connection* ##" entries in my ipconfig results, which means I have to scroll up to see the actual entries I want to. That is a pain to do on a laptop with a touchpad, but also I think it was contributing to connectivity problems when switching between wireless and wired connections.

If you want to remove them, there is a method that seems to be harmless:

* Right-click My Computer, go to Manage.
* Go to Device Manager
* Click View on the top of the window, and check Show hidden devices.
* Now expand the Network adapters tree, and you should see several entries that start with isatap.(something).
* Disable (right-click, Disable) several of them, and verify that all your networking things still work.
* If that didn't cause any problems, you should be able to safely delete them (right-click, Uninstall).

Now your ipconfig readout should be a little more sane. This problems seems to be caused by IPv4 and IPv6 tunneling of some sort, which you can read about here.

I had to disable a few other hidden network adapters but a quick check of my ipconfig output and test of my network showed my progress and the fact that I hadn't broken anything.

Wednesday, February 11, 2009

Install Visio 2003 on Ubuntu 8.10

I can accross this beauty on how to install Visio 2003 onto Ubuntu with Wine. The trick is on the wincfg on the Libraries tab. Make sure you have what is in the picture on the link.

Tuesday, February 10, 2009

Make an ISO image from the command line.

This is a command that I ALWAYS forget... go figure?!?! To make an iso from your CD/DVD place the disk into your drive and make sure it is NOT mounted. Then from a terminal window run the following:

sudo dd if=/dev/cdrom of=Name_Of_ISOFile.iso

where /dev/cdrom id the name of your device. I.e. if the device is a SCSI cd rom change it to

sudo dd if=/dev/scd0 of=Name_Of_ISOFile.iso


Since dd is not specific to CDs, it will also create disk images of floppies, hard drives, zip drives, etc.

To make an ISO from files on your hard drive, create a directory which holds the files you want. Then use the mkisofs command.

mkisofs -o /tmp/MyISO.iso /tmp/DirToMakeIsoFrom/


This results in a file called MyISO.iso in folder /tmp which contains all the files and directories in /tmp/DirToMakeIsoFrom/.

To test that the ISO was created successfully all you need to do is mount it.

sudo mount -o loop -t iso9660 Name_Of_ISOFile.iso /mnt/test

Monday, February 9, 2009

Ubuntu Package Missing GPG Key

So, I got the repos to update from Open Office 2.4 to Open Office 3.0

deb http://ppa.launchpad.net/openoffice-pkgs/ubuntu intrepid main

which I added to my /etc/apt/sources.lst

However I kept getting the NO GPG key authentication error when I was trying

sudo apt-get upgrade


I stumbled onto this GEM. Thanks to lvlo.

Firstly run:

gpg --keyserver keyserver.ubuntu.com --recv-keys $KEY

then run:

gpg --export --armor $KEY | sudo apt-key add -

$KEY is the value of the package you are not authenticated for.

For Open Office 3.0 I got 60D11217247D1CFF

This worked for me... Hopefully it works for you also.

Monday, August 18, 2008

Microsoft Word or Excel file takes a long time to open

I've had an issue for a while where if I open a Microsoft Word or Excel file it takes a long time to open but if I open up Word or Excel first and then open the file then it opens quickly and now I've finally found the solution on MyITkb.net Click here to go directly to the page that the fix is on. To save time I've put the instructions below but do yourself a favour and go check out that site.

NOTE: This refers to XP only. The functionality of editing file types manually has been removed in Vista.

Why is this happening? DDE may be broken for either Word or Excel.

Possible Resolutions:
Remember this is for ONLY when you double-click on a Word or Excel file and it takes a long time to open.

Solution 1.) If you have installed PDF maker, which can get installed when you install scanner software, the Excel add-on can potentially cause Excel to open slowly. This is more common in Office 2007.
1. Close Excel and any other window you have open
2. Open "My Computer" and browse to C:\Program Files\Microsoft Office\Office12\XLSTART
3. When you open Excel, check to see if the time it takes to open the xls/xlsx is shortened.


Solution 2.) This can be fixed by reinstalling Office but there is a faster way to fix this.
1. Go to your Control Panel, (click on Start then Click on Control Panel)
2. Click on Folder Options, then File Types,
3. scroll down to and select (DOC for Word files) or XLS (for Excel files),
4. click Advanced and select Open entry,
5. click the edit Button.
6. deselect "Use DDE"
7. append "%1" (include the quote marks) to the end of the application command line,
8. Remove /dde if it is at the end of the command line
9. Then click on OK three times.


If the issue was being caused by DDE, then when you now open a Word or Excel file they will now open faster, without a long pause.

Tuesday, May 27, 2008

Canon Drivers in Ubuntu

As I've discovered getting Ubuntu Hardy to print in colour to a Canon iRC 2880i can be a bit of a nightmare. Now that I've figured it out I thought I should put it here.
This guide should work for most Canon printers and most versions of Ubuntu.

If you only want to print in black & white then it is fairly straight forward.

1. Goto System->Administration->Printing
2. Create a new printer queue
3. Select the type of connection to the printer (mine is Windows Printer via SAMBA)
4. Input the printer settings eg: 10.0.0.1/NameOfPrinter and authentication if needed
5. For drivers use Generic->PCL 5c->Generic PCL 5c Printer Foomatic/hpijs
6. Give it a name and you're set to go


If you would also like to print in colour then this is where the fun begins.

You will need the UFR Printer Drivers from Canon in Australia. The PostScript drivers are also there but I haven't tried them but I can't see why this guide won't work for them.
If you're using the iRC 2880 then you can go straight here

http://www.canon.com.au/products/multifunctionals/multifunctional_digital_devices/irc2880_drivers.aspx

otherwise just go here and select your model

http://www.canon.com.au/support/default.aspx


Once you have the drivers and have extracted them then follow these steps.
Note: If you are using a version of Ubuntu that is older than Hardy you should just be able to run the deb files in the Debian folder and if there are no problems then you can skip to step 6

1. If you try and run the deb file in the debian folder in Hardy it will give a dependency error regarding libcupsys2-gnutls10. So in that case...
2. Run sudo apt-get install alien
3. Go to the extracted drivers RPM directory in a Terminal
4. Run sudo alien -c *.rpm (The -c will include any scripts in the package)
5. Run your newly created deb packages. First the cups common one then the driver one.
6. Follow the instructions above for the setting up of only black & white printing up to and including step 4
7. For drivers use Canon->iR C2880/C3380 UFR II->iR C2880/C3380 UFR II (or whatever model you are using)
8. Give it a name and you should now be printing in colour


In case you were wondering why you get the dependency error in step 1, the reason is that the Debian package was converted from a RPM one, using alien. Alien picked up the dependencies that where present on the system that the package was initially created.

Like I said at the beginning, this should work for most Canon printers because I found the link for the Canon Australia on a forum explaining how to get a different model of Canon printer installed on Ubuntu Edgy.

Wednesday, May 21, 2008

Netbeans Formatting

Just a very quick note.

I tried to change my tabs size from the default 8 to 4 and it all seemed broken. My tabs became 2 spaces. I did some searching only to find that many developers have even reverted back to Netbeans 6.0.

My settings were changed as follows:

Tools -> Options -> Editor -> Indentation
I changed "Number of Spaces per Indent" to 4 and "Tab Size" to 4

The only way I got it to work was a complete shutdown of Netbeans. Simple enough but caused me loads headache (and I nearly replaced Netbeans 6.1 with an older version)

Friday, May 16, 2008

WARNING: HDD shortened life span under linux

Please note this is NOT my work. I have shamelessly copyied it from http://ubuntuforums.org/showthread.php?t=795327 so kudos to nicedude.

Due to APM constantly parking and unparking your hdd your hdd cycle count increases rapidly. As most drives are rated to 600 000 cycles the faster you get to these the faster your drive will wear. I tested my drive (Western Digital) and found I suffered from this very problem.

Basically you need to do the following - Install the disk monitoring tools


sudo aptitude install smartmontools

Then by running


sudo fdisk -l

and finding out how your drive is addressed (I.e. /dev/sda) you can run this


sudo smartctl -a /dev/sda | grep Load_Cycle_Count

WAIT 15 MINS AND RUN THE COMMAND AGAIN

NB: If in 15 mins the last number increased by more than 2-4 then you suffer from the same issue as I did.  Following the directions in the origional post I downloaded the shell script to my desktop made it executable and ran the following


sudo cp ~/Desktop/99-sda-load-count-fix.sh /etc/acpi
sudo cp ~/Desktop/99-sda-load-count-fix.sh /etc/acpi/start.d
sudo cp ~/Desktop/99-sda-load-count-fix.sh /etc/acpi/suspend.d
sudo cp ~/Desktop/99-sda-load-count-fix.sh /etc/acpi/resume.d



you could also create the shell script yourself it looks as follows


#!/bin/sh
## Script by nicedude at Ubuntu forum 5-14-2008
## A fix to stop high hdd spin down counts from occuring thereby increasing hdd life
## The hdparm -B parameter can be adjusted between 200-254 should be sufficient for these purposes
## Using the value - B 200 should work fine if not enough then you could increase up to a max of 255
## which means no APM power management for the drive
## If your drive is called hda instead of sda then change it below
## You can find out by running sudo fdisk -l in a terminal and looking at whether it is called hda or sda

hdparm -B 200 /dev/sda


After a reboot run the following to get the Load_Cycle_Count


sudo smartctl -a /dev/sda | grep Load_Cycle_Count


WAIT 15 MINS AND RUN THE COMMAND AGAIN

You should only see a small increment.

Hope you are feeling a little more comfortable.. ;)

3G in Ubuntu

Getting 3G in Ubuntu to work is pretty straight forward for most people but there can be some minor issues that affect a few of us especially if you are running Hardy Heron.

Firstly you'll want to go to https://forge.vodafonebetavine.net/projects/vodafonemobilec/ to get the Vodafone Mobile Connect Card Driver. At the time of writing this the latest stable version is 1.99.17.

Go to where you have downloaded the Deb file and Right-Click on it then select Open with "GDebi Package Installer" and install the package. The Package Installer will download and install any dependencies that are required and then it will install the driver.

Once the install is complete plug in your 3G device and give it about 30 seconds to register itself with the system. Now go to Applications -> Internet and select Vodafone Mobile Connect Card driver for Linux and the application will start up. A warning message stating that Device setup not completed click close on the message and confirm that the device it discovered is correct then it will ask for your pin number. It will then start the Authenticating process.

Now for most people this should be working now if not carry on reading.

If after selecting your device you just have a window with a progress bar bouncing back and forth then click Cancel and follow these steps:
1. Remove your 3G device
2. Run sudo udevcontrol reload_rules
3. Plug your device back in and wait about 30 seconds
4. Run the Vodafine Mobile Connect application again

It should now start the Authenticating process and go through successfully. Just note that this can take up to 1 minute sometimes.

Howto: Disable IPv6 in Firefox 3

This tip will speed up the process of resolving DSN names. (I.e. web sites name resolution)

Open a new tab in firefox.
In the url/address bar type about:config
Click on the "I'll be careful, I promise" on the resulting screen that pops up.
In the Filter: field provided type ip
The list of configurable items is reduced to only contain entries with the ip string in them.
Look for the entry network.dns.disableIPv6
It will have a Status of default, Type of boolean and a Value of false
Double click on this entry it will change to bold
The Status will change to user set, Type will still be boolean however Value will now be True
What we have done is turn off IPv6 dns lookups
Restart Firefox and you should see an improvement in finding your web pages.