root password reset

Within the standard ubuntu or the derviertives (kubuntu/edubuntu etc) the root password is not set and the way to gain access to the root commands is via the command line

sudo command here

I personally prefer to have root password set because then I can use the root admin rights on the desktop without having to constantly type in sudo all of the time, so to set the root password to something that I will use you can use this

sudo set password root

this will set the password to something that you can remember and thus any time that you want to have a console open as root just type in

su

and then the password and you are in the root console 🙂

changing the hostname

To change the hostname of a linux distribution you can either change the hostname on-the-fly, but it does not restore it after a reboot. To change the hostname on-the-fly you can do

echo "your new hostname" > /proc/sys/kernel/hostname

on a ubuntu/debian system to alter the hostname after a reboot you can alter the

/etc/hostname

file, if you cannot find the hostname file there, you can search for the file within the /etc directory by

grep -R "your hostname" /etc

it will display a few files, but you should find out where your hostname is set, normally either within /etc/sysconfig or /etc/network directories.

Linux file structure – comparsion with Windows

Here is the Linux file structure from the root, which some explanations. The main explanation for the /bin, /boot /lib are the basic files that are required on boot up that the kernel needs to “run” as such. The files within the /usr are the files that user programs use e.g. games.

Anyway here is a list of directories on my linux setup.

bin binary files for boot up e.g. mount e.g.
boot boot files – kernel images etc.
dev devices on the computer.
etc configuration files for the programs
home home users, e.g. your name /home/ian
lib libraries
lib32 libraries for the 32bit programs
lib64 /lib (link to the libraries since I am using the 64 linux version)
lost+found
media media that is going to be mounted (cd-rom’s)
mnt media that is going to be mounted (Hard drives etc)
opt opitional programs e.g. things like google chrome, they are normally place in here is not distro specific.
proc processes that are happening on the computer, all process you can “talk” to
root root home files.
sbin sbin, booted up at initial stage of the boot process, things like modprobe for setting up systems items.
sys system image of devices attached and also file systems that are loadable.
tmp tempoary files.
usr user files, e.g. games, libraries, binary files
bin games include lib lib32 lib64 local sbin share src
it has its own includes, libraries, sbin and bin directories for all of the files within that user directory.
var variable files, e.g. logs, apache www hosting files.

The Windows equivalent would be that most of the / (root) directory is within the c:/windows directory, apart from the /home which is the c:/Users or c:/Documents depending on your Windows version.

bin /Windows /Windows/System32 /Windows/System
boot boot.ini file that points to what to do.
dev Does not appear to have something similar on the file system
etc /Program Data (depending on Windows versions)
home /Users
lib /Windows /Windows/System32 /Windows/System /Windows/.Net (for .Net stuff) etc.
lib32
media Does not appear to have a link to the different mount points but display them on the windows explorer
mnt Does not appear to have a link to the different mount points but display them on the windows explorer
opt /Program files/
proc Does not appear to have a list of running process on the file system, but you can view them with pslist pskill
root /Documents/Admin user account
sbin /Windows
sys Does not appear to have a list of devices attached
tmp /tmp
usr /Program files/
var /Program files/ or where ever you want them.

That kinder helps me to understand that there is more details on the command line, directory structure to actual processes and devices attached than Windows, well of course there is the regviewer that can display options like the /etc in the linux but nothing as structured, things just across like a mess (to me anyway).

Blank screen in grub

After doing a update to the nvidia kernel for the 4GB problem, the grub screen was using a graphical interface which was not allowing me to view the options on the grub screen. It was black / blank, so to alter it so that it uses a terminal (console) version instead of a graphical interface you have to alter the /etc/default/grub file

vim /etc/default/grub

And just uncomment the GRUB_TERMINAL option, or alter it to say console as below.

# Uncomment to disable graphical terminal (grub-pc only)
GRUB_TERMINAL=console

You will need to update the grub /boot/grub/grub.cfg file which is done via the

update-grub

command, you will have to be root to do this, or sudo if you do not have a root access as such.

now the screen will be viewable in a console mode which is all that I needed anyway, I was not really that bothered about having a graphical image in the backdrop just to select a OS or kernel version.

Mounting – Linux

Sometimes a USB external drive may not mount in Linux, could be because the the harddrive is getting to that point of I am going to give up soon so you better copy off all of the data!!!!..

Anyway, here are some basic guides to mount a external harddrive if it has not been auto mounted by udev

If you do a dmesg on the command line

dmesg 
 
[ 4454.972580] scsi 6:0:0:0: Direct-Access     Maxtor 4 D040H2           0811 PQ: 0 ANSI: 0                                                            
[ 4454.973682] sd 6:0:0:0: Attached scsi generic sg3 type 0                                                                                            
[ 4454.980992] sd 6:0:0:0: [sdc] 80043264 512-byte logical blocks: (40.9 GB/38.1 GiB)                                                                  
[ 4454.983014] sd 6:0:0:0: [sdc] Test WP failed, assume Write Enabled                                                                                  
[ 4454.983021] sd 6:0:0:0: [sdc] Assuming drive cache: write through                                                                                   
[ 4454.985201] sd 6:0:0:0: [sdc] Test WP failed, assume Write Enabled                                                                                  
[ 4454.985205] sd 6:0:0:0: [sdc] Assuming drive cache: write through                                                                                   
[ 4454.985209]  sdc: sdc1                                                                                                                              
[ 4455.022214] sd 6:0:0:0: [sdc] Test WP failed, assume Write Enabled                                                                                  
[ 4455.022218] sd 6:0:0:0: [sdc] Assuming drive cache: write through                                                                                   
[ 4455.022224] sd 6:0:0:0: [sdc] Attached SCSI disk

and get something like the above, the most interesting part is the sdc:sdc1, because this tells you where the device has been placed onto the /dev directory structure. You could also use the

lsusb

to find out where it was placed in the USB structure as well and try to mount from that device entry, but I just use the /dev/sdc ones normally, both will work through.

To mount a external drive, you need to find somewhere to place it, e.g. /mnt and then create a directory (that is not there already)

cd /mnt
mkdir USBEXT

and then mount the USB external drive, most are the type of V/FAT types so you just specify that in the type (-t) parameter

mount -t vfat /dev/sdc1 /mnt/USBEXT

the /dev/sdc1 is where it was placed and the /mnt/USBEXT was where I want it mounted and the -t was VFAT.