2

How can I write an openSUSE script that will change my boot menu.lst file and add nomodeset automatically both to failsafe and normal boot option? This script is for SUSE Studio I'm going to write it under the "Run script whenever the appliance boots" for the first boot.

  • P.S. I was really looking for a script. That would have worked natively within unix. – JohnRoach Jan 20 '11 at 8:56
3

Look for the kopt=, defoptions= and altoptions= lines beginning with ## in your menu.lst file. These specify options to be used when the menu entries are first created by installing a new kernel. No need to edit the file afterwards. You can also update all your existing entries by running update-grub.

For grub2, the file to edit is /etc/default/grub, and the same command to update. However, the parameters to change are GRUB_CMDLINE_LINUX_DEFAULT and GRUB_CMDLINE_LINUX.

For a one-off change, you can make temporary edits to the options directly in grub, by entering the "edit commandline" mode.

  • Thank you for your answer however I was really looking for a script. That would have worked natively within OpenSuse. – JohnRoach Jan 20 '11 at 8:57
  • I think you've missed the point. You don't need a script. You make a one-time change to these lines in menu.lst and then the settings you want will be applied every time a new kernel is installed. You can have them applied to every existing menu entry by running update-grub. – Neil Mayhew Feb 12 '11 at 1:21
  • If you want to use a script to make an identical change to a large number of machines, that's really outside the scope of a question like this. You would need to ask a more general question. You could do a lot of damage if you don't understand what you're doing, so it's not a good idea just to take a script posted by someone else and use it as-is. – Neil Mayhew Feb 12 '11 at 1:23
0

If you know what will definitely be surrounding it on the line, you can use sed or Perl with something like s/preceding-text$/preceding-text nomodeset$/g

The $ assumes that it's right at the end of the line. The preceding text would have to be unique to the lines you need to hit.

0

Read the release notes

Basically, you can use your favorite text editor to edit /boot/grub/menu.lst as root. Add nomodeset to the kernel boot line.

Or set the NO_KMS_IN_INITRD sysconfig variable to yes via YAST.

  • Thank you for your answer however I was really looking for a script. That would have worked natively within OpenSuse. – JohnRoach Jan 20 '11 at 8:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.