Monthly Archives: December 2011

Ubuntu – Setting up a SSH Server on a Minimal Install

On a minimal install there is no SSH server setup automatically so I’m having to add that.  Here is what I did:

SSH client is installed in the minimal (Ubuntu 11.04), but the SSH Server is not.

From the Terminal type:

sudo apt-get install openssh-server

 

That seems like all you need to do.  If you have connected to the computer previously and it is a fresh install you may run into an error regarding the Key not matching.  To fix this in Ubuntu delete the ~/.ssh/known_hosts file on the client PC.

 

https://help.ubuntu.com/10.04/serverguide/C/openssh-server.html

 

 

Leave a Comment

Filed under Ubuntu

Ubunut Minimal Install – Fixing Locale Error After Removing language-pack-en-base

I read on a low memory install site that I could save some space by removing language-pack-en-base. Great!  I did it but now I’m getting all kinds of errors on locale not configured.

To fix this problem it was rather simple from the terminal I ran:
sudo dpkg-reconfigure locales

It creates errors while reconfiguring but afterwards it seems to fix the problem.

Other links:
https://help.ubuntu.com/community/Installation/LowMemorySystems
http://www.myscienceisbetter.info/repair-perl-locale-errors-on-ubuntu-server.html

Leave a Comment

Filed under Uncategorized

Ubuntu 11.10 Command Line Quick Reference

I’m finding myself searching the web for tons of command line references for Ubuntu, and then forgetting what I looked up a few days later.  The mind is a terrible thing to watch waste.  Well Here is a list of the things I’m finding so that I can get it easily later.

 

Find Files:

find -iname ‘fileiwant.blah’

This is a case insensitive file search in the directory you are in.

 Drive mounting/finding info

sudo fdisk -l

This will display a list of drives and their sizes as well as the important /dev/sdXX

First find the /dev/sdXX that you want to mount, it should look like /dev/sda1 or /dev/sdb1 or something similar.Next you must mount it to a directory using:

sudo mount /dev/sda1 /media/mountdirectory

Insert your dev number where sda1 is and /media/mountdirectory is the location of the directory where you want to mount it.

To find your mount points for already mounted drives simply type:

mount

File Manipulation

cp -Rv filetocopy.file /directorytocopyto/

Copy filetocopy.file to /directorytocopyto/.  It will also copy subdirectories (-R) and -v will show all the files which are copied (verbose).

sudo chmod u+xwr filename

Add execute, write and read to filename for the file owner.  You can change Owner, Group and Other permissions for read, write, and execute.  There is another way and it may be easier if you can understand the numbers.  here is an example: chmod 777 In this example the file would be set to read, write, execute for owner, group and other.

Permission Owner Group Other
Total 7 7 7
Add x 1 w 2 r 4 x 1 w 2 r 4 x 1 w 2 r 4

Unzipping .tgz (tar gz) Files:

Files ending in .tgz are files which have been zipped and tared.  They are the Linux equivalent of .zip files.  To undo them simply type:
tar -xzvf myarchive.tgz
Explanation of options:

x is extract

f FILE is the file to extract

v verbose mode (optional)

z gzip or gunzip mode, necessary for gz files and tgz.

 

Other Links:

https://help.ubuntu.com/community/FilePermissions

https://help.ubuntu.com/community/FileCompression

Leave a Comment

Filed under Ubuntu

Ubuntu – NFS quick and simple

I found a few tutorials which went into depth on various aspects of NFS (Linux file sharing) and finally used this method. There is no security and I currently have clients set to manually mount shared drives after reboot. I may work on that later.

On the Server:
install NFS files from a terminal:
sudo apt-get install nfs-kernel-server nfs-common portmap

You can create a folder to house your shares or use an existing one.
create an export file which will define what folders will be shared using your favorite editor edit /etc/exports (using sudo). I have added a few lines like these:

/exports 192.168.1.1/24(rw,no_root_squash,async)
/exports/anotherfolder 192.168.1.1/24(rw,no_root_squash,no_subtree_check,async)

The first part (/exports) is the location of the folder can be anything.

The second part (192.168.1.1/24) is the ip addresses allowed to access this can be a single address or a subnet like this example.

The third part ((rw,no_root_squash,no_subtree_check,async)) defines the permissions.  These are read/write.

Last you have to edit /etc/default/nfs-common change the following lines to reflect these settings:

# Do you want to start the idmapd daemon? It is only needed for NFSv4.
NEED_IDMAPD=yes
# Do you want to start the gssd daemon? It is required for Kerberos mounts.
NEED_GSSD=no

After editing this file you have to restart the nfs using:

sudo exportfs -a

On the Client:

Install the necessary files:

sudo apt-get install nfs-common portmap

On the client you have to edit /etc/default/nfs-common to match the server:

# Do you want to start the idmapd daemon? It is only needed for NFSv4.
NEED_IDMAPD=yes
# Do you want to start the gssd daemon? It is required for Kerberos mounts.
NEED_GSSD=no

