Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Problems with setting up kernel with buildkernel (SOLVED)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
M3L6H
n00b
n00b


Joined: 03 Apr 2016
Posts: 17

PostPosted: Mon Apr 04, 2016 4:15 pm    Post subject: Problems with setting up kernel with buildkernel (SOLVED) Reply with quote

I've been working on installing Gentoo on my system (following this guide: https://wiki.gentoo.org/wiki/Sakaki%27s_EFI_Install_Guide). I'm currently on this step: https://wiki.gentoo.org/wiki/Sakaki%27s_EFI_Install_Guide/Configuring_and_Building_the_Kernel#Option_2:_Editing_buildkernel.conf_Using_buildkernel_--easy-setup However, when I try to run 'buildkernel --easy-setup', it throws the following:

/usr/sbin/buildkernel: line 334: ISUSBPART: bad array subscript

* buildkernel: Error: Caught signal - exiting

The code throwing the error seems to be this:

partuuid_is_on_usb_device() {
local CANONPART="$(readlink --canonicalize "${PARTUUIDDEVDIR}/${1,,}")"
if [[ "${ISUSBPART[${CANONPART}]-0}" == "1" ]]; then
return 0
fi
return 1
}

I'm not quite sure what that's all about. Any help would be appreciated. Thanks!


Last edited by M3L6H on Tue Apr 05, 2016 3:37 pm; edited 1 time in total
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Mon Apr 04, 2016 6:59 pm    Post subject: Re: Problems with setting up kernel with buildkernel Reply with quote

M3L6H wrote:
I'm not quite sure what that's all about. Any help would be appreciated. Thanks!

M3L6H ... ok, I now see where 'buildkernel' comes from ... again, please follow the handbook.

best ... khay
Back to top
View user's profile Send private message
Chiitoo
Administrator
Administrator


Joined: 28 Feb 2010
Posts: 2571
Location: Here and Away Again

PostPosted: Mon Apr 04, 2016 7:05 pm    Post subject: Reply with quote

Moved from Installing Gentoo to Unsupported Software, as this seems to be about software that is not available via Portage at this time.
_________________
Kindest of regardses.
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3846
Location: Austro Bavaria

PostPosted: Mon Apr 04, 2016 9:14 pm    Post subject: Reply with quote

Where is the point in using a script from an overlay which you do not understand?

The gentoo handbook are the basics with researching the other parts to set up a box. I use gentoo for quite a while, i used linux for a much longer time, and i did needed to read about uefi and some special script commands to get my box running.

I also recommend, use the handbook please. Thank you.

@ mods, the guide refers to a script from an overlay
Back to top
View user's profile Send private message
Tony0945
Watchman
Watchman


Joined: 25 Jul 2006
Posts: 5127
Location: Illinois, USA

PostPosted: Tue Apr 05, 2016 12:10 am    Post subject: Reply with quote

tw04l124 wrote:
Where is the point in using a script from an overlay which you do not understand?


The wiki implies that Windows 8 & 10 require special handling to dual-boot. I've only dual booted with XP & below using the boot sector intended foe DOS/Win98.
Others boot grub and chainload Windows. I don't know if that works with UEFI. So be a little easier on him.

My sister has win 8. Ugh! And I wouldn't allow win 10 in the same HOUSE with my hardware. YMMV.
Back to top
View user's profile Send private message
M3L6H
n00b
n00b


Joined: 03 Apr 2016
Posts: 17

PostPosted: Tue Apr 05, 2016 12:27 am    Post subject: Reply with quote

Glad to see someone understands. :D Anyway, I’ve gotten in touch with the maker of the overlay, so we'll see what comes of that.
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 3664

PostPosted: Tue Apr 05, 2016 8:03 am    Post subject: Reply with quote

Tony0945 wrote:
The wiki implies that Windows 8 & 10 require special handling to dual-boot.

Could you please point us to the exact section where this is written? A windows 10 dual-boot with Gentoo is as easy as was with windows 7. At least with msdos partition table.
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Tue Apr 05, 2016 8:25 am    Post subject: Re: Problems with setting up kernel with buildkernel Reply with quote

Code:
if [[ "${ISUSBPART[${CANONPART}]-0}" == "1" ]]; then
is borked as the bracketing is fubared; one reason I do not favour excessive bracketing, is that it's harder to spot mistakes.
For an associative array, it should be:
Code:
if [[ ${ISUSBPART["${CANONPART:-0}"]} = 1 ]]; then

