I want kubuntu to ask me at start up – which of the profile I want to use. There should be a default answer which should run automatically in 3 seconds. Much as if were Grub asking You which operational system You would like to start.
The rational to have several start-up options: normally I have a lot of things starting by default: krusader, firefox, konsole, emacs… So the full loading takes about 1 minute. But sometimes – I'm on the run, and need just to do some single thing – so I'll need only, say krusader. I'd've made several start-up scripts… So I'm wondering – is it possible to choose between them at start up?
Perhaps that could be done with Grub…
Edit:
Grub didn't asked me about the start up profile at all – that is not even "Normal mode" or "Recovery mode". I made him do it with Grub Editor (the package is called kcm-grub2
):
sudo sed -i '$ a\deb http://download.opensuse.org/repositories/home:ksmanis/xUbuntu_11.10/ /' /etc/apt/sources.list
wget -q http://download.opensuse.org/repositories/home:ksmanis/xUbuntu_11.10/Release.key -O- | sudo apt-key add -
sudo apt-get update
sudo apt-get install kcm-grub2
After the installation and restart, in System settings
-> Startup and Shutdown
new item has appeared: Grub2 Bootloader
. In there – I checked "Automatically choose the default boot entry in 3 seconds".
After that, following the lumbric solution I've copied the gnu-linux
menuentry
record to the end of the /etc/grub.d/40_custom
, and add a "productivity-profile" there. Here's the text of the modified 40_custom
:
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry 'Full' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
set gfxpayload=$linux_gfx_mode
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root 392f79ba-0f1f-422f-ac76-11860e0f4869
linux /boot/vmlinuz-3.0.0-16-generic root=UUID=392f79ba-0f1f-422f-ac76-11860e0f4869 ro quiet splash vt.handoff=7 productivity-profile=1
initrd /boot/initrd.img-3.0.0-16-generic
}
menuentry 'Public' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
set gfxpayload=$linux_gfx_mode
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root 392f79ba-0f1f-422f-ac76-11860e0f4869
linux /boot/vmlinuz-3.0.0-16-generic root=UUID=392f79ba-0f1f-422f-ac76-11860e0f4869 ro quiet splash vt.handoff=7 productivity-profile=2
initrd /boot/initrd.img-3.0.0-16-generic
}
menuentry 'Fastest' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
set gfxpayload=$linux_gfx_mode
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root 392f79ba-0f1f-422f-ac76-11860e0f4869
linux /boot/vmlinuz-3.0.0-16-generic root=UUID=392f79ba-0f1f-422f-ac76-11860e0f4869 ro quiet splash vt.handoff=7 productivity-profile=3
initrd /boot/initrd.img-3.0.0-16-generic
}
productivity-profile
is picked up by the Start-up bash script.
That's it. Now I have 5 start-up profiles: Clean, Recovery, Full, Public, Fastest.
Best Answer
With the help of @Lekensteyn, I made a version where you can select the profile in GRUB. The creation of the custom menu can be still improved probably.
Step 1: create custom GRUB menu
You need to create GRUB menu entries with an additional parameter. You can follow this instructions. So copy your default entry from
/boot/grub/grub.cfg
(the lines withmenuentry ... { ... }
) to/etc/grub.d/40_custom
.Then edit (the copied entry in
/etc/grub.d/40_custom
) the line where it sayslinux /boot...
and add at the and of a line seperated with a space:You can also edit the name of the menu entry, so change the part
menuentry 'Ubuntu, with...
to something likemenuentry 'Ubuntu (Profile 1), with...
.Add such a menu entry for each of your profiles (with a unique number each).
You can remove the execute permissions from the other files in
/etc/grub.d/
in order to remove these menu entries. Don't forget to runsudo update-grub
afterwards.Note that after a kernel update, you'd have to change your grub menu manually if you follow this instructions! (You can improve this answer and describe how to edit the scripts in
/etc/grub.d/
accordingly.ยด)Step 2: check if Step 1 was successful
Reboot and select one of the profiles. Then run in a terminal:
You should get something like:
...where the number at the end of the line has to be the chosen profile.
Step 3: Adopt script to your needs and run it on start up
Then use this script to run your start up scripts: