Page 3 of 6

grub2 menu entry

Posted: 04 Nov 2017, 09:55
by Blaze
Ed_P, I have installed English language in my system. I switched Russian to English.
I added these lines in grub.cfg and Porteus is boot up fine

Code: Select all

menuentry "Porteus 4.0" --class slackware   --class icon-linux  {

     search -f /boot/syslinux/vmlinuz --set=root
     echo "Porteus bootloader is:          "$root
     set porteus_parms="changes=/porteus kmap=us,ru"

     linux   /boot/syslinux/vmlinuz $porteus_parms
     initrd /boot/syslinux/initrd.xz
}
Thanks.

BTW, I noticed that the language code changed from 0419 to 0409 after I switched Russian to English.
Image

I have one qustion. Can I install grub2win to /dev/sda1 partition if I will set drive letter for this partition - this is hide partition with label “System Reserved” (Зарезервировано системой - label in Russian) in Windows?

Image

grub2 menu entry

Posted: 04 Nov 2017, 14:57
by Ed_P
:Yahoo!: :celebrate3:

As for installing to a different partition yes that is possible, as for a hidden partition I don't know. Hidden means no drive letter and Grub2Win is accessed when booting via the BCD and I don't know if the BCD can work with hidden partitions. Easy enough to find out, backup your c:\grub2\grub.cfg file, click on the Grub2Win Uninstall option at the top, then do the install again to the hidden partition and restore your grub.cfg file.

:beer:



Add to c:\grub2\themes\icons\
https://s1.postimg.org/1rpfu4sp9b/icon-porteus.png
then you can have
menuentry " Porteus 4.0" --class slackware --class icon-porteus {

:)

grub2 menu entry

Posted: 04 Nov 2017, 18:49
by Blaze
Ed_P, I like Tux icon. Thanks.
Do you know how to add windows boot menu to grub2win window?

I tried this variant

Code: Select all

menuentry 'Windows' --class windows --class icon-windows {
     search -f /bootmgr --set=root
     echo "Windows bootloader is:          "$root
     chainloader $root
}
but I don't have success :(

Code: Select all

tree /mnt/sda1
/mnt/sda1
├── $RECYCLE.BIN
│   ├── S-1-5-18
│   │   ├── $I2G4A93
│   │   ├── $IWTZ90S
│   │   ├── $IXDDI9L
│   │   ├── $R2G4A93
│   │   ├── $RWTZ90S
│   │   ├── $RXDDI9L
│   │   └── desktop.ini
│   └── S-1-5-21-991425896-604461274-521109655-1000
│       └── desktop.ini
├── BOOTSECT.BAK
├── Boot
│   ├── BCD
│   ├── BCD.LOG
│   ├── BOOTSTAT.DAT
│   ├── Fonts
│   │   ├── chs_boot.ttf
│   │   ├── cht_boot.ttf
│   │   ├── jpn_boot.ttf
│   │   ├── kor_boot.ttf
│   │   └── wgl4_boot.ttf
│   ├── cs-CZ
│   │   └── bootmgr.exe.mui
│   ├── da-DK
│   │   └── bootmgr.exe.mui
│   ├── de-DE
│   │   └── bootmgr.exe.mui
│   ├── el-GR
│   │   └── bootmgr.exe.mui
│   ├── en-US
│   │   ├── bootmgr.exe.mui
│   │   └── memtest.exe.mui
│   ├── es-ES
│   │   └── bootmgr.exe.mui
│   ├── fi-FI
│   │   └── bootmgr.exe.mui
│   ├── fr-FR
│   │   └── bootmgr.exe.mui
│   ├── hu-HU
│   │   └── bootmgr.exe.mui
│   ├── it-IT
│   │   └── bootmgr.exe.mui
│   ├── ja-JP
│   │   └── bootmgr.exe.mui
│   ├── ko-KR
│   │   └── bootmgr.exe.mui
│   ├── memtest.exe
│   ├── nb-NO
│   │   └── bootmgr.exe.mui
│   ├── nl-NL
│   │   └── bootmgr.exe.mui
│   ├── pl-PL
│   │   └── bootmgr.exe.mui
│   ├── pt-BR
│   │   └── bootmgr.exe.mui
│   ├── pt-PT
│   │   └── bootmgr.exe.mui
│   ├── ru-RU
│   │   ├── bootmgr.exe.mui
│   │   └── memtest.exe.mui
│   ├── sv-SE
│   │   └── bootmgr.exe.mui
│   ├── tr-TR
│   │   └── bootmgr.exe.mui
│   ├── zh-CN
│   │   └── bootmgr.exe.mui
│   ├── zh-HK
│   │   └── bootmgr.exe.mui
│   └── zh-TW
│       └── bootmgr.exe.mui
├── System Volume Information
│   └── tracking.log
└── bootmgr