With just - and not :- the default selection would never happen, since the variable has been assigned a value (it may be empty, but it's been assigned.)

If that is a standard array (integer-based, not associative) it is unnecessary to supply a default value, since that is an arithmetic context:
Code:
if [[ ${ISUSBPART[CANONPART]} = 1 ]]; then

The whole function would be cleaner as:
Code:
partuuid_is_usb() {
   local p=$(readlink --canonicalize "${PARTUUIDDEVDIR}/${1,,}")
   [[ ${ISUSBPART[p]} = 1 ]]
}

or:
Code:
[[ ${ISUSBPART["${p:-0}"]} = 1 ]]
if that's an associative array (declare -A arr)
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Tue Apr 05, 2016 8:26 am    Post subject: Reply with quote

charles17 wrote:
Tony0945 wrote:
The wiki implies that Windows 8 & 10 require special handling to dual-boot.

Could you please point us to the exact section where this is written? A windows 10 dual-boot with Gentoo is as easy as was with windows 7. At least with msdos partition table.

charles17 ... that would be 'legacy' MBR booting, and while that is one option efi booting is another. I didn't read the wiki in any depth but if anyone were taking this route then I'd suggest they read Roderick Smith's managing secure boot rather than follow that guide. The information is available, and besides configuring secure boot, there is no reason *not* to follow the handbook.

best ... khay
Back to top
View user's profile Send private message
M3L6H
n00b
n00b


Joined: 03 Apr 2016
Posts: 17

PostPosted: Tue Apr 05, 2016 3:33 pm    Post subject: Reply with quote

Problem solved! Turns out (somehow this slipped my notice), my SSD was not GPT partitioned. So I had to modify the CRYPTPATHMAP parameter in the .conf file. I wasn't able to run buildkernel --easy-config this way, but I was able to run buildkernel --ask --verbose, and that worked out fine.
Back to top
View user's profile Send private message
Sakaki
Guru
Guru


Joined: 21 May 2014
Posts: 409

PostPosted: Tue Apr 05, 2016 5:17 pm    Post subject: Re: Problems with setting up kernel with buildkernel Reply with quote

steveL wrote:
Code:
if [[ "${ISUSBPART[${CANONPART}]-0}" == "1" ]]; then
is borked as the bracketing is fubared)

Actually it is as intended - the test is looking up a modified path in the ISUSBPART associative array and returning the value stored there (0 or 1) if previously seen, or a default value of 0 if not yet seen (unknown key); this returned value is then compared with 1 to decide what to do next. The default is needed because the script runs under set -u.

As M3L6H just noted, the underlying issue is that the buildkernel script is designed to work with GPT systems, not MBR. Nevertheless, it should fail gracefully in such a case (and notify the user to set CRYPTPATHMAP directly); I will add that to the next release.
_________________
Regards,

sakaki
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3846
Location: Austro Bavaria

PostPosted: Tue Apr 05, 2016 8:28 pm    Post subject: Reply with quote

afaik gpt is the way to go these days because of uefi / windows 10 constraints. i only remember from last september that i was forced to use gpt because of uefi or windows 10 or so... honestly forgot why
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Wed Apr 06, 2016 2:28 pm    Post subject: Re: Problems with setting up kernel with buildkernel Reply with quote

steveL wrote:
Code:
if [[ "${ISUSBPART[${CANONPART}]-0}" == "1" ]]; then
is borked as the bracketing is fubared)

Sakaki wrote:
Actually it is as intended

If it were "as intended" then you wouldn't get
Code:
/usr/sbin/buildkernel: line 334: ISUSBPART: bad array subscript

Quote:
the test is looking up a modified path in the ISUSBPART associative array and returning the value stored there (0 or 1) if previously seen, or a default value of 0 if not yet seen (unknown key); this returned value is then compared with 1 to decide what to do next. The default is needed because the script runs under set -u.

OK, I see what you're saying; your intention is to use 0 when there is no matching value, and it is indeed an associative array.

Firstly, bash (as other ksh-derivatives) does not field-split inside [[.
However it does use fnmatch(3p) on the RHS of the = operator, which is a simple strcmp() in sh, or iow glob-matching; so the RHS of that is usually quoted when it's a parameter-expansion, to force simple strcmp() in effect.

For the specific, you don't even need the default value for your comparison (I should have spotted that before); you just need to quote the expansion of the array-index, as indicated for an associative array (which can have any string as index):
Code:
[[ ${ISUSBPART["$p"]} = 1 ]]
You would not need to do this for an integer-based array, in the usual case, where indexing is equivalent to arithmetic context, so ${arr[i++]} works as expected.

The return value will be shell true (or 0) if the associative value is a 1, or false (1) if not, the same values you're returning currently.
(With no 'return' stmt the return value is the exit status of the last command run.)

You also would not need the default if you were using integer comparison, which is -eq in [[, but quicker with:
Code:
((${ISUSBPART["$p"]}))
as the last statement; an empty (or unset) value in arithmetic context is equivalent to 0.
I tend to use arithmetic context for that reason: it's quicker in bash.
Originally it was the ease of the C-style "uninitialised is 0" semantic, but greycat insists on initialisation. ;-) Still works for locals, though declare -i a b c works better.

#bash are your (sometimes grumpy;) friends.

HTH,
steveL
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum