ARM chroot issues: fatal error: rt_sigaction failure

Bug #1501651 reported by Victor Mayoral on 2015-10-01
46
This bug affects 6 people
Affects Status Importance Assigned to Milestone
golang (Ubuntu)
High
Michael Hudson-Doyle
Trusty
Undecided
Unassigned
Wily
Medium
Chris J Arges

Bug Description

SRU Justification:

[Impact]
Users of go programs compiled for arm and running on x86_64 will be unable to emulate their programs with qemu.

[Test Case]
1)
echo "package main

import "fmt"

func main() {
 fmt.Println("Hi")
}
">test.go

2) GOARCH=arm go build test.go
3) qemu-arm test

[Regression Potential]
This patch is upstream and in Xenial. The change affects golang runtime only.

-

Trying to create an ARM snap with snapcraft using an ARM chroot as advised:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
 LANGUAGE = "en_US",
 LC_ALL = (unset),
 LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Pulling integration
Building integration
cp --preserve=all -R icon.svg /snap_spider_tweet/parts/integration/install/icon.svg
Staging integration
Snapping integration
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
 LANGUAGE = "en_US",
 LC_ALL = (unset),
 LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
fatal error: rt_sigaction failure

runtime stack:
runtime.throw(0x57d6ed)
 /usr/lib/go/src/runtime/panic.go:491 +0xa4
runtime.setsig(0x40, 0x5704c, 0x594d01)
 /usr/lib/go/src/runtime/os_linux.c:302 +0xa8
runtime.initsig()
 /usr/lib/go/src/runtime/signal_unix.c:39 +0x88
mstart()
 /usr/lib/go/src/runtime/proc.c:856 +0x6c
runtime.mstart()
 /usr/lib/go/src/runtime/proc.c:836 +0x4c

goroutine 1 [runnable]:
runtime.main()
 /usr/lib/go/src/runtime/proc.go:16
runtime.goexit()
 /usr/lib/go/src/runtime/asm_arm.s:1322 +0x4

Reproduced it two different machines.

Reproducing it:
- qemu-debootstrap --arch=armhf vivid ~/vivid/
- set up the right sources.list
- apt-get install software-properties-common python-software-properties
- sudo add-apt-repository ppa:snappy-dev/tools
- sudo apt-get update
- sudo apt-get upgrade
- sudo apt-get install snappy-tools bzr
- snapcrafting any source will end up in a similar output

John Lenton (chipaca) wrote :

It's a long-standing qemu bug. See https://groups.google.com/forum/#!topic/golang-nuts/MqKTX_XIOKE for example.

Changed in snapcraft:
status: New → Invalid
Chris J Arges (arges) on 2015-10-21
Changed in qemu (Ubuntu):
assignee: nobody → Chris J Arges (arges)
Chris J Arges (arges) wrote :

Another test case:

1)
echo "package main

import "fmt"

func main() {
 fmt.Println("Hi")
}
">test.go

2) GOARCH=arm go build test.go
3) qemu-arm test

Chris J Arges (arges) wrote :

This also fails with upstream qemu.
Related golang bug: https://github.com/golang/go/issues/1508

Chris J Arges (arges) wrote :

Culprit in qemu code:
http://git.qemu.org/?p=qemu.git;a=blob;f=linux-user/signal.c;h=1141054be2170128d6f7a340b41484b49a255936;hb=HEAD#l82

Proposed fix (that was never merged):
https://codereview.appspot.com/124900043/diff/60001/src/pkg/runtime/os_linux.c

