Topic: #! lost from grub options (solved)

I had installed Debian from the netinst CD awhile back and toyed around with it occasionally. This evening, I decided to install Openbox on the Debian OS. It did not start. I added Slim, but still no luck getting openbox to start. I added XFCE and synaptic, then uninstalled Openbox, added the dependencies listed on teh Openbox site, then re-installed Openbox (all via synaptic). Grub is different now, and it doesn't have #! there anymore. gparted shows the partition is still fine, and the boot flag is on the Windows 7 partition, which is what I thought it was. (I could be wrong.) When I first installed the Debian from the netinst, it detected #! just fine.
/boot/grub/grub.cfg doesn't have the entry for #!.

root@debian:/home/tom# fdisk -l

Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x4ca299f5

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1         154     1228800    7  HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/sda2   *         154       19606   156250000    7  HPFS/NTFS
/dev/sda3           19606       37639   144849921    5  Extended
/dev/sda4           37639       38914    10240000    7  HPFS/NTFS
/dev/sda5           36904       37639     5906432   82  Linux swap / Solaris
/dev/sda6           19606       23533    31543296   83  Linux
/dev/sda7           23533       36356   103004160   83  Linux
/dev/sda8           36356       36904     4393984   82  Linux swap / Solaris

Partition table entries are not in disk order
root@debian:/home/tom# 

This isn't urgent as I keep my documents on a network drive, but it would be nice to have #! back again if anyone has a suggestion.

Last edited by tmillic (2011-11-14 18:57:29)

Re: #! lost from grub options (solved)

Hello,

you could simulate update-grub by using the command grub-mkconfig (*) and see if the OS's are detected. If they are detected, you can use update-grub ponting at the boot partition to rewrite GRUB. Though I tell you in advance, that I have no experience with Win7 and Linux on one drive and the way how Win7 wants to be in the boot order.


(*) grub-mkconfig, by default, prints out the grub.cfg and is usually called by grub-install.

Last edited by machinebacon (2011-11-14 07:17:10)

Nothing right in the left brain. Nothing left in the right brain.

Re: #! lost from grub options (solved)

machinebacon, you must never sleep.
I'll try that. I also had an idea while in the bathroom. Maybe running updage-grub from the #! live disc would detect the #! entry?

Re: #! lost from grub options (solved)

Neither worked. I even tried grub=mkconfig with the #! live disk.
I did start playing with this to learn a bit about how it worked. ;-)

Re: #! lost from grub options (solved)

Quite probably big_smile I'm just not sure on which partition you would write the GRUB (usually /sda1 but don't write me letters!)
Anyway, mkconfig would do no harm and you could scroll through the output and search the Debian 2.6.32-5 entry which is #!

Last edited by machinebacon (2011-11-14 07:41:48)

Nothing right in the left brain. Nothing left in the right brain.

Re: #! lost from grub options (solved)

Edit: I have just seen what you wrote while I was typing. If you like I post the entry of #! so you can integrate it in your grub.cfg

menuentry 'CrunchBang Linux, with Linux 2.6.32-5-686' --class debian --class gnu-linux --class gnu --class os {
    insmod part_msdos
    insmod ext2
    set root='(hdXXX,msdosXXX)'
    search --no-floppy --fs-uuid --set HERE_COMES_THE_UUID_OF_THE_PARTITION
    linux    /boot/vmlinuz-2.6.32-5-686 root=UUID=HERE_COMES_THE_UUID_OF_THE_PARTITION ro  quiet  splash
    echo    'Loading initial ramdisk ...'
    initrd    /boot/initrd.img-2.6.32-5-686
}
menuentry 'CrunchBang Linux, with Linux 2.6.32-5-686 (recovery mode)' --class debian --class gnu-linux --class gnu --class os {
    insmod part_msdos
    insmod ext2
    set root='(hdXXX,msdosXXXX)'
    search --no-floppy --fs-uuid --set HERE_COMES_THE_UUID_OF_THE_PARTITION
    echo    'Loading Linux 2.6.32-5-686 ...'
    linux    /boot/vmlinuz-2.6.32-5-686 root=UUID=HERE_COMES_THE_UUID_OF_THE_PARTITION ro single 
    echo    'Loading initial ramdisk ...'
    initrd    /boot/initrd.img-2.6.32-5-686
}

check the "set root" line, you have probably hd0,msdos0 there, I don't know. Check and compare with the other entries.
Also, find the UUID of your #! partition (use blkid) and replace it where I stated it.

Nothing right in the left brain. Nothing left in the right brain.

Re: #! lost from grub options (solved)

I'll try that in the morning between classes. I found that ls -al at the grub command prompt lists uuid information as well. Thanks again.

Re: #! lost from grub options (solved)

Something I notice tmillic, you show an incorrect command in your reply and I don't know if it is a typo or a mistake. The command machinebacon gave you is grub-mkconfig (not with a equal sign). You said it didn't work. If you entered the correct command there should have been some output.

[Edit] addition - You will need to run that command with sudo, but you probably already know that, just thought I should mention that as I'm looking back over this.[/Edit]

Clearly when you installed Debian you allowed Debian to take charge of your bootloader (GRUB) and so, now, the Debian version is being run when you update-grub from the Debian install. The Crunchbang developer has modified the grub configuration file in /etc/default to identify as CB but when you run from Debian that configuration is not used, thus Debian grub would identify the kernel lines it finds on your CB install as Debian kernels. If you review your grub.cfg carefully you should be able to find your Crunchbang install on the partitions it was installed on, but identified as Debian. Machinebacon has given you the template for a Crunchbang stanza in grub.cfg if you wanted to manually enter it or add it to the "custom" shell script in /etc/grub.d. However, I would not do it that way in this case.

My advice is to only let one operating system control your bootloader and I suggest you let it be CB since that is the OS you will likely stay with. Once you have determined the line in your current boot menu that will lead to the CB partition, boot it up , reinstall grub to the MBR from Crunchbang, do an update-grub to pickup your Debian install and next time you boot, it should use the menu that you lost by letting Debian take over.

Last edited by Thorny (2011-11-14 18:27:40)

Re: #! lost from grub options (solved)

Good eye Thorny. It was a typo. I hadn't installed the video drivers for the debian installation yet.
I couldn't remember the name of the kernel as it was from the backports, and the default kernel had been removed already, so trying to edit the line to boot into the #! partition wasn't working out. Maybe the mkconfig wasn't picking up a partition that wasn't mounted? At any rate, there were no entries with the 2.6.39 kernel that I was using with #!.
Machinebacon, your post of your grub entry made me think "well, the old cruchbang grub.cfg is still there". I used the mount command to mount the #! partition, navigated to the /boot/grub directory of the #! partition (while in debian), copied the debian grub, the active one, to grub-old.cfg, then copied the grub.cfg from the #! partition to the location of the active one. It booted right up, and the entry for the debian netinst is still there too.
Now, thanks to the help from you guys, I'm crunchbanging again! Now to prepare for that physics exam this afternoon...
Thanks again.