How to install (only) a kernel from an installation CD
Hello
While trying to free up space it seems I managed to erase or linux-images (had 5-6 of them). When I restarted the computer... surprise, only Ubuntu memory test appears.
Using a installation CD, how may I install just the kernel, so that the rest of my system remains intact? I wouldn't want to install everything from scratch.
Thank you very much
Re: How to install (only) a kernel from an installation CD
No advice out there? I'll end up erasing my previous system and installing Karmic from scratch...
Please, any advice. Thanks
Re: How to install (only) a kernel from an installation CD
This is definitely possible to do, but it'll be tricky. I'd advise following the install method that Gentoo uses: booting into a shell using the install disk, mounting the drive, and chrooting your environment into your old system. Then you can start some basic services (i.e. networking) and install the latest kernel using aptitude.
I'd basically do something like this:
Code:
# Boot into a ROOT shell from the installer - BE CAREFUL!
# Create a mount point for your existing system
mkdir /mnt/system
# Mount the root partition
# Note that my root filesystem is ext4 on /dev/sda2 - you need to adjust for yours
mount -t ext4 / /dev/sda2
# chroot into your old system
chroot /mnt/system /bin/bash
# update some environment variabls
env-update
source /etc/profile
# mount all of your previous mount points
mount -a
Then you should be able to start networking & find a kernel to install.
Let me know if you need more detail - I'd be happy to try to figure things out with you.
I'm using this document as a starting point:
http://www.gentoo.org/doc/en/handboo...ap=6#doc_chap1
Re: How to install (only) a kernel from an installation CD
Quote:
Originally Posted by
bribera
[CODE]# Boot into a ROOT shell from the installer - BE CAREFUL!
# Create a mount point for your existing system
mkdir /mnt/system
# Mount the root partition
# Note that my root filesystem is ext4 on /dev/sda2 - you need to adjust for yours
mount -t ext4 / /dev/sda2
Hi. Thank you for your help. For my computer I am using
Code:
mount -t ext3 / /dev/sda2
but it is not working. I get the following output:
Code:
ubuntu@ubuntu:~$ sudo mount -t ext3 / /dev/sda2
mount: / is not a block device
I'm running Ubuntu from the install disc. fdisk outputs the following:
Code:
Device Boot Start End Blocks Id System
/dev/sda1 1 914 7341673+ 83 Linux
/dev/sda2 * 3531 6209 21519067+ 7 HPFS/NTFS
/dev/sda3 6210 14593 67344480 7 HPFS/NTFS
/dev/sda4 915 1845 7478257+ 5 Extended
/dev/sda5 915 1036 979933+ 83 Linux
/dev/sda6 1037 1650 4931923+ 83 Linux
/dev/sda7 1651 1845 1566306 82 Linux swap / Solaris
Thank you very much for your help and hope to get this cracking soo.
Re: How to install (only) a kernel from an installation CD
Oh, oops -- it looks like I reversed the parameters. The device needs to come first, and then the directory you'd like to mount. I also accidentally told you to mount it to / -- that doesn't work, since you can't mount to / directly. You have to mount to a different directory and chroot into it.
There's another problem with the command you're running:
You're mounting /dev/sda2, which looks like a Windows partition to me - it's of type HPFS/NTFS.
Do you know which of your partitions is actually the root partition for Linux? My guess is it's /dev/sda1 or /dev/sda6, since they're the largest Linux partitions... but you seem to have a weird partition scheme.
You need to figure out which one is actually supposed to be mounted as / - you can do this by trial and error.
Code:
# First you'll make a mount point:
ubuntu@ubuntu:~$ sudo mkdir /mnt/system
# Then you'll mount one of the Linux partitions:
ubuntu@ubuntu:~$ sudo mount -t ext3 /dev/sda1 /mnt/system
# Then check to see if it's actually the / partition:
ubuntu@ubuntu:~$ ls /mnt/system
# If you decide it's not the / partition, unmount it before trying a new one:
ubuntu@ubuntu:~$ sudo umount /mnt/system
An example of what ls might output is this, from my / partition:
Code:
total 100K
drwxr-xr-x 2 root root 4.0K 2009-10-26 11:47 bin
drwxr-xr-x 3 root root 4.0K 2009-10-27 11:33 boot
lrwxrwxrwx 1 root root 11 2009-10-02 11:15 cdrom -> media/cdrom
drwxr-xr-x 17 root root 4.0K 2009-11-06 10:38 dev
drwxr-xr-x 146 root root 12K 2009-11-06 10:38 etc
drwxr-xr-x 3 root root 4.0K 2009-10-02 11:28 home
lrwxrwxrwx 1 root root 33 2009-10-19 11:22 initrd.img -> boot/initrd.img-2.6.31-14-generic
lrwxrwxrwx 1 root root 33 2009-10-09 18:08 initrd.img.old -> boot/initrd.img-2.6.31-13-generic
drwxr-xr-x 13 root root 12K 2009-10-27 12:44 lib
drwxr-xr-x 7 root root 12K 2009-10-26 11:47 lib32
lrwxrwxrwx 1 root root 4 2009-10-02 11:16 lib64 -> /lib
drwx------ 2 root root 16K 2009-10-02 11:15 lost+found
drwxr-xr-x 3 root root 4.0K 2009-09-29 13:01 media
drwxr-xr-x 2 root root 4.0K 2009-07-13 19:36 mnt
drwxr-xr-x 3 root root 4.0K 2009-10-12 13:48 opt
dr-xr-xr-x 202 root root 0 2009-11-06 10:36 proc
drwx------ 14 root root 4.0K 2009-10-29 12:39 root
drwxr-xr-x 2 root root 4.0K 2009-10-27 11:32 sbin
drwxr-xr-x 2 root root 4.0K 2009-08-25 04:07 selinux
drwxr-xr-x 3 root root 4.0K 2009-10-07 12:00 srv
drwxr-xr-x 13 root root 0 2009-11-06 10:36 sys
drwxrwxrwt 14 root root 340 2009-11-06 11:13 tmp
drwxr-xr-x 12 root root 4.0K 2009-10-30 11:34 usr
drwxr-xr-x 15 root root 4.0K 2009-09-29 13:12 var
lrwxrwxrwx 1 root root 30 2009-10-19 11:22 vmlinuz -> boot/vmlinuz-2.6.31-14-generic
lrwxrwxrwx 1 root root 30 2009-10-09 18:08 vmlinuz.old -> boot/vmlinuz-2.6.31-13-generic
Your partitioning scheme is a little complicated, so you may need to check several of your partitions. Just mount and ls each in order, umounting if you decide you've chosen the wrong one.
Once you get a partition with directories reasonably similar to the ones I posted, you can move into that directory and chroot:
Code:
# chroot into your old system
ubuntu@ubuntu:~$ sudo chroot /mnt/system /bin/bash
# update some environment variables
ubuntu@ubuntu:~$ env-update
ubuntu@ubuntu:~$ source /etc/profile
# mount all of your previous mount points from /etc/fstab
ubuntu@ubuntu:~$ sudo mount -a
Re: How to install (only) a kernel from an installation CD
Ok. So I got past the mounting and the /bin/bash parts (I mounted sda1).
Right now I get the following errors:
Code:
root@ubuntu:/# env-update
bash: env-update: command not found
Code:
root@ubuntu:/# source /etc/profile
root@ubuntu:/# mount -a
mount: special device /dev/disk/by-uuid/9c30c2b1-7423-48c7-86c5-eceddd6d41f6 does not exist
ntfs-3g: Failed to access volume '/dev/sda3': No such file or directory
Please type '/sbin/mount.ntfs-3g --help' for more information.
Work under way.
Re: How to install (only) a kernel from an installation CD
The env-update error doesn't matter; I guess that's a Gentoo-only thing.
What does the following output?
Code:
ubuntu@ubuntu:~$ mount -l
Also, can you post the output of:
Code:
ubuntu@ubuntu:~$ cat /etc/fstab
Re: How to install (only) a kernel from an installation CD
I have also tried to install directly through apt-get a linux-image, but:
Code:
root@ubuntu:/# sudo apt-get install linux-image-2.6.30
sudo: unable to resolve host ubuntu
E: Could not get lock /var/lib/dpkg/lock - open (11 Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/),
is another process using it?
No chance to get that working :).
Re: How to install (only) a kernel from an installation CD
Quote:
Originally Posted by
bribera
The env-update error doesn't matter; I guess that's a Gentoo-only thing.
What does the following output?
Code:
ubuntu@ubuntu:~$ mount -l
Also, can you post the output of:
Code:
ubuntu@ubuntu:~$ cat /etc/fstab
Thank you Bribera. I get the following output:
Code:
root@ubuntu:/# mount -l
/dev/sda1 on / type ext3 (rw,relatime,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
varrun on /var/run type tmpfs (rw,nosuid,mode=0755)
varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
root@ubuntu:/# cat /etc/fstab
# /etc/fstab: static file system information.
#
# -- This file has been automaticly generated by ntfs-config --
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
# Entry for /dev/sda1 :
UUID=c1448a6e-04eb-46a1-80f0-5154db00f923 / ext3 relatime,errors=remount-ro 0 1
# Entry for /dev/sda6 :
UUID=9c30c2b1-7423-48c7-86c5-eceddd6d41f6 /home ext3 relatime 0 2
# Entry for /dev/sda7 :
UUID=ca1de354-fe68-4bb4-8258-29481db9f3e5 none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
/dev/sda3 /media/Media ntfs-3g defaults,locale=en_GB.UTF-8 0 0
#/dev/sda2 /media/Windows ntfs-3g defaults,locale=en_GB.UTF-8 0 0
By the way, my partitioning is indeed strange. Dual boot basically, the linux root, home, swap, the Windows and some other partitions. Cheers
Re: How to install (only) a kernel from an installation CD
Hmm... two thoughts on that:
- Your networking probably isn't running, so you won't be able to download stuff
- /var might be mounted elsewhere (!?)
For the first, try running this:
Code:
ubuntu@ubuntu:~$ sudo /etc/init.d/networking start
For the second, post your mount -l and /etc/fstab. It could be that one of your other partitions needs to be mounted in order to access /var.