LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Ubuntu (https://www.linuxquestions.org/questions/ubuntu-63/)
-   -   Xubuntu 8.04 - edit grub (https://www.linuxquestions.org/questions/ubuntu-63/xubuntu-8-04-edit-grub-4175459316/)

meridius10 04-23-2013 12:40 PM

Xubuntu 8.04 - edit grub
 
I have an old version of Xubuntu on an old laptop with an old version of grub without an internet connection.

Now I would like to edit grub. So I tried:

Code:

sudo su
Code:

gedit /boot/grub/menu.lst
then
Code:

apt-get install gedit
When I try to do this it doesn't work, maybe as I have no internet connection.

I guess the final bit of terminal command is to:
Code:

update-grub
I have completely forgotten how to do this!

Nevertheless it takes me back to the good old days of 2008 when I first found Linux, then wanting to completely make a break from the Microsoft empire. Sadly I am still in prison, but hopefully in the not too distant future we will all be able to free ourselves from Darth Vader and his evil empire.

yooy 04-23-2013 12:52 PM

you need to check what kind of editor you have on old xubuntu, you surely can't install one without internet connection!

meridius10 04-23-2013 01:37 PM

I am not sure what the editor is in 8.04; mousepad?!

Is there any way that I can download the right file or application from another computer to a usb and install it that way to get gedit or anything else that might work?

TobiSGD 04-23-2013 01:43 PM

On Xubuntu you should have Mousepad and Nano installed, possibly also Vi or Vim. Any of these should be sufficient to edit the menu.lst file.
Xubuntu 8.04 used Grub 0.97, so the update-grub command is not needed.

meridius10 04-23-2013 04:16 PM

OK, so do you know what I should type into the terminal in terms of commands to edit grub?

N.B. I don't have an internet connection with this particular laptop.

TobiSGD 04-23-2013 04:35 PM

Sorry, I was mistaken, the default editor for Xubuntu is Leafpad, not Mousepad.
Try it with
Code:

sudo nano /boot/grub/menu.lst
or
Code:

sudo leafpad /boot/grub/menu.lst
The changes in the configuration are immediately active, you don't need to run other commands.

impert 04-23-2013 05:08 PM

If you're able to boot your computer and use an editor, then I'm not sure why you want to edit the menu.lst

Debian-based distros have complicated menu.lst files so they can be automatically updated when you update the system and a new kernel is installed.
If you have no internet you can't update, so all the stuff at the beginning is of no use to you.
I suggest saving the old menu.lst for reference
Code:

cd /boot/grub
mv menu.lst old_menu.lst

and writing with mousepad or leafpad if it's indeed leafpad (disregard any error messages) or nano
Code:

sudo mousepad /boot/grub/menu.lst
a minimal one such as:

Code:

# menu.lst
default        0
timeout                5

color cyan/blue white/blue

title                Xubuntu 8.04, kernel 2.6.38-15-generic
kernel                /boot/vmlinuz-2.6.38-15-generic root=/dev/sda1 ro 
initrd                /boot/initrd.img-2.6.38-15-generic

NOTE:
1 I have assumed that Xubuntu is on partition sda1. If not, change accordingly.
2 Your kernel version will not be as above, and you will have to get the correct version from the /boot directory.
3 The initrd.img version must match the kernel version
4 If you have another distribution in sda2, you can add:

Code:

title                Ubuntu maverick or whatever kernel 2.6.35-22-generic
root                (hd0,1)
kernel                /boot/vmlinuz-2.6.35-22-generic root=/dev/sda2 ro
initrd                /boot/initrd.img-2.6.35-22-generic

Again change the version to suit.
Hope you'll be able to get a newer OS on a newer computer soon.

meridius10 04-24-2013 02:59 AM

Many thanks for your advice. It was just a question of changing the text editor from gedit to mousepad:

Code:

sudo mousepad /boot/grub/menu.lst
I remember doing this in the past (2010) but didn't have any notes on it.

All I wanted to do is change the boot order so that XP comes up first on menu.lst followed by all the Xubuntu entries which I changed to place under 'Other Operating Systems' (normally for Windows XP). I don't know if this is the technically correct way to do it because of subsequent entries by grub itself, but my task has been completed.

This is only a spare laptop and will not contain any important information. I just want to go through an Ubuntu book and practice on the Xubuntu partition.

At the same time if I remember correctly grub is easier to amend contrasted with grub2.

impert 04-25-2013 05:58 AM

Quote:

All I wanted to do is change the boot order so that XP comes up first on menu.lst followed by all the Xubuntu entries which I changed to place under 'Other Operating Systems' (normally for Windows XP)
In that case all you have to do is to change the line:
Code:

default  0
(which makes the first listed distro boot as default), to read whatever number XP is, counting from zero; ie if it's the second entry, put default 1, if it's the third, default 2.
Or you can cut and paste the entries to get them in the order you want.

impert 04-25-2013 06:22 AM

Quote:

I changed to place under 'Other Operating Systems' (normally for Windows XP). I don't know if this is the technically correct way to do it
Well, no, it's not. I forgot to mention that everything between
Code:

## ## End Default Options ##
and
Code:

### END DEBIAN AUTOMAGIC KERNELS LIST
is updated by the Debian package installer when there is a new kernel. If you get onto the internet for an update and it installs a new kernel it may not react well when it finds your XP there. You'll still be able to edit it by hand.

snowday 04-25-2013 06:29 AM

You are correct but:

Quote:

Originally Posted by impert (Post 4938572)
is updated by the Debian package installer when there is a new kernel. If you get onto the internet for an update and it installs a new kernel it may not react well when it finds your XP there.

There is zero risk of this since 8.04 is unsupported for over a year and will never ever receive any future kernel updates. :)

meridius10 04-25-2013 07:33 AM

I don't think this partition will ever make it on to the internet. It is on a laptop that can take max. 160MB RAM! I don't understand the default as 0? Is XP now 0?

This is my current setup (I just copied and pasted grub onto a usb...):
Code:

# menu.lst - See: grub(8), info grub, update-grub(8)
#            grub-install(8), grub-floppy(8),
#            grub-md5-crypt, /usr/share/doc/grub
#            and /usr/share/doc/grub-doc/.

## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not use 'savedefault' or your
# array will desync and will not let you boot your system.
default                0

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout                30

## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
#hiddenmenu

# Pretty colours
#color cyan/blue white/blue

## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line)  and entries protected by the
# command 'lock'
# e.g. password topsecret
#      password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret

#
# examples
#
# title                Windows 95/98/NT/2000
# root                (hd0,0)
# makeactive
# chainloader        +1
#
# title                Linux
# root                (hd0,1)
# kernel        /vmlinuz root=/dev/hda2 ro
#

#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST

### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below

## DO NOT UNCOMMENT THEM, Just edit them to your needs

## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
##      kopt_2_6_8=root=/dev/hdc1 ro
##      kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=UUID=2dc0e4c9-0c61-432c-a71b-fe0a23a128b1 ro

## Setup crashdump menu entries
## e.g. crashdump=1
# crashdump=0

## default grub root device
## e.g. groot=(hd0,0)
# groot=(hd0,4)

## should update-grub create alternative automagic boot options
## e.g. alternative=true
##      alternative=false
# alternative=true

## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
##      lockalternative=false
# lockalternative=false

## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=quiet splash

## should update-grub lock old automagic boot options
## e.g. lockold=false
##      lockold=true
# lockold=false

## Xen hypervisor options to use with the default Xen boot option
# xenhopt=

## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0

## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
##      altoptions=(recovery) single
# altoptions=(recovery mode) single

## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
##      howmany=7
# howmany=all

## should update-grub create memtest86 boot option
## e.g. memtest86=true
##      memtest86=false
# memtest86=true

## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false

## should update-grub add savedefault to the default options
## can be true or false
# savedefault=false

## ## End Default Options ##

# This is a divider, added to separate the menu items below from the Debian
# ones.
#title                Other operating systems:
#root


# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sda1
title                Microsoft Windows XP Professional
root                (hd0,0)
savedefault
makeactive
chainloader        +1

title                Other operating systems:
root

title                Ubuntu 8.04.1, kernel 2.6.24-19-generic
root                (hd0,4)
kernel                /boot/vmlinuz-2.6.24-19-generic root=UUID=2dc0e4c9-0c61-432c-a71b-fe0a23a128b1 ro quiet splash
initrd                /boot/initrd.img-2.6.24-19-generic
quiet

title                Ubuntu 8.04.1, kernel 2.6.24-19-generic (recovery mode)
root                (hd0,4)
kernel                /boot/vmlinuz-2.6.24-19-generic root=UUID=2dc0e4c9-0c61-432c-a71b-fe0a23a128b1 ro single
initrd                /boot/initrd.img-2.6.24-19-generic

title                Ubuntu 8.04.1, memtest86+
root                (hd0,4)
kernel                /boot/memtest86+.bin
quiet

### END DEBIAN AUTOMAGIC KERNELS LIST


impert 04-26-2013 04:26 AM

Yes, that should work. Give it a try.

I'd get rid of the uncommented (no #) lines:
Code:

title                Other operating systems:
root

between the Windows entry and the Ubuntu entry. Something odd might happen if you click on that entry inadvertently.

meridius10 04-26-2013 05:29 AM

OK. Many thanks for all your help.

It's all working fine now. :)


All times are GMT -5. The time now is 10:20 AM.