Next create a folder where you want to have the shared file exist:

mkdir ~/sharedfiles

now simply mount the shared drive to the directory (let’s assume that the server ip is 192.168.1.10):

sudo mount 192.168.1.10:/export/anotherfolder ~/sharedfiles

That should do it.

Next I’ll try and figure out how to remount these files after reboot on the client.  You will have to re-run the mount command above if you reboot your client.

Other Links:

http://www.ubuntugeek.com/nfs-server-and-client-configuration-in-ubuntu.html

https://help.ubuntu.com/community/NFSv4Howto

http://www.ubuntugeek.com/mount-network-file-systems-nfssamba-in-ubuntu.html

 

Leave a Comment

Filed under Ubuntu

Ubuntu Sound Saga

This post is to document my saga with a usb sound card and getting it to work. I know that I can get sound out of this card because I already had it working. I changed a setting and now no sound.

What I have tried so far:
Reinstall of Ubuntu, this time I’m going for minimal install.

installed packages for sound:
sudo apt-get install linux-sound-base alsa-base alsa-utils

aplay -vv /usr/share/sounds/alsa/Front_Center.wav  (Verbose tells me no card)

No sound.  Displays:

ALSA lib confmisc.c:768:(parse_card) cannot find card '0'
ALSA lib conf.c:4184:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4184:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name
ALSA lib conf.c:4184:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4663:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2212:(snd_pcm_open_noupdate) Unknown PCM default
aplay: main:660: audio open error: No such file or directory

Now I search to see why my usb card is not detected.

sudo aplay -l
Displays (just aplay -l says no sound card... maybe this is my problem):
**** List of PLAYBACK Hardware Devices ****
card 1: default [Generic USB Audio Device ], device 0: USB Audio [USB Audio]
 Subdevices: 1/1
 Subdevice #0: subdevice #0

Now I’m trying:

lspci -v | grep -A7 -i "audio"

Shows nothing, this could be a problem (turns out this is because I’m using a usb sound card and my pci card is disabled).  I am going to try reseating the usb card.  Looks like I had the cable plugged into the mic input.  Still no sound and same error when aplay is used.  On to the next thing.  Reading the SoundTroubleShooting guide leads me to think it might be bios, checking settings in bios.

alsamixer does not run.  But if I specify the card alsamixer –card=1 it will work.

I changed USB bootable in my bios and now I can use aplay -l with no sudo but still same error when trying to play some file.  Still nothing shows up with lspci. Next I will look to see if my driver is loading correctly.

Step 1: what is my sound driver supposed to be called?  snd-usb?

lsusb

Gives more info, my card is:

Bus 004 Device 002: ID 0d8c:000e C-Media Electronics, Inc. Audio Adapter (Planet UP-100, Genius G-Talk)

This sounds familiar from the last time, at least the Planet UP-100. Ok what driver do I need?

Perhaps the driver is snd-usb-audio?  Taking a look at the file: /etc/modprobe.d/alsa-base.conf this file prevents the loading of the snd-usb-audio driver as the 0 device.  Since I disabled my primary card (it doesn’t work with Ubuntu) the usb has to be the primary card.  I will comment out the lines that prevent it from loading (there happen to be two of them exactly the same):

