Re: Lenovo BIOS boot fix

2015-07-14 Thread Joseph Mingrone
Warren Block wbl...@wonkity.com writes:
 Please, whoever has one of these systems, find a contact address for
 Lenovo.  It should be on every one of these messages, and we should be
 encouraging every affected user to contact Lenovo support.  I can post
 it in the forums, also.

gethuman.com lists customerfeedb...@lenovo.com as a contact email.

http://www.headquartersinfo.com/lenovo-headquarters-information/

One this page is a list of the Lenovo Headquarters Executive Team.
Most of them have Twitter accounts.  Some public tweets to them might
have a strong impact.

If you're providing feedback and you don't agree with Lenovo's practice
of preventing you from installing your own wireless card, please mention
that as well.  There is also a petition:
https://www.change.org/p/lenovo-release-an-unencumbered-version-of-the-bios.

Joseph


signature.asc
Description: PGP signature


Re: Lenovo BIOS boot fix

2015-07-13 Thread Tomoaki AOKI
Confirmed. Boots OK as expected for my ThinkPad T420 (has buggy BIOS).

On Sun, 12 Jul 2015 12:54:09 -0400
Allan Jude allanj...@freebsd.org wrote:

 On 2015-07-12 09:24, Tomoaki AOKI wrote:
 
  As far as I could confirm currently,
 
 *My ThinkPad didn't boot from decompressed .xz image written in
  memstick.
 
 *The partition tables (both PMBR and GPT) looks fine.
  (As expected. Verified with `gpart show` and `fdisk -p -v da0`)
 
 *Overwriting bootcode (gptzfsboot) in GPT partition 1 didn't help.
 
 
  Not yet confirmed, but possible cause would be
 
 *Bootcode in PMBR is missing or corrupt.
   (I noticed I hadn't tested overwriting it.)
 
 */boot in ZFS partition or anything related is not proper.
 
 
  Sorry, I cannot reboot my ThinkPad right now.
  Allan, can you confirm above?
 
 
 You are correct, the PMBR bootcode was missing, my mistake.
 
 I have uploaded new images (and set the old ones to redirect to the new 
 ones)
 
 compressed (193 MiB):
 http://www.allanjude.com/bsd/lenovofix_20150712-r285132.img.xz
 
 uncompressed (1 GiB):
 http://www.allanjude.com/bsd/lenovofix_20150712-r285132.img
 
 
 
 -- 
 Allan Jude
 ___
 freebsd-current@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-current
 To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org
 


-- 
青木 知明  [Tomoaki AOKI]
junch...@dec.sakura.ne.jp
mxe02...@nifty.com
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Lenovo BIOS boot fix

2015-07-13 Thread Allan Jude
On 2015-07-13 03:58, Hans Ottevanger wrote:
 On 07/12/15 20:07, Allan Jude wrote:
 On 2015-07-12 11:10, Andrey V. Elsukov wrote:
 On 12.07.2015 09:02, Allan Jude wrote:
 I forgot to include the link to the patch as well:

 http://www.allanjude.com/bsd/lenovofix_gpart.patch

 I will most likely make this patch optional, behind a flag to the
 'gpart
 create -s gpt' command, to avoid potentially breaking existing working
 systems, but if using offset 1 works on all other hardware, having
 it as
 the default would be nice.

 Another option would be to make a separate standalone program to modify
 the pMBR for Lenovo machines, rather than modifying gpart.

 Hi,

 I think Lenovo's BIOS just think that your partition layout is MBR and
 uses legacy boot.

 if (MBR_partition[0].type == 0xee  gpt_is_ok()) {
  UEFI_boot();
 } else {
  MBR_boot();
 }


 I am not sure what they actually do, but, by making it the
 MBR_partition[1].type that is 0xee, FreeBSD is still perfectly happy,
 and the Lenovo boots.

 Other non-lenovo machines I tested on also worked.

 Tested Platforms (in BIOS/non-UEFI mode):

 Lenovo X220
 Lenovo X230 (doesn't have the bug, boots fine with MBR[0].type = 0xee)
 Lenovo T530 (also doesn't have the bug)
 Asus Core2Duo
 Asus i7 Nehalem desktop
 Asus i5 Sandy bridge desktop
 Gigabyte i5 Ivy bridge desktop
 Intel Ivy bridge NUC
 Intel Haswell NUC
 Supermicro i7 Haswell workstation


 
 Hi Allan,
 
 I did some experiments with the newest memstick image you provided
 (lenovofix_20150712-r285132.img).
 
 On an oldish Q6600 based system using an INTEL DP965LT main-board (it
 only has BIOS mode) I first pulled the SATA connectors before trying to
 boot from the USB stick. It shows the same problem as always with a
 fresh install of FreeBSD 10.x:
 
 No bootable device -- insert boot disk and press any key
 
 This can be fixed by first modifying the image on the USB stick using
 
 gpart recover da0
 
 (the stick is 8Gbyte and the image as copied on it is 1Gbyte, so the GPT
 seems corrupt), followed by the usual
 
 gpart set -a active da0
 
 I think this issue manifests itself on a generation of older Intel and
 Foxconn main-boards and possibly differs from the problem that you try
 to solve with Lenovo hardware.
 
 I also tried the unmodified image on an even older T7200 based system
 having an Asus NL4VM-DH main-board and there it just dumps the registers
 (followed by BTX Halted) very early in the boot process. This has
 happened before on several occasions with FreeBSD 10.x. The board is
 probably too rare to worry about too much, though it still runs OpenBSD
 5.7 perfectly.
 
 
 Kind regards,
 
 Hans Ottevanger
 
 Eindhoven, Netherlands
 www.beastielabs.net
 
 
 
 
 

Needing the active flag set is indeed a different problem. I am working
on a patch for bsdinstall that will allow the user to request the active
bit be set as well.

-- 
Allan Jude



signature.asc
Description: OpenPGP digital signature


Re: Lenovo BIOS boot fix

2015-07-13 Thread Warren Block

On Mon, 13 Jul 2015, Adrian Chadd wrote:


But the problem here is that we're using GPT but /not/ UEFI, right?
That's why that's all a mess?


If you have a GPT layout, but it boots on a BIOS machine, the missing 
active flag on a standards-correct PMBR partition usually does not keep 
it from booting.  Usually.


The Lenovo thing is just a bug, firmware that sees GPT and automatically 
assumes that a GPT disk has all the UEFI features (extra partitions and 
security and cryptography and all that).


That is wrong.  Lenovo can fix it, and there should be villagers with 
pitchforks at their gates politely requesting that they fix it for these 
still-broken models like they have for other models.

___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Lenovo BIOS boot fix

2015-07-13 Thread Warren Block

On Mon, 13 Jul 2015, Allan Jude wrote:


On 2015-07-13 11:19, Warren Block wrote:


Needing the active flag set is indeed a different problem. I am working
on a patch for bsdinstall that will allow the user to request the active
bit be set as well.


For GPT, that should be the default, because it matches the standard.

I would like to see an effort to get Lenovo to fix their broken
UEFI/BIOS.  Adding non-standard PMBR configurations should be short-term
hack.


Lenovo has fixed the issue in newer models, x230, t530, t540 etc work fine.

Just the x220, t420, and t520 etc series do not.


The latest BIOS update for the x220 was less than two months ago, so it 
is still supported.  That they've fixed the problem in other models 
shows they understand the issue.  So owners of those models should be 
bugging Lenovo, so to speak.


Long-term, it seems like they as a company would be concerned that 
special bug fixes naming their specific models are needed.


Short-term, we probably can't avoid this.  It would be nice to be able 
to remove a Lenovo-specific hack from gpart in the future with a commit 
that says Fixed by Lenovo BIOS update #123, no longer needed.

___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Lenovo BIOS boot fix

2015-07-13 Thread Allan Jude

On 2015-07-13 14:08, Warren Block wrote:

On Mon, 13 Jul 2015, Allan Jude wrote:


On 2015-07-13 11:19, Warren Block wrote:


Needing the active flag set is indeed a different problem. I am working
on a patch for bsdinstall that will allow the user to request the
active
bit be set as well.


For GPT, that should be the default, because it matches the standard.

I would like to see an effort to get Lenovo to fix their broken
UEFI/BIOS.  Adding non-standard PMBR configurations should be short-term
hack.


Lenovo has fixed the issue in newer models, x230, t530, t540 etc work
fine.

Just the x220, t420, and t520 etc series do not.


The latest BIOS update for the x220 was less than two months ago, so it
is still supported.  That they've fixed the problem in other models
shows they understand the issue.  So owners of those models should be
bugging Lenovo, so to speak.

Long-term, it seems like they as a company would be concerned that
special bug fixes naming their specific models are needed.

Short-term, we probably can't avoid this.  It would be nice to be able
to remove a Lenovo-specific hack from gpart in the future with a commit
that says Fixed by Lenovo BIOS update #123, no longer needed.


I tried the latest bios update for the X220, from 2015-05-27

It does not resolve the issue.

Also, it required some hoop jumping, as they only provide a bootable cd 
(x220s do not have CD drives) and a windows program.


However, if others are interested, this handy perl script: 
http://userpages.uni-koblenz.de/~krienke/ftp/noarch/geteltorito/


can be used to extract the el torito image from that .iso to a file, 
that can then be dd'd to a USB stick and update the bios.


--
Allan Jude
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Lenovo BIOS boot fix

2015-07-13 Thread Warren Block


Needing the active flag set is indeed a different problem. I am working
on a patch for bsdinstall that will allow the user to request the active
bit be set as well.


For GPT, that should be the default, because it matches the standard.

I would like to see an effort to get Lenovo to fix their broken 
UEFI/BIOS.  Adding non-standard PMBR configurations should be short-term 
hack.

___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Lenovo BIOS boot fix

2015-07-13 Thread Adrian Chadd
I'm really confused. Why is the active flag not set again?

I thought that was the whole point of the active flag in the partition table.


-a


On 13 July 2015 at 08:54, Allan Jude allanj...@freebsd.org wrote:
 On 2015-07-13 11:19, Warren Block wrote:


 Needing the active flag set is indeed a different problem. I am working
 on a patch for bsdinstall that will allow the user to request the active
 bit be set as well.


 For GPT, that should be the default, because it matches the standard.

 I would like to see an effort to get Lenovo to fix their broken
 UEFI/BIOS.  Adding non-standard PMBR configurations should be short-term
 hack.


 Lenovo has fixed the issue in newer models, x230, t530, t540 etc work fine.

 Just the x220, t420, and t520 etc series do not.

 --
 Allan Jude

 ___
 freebsd-current@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-current
 To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Lenovo BIOS boot fix

2015-07-13 Thread Allan Jude

On 2015-07-13 13:19, Adrian Chadd wrote:

I'm really confused. Why is the active flag not set again?

I thought that was the whole point of the active flag in the partition table.


-a



Not that it counts much, but windows does not set the active flag in its 
pMBR.


I was under the impression the standard says that it should not be set, 
as anything actually examining the pMBR as if it were an MBR, obviously 
doesn't support GPT.


I've heard reports that GPT partitions with the active flag set, will 
not boot properly under UEFI.


At this point, I am not sure whether it should be set or not.

This fix is for the Lenovo's with the broken BIOS. It moves the 0xee 
partition in the pMBR to the 2nd slot instead of the first. This does 
not seem to break any previously working hardware, and it makes the 
Lenovo's work.


I have a patch: https://reviews.freebsd.org/D3065
that adds an option to gpart create to a pMBR with this fix applied.

If this gets committed, I can add 'GPT + Lenovo Fix' as an option during 
the installer. I already plan to add 'GPT + Active' for people like 
Colin Percival, who have a Dell or HP that seems to complain if the 
active flag is missing.


Windows avoids these issues by entirely refusing to boot from a GPT 
partitioned disk without UEFI, even though there is no such requirement.



--
Allan Jude
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Lenovo BIOS boot fix

2015-07-13 Thread Warren Block

On Mon, 13 Jul 2015, Allan Jude wrote:


On 2015-07-13 14:08, Warren Block wrote:

On Mon, 13 Jul 2015, Allan Jude wrote:


On 2015-07-13 11:19, Warren Block wrote:


Needing the active flag set is indeed a different problem. I am working
on a patch for bsdinstall that will allow the user to request the
active
bit be set as well.


For GPT, that should be the default, because it matches the standard.

I would like to see an effort to get Lenovo to fix their broken
UEFI/BIOS.  Adding non-standard PMBR configurations should be short-term
hack.


Lenovo has fixed the issue in newer models, x230, t530, t540 etc work
fine.

Just the x220, t420, and t520 etc series do not.


The latest BIOS update for the x220 was less than two months ago, so it
is still supported.  That they've fixed the problem in other models
shows they understand the issue.  So owners of those models should be
bugging Lenovo, so to speak.

Long-term, it seems like they as a company would be concerned that
special bug fixes naming their specific models are needed.

Short-term, we probably can't avoid this.  It would be nice to be able
to remove a Lenovo-specific hack from gpart in the future with a commit
that says Fixed by Lenovo BIOS update #123, no longer needed.


I tried the latest bios update for the X220, from 2015-05-27

It does not resolve the issue.

Also, it required some hoop jumping, as they only provide a bootable cd 
(x220s do not have CD drives) and a windows program.


However, if others are interested, this handy perl script: 
http://userpages.uni-koblenz.de/~krienke/ftp/noarch/geteltorito/


can be used to extract the el torito image from that .iso to a file, that can 
then be dd'd to a USB stick and update the bios.


Sorry, I did not mean to imply that the latest X220 BIOS fixed the 
problem, just that they were continuing to release BIOS updates for it 
and could not disown responsibility by saying the system was no longer 
supported.

___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Lenovo BIOS boot fix

2015-07-13 Thread Allan Jude

On 2015-07-13 15:45, Warren Block wrote:

On Mon, 13 Jul 2015, Allan Jude wrote:


On 2015-07-13 14:08, Warren Block wrote:

On Mon, 13 Jul 2015, Allan Jude wrote:


On 2015-07-13 11:19, Warren Block wrote:


Needing the active flag set is indeed a different problem. I am
working
on a patch for bsdinstall that will allow the user to request the
active
bit be set as well.


For GPT, that should be the default, because it matches the standard.

I would like to see an effort to get Lenovo to fix their broken
UEFI/BIOS.  Adding non-standard PMBR configurations should be
short-term
hack.


Lenovo has fixed the issue in newer models, x230, t530, t540 etc work
fine.

Just the x220, t420, and t520 etc series do not.


The latest BIOS update for the x220 was less than two months ago, so it
is still supported.  That they've fixed the problem in other models
shows they understand the issue.  So owners of those models should be
bugging Lenovo, so to speak.

Long-term, it seems like they as a company would be concerned that
special bug fixes naming their specific models are needed.

Short-term, we probably can't avoid this.  It would be nice to be able
to remove a Lenovo-specific hack from gpart in the future with a commit
that says Fixed by Lenovo BIOS update #123, no longer needed.


I tried the latest bios update for the X220, from 2015-05-27

It does not resolve the issue.

Also, it required some hoop jumping, as they only provide a bootable
cd (x220s do not have CD drives) and a windows program.

However, if others are interested, this handy perl script:
http://userpages.uni-koblenz.de/~krienke/ftp/noarch/geteltorito/

can be used to extract the el torito image from that .iso to a file,
that can then be dd'd to a USB stick and update the bios.


Sorry, I did not mean to imply that the latest X220 BIOS fixed the
problem, just that they were continuing to release BIOS updates for it
and could not disown responsibility by saying the system was no longer
supported.


Right. I was not aware they were still publishing BIOSs, so I was 
hopeful it was fixed, and was disappointed after jumping through the 
hoops to get the update without installing windows on my machine, or 
somehow connecting a CD drive to it.


Anyway, yes, hopefully Lenovo will fix this someday.

--
Allan Jude
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Lenovo BIOS boot fix

2015-07-13 Thread Kevin Oberman
On Mon, Jul 13, 2015 at 12:52 PM, Allan Jude allanj...@freebsd.org wrote:

 On 2015-07-13 15:45, Warren Block wrote:

 On Mon, 13 Jul 2015, Allan Jude wrote:

  On 2015-07-13 14:08, Warren Block wrote:

 On Mon, 13 Jul 2015, Allan Jude wrote:

  On 2015-07-13 11:19, Warren Block wrote:


 Needing the active flag set is indeed a different problem. I am
 working
 on a patch for bsdinstall that will allow the user to request the
 active
 bit be set as well.


 For GPT, that should be the default, because it matches the standard.

 I would like to see an effort to get Lenovo to fix their broken
 UEFI/BIOS.  Adding non-standard PMBR configurations should be
 short-term
 hack.


 Lenovo has fixed the issue in newer models, x230, t530, t540 etc work
 fine.

 Just the x220, t420, and t520 etc series do not.


 The latest BIOS update for the x220 was less than two months ago, so it
 is still supported.  That they've fixed the problem in other models
 shows they understand the issue.  So owners of those models should be
 bugging Lenovo, so to speak.

 Long-term, it seems like they as a company would be concerned that
 special bug fixes naming their specific models are needed.

 Short-term, we probably can't avoid this.  It would be nice to be able
 to remove a Lenovo-specific hack from gpart in the future with a commit
 that says Fixed by Lenovo BIOS update #123, no longer needed.


 I tried the latest bios update for the X220, from 2015-05-27

 It does not resolve the issue.

 Also, it required some hoop jumping, as they only provide a bootable
 cd (x220s do not have CD drives) and a windows program.

 However, if others are interested, this handy perl script:
 http://userpages.uni-koblenz.de/~krienke/ftp/noarch/geteltorito/

 can be used to extract the el torito image from that .iso to a file,
 that can then be dd'd to a USB stick and update the bios.


 Sorry, I did not mean to imply that the latest X220 BIOS fixed the
 problem, just that they were continuing to release BIOS updates for it
 and could not disown responsibility by saying the system was no longer
 supported.


 Right. I was not aware they were still publishing BIOSs, so I was hopeful
 it was fixed, and was disappointed after jumping through the hoops to get
 the update without installing windows on my machine, or somehow connecting
 a CD drive to it.

 Anyway, yes, hopefully Lenovo will fix this someday.

 --
 Allan Jude


This is possibly orthogonal and possibly not of use on X2nn systems, but I
boot my T520 with a GPT formatted disk as the secondary drive by having the
MBR disk0 configured with booteasy and telling it to boot disk1. While this
is of no use on single spindle systems like the X220, I have been told that
a MBR USB drive can be used to do the same thing. I have not tried this and
can't confirm, though. Clearly a kludge work-around, but better than
nothing and works well for me as I have always left Windows on the main
drive and put FreeBSD on the removable one.
--
Kevin Oberman, Network Engineer, Retired
E-mail: rkober...@gmail.com
PGP Fingerprint: D03FB98AFA78E3B78C1694B318AB39EF1B055683
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Lenovo BIOS boot fix

2015-07-13 Thread Allan Jude

On 2015-07-13 11:19, Warren Block wrote:


Needing the active flag set is indeed a different problem. I am working
on a patch for bsdinstall that will allow the user to request the active
bit be set as well.


For GPT, that should be the default, because it matches the standard.

I would like to see an effort to get Lenovo to fix their broken
UEFI/BIOS.  Adding non-standard PMBR configurations should be short-term
hack.


Lenovo has fixed the issue in newer models, x230, t530, t540 etc work fine.

Just the x220, t420, and t520 etc series do not.

--
Allan Jude
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Lenovo BIOS boot fix

2015-07-13 Thread Warren Block

On Mon, 13 Jul 2015, Kevin Oberman wrote:


This is possibly orthogonal and possibly not of use on X2nn systems, but I boot 
my T520 with a GPT formatted disk as the secondary drive by having the MBR 
disk0 configured with booteasy
and telling it to boot disk1. While this is of no use on single spindle systems 
like the X220, I have been told that a MBR USB drive can be used to do the same 
thing. I have not tried
this and can't confirm, though. Clearly a kludge work-around, but better than 
nothing and works well for me as I have always left Windows on the main drive 
and put FreeBSD on the
removable one.


Please, whoever has one of these systems, find a contact address for 
Lenovo.  It should be on every one of these messages, and we should be 
encouraging every affected user to contact Lenovo support.  I can post 
it in the forums, also.

___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Lenovo BIOS boot fix

2015-07-13 Thread Adrian Chadd
Hi,

But the problem here is that we're using GPT but /not/ UEFI, right?
That's why that's all a mess?



-adrian
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Lenovo BIOS boot fix

2015-07-13 Thread Warren Block

On Mon, 13 Jul 2015, Adrian Chadd wrote:


I'm really confused. Why is the active flag not set again?

I thought that was the whole point of the active flag in the partition table.


At one point, smart people explained this to me.  My fault if I do not 
remember it correctly (not that it will stop me from attempting an 
explanation):


MBR partitions have active flags.  The BIOS is supposed to boot from the 
one that is set active.  It is not required that one be set active, 
though.  Most BIOS systems will still boot without any MBR partitions 
set active, presumably from the first partition.


The PMBR on a GPT disk is a simulation of an MBR.  However, according to 
the GPT standard, that simulated first MBR partition in the PMBR must 
not be set active.  A strict UEFI implementation will *not* boot if 
there is an active flag set for a PMBR partition.


Earlier versions of the FreeBSD PMBR had the PMBR partition set active, 
which was wrong.  The current version is correct.


I'm fairly sure we've seen people with both problems on the mailing 
lists and in the forums: BIOS systems that would not boot without an MBR 
partition set active, and UEFI systems that would not boot when a PMBR 
partition was set active.  They are rare, but it goes to prove you can't 
win.


(To fix old, incorrect FreeBSD PMBR versions, gpart can be used to set 
the active property on the GPT disk itself, which clears an active 
flag set on a PMBR partition.  So the problem should already be fixed, 
but this is the set active we are talking about.)

___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Lenovo BIOS boot fix

2015-07-13 Thread Hans Ottevanger

On 07/12/15 20:07, Allan Jude wrote:

On 2015-07-12 11:10, Andrey V. Elsukov wrote:

On 12.07.2015 09:02, Allan Jude wrote:

I forgot to include the link to the patch as well:

http://www.allanjude.com/bsd/lenovofix_gpart.patch

I will most likely make this patch optional, behind a flag to the 'gpart
create -s gpt' command, to avoid potentially breaking existing working
systems, but if using offset 1 works on all other hardware, having it as
the default would be nice.

Another option would be to make a separate standalone program to modify
the pMBR for Lenovo machines, rather than modifying gpart.


Hi,

I think Lenovo's BIOS just think that your partition layout is MBR and
uses legacy boot.

if (MBR_partition[0].type == 0xee  gpt_is_ok()) {
 UEFI_boot();
} else {
 MBR_boot();
}



I am not sure what they actually do, but, by making it the
MBR_partition[1].type that is 0xee, FreeBSD is still perfectly happy,
and the Lenovo boots.

Other non-lenovo machines I tested on also worked.

Tested Platforms (in BIOS/non-UEFI mode):

Lenovo X220
Lenovo X230 (doesn't have the bug, boots fine with MBR[0].type = 0xee)
Lenovo T530 (also doesn't have the bug)
Asus Core2Duo
Asus i7 Nehalem desktop
Asus i5 Sandy bridge desktop
Gigabyte i5 Ivy bridge desktop
Intel Ivy bridge NUC
Intel Haswell NUC
Supermicro i7 Haswell workstation




Hi Allan,

I did some experiments with the newest memstick image you provided 
(lenovofix_20150712-r285132.img).


On an oldish Q6600 based system using an INTEL DP965LT main-board (it 
only has BIOS mode) I first pulled the SATA connectors before trying to 
boot from the USB stick. It shows the same problem as always with a 
fresh install of FreeBSD 10.x:


No bootable device -- insert boot disk and press any key

This can be fixed by first modifying the image on the USB stick using

gpart recover da0

(the stick is 8Gbyte and the image as copied on it is 1Gbyte, so the GPT 
seems corrupt), followed by the usual


gpart set -a active da0

I think this issue manifests itself on a generation of older Intel and 
Foxconn main-boards and possibly differs from the problem that you try 
to solve with Lenovo hardware.


I also tried the unmodified image on an even older T7200 based system 
having an Asus NL4VM-DH main-board and there it just dumps the registers 
(followed by BTX Halted) very early in the boot process. This has 
happened before on several occasions with FreeBSD 10.x. The board is 
probably too rare to worry about too much, though it still runs OpenBSD 
5.7 perfectly.



Kind regards,

Hans Ottevanger

Eindhoven, Netherlands
www.beastielabs.net





___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Lenovo BIOS boot fix

2015-07-12 Thread Allan Jude
On 2015-07-12 01:49, Allan Jude wrote:
 I have spent my weekend researching why my Lenovo X220s refuse to boot
 from GPT partitioned disks.
 
 Based on this mailing list post:
 https://lists.freebsd.org/pipermail/freebsd-i386/2013-March/010437.html
 
 I have written a patch for gpart to change the way the PMBR is created.
 
 Instead of writing the 0xee partition in the first slot (offset 0), it
 writes it to the 2nd slot (offset 1).
 
 This resolves the issue on my Lenovo X220s, and the installed image
 boots fine on my T530, and various other non-lenovo amd64 machines at my
 house.
 
 If others could please test this image (it is a pre-installed system, so
 just dd it to a memory stick, and see if it boots. Can be safely done
 without touching your disks), that would be most helpful.
 
 compressed (193 MiB):
 http://www.allanjude.com/bsd/lenovofix_20150704-r285132.img.xz
 
 uncompressed (1 GiB):
 http://www.allanjude.com/bsd/lenovofix_20150704-r285132.img
 
 

I forgot to include the link to the patch as well:

http://www.allanjude.com/bsd/lenovofix_gpart.patch

I will most likely make this patch optional, behind a flag to the 'gpart
create -s gpt' command, to avoid potentially breaking existing working
systems, but if using offset 1 works on all other hardware, having it as
the default would be nice.

Another option would be to make a separate standalone program to modify
the pMBR for Lenovo machines, rather than modifying gpart.

Thoughts?

-- 
Allan Jude



signature.asc
Description: OpenPGP digital signature


Re: Lenovo BIOS boot fix

2015-07-12 Thread Tomoaki AOKI
Hi.

As far as I could confirm currently,

  *My ThinkPad didn't boot from decompressed .xz image written in
   memstick.

  *The partition tables (both PMBR and GPT) looks fine.
   (As expected. Verified with `gpart show` and `fdisk -p -v da0`)

  *Overwriting bootcode (gptzfsboot) in GPT partition 1 didn't help.


Not yet confirmed, but possible cause would be

  *Bootcode in PMBR is missing or corrupt.
(I noticed I hadn't tested overwriting it.)

  */boot in ZFS partition or anything related is not proper.


Sorry, I cannot reboot my ThinkPad right now.
Allan, can you confirm above?


On Sun, 12 Jul 2015 11:34:14 +0200
Kurt Jaeger li...@opsec.eu wrote:

 Hi!
 
  I have spent my weekend researching why my Lenovo X220s refuse to boot
  from GPT partitioned disks.
  
  Based on this mailing list post:
  https://lists.freebsd.org/pipermail/freebsd-i386/2013-March/010437.html
  
  I have written a patch for gpart to change the way the PMBR is created.
  
  Instead of writing the 0xee partition in the first slot (offset 0), it
  writes it to the 2nd slot (offset 1).
  
  This resolves the issue on my Lenovo X220s, and the installed image
  boots fine on my T530, and various other non-lenovo amd64 machines at my
  house.
  
  If others could please test this image (it is a pre-installed system, so
  just dd it to a memory stick, and see if it boots. Can be safely done
  without touching your disks), that would be most helpful.
 
 I used the image, put it on a stick, and set the BIOS to boot uefi-only
 or gpt-only and it never booted ? It's early sunday morning, it was
 a long week, so maybe I just missed something I'm supposed to do ?
 
 BIOS is 1.39.
 
 -- 
 p...@opsec.eu+49 171 3101372 5 years to 
 go !
 ___
 freebsd-current@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-current
 To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org
 


-- 
Tomoaki AOKIjunch...@dec.sakura.ne.jp
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Lenovo BIOS boot fix

2015-07-12 Thread Kurt Jaeger
Hi!

 I have spent my weekend researching why my Lenovo X220s refuse to boot
 from GPT partitioned disks.
 
 Based on this mailing list post:
 https://lists.freebsd.org/pipermail/freebsd-i386/2013-March/010437.html
 
 I have written a patch for gpart to change the way the PMBR is created.
 
 Instead of writing the 0xee partition in the first slot (offset 0), it
 writes it to the 2nd slot (offset 1).
 
 This resolves the issue on my Lenovo X220s, and the installed image
 boots fine on my T530, and various other non-lenovo amd64 machines at my
 house.
 
 If others could please test this image (it is a pre-installed system, so
 just dd it to a memory stick, and see if it boots. Can be safely done
 without touching your disks), that would be most helpful.

I used the image, put it on a stick, and set the BIOS to boot uefi-only
or gpt-only and it never booted ? It's early sunday morning, it was
a long week, so maybe I just missed something I'm supposed to do ?

BIOS is 1.39.

-- 
p...@opsec.eu+49 171 3101372 5 years to go !
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Lenovo BIOS boot fix

2015-07-12 Thread Tomoaki AOKI
Hi. I'd have to chime in. ;-)

There are at least 4 ways of workarounds, including yours (1).

  1: Offset GPT entry in PMBR. (First posted by Chris Torek.)
  2: Mimic ESP [use 0xEF instead of 0xEE] (Need patch for loader.)
  3: Use UEFI loader. (Currently clean root-on-ZFS is NOT supported)
  4: Use MBR instead of GPT. (No large disk support)

My first solution was 2, but the patched loader possibly misbehave if
separate ESP (EFI System Partition) exists. (Hybrid MBR case, not
tested.)

I've tested 3 only with memstick.img built with head. Not with actual
HDD installation. (ThinkPad T420)


The important thing is that some problematic computers other than
Lenovo's can require the way other than 1. And some won't need anything
above, but setting active flag with gpart.

So, as you already mentioned, these workarounds should be optional.
Ideally, prepare options for gpart, and menus for bsdinstall to choose
whichever.


Please see also my related page[1]. It includes loader patch for 2 (but
not separate files). Newer entry on top.

As I'm using solution 1 currently, the patch isn't tested for a long
time. I'm testing if it's applicable to stable/10 or not (no build
test), and now applicable with fuzz.

[1]http://www.dec.sakura.ne.jp/~junchoon/machine/freebsd-e.html


On Sun, 12 Jul 2015 02:02:51 -0400
Allan Jude allanj...@freebsd.org wrote:

 On 2015-07-12 01:49, Allan Jude wrote:
  I have spent my weekend researching why my Lenovo X220s refuse to boot
  from GPT partitioned disks.
  
  Based on this mailing list post:
  https://lists.freebsd.org/pipermail/freebsd-i386/2013-March/010437.html
  
  I have written a patch for gpart to change the way the PMBR is created.
  
  Instead of writing the 0xee partition in the first slot (offset 0), it
  writes it to the 2nd slot (offset 1).
  
  This resolves the issue on my Lenovo X220s, and the installed image
  boots fine on my T530, and various other non-lenovo amd64 machines at my
  house.
  
  If others could please test this image (it is a pre-installed system, so
  just dd it to a memory stick, and see if it boots. Can be safely done
  without touching your disks), that would be most helpful.
  
  compressed (193 MiB):
  http://www.allanjude.com/bsd/lenovofix_20150704-r285132.img.xz
  
  uncompressed (1 GiB):
  http://www.allanjude.com/bsd/lenovofix_20150704-r285132.img
  
  
 
 I forgot to include the link to the patch as well:
 
 http://www.allanjude.com/bsd/lenovofix_gpart.patch
 
 I will most likely make this patch optional, behind a flag to the 'gpart
 create -s gpt' command, to avoid potentially breaking existing working
 systems, but if using offset 1 works on all other hardware, having it as
 the default would be nice.
 
 Another option would be to make a separate standalone program to modify
 the pMBR for Lenovo machines, rather than modifying gpart.
 
 Thoughts?
 
 -- 
 Allan Jude
 


-- 
Tomoaki AOKIjunch...@dec.sakura.ne.jp
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Lenovo BIOS boot fix

2015-07-12 Thread Kurt Jaeger
Hi!

 What model machine is this?

It's a X220:
Intel(R) Core(TM) i5 CPU   M 520
2500 MHz
4096 MB RAM
Serial: R9-GGPAX YY/MM
Type: 42918F6

dmidecode says:

Vendor: LENOVO
Version: 8DET69WW (1.39 )

with more details available at

http://people.freebsd.org/~pi/udog/

 Can you try running:
 
 gpart set -a active da0

Done, no change. If it helps, I can provide ssh access to the box,
it's only a test laptop.

-- 
p...@opsec.eu+49 171 3101372 5 years to go !
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Lenovo BIOS boot fix

2015-07-12 Thread Allan Jude

On 2015-07-12 09:24, Tomoaki AOKI wrote:

Hi.

As far as I could confirm currently,

   *My ThinkPad didn't boot from decompressed .xz image written in
memstick.

   *The partition tables (both PMBR and GPT) looks fine.
(As expected. Verified with `gpart show` and `fdisk -p -v da0`)

   *Overwriting bootcode (gptzfsboot) in GPT partition 1 didn't help.


Not yet confirmed, but possible cause would be

   *Bootcode in PMBR is missing or corrupt.
 (I noticed I hadn't tested overwriting it.)

   */boot in ZFS partition or anything related is not proper.


Sorry, I cannot reboot my ThinkPad right now.
Allan, can you confirm above?



You are correct, the PMBR bootcode was missing, my mistake.

I have uploaded new images (and set the old ones to redirect to the new 
ones)


compressed (193 MiB):
http://www.allanjude.com/bsd/lenovofix_20150712-r285132.img.xz

uncompressed (1 GiB):
http://www.allanjude.com/bsd/lenovofix_20150712-r285132.img



--
Allan Jude
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Lenovo BIOS boot fix

2015-07-12 Thread Andrey V. Elsukov
On 12.07.2015 09:02, Allan Jude wrote:
 I forgot to include the link to the patch as well:
 
 http://www.allanjude.com/bsd/lenovofix_gpart.patch
 
 I will most likely make this patch optional, behind a flag to the 'gpart
 create -s gpt' command, to avoid potentially breaking existing working
 systems, but if using offset 1 works on all other hardware, having it as
 the default would be nice.
 
 Another option would be to make a separate standalone program to modify
 the pMBR for Lenovo machines, rather than modifying gpart.

Hi,

I think Lenovo's BIOS just think that your partition layout is MBR and
uses legacy boot.

if (MBR_partition[0].type == 0xee  gpt_is_ok()) {
   UEFI_boot();
} else {
   MBR_boot();
}

-- 
WBR, Andrey V. Elsukov



signature.asc
Description: OpenPGP digital signature


Re: Lenovo BIOS boot fix

2015-07-12 Thread Allan Jude
On 2015-07-12 13:52, Kurt Jaeger wrote:
 Hi!
 
 This was a mistake in my image, can you please try one of the new ones?

 compressed (193 MiB):
 http://www.allanjude.com/bsd/lenovofix_20150712-r285132.img.xz
 
 I did this:
 
 xzcat lenovofix_20150712-r285132.img.xz | dd of=/dev/da0 bs=1m
 
 gpart show
 = 34  2097085  diskid/DISK-60A44C3FABFEEDA159663FE7  GPT  (3.7G) 
 [CORRUPT]
 [...]
 
 gpart recover /dev/da0
 gpart show
 = 34  7679933  diskid/DISK-60A44C3FABFEEDA159663FE7  GPT  (3.7G)
 
 I rebooted, changed the BIOS to legacy-only and F12 to boot
 from the USB HDD.
 
 No change, it tries to boot and returns into the F12 boot selection menue.
 

What model machine is this?

Can you try running:

gpart set -a active da0

And try again?


-- 
Allan Jude



signature.asc
Description: OpenPGP digital signature


Re: Lenovo BIOS boot fix

2015-07-12 Thread Kurt Jaeger
Hi!

 This was a mistake in my image, can you please try one of the new ones?
 
 compressed (193 MiB):
 http://www.allanjude.com/bsd/lenovofix_20150712-r285132.img.xz

I did this:

xzcat lenovofix_20150712-r285132.img.xz | dd of=/dev/da0 bs=1m

gpart show
= 34  2097085  diskid/DISK-60A44C3FABFEEDA159663FE7  GPT  (3.7G) [CORRUPT]
[...]

gpart recover /dev/da0
gpart show
= 34  7679933  diskid/DISK-60A44C3FABFEEDA159663FE7  GPT  (3.7G)

I rebooted, changed the BIOS to legacy-only and F12 to boot
from the USB HDD.

No change, it tries to boot and returns into the F12 boot selection menue.

-- 
p...@opsec.eu+49 171 3101372 5 years to go !
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Lenovo BIOS boot fix

2015-07-12 Thread Allan Jude

On 2015-07-12 04:44, Tomoaki AOKI wrote:

Hi. I'd have to chime in. ;-)

There are at least 4 ways of workarounds, including yours (1).

   1: Offset GPT entry in PMBR. (First posted by Chris Torek.)
   2: Mimic ESP [use 0xEF instead of 0xEE] (Need patch for loader.)
   3: Use UEFI loader. (Currently clean root-on-ZFS is NOT supported)
   4: Use MBR instead of GPT. (No large disk support)



5. Some machines also require the 0xEE partition be set active

Separately, I have also used: 6. 'Use BSD partitioning instead of GPT'
This happens to be what the FreeBSD installer memsticks use, and why 
they never had problems booting on the Lenovos



My first solution was 2, but the patched loader possibly misbehave if
separate ESP (EFI System Partition) exists. (Hybrid MBR case, not
tested.)

I've tested 3 only with memstick.img built with head. Not with actual
HDD installation. (ThinkPad T420)


The important thing is that some problematic computers other than
Lenovo's can require the way other than 1. And some won't need anything
above, but setting active flag with gpart.


Yes, I will be adding this as an option to bsdinstall



So, as you already mentioned, these workarounds should be optional.
Ideally, prepare options for gpart, and menus for bsdinstall to choose
whichever.



Yes, my plan is to add an option during 'gpart create -s gpt' to apply 
the #1 fix.


In bsdinstall, there will be the following options:
GPT
MBR
GPT + Active (#5)
GPT + Lenovo Fix (#1)



Please see also my related page[1]. It includes loader patch for 2 (but
not separate files). Newer entry on top.

As I'm using solution 1 currently, the patch isn't tested for a long
time. I'm testing if it's applicable to stable/10 or not (no build
test), and now applicable with fuzz.

[1]http://www.dec.sakura.ne.jp/~junchoon/machine/freebsd-e.html




Thank you for sharing your research

--
Allan Jude
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: Lenovo BIOS boot fix

2015-07-12 Thread Allan Jude
On 2015-07-12 11:10, Andrey V. Elsukov wrote:
 On 12.07.2015 09:02, Allan Jude wrote:
 I forgot to include the link to the patch as well:

 http://www.allanjude.com/bsd/lenovofix_gpart.patch

 I will most likely make this patch optional, behind a flag to the 'gpart
 create -s gpt' command, to avoid potentially breaking existing working
 systems, but if using offset 1 works on all other hardware, having it as
 the default would be nice.

 Another option would be to make a separate standalone program to modify
 the pMBR for Lenovo machines, rather than modifying gpart.

 Hi,

 I think Lenovo's BIOS just think that your partition layout is MBR and
 uses legacy boot.

 if (MBR_partition[0].type == 0xee  gpt_is_ok()) {
 UEFI_boot();
 } else {
 MBR_boot();
 }


I am not sure what they actually do, but, by making it the
MBR_partition[1].type that is 0xee, FreeBSD is still perfectly happy,
and the Lenovo boots.

Other non-lenovo machines I tested on also worked.

Tested Platforms (in BIOS/non-UEFI mode):

Lenovo X220
Lenovo X230 (doesn't have the bug, boots fine with MBR[0].type = 0xee)
Lenovo T530 (also doesn't have the bug)
Asus Core2Duo
Asus i7 Nehalem desktop
Asus i5 Sandy bridge desktop
Gigabyte i5 Ivy bridge desktop
Intel Ivy bridge NUC
Intel Haswell NUC
Supermicro i7 Haswell workstation


-- 
Allan Jude

-- 
Allan Jude



signature.asc
Description: OpenPGP digital signature