LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   Kernel in subdir of /boot (https://www.linuxquestions.org/questions/debian-26/kernel-in-subdir-of-boot-611244/)

hepburnenthorpe 01-04-2008 09:21 PM

Kernel in subdir of /boot
 
Hello, new debian user here having recently moved from Gentoo.

Currently trying to get a dual boot of Debian and Gentoo going and have decided that Id'e like my kernels to be in subdirs of /boot.

Code:

thorpe@oblivion ~ # ls -l /boot
total 112K
98497 drwxr-xr-x 2 root root 4.0K 2007-05-11 10:10 arch/
  12 lrwxrwxrwx 1 root root    1 2007-05-03 12:06 boot -> ./
32833 drwxr-xr-x 2 root root 4.0K 2008-01-05 13:29 debian/
49249 drwxr-xr-x 4 root root 4.0K 2007-05-03 13:14 gentoo/
16417 drwxr-xr-x 2 root root 4.0K 2008-01-04 16:29 grub/
  11 drwx------ 2 root root 4.0K 2007-07-24 21:53 lost+found/
  23 -rw-r--r-- 1 root root  81K 2007-05-03 12:14 message

Code:

thorpe@oblivion ~ # ls -l /boot/debian/
total 6424
-rw-r--r-- 1 root root  70781 2007-03-27 02:32 config-2.6.18-4-686
-rw-r--r-- 1 root root 4490469 2007-07-28 13:32 initrd.img-2.6.18-4-686
-rw-r--r-- 1 root root  722037 2007-03-27 08:42 System.map-2.6.18-4-686
-rw-r--r-- 1 root root 1260290 2007-03-27 08:42 vmlinuz-2.6.18-4-686

I have then changed the symlinks in /

Code:

lrwxrwxrwx  1 root root        35 2008-01-05 13:30 initrd.img -> /boot/debian/initrd.img-2.6.18-4-686
lrwxrwxrwx  1 root root        25 2008-01-05 13:30 vmlinuz -> /boot/vmlinuz-2.6.18-4-686

I have also changed my menu.lst
Code:

title Debian GNU/Linux, kernel 2.6.18-4-686
root (hd0,11)
kernel /debian/vmlinuz-2.6.18-4-686 root=/dev/hda9 ro 
initrd /debian/initrd.img-2.6.18-4-686

Everything seems fine. I can boot no probs. However, trying to run apt-get upgrade fails with....

Code:

thorpe@oblivion /boot/debian # apt-get upgrade
Reading package lists... Done
Building dependency tree... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
Need to get 0B of archives.
After unpacking 0B of additional disk space will be used.
Do you want to continue [Y/n]?
Setting up linux-image-2.6.18-5-686 (2.6.18.dfsg.1-17) ...
Internal Error: Could not find image (/boot/vmlinuz-2.6.18-5-686)
dpkg: error processing linux-image-2.6.18-5-686 (--configure):
 subprocess post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of linux-image-2.6-686:
 linux-image-2.6-686 depends on linux-image-2.6.18-5-686; however:
  Package linux-image-2.6.18-5-686 is not configured yet.
dpkg: error processing linux-image-2.6-686 (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 linux-image-2.6.18-5-686
 linux-image-2.6-686
E: Sub-process /usr/bin/dpkg returned an error code (1)

Are there any other adjustments I need to make to get this to work properly?

Dutch Master 01-04-2008 09:48 PM

Make a sym-link from where the script expects the image to be (in /boot) to where it actually is (in /boot/debian). Should be a breeze for you as Gentoo-ist ;)

hepburnenthorpe 01-05-2008 05:51 AM

Sure, I could do that but it kind of defeats the purpose of trying to keep my /boot directory uncluttered.

I've found a file, /etc/kernel-img.conf that would appear to be usefull in this situation. But looking at the man page related to it still leaves me unclear on which directive I need to change.

I've managed to fix the update error simply by uninstalling 2.6.18-5. Somehow I had installed it into my /boot dir when my boot partition was not mounted. I now have my boot directory mounting to /boot on startup so that error wont happen again. I'm still however looking for a solution that will enable me to keep my kernel image in a sub dir of /boot

Anyone?

pixellany 01-05-2008 06:40 AM

You have only two choices that I can think of:
1. Links
2. Change every application / config file that looks for the kernel files

I am curious why you would need to go to all this trouble.

hepburnenthorpe 01-05-2008 10:51 PM

Quote:

I am curious why you would need to go to all this trouble.
Because as I add more operating systems, the chance of one of them using the same kernel name increases. Eventually one of them is going to overight another. By keeping them in there own sub directory this problem is eliminated.

Are you people telling me there is no easy way for this to be done? Seems a simple request.

hepburnenthorpe 01-05-2008 10:57 PM

Ok, after a bit more investigating of the /etc/kernel-img.conf file it would appear that adding....

Code:

move_image = YES
image_dest = /boot/debian

will do what I want. havent tested it as yet, but looks promising.

I guess I was just being lazy.

hepburnenthorpe 01-06-2008 04:24 AM

Nope, that doesn't appear to work either. I'm sure thats the behavour kernel-img.conf(5) describes.

With /etc/kernel-img.conf changed as above I end up with all the *5-686 files in /boot and my vmlinuz and initrd.img links in /boot/debian pointing back toward /boot. There has to be a way.

Has anyone got any ideas why this isn't working and if so, how it can be done?

Thankyou.

pixellany 01-06-2008 06:59 AM

Quote:

Originally Posted by hepburnenthorpe (Post 3012925)
Because as I add more operating systems, the chance of one of them using the same kernel name increases. Eventually one of them is going to overight another. By keeping them in there own sub directory this problem is eliminated.

Are you people telling me there is no easy way for this to be done? Seems a simple request.

We're only telling you what we know.....that's the best anyone can do.

From the above, i understand you are trying to use one /boot partition for multiple OSes. Two points:
1. It is not necessary to have a separate /boot partition.
2. If it is separate, it can be very small (typically 100MB), and there is no real benefit in trying to share it with multiple OSes

Bottom line: The way to have separate directories for the kernel(s) is by having separate /boot directories---regardless of whether /boot is a separate partition.

hepburnenthorpe 01-06-2008 03:23 PM

Quote:

1. It is not necessary to have a separate /boot partition.
I am aware of this, though it should make what I am attempting easier.

Quote:

2. If it is separate, it can be very small (typically 100MB), and there is no real benefit in trying to share it with multiple OSes
One major benifit is that I only need one shared /boot/grub/menu.lst. Maybe I'm mssing something, but I think this is the cleanest way of doing it.

pixellany 01-06-2008 03:32 PM

You only need one /boot/grub/menu.lst regardless. In fact you can only have one which is acitve. When GRUB is installed, it gets "hard-coded" to point to the partition where it will find /boot/grub/menu.lst. No other instances/versions of that file will have any meaning.

hepburnenthorpe 01-06-2008 05:03 PM

Yeah, I know that. Thats why it seems easiest to me to store all the kernels in the same /boot drive along with the /boot/grub/menu.lst file. Dont your grub entries need to be referenced in relation to that /boot. eg; My current /boot/grub/menu.lst file looks like...

Code:

default 2
fallback 1
timeout 1
hiddenmenu

# Partitions.
##################################
#
# Gentoo                /dev/hda5
# EMPTY                /dev/hda6
# Arch                  /dev/hda7
# tsp-linux            /dev/hda8
# EMPTY                /dev/hda9
# EMPTY                /dev/hda10
# SPARE (DONT USE)      /dev/hda14
#
# SPARE                /dev/hdb1
# shared storage        /dev/hdb2
#
#################################

title Arch
root (hd0,11)
kernel /arch/vmlinuz-2.6.18 root=/dev/hda7 ro 
initrd /arch/initrd.img-2.6.18

title Gentoo (Stable)
root (hd0,11)
kernel /gentoo/stable/kernel-2.6.22-gentoo-r9-10.11.2007 root=/dev/hda5

title Gentoo (Experimental)
root (hd0,11)
kernel /gentoo/experimental/kernel-2.6.22-gentoo-r9-03.01.2008 root=/dev/hda5

title tsp
root (hd0,11)
kernel /tsp/kernel-2.6.22-18.12.2007 root=/dev/hda8
   
title Debian
root (hd0,11)
kernel /debian/vmlinuz-2.6.18-5-686 root=/dev/hda9 ro 
initrd /debain/initrd.img-2.6.18-5-686

Does the / not refer to the /boot drive? How would I make it refer to another drive?

Anyway, thats not really what I want to do. As you can see, I have several distros, all which are quite happy to have there kernel in a subdirectory. Even Debian is quite happy to have it in a subdirectory. The problem is, when I upgrade or reinstall the kernal I need to manually move it.

pixellany 01-06-2008 05:15 PM

Quote:

Does the / not refer to the /boot drive? How would I make it refer to another drive?
The root (hdX,Y) statement tells GRUB where to look for grub/menu.lst, and gives the starting point, from which the kernel and initrd statements give the relative path to the files.

As I think about it, I don't think there ever has to be a directory named "boot". i.e. all that is required is that the combo of the root and later statements gets you to where the files are.

hepburnenthorpe 01-06-2008 06:02 PM

Quote:

The root (hdX,Y) statement tells GRUB where to look for grub/menu.lst, and gives the starting point, from which the kernel and initrd statements give the relative path to the files.
Given that then, what would the grub entry look like if my kernel was in /root (/dev/hda5) ?

pixellany 01-06-2008 10:53 PM

If you really meant /root (not / ), then it would be:

root (hd0,4)
kernel /root/vmlinuz....etc.

If you meant /, then
root (hd0,4)
kernel vmlinux...etc

Note that---to help keep us confused---there are a minimum of three usages of "root":
1. the name of the "superuser" (whose home directory is named /root)
2. / = the root of the filesystem tree
3. GRUB's root which is defined as I posted earlier

hepburnenthorpe 01-07-2008 02:32 AM

Yes, I blatantly said /root.

So then, given that last post. if I wanted to move all my kernels for each OS into there own /boot directory within the systems / directory I could use the following?

Code:

title Arch
root (hd0,6)
kernel /boot/vmlinuz-2.6.18 root=/dev/hda7 ro 
initrd /boot/initrd.img-2.6.18

title Gentoo (Stable)
root (hd0,4)
kernel /boot/kernel-2.6.22-gentoo-r9-10.11.2007 root=/dev/hda5

title Gentoo (Experimental)
root (hd0,4)
kernel /boot/kernel-2.6.22-gentoo-r9-03.01.2008 root=/dev/hda5

title tsp
root (hd0,7)
kernel /boot/kernel-2.6.22-18.12.2007 root=/dev/hda8
   
title Debian
root (hd0,8)
kernel /boot/vmlinuz-2.6.18-5-686 root=/dev/hda9 ro 
initrd /boot/initrd.img-2.6.18-5-686

This may very well be an option.


All times are GMT -5. The time now is 05:49 PM.