How do I chroot / fakeroot or sbuild with the ubuntu image?

Benedikt Schemmer's Avatar

Benedikt Schemmer

31 May, 2018 04:12 PM

Hi there,

I would like to use the ubuntu image to build 32-bit versions of mesa (the graphic driver).

However no matter what I try, the actual chroot doesn't seem to work, as I always end up in the exact same setup as it was before.
I.e. when I try to install packages it uses the 64-bit versions, the same goes for the actual build process which also tries (and this case also fails) to use an 64-bit environment.

If I try this on my local machine there is absolutely no problem at all to get it working.
So is chroot disabled for some reason or are there additional steps I need to take in order to enable it?
(Using chroot or fakechroot directly fails with bash complaining that there is no interactive shell or invalid ioctl)

excerpt from the current version of the appveyor.yml I'm using:

sudo adduser $USER sbuild
Adding user `appveyor' to group `sbuild' ...
Adding user appveyor to group sbuild
sudo adduser root sbuild
Adding user `root' to group `sbuild' ...
Adding user root to group sbuild
sudo mkdir -p $HOME/ubuntu/scratch
sudo chmod ugo+w /etc/schroot/sbuild/fstab
sudo echo "/home/$USER/ubuntu/scratch /scratch none rw,bind 0 0" >> /etc/schroot/sbuild/fstab
sudo echo "\$maintainer_name='me';\n\$distribution = 'xenial';\n\$build_arch_all = 1;\n\$purge_build_directory = 'successful';\n\$purge_session = 'successful';\n\$purge_build_deps = 'successful';\n\$log_dir=\$ENV{HOME}.'/ubuntu/logs';\n1;" > ~/.sbuildrc
sudo mkdir -p $HOME/ubuntu/{build,logs}
sudo echo 'SCHROOT_CONF_SUFFIX="source-root-users=root,sbuild,admin\nsource-root-groups=root,sbuild,admin\npreserve-environment=true"' > ~/.mk-sbuild.rc
sudo sg sbuild
sudo mk-sbuild xenial --arch=i386
Done building xenial-i386.
 To CHANGE the golden image: sudo schroot -c source:xenial-i386 -u root
 To ENTER an image snapshot: schroot -c xenial-i386
 To BUILD within a snapshot: sbuild -A -d xenial-i386 PACKAGE*.dsc
 To BUILD for : sbuild -A -d xenial-i386 --host PACKAGE*.dsc

sudo schroot -c xenial-i386 -u root
W: Failed to change to directory ‘/home/appveyor/projects/mymesa’: No such file or directory
I: The directory does not exist inside the chroot. Use the --directory option to run the command in a different directory.
W: Falling back to directory ‘/root’

From here on it still uses the 64-bit versions.

  1. Support Staff 1 Posted by wasapl on 31 May, 2018 07:37 PM

    wasapl's Avatar


    As I can see you try to write several lines to .sbuildrc and .mk-sbuild.rc with one echo command. To make echo read \n as line feed you have to provide it -e option like this:
    echo -e "line1\nline2" >myfile
    If this does not fix your problem please show us your appveyor.yml. You can email it [email blocked] if you don't what to show it publicly.

    Am I understanding right that you trying to build the driver from

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

18 Aug, 2018 12:13 AM
17 Aug, 2018 09:45 PM
17 Aug, 2018 06:02 PM
17 Aug, 2018 04:26 PM
17 Aug, 2018 04:04 PM