options snd-usb-audio index=-2 (just add a # in front of the line)

Restarting alsa:

sudo alsa force-reload

It also gave me a nice list of the drivers being loaded by alsa.  Retesting.

SUCCESS!!

Recap:

1. Check cables.

2. Play sound: aplay -vv /usr/share/sounds/alsa/Front_Center.wav

3. Check if there is a card: sudo aplay -l

4. Use either lsusb or lspci -v | grep -A7 -i “audio” to find out if there is a sound card detected.

5. Check that the drivers are loading correctly.  If usb and it has to be the primary card edit /etc/modprobe.d/alsa-base.conf to allow usb as card 0.

Reloading alsa: sudo alsa force-reload

 

**Update**

I got a new computer and there were some audio problems with it as well after a minimal install.  Here is what I did:

After running the requisite aplay I got an error message saying:

ALSA lib confmisc.c:768:(parse_card) cannot find card '0'
ALSA lib conf.c:4184:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4184:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name
ALSA lib conf.c:4184:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4663:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2212:(snd_pcm_open_noupdate) Unknown PCM default
aplay: main:660: audio open error: No such file or directory

Next I tried to run aplay sound with sudo, it worked fine.  My hunch is that there is some sort of permission problem and my user is not setup for access to sound where the root user is.  Now I will check to see if there is a group problem.

First I tried adding my user to the audio group:

sudo adduser username audio

I get the same error running aplay.  Restarting alsa does not fix the problem.  Reboot the computer.

Success!
Links:

https://help.ubuntu.com/community/SoundTroubleshooting

http://mauroandres.wordpress.com/2007/04/18/minimal-ubuntu-install/#Sound

http://www.alsa-project.org/main/index.php/SoundcardTesting

http://www.maenad.net/geek/di8k-debian/node23.html

 

https://help.ubuntu.com/8.04/serverguide/C/user-management.html

 

 

 

2 Comments

Filed under Ubuntu

Grub 2 – Adding a Boot Option

I always forget how to add an option so here is the quick and dirty.

Add to grub 2 by adding a file to the /etc/grub.d/ folder. There are several in there already (those are the current options) Grub organizes them by name so 00_header comes before 10_linux. Add a new file ie: (12_newfile) and edit it in your favorite editor.

I am going to use this file for an install drive from the mini.iso
so you may have to determine what the correct settings are here is my file:

#!/bin/sh -e
echo “#HD Ubuntu Install”
cat << EOF
menuentry “HD Install” {
set root=(hd0,1)
linux /linux
initrd /initrd.gz vga=normal ramdisk_size=14972 root=/dev/rd/0 rw —
}
EOF

The important part is the root=(hd0,1) and the linux/initrd

root is the drive you want to use, for instance if you want to use /dev/sda1 it is (hd0,1) sda2 would be (hd0,2) sdb1 would be (hd1,1) etc.

linux is the linux image names are often: linux vmlinuz

initrd is often initrd.gz  these things can change so best to do a search to get the right options.

Once your write this file you have to make it executable and have grub reconfigure the grub.cfg file, from the command line type:

sudo chmod +x 12_filename

sudo update-grub

Reboot and your new option will be there.

Links:

http://ubuntuforums.org/showthread.php?t=28948

Leave a Comment

Filed under Ubuntu

Ubuntu – Turning off swap for resizing

I am trying to re-partition my harddrive and my new install has a swap at the end of the drive but I want to merge it with another partition at the end.

Warning: Partitioning, resizing, and formatting can and most likely will destroy all data.  I’m not responsible if you lose everything.  Proceed at your own risk!  (Unmounting your swap may make your computer run slow too.)

Open terminal
type:
sudo swapoff -a

This will turn off all swaps.

Now open gparted and resize to your hearts content.

Leave a Comment

Filed under Ubuntu

Ubuntu 11.04 Minimal Install Using Openbox as Window Manager

I have been playing with minimal installs and found this to be a pretty good combination. I wanted to write down the packages to download after minimal installation, so here they are.

Make a minimal install, there are many guides on the internet.  Here is one that I found useful:

http://www.psychocats.net/ubuntu/minimal

 

Here is the quick one line command to put in the terminal:

sudo apt-get install xorg openbox obconf openbox-themes lxpanel xfe linux-sound-base alsa-base alsa-utils leafpad gksu synaptic chromium-browser nfs-kernel-server nfs-common portmap flashplugin-installer xdm readahead terminator openssh-server

Packages explained:

xorg – x.org package will install all that you need for xwindows.

openbox, obconf, openbox-themes – These three are for openbox.

lxpanel – a nice panel, task bar for those Windows users out there.  I had to add a lxpanel line to my ~/.config/openbox/autostart.sh file for it to start.  I also noticed it will add programs automatically to the menu, which the default openbox menu system does not.

xfe – a simple file explorer.  I may want to change this but for now I like it.

linux-sound-base alsa-base alsa-utils – sound drivers and utilities

leafpad – simple text editor

gksu – Graphical sudo (for usage with things like synaptic in xwindows)

synaptic – Package installer for xwindows

chromium-browser – Chrome, my browser of choice.  Mainly because I can avoid gnome files this way.

nfs-kernel-server nfs-common portmap – nfs file sharing for Ubuntu.  I’m creating a file server so I want this.  You don’t have to install unless you want it.

flashplugin-install – this is the flash plugin.  For some reason they have three of these packages, this one will download from adobe the current one.

xdm – a simple login manager, it is nice.  I like it better than slim.

readahead – supposed to make booting faster.

terminator – had to find a better terminal this one has copy and paste with right click, game on!

openssh-server – If you want to connect to your computer remotely this is the only way to go.  Creates an ssh server so you can log in, most installs include this but minimal does not.

Since you are using Openbox it is convieniet to copy the menu.xml to you ~/.config/openbox/ directory:

from the terminal:

cp /etc/xdg/openbox/menu.xml ~/.config/openbox/

You also may want to copy the autostart.sh and add anything (like lxpanel) you want to have started upon bootup.

cp /etc/xdg/openbox/autostart.sh ~/.config/openbox/

Good luck!

Other Links:

https://help.ubuntu.com/community/Installation/LowMemorySystems

 

Leave a Comment

Filed under Ubuntu

Ubuntu – mounting an iso file

To mount an iso file to copy files.

open your terminal
First you must have a folder to mount the iso file to, type:
sudo mkdir /media/isofile

now you mount it with some special options.
sudo mount myiso.iso /media/isofile/ -t iso9660 -o loop

Now your files will be mounted in /media/isofile/ folder.  They will be read only so you will not be able to add to them.

Links:

Mount and Unmout ISO images without burning them

Leave a Comment

Filed under Ubuntu