# GRUB boot -s



## mutterhunt (Aug 7, 2020)

In Greece there was only BSD left after withdrawel symptoms of 3 months of data, computer, mobile (stolen!); 

so back in Austria, new devices, bill tried to kill me as usual with the upcoming release (2 weeks on market: 1.000.000 viruses!), but now finally BTT:

1. make kernel (works!);
2. make buildworld -j5 (no errors). (after 12 hours of building as only 1.300MhZ CPU dual)

but:
a) on grub configuration I wrote:


```
menuentry "FreeBSD current" --class freebsd --class bsd --class os
{
insmod ufs2
ismod bsd
set root=(hd0,gpt2)
kfreebsd /boot/lizbeth/kernel
set kfreeBSD.vfs.root.mountfrom=ufs:/dev/ada0s1a (???)
set kfreeBSD.vfs.root.mountfrom.options=rw
set kfreeBSD.hw.psm.synaptics-support=1
}
```

b) it doesn't start with the loader, as this would have been gpt1, but formated as 'freeBSD boot', that isn't recognized by grub anyhow. 

c) BTW, where's the grub version of freeBSD in the ports collection, disappeared in the 'pkg search' listing? So having no boot menue at all just starting up with the kernel I can't even boot in single mode for a 'make installworld -j5'. The BIOS is plain MBR (although gpt?), no reEFInd. 'reboot -s' doesn't work. 

d) Normally I tend to change resolution in bootloader with 'mode 3' but this doesn't work even from boot stick (depends on which loader it starts from) for getting a more detailed grafic in plasma5-plasma. 

e) There's also the quite usual search for the root device after and before VERBOSE_INIT=2 with to enter ufs:/dev/ada0p2. 

Dear specialists, any ideas?

Lizbeth


----------



## Alain De Vos (Aug 7, 2020)

To check partitioning, boot with an USB freebsd stick and try to mount your root partion.
Check your kernel is on the place it is expected by grub.
Go to a shell on the freebsd stick , can you print the output of "gpart show -p"
Reading "man gpart" is very helpfull.
Try first to boot into a non-graphical mode.
If that works, try something like openbox.
If that works try kde


----------



## judd (Aug 7, 2020)

mutterhunt

This may also help:

https://forums.freebsd.org/threads/dual-boot-freebsd-in-a-multi-os-system.74464/post-472445


----------



## George (Aug 8, 2020)

Usually loader(8) is on an msdosfs or efi.

Grub2 is deprecated from ports:

```
DEPRECATED: Unmaintained (more than five years), not updated (one-and-a-half years), does not build with modern compilers
```

See https://www.freshports.org/sysutils/grub2/


----------



## Alain De Vos (Aug 8, 2020)

When you use grub2 from linux , you can boot freebsd in a fine way. Or direct with kfreebsd or indirect boot the freebsd bootloader.


----------



## mutterhunt (Aug 8, 2020)

heya guys, 

thx for frequent reply. 
first thing: installworld is ok now with the USB-stick kernel and the mount -o rw / --> mount /dev/ada0p2 /mnt --> chroot /mnt --> cd /usr/src --> make installworld. reboot with new kernel from grub and do the mergemaster -Ui; works, but grafic is down now (gonna solve this with the i915 (not sfcb anymore --> maybe therefore only 1024x640 --- like the state of art for a 3D scan --- gonna scan and print you out in CA) or for this "old machine" with the aquivelent!). 

question remains on the 'mode 3' thing; the link from judd (but probably not vinnet from arch) is helpful, gonna backup the /dev/ada0p1 and reformat it as MBR with fat32 and do the chainloader thing in the grub.cfg:

Here my partition scheme from gpart show -p:


```
34                      250069613    ada0         GPT    (119G) (SSD)
34                       6                       - free -            (3.0K)
40                      1024                ada0p1     freebsd-boot (512K)
1064                  81787896      ada0p2    freebsd-ufs (39G)
81788960        2016               - free -              (1.0M)
81790976        1042432        ada0p7     bios-boot      (509M)
81790976        71909376      ada0p3    linux-data  (34G) --- Arch linux
154742784      57315328       - free -            (27G) --- futural windoze for mobile-rooting if with                                 
                                                                                                   qemu-system-64 not possible!
212058112        5859328      ada0p5      linux-swap (2.8G)
217917440       4311040      - free -        freebsd-swap (2.1G)
222228480      27840512    ada0p6      linux-data (13G) --- Sabayon linux
156668092       655               - free -
```

looks like my teeth with all the spaces in-between!  

one last step: how to avoid freeBSD to ask for the root-partition (happened suddenly after 3rd or 4th boot). this is on nearly every device I got after a while without recognizable reason.

job imago for me: debugger, as I like to kill bees and other insects (as a pure vegetarian) for you having something to eat (just let me my spirolina) - got caught a horniss-drone in a litter box; perfect: got medicine for it!

Other possibility: buy (if portmonée would let me) a 1 TB external for experiments like this. 
Will inform when loader will bring "beastie" masquote! Vulnerable fork of it, isn't it?

yours, 
miranda alias lizbeth


----------



## mutterhunt (Aug 8, 2020)

I found: http://www.wonkity.com/~wblock/docs/html/disksetup.html#_the_old_standard_mbr

choosen: GPT; works up to the point:
gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 ada0
"Operation not permitted"

this appears everywhere p.E. when doing a 'insmod XYZ.ko'. kern-secure is on 2 but changing it doesn't effect.


----------



## George (Aug 8, 2020)

> one last step: how to avoid freeBSD to ask for the root-partition (happened suddenly after 3rd or 4th boot). this is on nearly every device I got after a while without recognizable reason.


You can set the root partition (or the boot partition? ) with a kernel environment variable in /boot/loader.conf. E.g. currdev="disk1s1a".



> gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 ada0
> "Operation not permitted"


I don't think you can combine the options -b and -p. You either write to a partition (with -p and -i), or to a partitioning scheme (e.g. MBR, GPT, with -b).


----------



## mutterhunt (Aug 9, 2020)

aehhh... not insmod here but 'kldload XYZ.ko', sorry. both ways, embedded (with the -b flag) and to the slice 1 (with the i flag) doesn't work at all --- "Operation not permitted" --- but the main chainloader-problem remains: GRUB can identify the freebsd-ufs partition but not the freebsd-boot formated one with the 512k.

got it for a while: This is the GRUB2-bootloader-config that works for me now:


```
menuentry "FreeBSD current" --class os --class freebsd --class bsd
insmod ufs2
insmod bsd
set root=(hd0,gpt2)    
kfreebsd /boot/loader
set kfreeBSD.vfs.root.mountfrom=/dev/ada0p1
```

It finds the root partition now automatically again.

There are several loaders in the boot directory - does someone know with which one is it to fix the grafic resolution issue  via the 'mode 3' command (none of the offers like _lua; _simp, .rc or .4th worked). Or is this just possible with the UEFI method?....
I think MBR with GPT is outta for a decade - but I just a got a EFIless system. vidcontrol is depreciated AFAIK; is the higher resolution (1366x766) to be done with vc?

Furthermore I'm in a hospital with public WLAN and I gotta find some fixes for logging in to the welcome page therefore (incl. java scripts ASO). I guess with 'links' I won't get a 'ping www.whatever.com' just a 'ping 8.8.8.8' on a very native level without DM.

Then I'm gonna build llvm-devel with the latest clang for fixing the grafical issues with the linux driver linux i915, gotta pray as usual for making it work. Should this be a seperate issue as we're going from 100s to 1000s here?

In the meantime beastie knocks bill with his/her/its fork in his wrong understood crypto ass.


thx for the meantime.
Miranda


----------