I was able to hack /usr/lib/go/src/runtime/os1_linux.go as follows:
< if rt_sigaction(uintptr(i), &sa, nil, unsafe.Sizeof(sa.sa_mask)) != 0 {
---
> if rt_sigaction(uintptr(i), &sa, nil, unsafe.Sizeof(sa.sa_mask)) != 0 && i != 64 {

After rebuilding the binary, this allowed the test case to pass.

Chris J Arges (arges) wrote :
XiaoGuo, Liu (liu-xiao-guo) wrote :

I also got the same problem. How to fix it?

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in qemu (Ubuntu):
status: New → Confirmed
XiaoGuo, Liu (liu-xiao-guo) wrote :

It affects python as well.

Serge Hallyn (serge-hallyn) wrote :

@arges,

did you want to push this patch into our package until it hits upstream?

Chris J Arges (arges) wrote :

@serge

Sure, it's a patch to golang runtime. I'll put this on my todo list this week.

I'll try to push the go fix upstream too, I think it's just wanting for attention.

That went quickly, the fix is upstream already. Would adding the patch to xenial be sufficient?

Chris J Arges (arges) wrote :

Per our discussion, Michael will handle the Xenial upload, and I can SRU where necessary.

Changed in qemu (Ubuntu):
status: Confirmed → Invalid
assignee: Chris J Arges (arges) → nobody
Changed in golang (Ubuntu):
assignee: nobody → Michael Hudson-Doyle (mwhudson)

Here's a diff adding the patch.

On Thu, Nov 12, 2015 at 5:35 PM, Chris J Arges <email address hidden>
wrote:

> Per our discussion, Michael will handle the Xenial upload, and I can SRU
> where necessary.
>

Is it possible to SRU to trusty and vivid?

It will require a slightly different patch as the affected code is in C in the version there. Isn't vivid EOL really soon though?

no longer affects: qemu (Ubuntu)
Changed in golang (Ubuntu):
importance: Undecided → High
affects: snapcraft → ubuntu
no longer affects: ubuntu
Martin Pitt (pitti) wrote :

Uploaded, thanks!

Changed in golang (Ubuntu):
status: New → Fix Committed
Martin Pitt (pitti) wrote :

Package fails to build on some architectures, can you please have a look? https://launchpad.net/ubuntu/+source/golang/2:1.5.1-0ubuntu3

Unsubscribing sponsors, please re-subscribe if/when you have a followup patch.

Changed in golang (Ubuntu):
status: Fix Committed → In Progress

Ah yeah, that's because of the new binutils in xenial. Here's another debdiff (build tested in a xenial sbuild, lintian is a bit unhappy but the package builds)

tags: added: vivid
Chris J Arges (arges) wrote :

Looks like this got uploaded already. Unsubscribing sponsors.

Oops I got confused about version numbers. Trying again.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package golang - 2:1.5.1-0ubuntu4

---------------
golang (2:1.5.1-0ubuntu4) xenial; urgency=medium

  * Add d/patches/support-new-relocations.patch to fix ftbfs on xenial.

 -- Michael Hudson-Doyle <email address hidden> Mon, 16 Nov 2015 09:43:57 +1300

Changed in golang (Ubuntu):
status: In Progress → Fix Released
Chris J Arges (arges) wrote :

Uploaded SRU for Wily.

Changed in golang (Ubuntu Trusty):
status: New → Invalid
Changed in golang (Ubuntu Wily):
assignee: nobody → Chris J Arges (arges)
status: New → In Progress
importance: Undecided → Medium
description: updated

Hello Victor, or anyone else affected,

Accepted golang into wily-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/golang/2:1.5.1-0ubuntu2.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in golang (Ubuntu Wily):
status: In Progress → Fix Committed
tags: added: verification-needed

I don't know if it saves time overall but I've just proposed that we upload 1.5.2 (which includes this fix and several others) to xenial https://bugs.launchpad.net/ubuntu/+source/golang/+bug/1524071 -- maybe it makes sense to SRU that instead?

Chris J Arges (arges) wrote :

Sure, if you can attach a debdiff, or upload into Wily such that it closes out this bug that would make sense to me.

Jamie Strandboge (jdstrand) wrote :

FYI, I ran into this trying to use snapcraft in an armhf schroot. AIUI, ubuntu-snappy will need to be rebuilt against golang 2:1.5.1-0ubuntu2.1 for snapcraft to be able to run 'snappy build' in the schroot.

Chris J Arges (arges) wrote :

Does it need rebuilding? I believe this patch is against the go-runtime so as long as the correct runtime version is installed this _should_ work. But I'll defer to @mwhudson.

It needs rebuilding.

Chris J Arges (arges) wrote :

Verified this fixes the original issue.

tags: added: verification-done
removed: verification-needed
Chris J Arges (arges) wrote :

If we need to fix snapcraft as well, please add a task for that here so it can get rebuilt.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package golang - 2:1.5.1-0ubuntu2.1

---------------
golang (2:1.5.1-0ubuntu2.1) wily; urgency=medium

  [ Michael Hudson-Doyle ]
  * Add d/patches/qemu-compat.patch (LP: #1501651)

 -- Chris J Arges <email address hidden> Tue, 24 Nov 2015 11:41:15 -0600

Changed in golang (Ubuntu Wily):
status: Fix Committed → Fix Released

The verification of the Stable Release Update for golang has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers