Archive for November, 2007

Automatically Mounting Windows SMB Shares in Ubuntu v3

Mounting SMB SharesThis post is an update to two posts I wrote previously on how to make your network shares mount automatically when you start up your Ubuntu Linux computer. In this method we modify the fstab file so that when all the file systems are mounted the network shares are mounted as well.

This method works for me in Ubuntu Gusty Gibbon 7.10 and is probably the most secure. I have only tested this on a wired connection, so I don’t know exactly what will happen if you use this method when using a wireless connection.

First you have to install smbfs:

sudo apt-get install smbfs

Then create a folder inside of the /media directory to mount the share on:

sudo mkdir /media/Storage

You can call it whatever you want, I call it Storage. If you change the name remember to change it below when we edit the fstab file.

Create a credentials file in /root so that you can save your password and have it protected by the root account:

sudo gedit /root/.cifscredentials

Add the following information to the file, but change Guest to your SMB username and add your SMB password.

username=Guest
password=

Note: If your fileserver allows Guest access you can just leave the file as above. If it is password protected you have to put in your username and password.

Save and close the .cifscredentials file.

Now open up your fstab file so that you can add mounting instructions:

sudo gedit /etc/fstab

Add the following line to the bottom of the file:

//192.168.0.10/SHARENAME /media/Storage cifs auto,iocharset=utf8,uid=USER,gid=users,credentials=/root/.cifscredentials,file_mode=0775,dir_mode=0775 0 0

You have to change the following information:
Change 192.168.0.10 to the IP address or DNS name of your server
Change SHARENAME to the share you want to mount
Change USER to your Ubuntu username

The file_mode=0775,dir_mode=0775 part sets the mounted directory as read/write for all users so long as the SMB username you set in .cifscredentials has read/write access.

Now save the file and run the following command to test to see if you mount now works:

sudo mount -a

If that worked you should see a new drive icon on your desktop that lets you access your share. Now try rebooting and see if your shares mount automatically. If everything went as planned you will have a nice little drive mounted on your desktop every time you start up.

SMB Shares with Spaces in the Names

If you have a share with a space in the path you can replace the space with \040. For example:

//192.168.0.10/Storage\040130 /media/Storage\040130 cifs auto,iocharset=utf8,uid=matt,gid=users,credentials=/root/.cifscredentials,file_mode=0775,dir_mode=0775 0 0

This mounts my 130GB drive on my fileserver to a local directory called Storage 130.

Comments (40)

Amazed with Ubuntu Gusty GIbbon 7.10

I just wanted to say how impressed I am with the latest release of Ubuntu. 7.10, or Gusty, whichever you want to call it has really been an update about making it easier for mainstream (windows?) computer users to get started on linux. Here is a list of some of the improvements I have noticed in my daily use:

  • The Screens and Graphics utility: If Xorg can not start because of a misconfigured display adapter instead of failing to an error report like in previous versions, this GUI utility is automatically launched so you can select appropriate settings. It’s not foolproof, but it is leaps and bounds ahead of what you used to get.
  • Automatic installation of plugins: I went to a website with flash, Firefox told me it wasn’t installed and asked me if I wanted to install the plugin. Just like on Windows and OS X it worked flawlessly. I tried to open a video file in Totem and there was not codec installed for it. Totem prompted me to install the gstreamer packages, installed them, and then continued to play the video – better than windows. I opened Amarok and tried to play an MP3 file. It notified me that MP3 support was not installed and asked if I would like to install it. I went to the Apple Trailers website and they all worked. This is probably a result of me opening that video file in Totem earlier. All this was done without me having to pull up a terminal window once.
  • Compiz Fusion: It has all the eye candy of Compiz Fusion installed by default, you just have to enable it. If you want access to all the advanced effects just install the compizconfig-settings-manager package.
  • Speed: I dont know why, but it runs faster. Firefox launches faster and the whole system is more responsive. The boot process seems quicker as well.

The next version of Ubuntu is going to be a Long Term Support version, which means over the next 6 months they are mainly going to be working on bug fixes and stability. I really think Ubuntu is going to take off in the next year. Soon enough all that will be holding them back will be that ugly yellow colour scheme.

Comments

Backing Up Your Files on Ubuntu Linux

The reality of having a new Ubuntu release every 6 months means you either upgrade your distro and deal with the inevitable bugs or you wipe your system and install a fresh copy from scratch. Before you wipe your system you are going to want to back up any files you have on your drive. This can be done with a simple command.

First switch to root:

sudo su

Then run the tar command:

tar cvpzf /backup.tgz /home

Running the above command will create an archive file in the root folder of all of the files in your home directory including all the settings stored in the hidden folders. Be careful though, if you have a lot of large files in your home directory this archive is going to be quite large. I usually manually backup any ISOs or video files before creating the archive. Also remember to empty your trash or the files in there will be backed up too. I usually just use this command to back up any documents and pictures I have. The great thing is this will backup your Firefox bookmarks and everything.

Now, I also want to save a few configuration files in my backup so I don’t have to recreate them on the new system. I’m talking about my xorg.conf, fstab, and sources.list files. It is easy enough to add these files to the archive, just tack the path and filename onto the end of the command and they will be included.

tar cvpzf /backup-oct-2007.tgz /home /etc/fstab /etc/X11/xorg.conf /etc/apt/sources.list

Now just copy this backup file onto a thumb drive or file server and you are good to reformat your drive and install your fresh copy of the latest Ubuntu. Once installed I just open the archive and extract any files I want to keep then turf the archive.

Comments

Fixing Issues With Usplash on a Widescreen Monitor

The Ubuntu boot spash screen has never worked on my Dell 2405fpw widescreen monitor until now. The closest I ever got was to get the shutdown splash to work by editing the /etc/usplash.conf file. Well, I just installed 7.10 and after a little bit of digging today I finally figured out how to get my boot splash to display properly. PS, my issue with the boot splash was that the picture was squashed and skewed across the middle of the screen.

This is a three step process. First figure out what display levels are supported by your frame buffer, then edit your grub configuration to use one of the 16 bit resolutions supported, then edit your usplash.conf file to use a similar resolution. I had used this method before with no luck, then I came across a bug report that said you have to run sudo dpkg-reconfigure usplash because when Usplash is started during boot your root folder has not been mounted yet (meaning /etc/usplash.conf can not be read). This worked like a charm.

First we install hwinfo so we can use it to find out what resolutions we support.

sudo apt-get install hwinfo

Then I ran hwinfo and redirected the output to a text file. This way we can try a few different resolutions and we only have to reference the file, not run the command every time.

hwinfo --framebuffer > framebuffer.txt

Here is what my framebuffer.txt file looks like:

02: None 00.0: 11001 VESA Framebuffer
  [Created at bios.447]
  Unique ID: rdCR.z77_s6lubfB
  Hardware Class: framebuffer
  Model: "NVIDIA G70 Board - p317h2  "
  Vendor: "NVIDIA Corporation"
  Device: "G70 Board - p317h2  "
  SubVendor: "NVIDIA"
  SubDevice:
  Revision: "Chip Rev"
  Memory Size: 256 MB
  Memory Range: 0xe0000000-0xefffffff (rw)
  Mode 0x0300: 640x400 (+640), 8 bits
  Mode 0x0301: 640x480 (+640), 8 bits
  Mode 0x0303: 800x600 (+800), 8 bits
  Mode 0x0305: 1024x768 (+1024), 8 bits
  Mode 0x0307: 1280x1024 (+1280), 8 bits
  Mode 0x030e: 320x200 (+640), 16 bits
  Mode 0x030f: 320x200 (+1280), 24 bits
  Mode 0x0311: 640x480 (+1280), 16 bits
  Mode 0x0312: 640x480 (+2560), 24 bits
  Mode 0x0314: 800x600 (+1600), 16 bits
  Mode 0x0315: 800x600 (+3200), 24 bits
  Mode 0x0317: 1024x768 (+2048), 16 bits
  Mode 0x0318: 1024x768 (+4096), 24 bits
  Mode 0x031a: 1280x1024 (+2560), 16 bits
  Mode 0x031b: 1280x1024 (+5120), 24 bits
  Mode 0x0330: 320x200 (+320), 8 bits
  Mode 0x0331: 320x400 (+320), 8 bits
  Mode 0x0332: 320x400 (+640), 16 bits
  Mode 0x0333: 320x400 (+1280), 24 bits
  Mode 0x0334: 320x240 (+320), 8 bits
  Mode 0x0335: 320x240 (+640), 16 bits
  Mode 0x0336: 320x240 (+1280), 24 bits
  Mode 0x033d: 640x400 (+1280), 16 bits
  Mode 0x033e: 640x400 (+2560), 24 bits
  Mode 0x0345: 1600x1200 (+1600), 8 bits
  Mode 0x0346: 1600x1200 (+3200), 16 bits
  Mode 0x0347: 1400x1050 (+1400), 8 bits
  Mode 0x0348: 1400x1050 (+2800), 16 bits
  Config Status: cfg=new, avail=yes, need=no, active=unknown

The information you are interested in is the Mode. If you want to set your boot resolution to 1024×768 at 16 bits you want to use mode 0×0317. As you can see my frame buffer doesnt support any widescreen resolutions. I picked the 1280×1024@16bit, which was 0×031a on my computer. I tried some of the higher resolutions as well as some of the lower ones. They all resulted in different issues from only displaying as black and white, to not displaying anything at all. both 1024 and 1280 seemed to work ok though, so I went with the higher one. Just pick one and go with it. I should note that these resolutions will not effect the resolution once Ubuntu is completely started up. They are unrelated.

Open up the grub menu configuration to edit the resolution:

sudo gedit /boot/grub/menu.lst

find the following line:

# defoptions=quiet splash vga=

and modify it so that it has your mode after the vga=. Here is what mine looks like:

# defoptions=quiet splash vga=0x031a

Do not uncomment the above line or it will not work. It has to be commented.

Save and close the file and then update grub:

sudo update-grub

Now you want to update usplash to use the same resolution that you set for boot. Open the Usplash configuration file:

sudo gedit /etc/usplash.conf

I changed mine to look like this:

# Usplash configuration file
xres=1280
yres=800

Now you will notice I set my boot resolution to 1280×1024 but my Usplash resolution is set to 1280×800. This is because I have a widescreen monitor and when I set Usplash to 1280×1024 the boot logo was stretched. I changed it to 800 to counteract the stretch. If you have a standard 4:3 monitor you should set them both to 1280×1024. Otherwise, try what I did and see if it works for you.

This is the most important part. You have to update Usplash or the configuration change you just made will have no effect. So run the following command:

sudo dpkg-reconfigure usplash

Now reboot and cross your fingers. You might have a working boot splash. If you dont, try changing the mode in grub and the resolution in Usplash to something lower and reboot again. Trial and error is the only way you will find what works best on your system. Good luck!

Comments