Debian Administration :: Mounting remote filesystems using SSH: "module-assistant install shfs"
Truely beautiful :o) and sooo easy!
A place for John to record his techy notes, both to refer back to when needed, and as a help for others...
Thursday, February 24, 2005
Thursday, February 17, 2005
Need to update all of the CPAN modules on a server?
If you are using the CPAN module within Perl, you can update all of the installed modules on your system using the command:
This forces CPAN to produce a list of all of the outdated modules on the machine and install them in one hit...
Not recommended for your average joe. you'll have to go over all of your module dependecies and check to see if updates break any of your live code.. still though there are instances where this can be useful.
Something else to think about... have a look here:
On a box where Perl has been upgraded a few times there will be lots of old dirs with modules in...
perl -MCPAN -e 'CPAN::Shell->install(CPAN::Shell->r)'
This forces CPAN to produce a list of all of the outdated modules on the machine and install them in one hit...
Not recommended for your average joe. you'll have to go over all of your module dependecies and check to see if updates break any of your live code.. still though there are instances where this can be useful.
Something else to think about... have a look here:
lrwxrwxrwx 1 root root 5 Feb 5 21:36 /usr/lib/perl/5.8 -> 5.8.4
drwxr-xr-x 5 root root 4096 Jan 30 2004 /usr/lib/perl/5.8.2
drwxr-xr-x 4 root root 4096 May 4 2004 /usr/lib/perl/5.8.3
drwxr-xr-x 30 root root 4096 Feb 17 18:05 /usr/lib/perl/5.8.4
drwxrwsr-x 9 root staff 4096 Mar 7 2002 /usr/local/lib/perl/5.6.1
drwxrwsr-x 21 root staff 4096 Dec 5 2003 /usr/local/lib/perl/5.8.0
drwxrwsr-x 4 root staff 4096 Oct 30 2003 /usr/local/lib/perl/5.8.1
drwxrwsr-x 11 root staff 4096 Mar 25 2004 /usr/local/lib/perl/5.8.2
drwxrwsr-x 12 root staff 4096 Jan 23 10:59 /usr/local/lib/perl/5.8.3
drwxrwsr-x 27 root staff 4096 Feb 17 18:08 /usr/local/lib/perl/5.8.4
On a box where Perl has been upgraded a few times there will be lots of old dirs with modules in...
Wednesday, February 16, 2005
Don't need patch...
If you don't have patch installed on a machine it's OK...
You can still use diff to update files...
To update a file using diff & ed:
Bear in mind that it has no context, so it doesn't know where it is in a changed file, it just goes by absolute line number (which means you have to update the bottom of the file before you can update the start - if you're only taking across some of the changes then you need to start at the bottom of the file and work your way back, only updating a chunk at a time... also it's not reversable... patch can see if you're trying to run a patch in reverse... if you try running ed to apply a patch, but accidentally run it against the updated file... then you will really mess it up!
so... make a backup (easy for me to say!) and be CAREFUL!
You can still use diff to update files...
To update a file using diff & ed:
# (diff -e file1 file2 ; echo -e "w\nq" ) > diffs
# ed file1 < diffs
Bear in mind that it has no context, so it doesn't know where it is in a changed file, it just goes by absolute line number (which means you have to update the bottom of the file before you can update the start - if you're only taking across some of the changes then you need to start at the bottom of the file and work your way back, only updating a chunk at a time... also it's not reversable... patch can see if you're trying to run a patch in reverse... if you try running ed to apply a patch, but accidentally run it against the updated file... then you will really mess it up!
so... make a backup (easy for me to say!) and be CAREFUL!
Tuesday, February 15, 2005
cpio pass-through mode
You have a web directory with 100000 files in it on a DVD.
You want to get a copy of all of the .htm files for editing...
(-a resets access times on source files, but no point using that on a DVD!)
The letters vdump can go in any order... more logically "padmuv", but "vdump" will be nice to remember! :o)
You want to get a copy of all of the .htm files for editing...
find webdir/ -name "*.htm" | cpio -vdump /target/directory
(-a resets access times on source files, but no point using that on a DVD!)
The letters vdump can go in any order... more logically "padmuv", but "vdump" will be nice to remember! :o)
# tar cvf /target/directory/backup.tar $(find webdir/ -name "*.htm")
-su: /bin/tar: Argument list too long
# find webdir/ -name "*.htm" | wc -l
100810
Monday, February 07, 2005
Installing Debian from hard disk...
http://d-i.pascal.at/
http://people.debian.org/~joeyh/d-i/images/daily/hd-media/
http://www.debian.org/devel/debian-installer/ports-status
http://www.debian.org/devel/debian-installer/
http://people.debian.org/~joeyh/d-i/images/daily/hd-media/
http://www.debian.org/devel/debian-installer/ports-status
http://www.debian.org/devel/debian-installer/
Sunday, February 06, 2005
If you want to reinstall everything...
You could do this:
apt-get -u --reinstall --fix-missing install $(dpkg -S LC_MESSAGES | cut -d: -f1 | tr ', ' '\n' | sort -u)
Tip of the day...
When you get Error 17 from grub it means it cannot find the partition you want it to boot...
(ToDo: go back and check this, I got this message off the web, but it looks right)
The tip is...
be careful if you go using:
Because when you hide partitions it changes their partition type, and if you hide the one with the grub install in it (e.g. where your /boot is) then grub won't be able to access the menu.lst to know what to boot!
GRUB Loading stage 1.5
GRUB loading, please wait....
Error 17
(ToDo: go back and check this, I got this message off the web, but it looks right)
The tip is...
be careful if you go using:
hide (hd0,0)
Because when you hide partitions it changes their partition type, and if you hide the one with the grub install in it (e.g. where your /boot is) then grub won't be able to access the menu.lst to know what to boot!
Saturday, February 05, 2005
Creating a bootable DOS partition from Linux
(or "how to flash the BIOS on your Debian box without a floppy drive, or CD-ROM drive or Windows partition or USB boot or anything like that...")
This can be done!!! :o)
I have a PC with no floppy & no CD-ROM, it is running Sarge and has a second (empty) hard disk.
I needed to boot in DOS so I could flash the BIOS.
Add this to grub's config ( /boot/grub/menu.lst - I instinctively type vi etc because it's a config file, then realise it's in /boot/grub because it's for booting and needs to be in the boot partition (if that's partitioned)) :
Download: Memdisk:
http://syslinux.zytor.com/memdisk.php
I got the newest one out of the SysLinux 3.07 download
http://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-3.07.tar.gz
although if you apt-get install syslinux you get one too ( /usr/lib/syslinux/memdisk ) which you could use, but that's currently 2.11-0.1 or so.
DOS floppy image:
http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/beta9sr1/fdos1440.img
In Linux use fdisk (or cfdisk as I did) to create a small partition at the start of the empty disk (I did 8MB)
Use dosfstools mkfs.vfat to format the new partition:
mount it:
copy memdisk and fdos1440.img and the flash program which you download from your hardware vendor into it:
boot, choose FreeDOS Image, Choose 1:
Then choose 1:
Then choose 2:
...and you should now find yourself at a nice little A:\>_ prompt :o)
then there you are :o) You can now flash your BIOS because you are in native DOS.
I'm wondering if you can use a loopback file within Linux as the root filesystem too, so you don't need a disk partition, now THAT would be scarey!!! :o)
This guy needed a CD-ROM:
http://www.linuxsa.org.au/pipermail/linuxsa/2004-November/075117.html
(wimp!)
This can be done!!! :o)
I have a PC with no floppy & no CD-ROM, it is running Sarge and has a second (empty) hard disk.
I needed to boot in DOS so I could flash the BIOS.
Add this to grub's config ( /boot/grub/menu.lst - I instinctively type vi etc because it's a config file, then realise it's in /boot/grub because it's for booting and needs to be in the boot partition (if that's partitioned)) :
title FreeDOS Image
root (hd1,0)
kernel /memdisk
initrd (hd1,0)/fdos1440.img
Download: Memdisk:
I got the newest one out of the SysLinux 3.07 download
although if you apt-get install syslinux you get one too ( /usr/lib/syslinux/memdisk ) which you could use, but that's currently 2.11-0.1 or so.
DOS floppy image:
In Linux use fdisk (or cfdisk as I did) to create a small partition at the start of the empty disk (I did 8MB)
Device Boot Start End Blocks Id System
/dev/hdc1 * 1 1 8001 b W95 FAT32
Use dosfstools mkfs.vfat to format the new partition:
apt-get install dosfstools
mkfs.vfat /dev/hdc1
mount it:
mkdir /mnt/hdc1
mount /dev/hdc1 /mnt/hdc1
copy memdisk and fdos1440.img and the flash program which you download from your hardware vendor into it:
boot, choose FreeDOS Image, Choose 1:
1->FreeDOS (speedup, 386+)
Then choose 1:
1) FreeDOS Beta9 ServiceRelease1 [2004-November-30]
Then choose 2:
2. FreeDOS Safe Mode (skip driver loading)
...and you should now find yourself at a nice little A:\>_ prompt :o)
c:
dir
then there you are :o) You can now flash your BIOS because you are in native DOS.
I'm wondering if you can use a loopback file within Linux as the root filesystem too, so you don't need a disk partition, now THAT would be scarey!!! :o)
This guy needed a CD-ROM:
(wimp!)
Friday, February 04, 2005
Power off on shutdown (with grub instead of LILO)
To power off on shutdown in Linux you need to do two things...
Firstly the kernel needs to know to do it, and secondly the apm module needs to be loaded.
You load the module by adding the line:
to
(or by doing
I'm used to doing it with LILO, but with grub telling the kernel to use it is a matter of addding
Firstly the kernel needs to know to do it, and secondly the apm module needs to be loaded.
You load the module by adding the line:
apm
to
/etc/modules
(or by doing
"modprobe apm"
for a one-off)
I'm used to doing it with LILO, but with grub telling the kernel to use it is a matter of addding
"apm=on"
to the end of the "kernel" line in /boot/grub/menu.lst
, after all the other stuff.
Thursday, February 03, 2005
Upgrading from LILO to grub...
After all these years of staying away from grub (for various reasons ... mainly because the one time I'd been confronted with it there was a box which wouldn't boot in a computer room, there wasn't time to research, I didn't know anything about it, I didn't like the name, and I didn't know where to start...) I tried upgrading a box after installing a new Sarge box which installs grub by default so I hade something to compare with as a working example...
Installing it was as simple as doing:
As simple as running:
(mine was:
(You can also use (hd0) instead of /dev/hda I believe.)
Then making
I have:
Installing it was as simple as doing:
As simple as running:
grub-install /dev/hda
(mine was:
grub-install --no-floppy /dev/hda
)(You can also use (hd0) instead of /dev/hda I believe.)
Then making
/boot/grub/menu.lst
I have:
default 0
timeout 3
color cyan/blue white/blue
title Debian GNU/Linux, kernel 2.4.27-2-686
root (hd0,0)
kernel /boot/vmlinuz-2.4.27-2-686 root=/dev/hda1 ro
initrd /boot/initrd.img-2.4.27-2-686
savedefault
boot
title Debian GNU/Linux, kernel 2.4.27-2-686 (recovery mode)
root (hd0,0)
kernel /boot/vmlinuz-2.4.27-2-686 root=/dev/hda1 ro single
initrd /boot/initrd.img-2.4.27-2-686
savedefault
boot
You can do this automatically on Debian with:
update-grub
Subscribe to:
Posts (Atom)