29 directories, 45 files

grub2 menu entry

Posted: 05 Nov 2017, 01:22
by Ed_P
?? Isn't Windows the 1st option in your grub2 boot menu? Or are you referring to booting a 2nd copy of Windows on a different drive?

Code: Select all

#
#  Menu Entry 0       Windows Boot Manager
#
menuentry   'Windows Boot Manager                                   Hotkey=w'   --hotkey=w    --class windows   --class icon-windows  {
set reviewpause=0
if [ $grub2win_bootmode = EFI ]; then
     set efibootmgr=/efi/Microsoft/Boot/bootmgfw.efi
     getbootpartition  file  $efibootmgr
     if [ $reviewpause -gt 0 ] ; then
	 echo Grub is now booting   Windows EFI Boot Manager
         echo Boot disk address is  $root
         echo The boot mode is      Windows EFI
         sleep -v -i $reviewpause
     fi
     chainloader $efibootmgr
else
     if [ -f (hd0,1)/ntldr ]; then
         set bootcontrol="XP boot.ini"
         set bootmodule=ntldr
	 set root=(hd0,1)	
     else
         set biosbootmgr=/bootmgr
         getbootpartition  file  $biosbootmgr
         set bootcontrol=BCD
         set bootmodule=bootmgr
     fi
     if [ $reviewpause -gt 0 ] ; then
          echo
          echo The Windows BIOS boot manager is at address ($root)
          echo
          echo The Windows boot control type is $bootcontrol
          echo
          sleep -v -i $reviewpause
     fi
     ntldr /$bootmodule
fi
savelast 0 'Windows Boot Manager'
}
Can you please download the new beta version of Grub2Win and test installing it? A pain to do at this point I know but Drummer is determined to fix the language problem and your testing would be appreciated.



-update-

If the Windows menu item I posted above isn't in your grub2 grub.cfg file try:

Code: Select all

menuentry 'Windows' --class windows --class icon-windows {
     search -f /bootmgr --set=root
     echo "Windows bootloader is:          "$root
     chainloader +1
#     ntldr ($root)/bootmgr
}
The chainloader command should work but if not delete it and uncomment the ntldr line and see if that works. I'll boot my old non-EFI netbook and test these tomorrow.

grub2 menu entry

Posted: 05 Nov 2017, 18:59
by Blaze
Ed_P, I don't use UEFI. I use mbr.
I have one hard drive (sda) and one ssd (sdb) disk

Code: Select all

sda    931,5G          disk 
├─sda1   500M ntfs     part /mnt/sda1
├─sda2 195,8G ntfs     part /mnt/sda2
├─sda3 634,8G ntfs     part /mnt/sda3
└─sda4 100,5G ext4     part /mnt/sda4
sdb     59,6G ext4     disk /mnt/sdb
  • I posted tree of sda1 (NTFS) partition with Windows 7 bootloader in my previous post
  • on the sda2 (NTFS) Windows 7
  • sda3 (NTFS) for my data
  • sda4 (ext4) for UniXlab
  • on the sdb (ext4) Porteus with his bootloader
Your variants that you published in this topic does not works for me.
When I press on Windows or Windows Boot Manager in the Grub2Win - Windows 7 not boot up.

My grub.cfg

Code: Select all

#
#       Created at 21:28:45  on  Воскресенье  05 Ноябрь 2017
#
# Generated by Grub2Win      Version 1.0.0.1 from directory C:\grub2
#              Stamp  2017 - 1104 - 213439
#
# The grub menu theme is - beachsunset
#
#
#  Grub2Win generated 2 menu entries.
#
#  The Grub default boot OS is menu entry 0  -  Windows EFI Boot Manager
#  The Grub default timeout is 30 seconds
#  The Grub locale language is Russian  -  Russkiy Yazyk   The locale code is - ru
#


set default=0
set grub2win_chosen='0  -  Windows EFI Boot Manager'
set timeout=30
set lang=ru
set grub2win_version=1.0.0.1
set pager=1
set icondir=$prefix/themes/icons
set locale_dir=$prefix/locale
set grub2win_procbits=32
if [ cpuid -l ] ; then set grub2win_procbits=64 ; fi
set grub2win_bootmode=BIOS
if [ $grub_platform = efi ] ; then set grub2win_bootmode=EFI ; fi 
set grub2win_custmode=BIOS
set grub2win_lastbooted=no
set gfxmode=1024x768,800x600,auto
set theme=$prefix/themes/custom.config
if [ $grub2win_bootmode = EFI ] ; then set theme=$theme.efi.txt ; else set theme=$theme.bios.txt ; fi
export theme
set gfxpayload=text
export icondir
insmod png
insmod all_video
loadfont $prefix/fonts/unicode.pf2
insmod gfxterm
terminal_output gfxterm
insmod gfxmenu


# start-grub2win-auto-menu-section  ***************************************************
#

#
#  Menu Entry 0       Windows EFI Boot Manager
#
#  ** Grub will boot this entry by default **
#
menuentry   'Windows EFI Boot Manager'       --class other   --class icon-windows  {
#
set reviewpause=5
# start-custom-code
# end-custom-code
sleep -i -v $reviewpause ; echo
savelast 0 'Windows EFI Boot Manager'
echo Grub is now loading  Windows EFI Boot Manager
}

#
#  Menu Entry 1       Boot information and Utilities
#
menuentry   'Boot information and Utilities'       --class bootinfo   --class icon-bootinfo  {
     export gfxmode
     export grub2part
     export grub2win_chosen 
     export grub2win_lastbooted
     export grub2win_version
     export grub2win_procbits
     export grub2win_bootmode
     export grub2win_efiboot
     export grub2win_efilevel
     configfile $prefix/winsource/bootinfo.cfg
}

#
#  Menu Entry 2       Porteus 4.0
#
#  ** Grub will boot this entry by default **
#
menuentry   'Porteus 4.0'       --class slackware   --class icon-linux  {
     search -f /boot/syslinux/vmlinuz --set=root
     echo "Porteus bootloader is:          "$root
     set porteus_parms="changes=/porteus kmap=us,ru"
     linux   /boot/syslinux/vmlinuz $porteus_parms
     initrd /boot/syslinux/initrd.xz
}

#
#  Menu Entry 3       Windows
#
menuentry 'Windows 7' --class windows --class icon-windows {
     search -f /bootmgr --set=root
     echo "Windows bootloader is:          "$root
     chainloader +1
}

#
#  Menu Entry 4       Reboot
#
menuentry   'Reboot'       --class other   --class icon-reboot  {
     reboot
}

#
# display any error messages         ***************************************************
#

function g2werror {
     echo
     echo
     echo *** $1 $2 $3 $4 $5
     echo *** Press the ESC key to continue
     echo
     sleep -v -i 120
     configfile $prefix/grub.cfg
}

#
# end-grub2win-auto-menu-section     ***************************************************

# start-grub2win-savelast-section   ****************************************************
#
function savelast {
     set      default=$1
     save_env default
     if [ $grub2win_bootlast = yes ] ; then
          set grub2win_chosen=$default'  -   '$2
     fi
     save_env grub2win_chosen
     if [ ! -z $subdefault ] ; then set default=$subdefault ; fi
}
#
# end-grub2win-savelast-section     ****************************************************

# start-grub2win-getbootpartition-section  *********************************************
#
# The getbootpartition function searches for a partition
# If the first paramater is 'label' it searches for a partition with the label name
# passed in the second parameter. Otherwise it searches for a file with the filename
# passed in the second parameter. 
# It then sets the root address to prepare for boot. 
# 
#
function getbootpartition {
     set pager=0
     set searchtype=$1
     set partsearch=$2
     if [ $searchtype = label ] ; then
          search.fs_label $partsearch rootaddress
     else 
          search.file     $partsearch rootaddress
     fi
     if [ $? = 0 ] ; then
          set root=($rootaddress)
          echo
          echo Grub is setting root to $root
          echo The boot partion $searchtype is $partsearch
          echo
     else 
          g2werror 'Grub did not find a boot partition with' $searchtype $partsearch
     fi
}
#
# end-grub2win-getbootpartition-section     ********************************************

# start-grub2win-user-section   ********************************************************
#
#
# end-grub2win-user-section     ********************************************************
BTW, I tried a new beta version of Grub2Win with my Russian localization and it works perfect for me.
Image
Thanks to you and Drummer :worship:

grub2 menu entry

Posted: 06 Nov 2017, 00:40
by Ed_P
Blaze wrote:
05 Nov 2017, 18:59
BTW, I tried a new beta version of Grub2Win with my Russian localization and it works perfect for me.
:Yahoo!: :celebrate3:
When I press on Windows or Windows Boot Manager in the Grub2Win - Windows 7 not boot up.
:( I've alerted Drummer to this new situation. :crazy:

I booted my netbook and though it is Win 10 now it was originally Win 7 and the partitions look similar to yours. And in it's grub2 menu is the menu entry 0 I posted earlier.

But let's let Drummer figure out the menu 0 code while we tinker with the menu entry 3 code.

Code: Select all

#
#  Menu Entry 3       Windows
#
menuentry 'Windows' --class windows --class icon-windows {
     echo root=$root
#     search -f /bootmgr --set=root
     set biosbootmgr=/bootmgr
     getbootpartition  file  $biosbootmgr
     set bootcontrol=BCD
     set bootmodule=bootmgr
#     echo "Windows bootloader is:          "$root
     echo
     echo The Windows BIOS boot manager is at address ($root)
     echo
     echo The Windows boot control type is $bootcontrol
     echo
     sleep -v -i  10
     chainloader $bootmodule
     }
Which is basicly the bcd logic from my menu 0 entry.

Hope this works. :)


-update-

Blaze with the beta version please create another Diagnostic file and send it to Drummer.
Also include what you see when you boot and select the Windows menu 0 option.

grub2 menu entry

Posted: 06 Nov 2017, 06:13
by Blaze
Ed_P, no success with your variant.
Grub2Win defined this partition hd0,msdos1 as bootable.
The boot partition file is /bootmgr
Error, invalid file name "/bootmgr"
Ed_P wrote:
06 Nov 2017, 00:40
Also include what you see when you boot and select the Windows menu 0 option.
I see only 1,2,3,4,5, black screen and it return me to grub2win menu.

These screenshots with your variant
Image
Image
Image

My diagnose.zip

Отправлено спустя 9 часов 39 минут 35 секунд:
Ed_P wrote:
06 Nov 2017, 00:40
with the beta version please create another Diagnostic file and send it to Drummer.
done.

grub2 menu entry

Posted: 11 Nov 2017, 17:21
by Blaze
Ed_P, I found that I want - all bootloaders (GRUB2 and Windows) in /mnt/sda1 partition (this is hide partition with label “System Reserved”), and I don't see text with options Windows 7 and Grub 2 For Windows (from Grub2Win), because GRUB2 bootloader boot up by deffault. Now Porteus (installed - not ISO) and Windows boot up fine for me.

Code: Select all

su
toor
getpkg grub
# I installed grub-2.02-x86_64-2dj.txz
mkdir /mnt/sda1/porteus
grub-install --boot-directory=/mnt/sda1/porteus /dev/sda
My /mnt/sda1/porteus/grub/grub.cfg (grub.cfg need to copy to /mnt/sda1/porteus/grub/)

Code: Select all

set default=0
set timeout=10
dir=$prefix/themes/Porteus   # directory with your theme
set theme=$dir/theme.txt
insmod regexp
loadfont $dir/*.pf2
insmod png
set gfxmode=auto
set lang=ru   # your language
insmod gfxterm
insmod vbe
terminal_output gfxterm

menuentry 'Porteus' --class porteus {
  search -f /boot/syslinux/vmlinuz --set=root
  echo "Porteus bootloader is:          "$root
  set porteus_parms="changes=/porteus kmap=us,ru timezone=Europe/Moscow"
  linux   /boot/syslinux/vmlinuz $porteus_parms
  initrd /boot/syslinux/initrd.xz
}

menuentry 'Always Fresh' --class porteus {
  search -f /boot/syslinux/vmlinuz --set=root
  echo "Porteus bootloader is:          "$root
  set porteus_parms="nomagic base_only norootcopy kmap=us,ru timezone=Europe/Moscow"
  linux   /boot/syslinux/vmlinuz $porteus_parms
  initrd /boot/syslinux/initrd.xz
}

menuentry 'Copy To RAM' --class porteus {
  search -f /boot/syslinux/vmlinuz --set=root
  echo "Porteus bootloader is:          "$root
  set porteus_parms="copy2ram kmap=us,ru timezone=Europe/Moscow"
  linux   /boot/syslinux/vmlinuz $porteus_parms
  initrd /boot/syslinux/initrd.xz
}

menuentry 'Text mode' --class porteus {
  search -f /boot/syslinux/vmlinuz --set=root
  echo "Porteus bootloader is:          "$root
  set porteus_parms="3 kmap=us,ru timezone=Europe/Moscow"
  linux   /boot/syslinux/vmlinuz $porteus_parms
  initrd /boot/syslinux/initrd.xz
}

menuentry 'Windows' --class windows {
  insmod part_msdos
  insmod ntfs
  search -f /bootmgr --set=root
  echo "Windows bootloader is:          "$root
  chainloader +1
}

menuentry "Reboot" --class reboot {
	echo "System rebooting..."
	reboot
}

menuentry "Shutdown" --class shutdown {
	echo "System shutting down..."
	halt
}
and my Porteus grub2 theme Download Porteus.tar.bz2 (unpack this archive (Porteus folder) to /mnt/sda1/porteus/grub/themes/)

It looks like this (sorry for quality)
Image

Note. If you use Intel CPU and Porteus 4 (This steps can be ignored for Porteus 5), you are must to load /boot/syslinux/intel-ucode.cpio with /boot/syslinux/initrd.xz like this

Code: Select all

set default=0
set timeout=10
dir=$prefix/themes/Porteus   # каталог с темой
set theme=$dir/theme.txt     # задаём файл описания
insmod regexp                # этот модуль позволяет использовать шаблоны в именах файлов
loadfont $dir/*.pf2          # загружаем по шаблону сразу все шрифты из темы
insmod png                   # модуль поддержки картинок
set gfxmode=auto
set lang=ru
insmod gfxterm
insmod vbe
terminal_output gfxterm      # включаем графику

menuentry 'Porteus' --class porteus {
  search -f /boot/syslinux/vmlinuz --set=root
  echo "Porteus bootloader is:          "$root
  set porteus_parms="changes=/porteus kmap=us,ru timezone=Europe/Moscow"
  linux   /boot/syslinux/vmlinuz $porteus_parms
  initrd  /boot/syslinux/intel-ucode.cpio /boot/syslinux/initrd.xz
}

menuentry 'Windows 7' --class windows {
  insmod part_msdos
  insmod ntfs
  search -f /bootmgr --set=root
  echo "Windows bootloader is:          "$root
  chainloader +1
}

menuentry "Reboot" --class reboot {
	echo "System rebooting..."
	reboot
}

menuentry "Shutdown" --class shutdown {
	echo "System shutting down..."
	halt
}

grub2 menu entry

Posted: 11 Nov 2017, 19:37
by Ed_P
:mega_shok: Wow! A nice find Blaze.

How is GRUB2 booting, via the Windows boot loader, via MBR or via BIOS?


-update-

I'm not seeing what you saw.

Code: Select all

guest@porteus:~$ su
Password: 
root@porteus:/home/guest# usm -g grub

 The following items were found.
 Choose an number to confirm. 
 ctrl+c to quit

1) grub-2.00-x86_64-5.txz
2) grub-2.00-x86_64-8dj.txz
#? ^C
root@porteus:/home/guest# 
Where did you find grub-2.02-x86_64-2dj.txz?

grub2 menu entry

Posted: 12 Nov 2017, 07:05
by Blaze
GRUB2 is booting via MBR
BTW don't forget about backup partition with bootloader and MBR.

Code: Select all

dd if=/dev/sda1 of=/mnt/sda4/sda1-iso-bootloader
dd if=/dev/sda of=/mnt/sda4/mbr-backup bs=512 count=1
on the pkgs.org grub-2.02-x86_64-2dj.txz

grub2 menu entry

Posted: 12 Nov 2017, 22:08
by Ed_P
BTW If the location of the new grub2 system is hidden how are copying the grub.cfg file to it? :%)

grub2 menu entry

Posted: 12 Nov 2017, 22:49
by francois
@blaze:
So you have installed grub2 grub-2.02-x86_64-2dj.txz (pkgs.org) without any other distribution necessary. This is great.

To see GRUB during boot you need to press the right-hand SHIFT key during boot (not tested on blaze install)
http://www.omgubuntu.co.uk/2016/07/key- ... enu-ubuntu

To modify grub2 so the grub menu appears:
http://www.pontikis.net/tip/?id=36
Comment line like this:
#GRUB_HIDDEN_TIMEOUT=0

grub2 menu entry

Posted: 13 Nov 2017, 18:23
by Blaze
Ed_P, a simple way to do this via Porteus or another GNU Linux distro.
If you use Windows, you are need to set letter for hidden partition in the Disk Management of Windows and copy grub.cfg
After this you can remove letter for hidden partition in the Disk Management of Windows.

francois, yep, and I see grub2 menu automatically.
BTW, I remove Grub 2 For Windows (from Grub2Win) menu in BCD of Windows via BOOTICE in the BCD Edit tab
Image

Pluses of GRUB2 (GNU Linux install) for me:
  1. I do not see unnecessary windows
  2. I do not press unnecessary buttons
  3. bootloader of Windows and GRUB2 are installed on the 'System Reserved' (this is hidden NTFS partition with no letter) partition that are made Windows 10/8/7 when you install it (in GNU Linux this is 1st partition of the disk /mnt/sda1 with size 500 MB)
  4. simple install without any problems
  5. etc...

grub2 menu entry

Posted: 13 Nov 2017, 21:38
by Ed_P
Blaze wrote:
13 Nov 2017, 18:23
Ed_P, a simple way to do this via Porteus or another GNU Linux distro.
If you use Windows, you are need to set letter for hidden partition in the Disk Management of Windows and copy grub.cfg
After this you can remove letter for hidden partition in the Disk Management of Windows.
:D I suspected as much. Just wondered if you had some secret shortcut way.

BTW Your Windows menu item doesn't need the insmod lines and can be shortened to just:

Code: Select all

menuentry 'Windows' --class windows {
  search -f /bootmgr --set=root
  echo "Windows bootloader is:    "$root
  chainloader +1
}
Tested with Grub2Win and it works.

Note francois, Blaze's grub2 menu has no GRUB_HIDDEN_TIMEOUT=0 line thus no hidden menu.

grub2 menu entry

Posted: 07 Dec 2017, 19:21
by francois
@blaze or all:
It would be nice to have a thread or tutorial on installing porteus with grub2 only no syslinux on linux partitions. No windows involved. With the above discussion this was not clear. I have tried it and fell on the grub command line, because update-grub on sda5 left me without the necessary vmlinuz and initrd on sda5 partition. :ROFL: