1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005
|
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>pbuilder User's Manual</title><link rel="stylesheet" href="pbuilder-doc.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.71.0"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="book" lang="en"><div class="titlepage"><div><div><h1 class="title"><a name="id249585"></a>pbuilder User's Manual</h1></div><div><h2 class="subtitle">Usage and operations</h2></div><div><div class="authorgroup"><div class="author"><h3 class="author"><span class="firstname">Junichi</span> <span class="surname">Uekawa</span></h3></div></div></div><div><p class="releaseinfo">documentation in progress ($Id: pbuilder-doc.xml,v 1.78 2006/11/13 19:08:08 lool Exp $)</p></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="chapter"><a href="#id250274">1. Introducing pbuilder</a></span></dt><dd><dl><dt><span class="sect1"><a href="#aim">1. Aims of pbuilder</a></span></dt></dl></dd><dt><span class="chapter"><a href="#usingpbuilder">2. Using pbuilder</a></span></dt><dd><dl><dt><span class="sect1"><a href="#creatingbase">1. Creating a base chroot image</a></span></dt><dt><span class="sect1"><a href="#id249732">2. Updating the base chroot image</a></span></dt><dt><span class="sect1"><a href="#buildpackagechroot">3. Building a package using the chroot image</a></span></dt><dt><span class="sect1"><a href="#pdebuild">4. Facilitating Debian Developers' typing, pdebuild</a></span></dt><dt><span class="sect1"><a href="#configfile">5. Configuration Files</a></span></dt><dt><span class="sect1"><a href="#nonrootchroot">6. Building packages as non-root inside the chroot</a></span></dt><dt><span class="sect1"><a href="#backporting">7. Using pbuilder for back-porting</a></span></dt><dt><span class="sect1"><a href="#massbuild">8. Mass-building packages</a></span></dt><dt><span class="sect1"><a href="#id291465">9. Auto-backporting scripts</a></span></dt><dt><span class="sect1"><a href="#autotesting">10. Using pbuilder for automated testing of packages</a></span></dt><dt><span class="sect1"><a href="#altcompiler">11. Using pbuilder for testing builds with alternate compilers</a></span></dt></dl></dd><dt><span class="chapter"><a href="#pbuilder-uml">3. Using User-mode-linux with pbuilder</a></span></dt><dd><dl><dt><span class="sect1"><a href="#user-mode-linux-config">1. Configuring user-mode-linux</a></span></dt><dt><span class="sect1"><a href="#rootstrap">2. Configuring rootstrap</a></span></dt><dt><span class="sect1"><a href="#pbuilderumlconfig">3. Configuring pbuilder-uml</a></span></dt><dt><span class="sect1"><a href="#consideruml">4. Considerations for running pbuilder-user-mode-linux</a></span></dt><dt><span class="sect1"><a href="#paralleluml">5. Parallel running of pbuilder-user-mode-linux</a></span></dt><dt><span class="sect1"><a href="#pbuilderumlwrap">6. Using pbuilder-user-mode-linux as a wrapper script to start up a virtual machine</a></span></dt></dl></dd><dt><span class="chapter"><a href="#faq">4. Frequently asked questions </a></span></dt><dd><dl><dt><span class="sect1"><a href="#id292232">1. pbuilder create fails</a></span></dt><dt><span class="sect1"><a href="#bindmountlimits">2. Directories that cannot be bind-mounted</a></span></dt><dt><span class="sect1"><a href="#modifyupdate">3. Logging in to pbuilder to modify the environment</a></span></dt><dt><span class="sect1"><a href="#BUILDRESULTUID">4. Setting BUILDRESULTUID for sudo sessions</a></span></dt><dt><span class="sect1"><a href="#tmpdir">5. Notes on usage of $TMPDIR</a></span></dt><dt><span class="sect1"><a href="#DISTRIBUTIONSWITCH">6. Creating a shortcut for running <span><strong class="command">pbuilder</strong></span> with a specific distribution</a></span></dt><dt><span class="sect1"><a href="#id292508">7. Using special apt sources lists, and local packages</a></span></dt><dt><span class="sect1"><a href="#id292590">8. How to get pbuilder to run apt-get update before trying to satisfy build-dependency</a></span></dt><dt><span class="sect1"><a href="#id292611">9. Different bash prompts inside pbuilder login</a></span></dt><dt><span class="sect1"><a href="#id292666">10. Using /var/cache/apt/archives for the package cache</a></span></dt><dt><span class="sect1"><a href="#stablebackport">11. pbuilder back ported to stable Debian releases</a></span></dt><dt><span class="sect1"><a href="#LOGNAME">12. Warning about LOGNAME not being defined</a></span></dt><dt><span class="sect1"><a href="#nobuildconflictessential">13. Cannot Build-conflict against an essential package</a></span></dt><dt><span class="sect1"><a href="#id292793">14. Avoiding the "ln: Invalid cross-device link" message</a></span></dt><dt><span class="sect1"><a href="#id292822">15. Using fakechroot</a></span></dt><dt><span class="sect1"><a href="#debconfinsidepbuilder">16. Using debconf inside pbuilder sessions</a></span></dt><dt><span class="sect1"><a href="#nodev">17. nodev mount options hinder pbuilder activity</a></span></dt><dt><span class="sect1"><a href="#faqslowpbuilder">18. pbuilder is slow</a></span></dt><dt><span class="sect1"><a href="#chrootmemo">19. Creating a chroot reminder</a></span></dt><dt><span class="sect1"><a href="#sponsor">20. Using pdebuild to sponsor package</a></span></dt><dt><span class="sect1"><a href="#sourcechanges">21. Why is there a source.changes file in ../?</a></span></dt><dt><span class="sect1"><a href="#amd64i386">22. amd64 and i386-mode</a></span></dt><dt><span class="sect1"><a href="#ccache">23. How to use ccache</a></span></dt><dt><span class="sect1"><a href="#tmpfsforpbuilder">24. Using tmpfs for buildplace</a></span></dt></dl></dd><dt><span class="chapter"><a href="#develanddebug">5. Troubleshooting and development</a></span></dt><dd><dl><dt><span class="sect1"><a href="#bugreport">1. Reporting bugs </a></span></dt><dt><span class="sect1"><a href="#mailinglist">2. Mailing list</a></span></dt><dt><span class="sect1"><a href="#IRCchannel">3. IRC Channel</a></span></dt><dt><span class="sect1"><a href="#development">4. Information for pbuilder developers</a></span></dt></dl></dd><dt><span class="chapter"><a href="#otheruse">6. Other uses of pbuilder</a></span></dt><dd><dl><dt><span class="sect1"><a href="#chroot">1. Using pbuilder for small experiments</a></span></dt><dt><span class="sect1"><a href="#id293780">2. Running little programs inside the chroot</a></span></dt></dl></dd><dt><span class="chapter"><a href="#experimental">7. Experimental or wish-list features of pbuilder</a></span></dt><dd><dl><dt><span class="sect1"><a href="#lvm">1. Using LVM</a></span></dt><dt><span class="sect1"><a href="#cowdancer">2. Using cowdancer</a></span></dt><dd><dl><dt><span class="sect2"><a href="#sargecowdancer">2.1. Using cowdancer for sarge</a></span></dt></dl></dd><dt><span class="sect1"><a href="#withouttargz">3. Using pbuilder without tar.gz</a></span></dt></dl></dd><dt><span class="chapter"><a href="#refs">8. Reference materials</a></span></dt><dd><dl><dt><span class="sect1"><a href="#dirstructoutside">1. Directory structure outside the chroot</a></span></dt><dt><span class="sect1"><a href="#dirstructinside">2. Directory structure inside the chroot</a></span></dt></dl></dd><dt><span class="chapter"><a href="#id294520">9. Minor archaeological details</a></span></dt><dd><dl><dt><span class="sect1"><a href="#id294526">1. Documentation history </a></span></dt><dt><span class="sect1"><a href="#pbuilderbackgroundhistory">2. Possibly inaccurate Background History of pbuilder</a></span></dt><dd><dl><dt><span class="sect2"><a href="#id294628">2.1. The Time Before pbuilder</a></span></dt><dt><span class="sect2"><a href="#birth">2.2. Birth of pbuilder</a></span></dt><dt><span class="sect2"><a href="#secondyear">2.3. And the second year of its life</a></span></dt><dt><span class="sect2"><a href="#fifthyear">2.4. Fifth year of pbuilder</a></span></dt></dl></dd></dl></dd></dl></div><div class="list-of-tables"><p><b>List of Tables</b></p><dl><dt>5.1. <a href="#id293472">Directory structure of the testsuite</a></dt><dt>8.1. <a href="#id294087">Directory Structure outside the chroot </a></dt><dt>8.2. <a href="#id294344">Directory Structure inside the chroot </a></dt></dl></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="id250274"></a>Chapter1.Introducing pbuilder</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="#aim">1. Aims of pbuilder</a></span></dt></dl></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="aim"></a>1.Aims of pbuilder</h2></div></div></div><p>
<span><strong class="command">pbuilder</strong></span> stands for
Personal Builder, and it is an automatic Debian Package Building system
for personal environments.
<span><strong class="command">pbuilder</strong></span> aims to be an
easy-to-setup system
for auto-building Debian packages inside a clean-room
environment, so that it is possible to verify that
a package can be built on most Debian installations.
The clean-room environment is achieved through the use of
a chroot image,
so that only minimal packages will be installed inside the
chroot.
</p><p>
The Debian distribution consists of free software
accompanied with source.
The source code within Debian's "main" section
must build within Debian "main",
with only the explicitly specified build-dependencies
installed.
</p><p>
The primary aim of <span><strong class="command">pbuilder</strong></span> is different from other
auto-building systems in Debian in that its aim is not
to try to build as many packages as possible.
It does not try to guess
what a package needs, and in most cases it tries the
worst choice of all if there is a choice to be made.
</p><p>
In this way, <span><strong class="command">pbuilder</strong></span> tries to ensure
that packages
tested against <span><strong class="command">pbuilder</strong></span> will build properly in
most Debian installations, hopefully resulting
in a good overall Debian source-buildability.
</p><p>
The goal of making Debian buildable from source is
somewhat accomplished, and has seen good progress.
It is known that Debian 3.0 has problems when building from source.
But the version after, Debian 3.1 should
be better, and the version after.
</p></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="usingpbuilder"></a>Chapter2.Using pbuilder</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="#creatingbase">1. Creating a base chroot image</a></span></dt><dt><span class="sect1"><a href="#id249732">2. Updating the base chroot image</a></span></dt><dt><span class="sect1"><a href="#buildpackagechroot">3. Building a package using the chroot image</a></span></dt><dt><span class="sect1"><a href="#pdebuild">4. Facilitating Debian Developers' typing, pdebuild</a></span></dt><dt><span class="sect1"><a href="#configfile">5. Configuration Files</a></span></dt><dt><span class="sect1"><a href="#nonrootchroot">6. Building packages as non-root inside the chroot</a></span></dt><dt><span class="sect1"><a href="#backporting">7. Using pbuilder for back-porting</a></span></dt><dt><span class="sect1"><a href="#massbuild">8. Mass-building packages</a></span></dt><dt><span class="sect1"><a href="#id291465">9. Auto-backporting scripts</a></span></dt><dt><span class="sect1"><a href="#autotesting">10. Using pbuilder for automated testing of packages</a></span></dt><dt><span class="sect1"><a href="#altcompiler">11. Using pbuilder for testing builds with alternate compilers</a></span></dt></dl></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="creatingbase"></a>1.Creating a base chroot image</h2></div></div></div><p>
<span><strong class="command">pbuilder create</strong></span>
will create a base chroot image.
The distribution code-name needs to be specified with
the <span><strong class="command"><code class="option">--distribution</code></strong></span>
command-line option.
Usually, "sid" is used, and the default is now sid.
</p><p>
<span><strong class="command">debootstrap</strong></span> is used to create
the bare minimum Debian installation,
and then build-essential packages are installed on top
of the minimum installation using <span><strong class="command">apt-get</strong></span>
inside the chroot.
</p><p>
For fuller documentation of command-line options, see
the pbuilder.8 manual page.
Some configuration will be required for <code class="filename">/etc/pbuilderrc</code>
for the mirror site
<sup>[<a name="id249721" href="#ftn.id249721">1</a>]</sup>
to use, and proxy configuration may be required to allow access
through HTTP.
See the pbuilderrc.5 manual page for details.
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id249732"></a>2.Updating the base chroot image</h2></div></div></div><p><span><strong class="command">pbuilder update</strong></span>
will update the chroot image.
It will extract the chroot, invoke <span><strong class="command">apt-get update</strong></span>
and <span><strong class="command">apt-get dist-upgrade</strong></span> inside the
chroot, and then recreate the base tar-ball.
</p><p>
It is possible to switch the distribution which the chroot
tar-ball is targeted at at this point.
Specify <span><strong class="command"><code class="option">--distribution <em class="parameter"><code>sid</code></em></code> <code class="option">--override-config</code></strong></span> to change the distribution
to sid.
<sup>[<a name="id249776" href="#ftn.id249776">2</a>]</sup>
</p><p>
For fuller documentation of command-line options, see
the pbuilder.8 manual page
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="buildpackagechroot"></a>3.Building a package using the chroot image</h2></div></div></div><p>
To build a package inside the chroot, invoke
<span><strong class="command">pbuilder build <code class="option">whatever.dsc</code></strong></span>.
<span><strong class="command">pbuilder</strong></span> will extract
the chroot image to a temporary working directory,
and satisfy the build-dependencies inside the chroot,
and build the package.
The built packages will be moved to a
directory specified with
the <span><strong class="command"><code class="option">--buildresult</code></strong></span>
command-line option.
</p><p>
The <span><strong class="command"><code class="option">--basetgz</code></strong></span> option can be
used to specify which chroot image to use.
</p><p>
<span><strong class="command">pbuilder</strong></span> will extract a fresh chroot image
created with <span><strong class="command">pbuilder build</strong></span>
and updated with <span><strong class="command">pbuilder update</strong></span>,
and populate the chroot with build-dependencies by parsing
debian/control and invoking <span><strong class="command">apt-get</strong></span>.
</p><p>
For fuller documentation of command-line options, see
the pbuilder.8 manual page
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="pdebuild"></a>4.Facilitating Debian Developers' typing, pdebuild</h2></div></div></div><p>
<span><strong class="command">pdebuild</strong></span> is a little wrapper
script that does the most frequent of all tasks.
A Debian Developer may try to do <span><strong class="command">debuild</strong></span>, and
build a package, inside a Debian source directory.
<span><strong class="command">pdebuild</strong></span> will allow similar
control, and allow package to be built inside the chroot,
to check that the current source tree will build happily
inside the chroot.
</p><p>
<span><strong class="command">pdebuild</strong></span> calls <span><strong class="command">dpkg-source</strong></span>
to build the source packages, and then invokes
<span><strong class="command">pbuilder</strong></span> on the resulting source package.
However, unlike debuild, the resulting deb files will be
found in the <span><strong class="command"><code class="option">--buildresult</code></strong></span>
directory.
</p><p>
See the pdebuild.1 manual page for more details.
</p><p>
There is a slightly different mode of operation available
in <span><strong class="command">pdebuild</strong></span> since version 0.97. <span><strong class="command">pdebuild</strong></span> usually runs
<span><strong class="command">debian/rules clean</strong></span> outside of the chroot;
however, it is possible to change the behaviour to run it
inside the chroot with
the <span><strong class="command"><code class="option">--use-pdebuild-internal</code></strong></span>.
It will try to bind mount the working directory inside chroot,
and run <span><strong class="command">dpkg-buildpackage</strong></span> inside.
It has the following characteristics, and is not yet the
default mode of operation.
</p><div class="itemizedlist"><ul type="disc"><li><p>
Satisfies build-dependency inside the chroot before creating source package.
(which is a good point that current <span><strong class="command">pdebuild</strong></span> cannot do).
</p></li><li><p>The working directory is modified
from inside the chroot.</p></li><li><p>Building with <span><strong class="command">pdebuild</strong></span> does not guarantee
that it works with <span><strong class="command">pbuilder</strong></span>.</p></li><li><p>If making the source package fails,
the session using the chroot is wasted
(chroot creation takes a bit of time, which should be improved with cowdancer).</p></li><li><p>Does not work in the same manner as it used to;
for example, <span><strong class="command"><code class="option">--buildresult</code></strong></span>
does not have any effect.</p></li><li><p>The build inside chroot is ran with the current user outside chroot.
</p></li></ul></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="configfile"></a>5.Configuration Files</h2></div></div></div><p>
It is possible to specify all settings by command-line
options. However, for typing convenience, it is possible to
use a configuration file.
</p><p>
<code class="filename">/etc/pbuilderrc</code> and
<code class="filename">${HOME}/.pbuilderrc</code>
are read in when <span><strong class="command">pbuilder</strong></span> is invoked.
The possible options are documented in
the pbuilderrc.5 manual page.
</p><p>
It is useful to use <code class="option">--configfile</code> option to load up a preset
configuration file when switching between configuration files for
different distributions.
</p><p>
Please note <code class="filename">${HOME}/.pbuilderrc</code> supersede system settings. For
example, if you are upgrading from sarge to etch, you may need to
adjust some part of your local setting just like new
<code class="filename">/usr/share/pbuilder/pbuilderrc</code>, e.g., "unset DEBOOTSTRAPOPTS", to cope
with the use of cdebootstrap. The same care is needed if you edited
old system setting in <code class="filename">/etc/pbuilderrc</code>.
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="nonrootchroot"></a>6.Building packages as non-root inside the chroot</h2></div></div></div><p>
<span><strong class="command">pbuilder</strong></span> requires full root privilege
when it is satisfying the build-dependencies, but most packages do not
need root privilege, or fail to build when they are root.
<span><strong class="command">pbuilder </strong></span> can create a user which is only used
inside <span><strong class="command">pbuilder </strong></span> and use that user id when
building, and use the <span><strong class="command">fakeroot</strong></span> command
when root privilege is required.
</p><p>
BUILDUSERID configuration option should be set to a value for a user id that
does not already exist on the system, so that it is more difficult for
packages that are being built with
<span><strong class="command">pbuilder</strong></span> to affect the environment outside the chroot.
When BUILDUSERNAME configuration option is also set,
<span><strong class="command">pbuilder</strong></span> will use the specified user name and fakeroot for building packages,
instead of running as root inside chroot.
</p><p>
Even when using the fakerooting method, <span><strong class="command">pbuilder</strong></span> will run with
root privilege when it is required.
For example, when installing
packages to the chroot, <span><strong class="command">pbuilder</strong></span> will run under root privilege.
</p><p>
To be able to invoke <span><strong class="command">pbuilder</strong></span> without being
root, you need to use user-mode-linux, as explained
in <a href="#pbuilder-uml" title="Chapter3.Using User-mode-linux with pbuilder">Chapter3, <i>Using User-mode-linux with pbuilder</i></a>.
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="backporting"></a>7.Using pbuilder for back-porting</h2></div></div></div><p>
<span><strong class="command">pbuilder</strong></span> can be used for back-porting software from
the latest Debian distribution to
the older stable distribution, by using a chroot that contains
an image of the older distribution, and building packages inside the
chroot.
There are several points to consider, and due to the following reasons,
automatic back-porting is usually not possible, and
manual interaction is required:
</p><div class="itemizedlist"><ul type="disc"><li><p>The package from the unstable distribution
may depend on packages or versions of packages which
are only available in unstable.
Thus, it may not be possible to satisfy Build-Depends:
on stable (without additional backporting work).</p></li><li><p>The stable distribution may have bugs that have been
fixed in unstable which need to be worked around.</p></li><li><p>The package in the unstable distribution may have
problems building even on unstable.</p></li></ul></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="massbuild"></a>8.Mass-building packages</h2></div></div></div><p>
<span><strong class="command">pbuilder</strong></span> can be automated, because its operations are
non-interactive.
It is possible to run <span><strong class="command">pbuilder</strong></span> through multiple packages
non-interactively.
Several such scripts are known to exist.
Junichi Uekawa has been running such a script since 2001,
and has been filing bugs on packages that fail the
test of <span><strong class="command">pbuilder</strong></span>. There were several problems with auto-building:
</p><div class="itemizedlist"><ul type="disc"><li><p>Build-Dependencies need to install non-interactively, but
some packages are so broken that they cannot install
without interaction (like postgresql).</p></li><li><p>When a library package breaks, or gcc/gcj/g++ breaks,
or even bison, a large number of build failures are reported.
(gcj-3.0 which had no "javac", bison which got more strict, etc.)
</p></li><li><p>Some people were quite hostile against build failure reports.</p></li></ul></div><p>
Most of the initial bugs have been resolved in the <span><strong class="command">pbuilder</strong></span>
sweep done around 2002, but these transitional problems which
affect a large portion of Debian Archive do arise from time to
time. Regression tests have their values.
</p><p>
A script that was used by Junichi Uekawa is now included in
the <span><strong class="command">pbuilder</strong></span> distribution, as <span><strong class="command">pbuildd.sh</strong></span>.
It is available in <code class="filename">/usr/share/doc/pbuilder/examples/pbuildd/</code>
and its configuration is in <code class="filename">/etc/pbuilder/pbuildd-config.sh</code>.
It should be easy enough to set up for people who are used to
<span><strong class="command">pbuilder</strong></span>. It has been running for quite a while, and it should be
possible to set the application up on your system also.
However, it is a new introduction, and please file bugs
to the Debian BTS if you know of possible problems,
or improved on the script considerably.
</p><p>
To set up pbuildd, there are some points to be aware of.
</p><div class="itemizedlist"><ul type="disc"><li><p>A file <code class="filename">./avoidlist</code> needs to be available with the list of packages to avoid building. </p></li><li><p>It will try building anything, even packages
which are not aimed for your architecture.</p></li><li><p>Because you are running random build scripts, it is better to use
the fakeroot option of <span><strong class="command">pbuilder</strong></span>, to avoid running the build
under root privilege.</p></li><li><p>Because not all builds are guaranteed to finish in a finite time,
setting a timeout is probably necessary, or pbuildd may stall with
a bad build.</p></li><li><p>
Some packages require a lot of disk space,
around 2GB seems to be sufficient for the largest packages for the time being.
If you find otherwise, please inform the maintainer of this documentation.
</p></li></ul></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id291465"></a>9.Auto-backporting scripts</h2></div></div></div><p>
There are some people who use <span><strong class="command">pbuilder</strong></span> to automatically back-port
a subset of packages to the stable distribution.
</p><p>
I would like some information on how people are doing it,
I would appreciate any feedback or information on
how you are doing, or any examples.
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="autotesting"></a>10.Using pbuilder for automated testing of packages</h2></div></div></div><p>
<span><strong class="command">pbuilder</strong></span> can be used for automated testing of packages.
It has the feature of allowing hooks to be placed,
and these hooks can try to install packages inside
the chroot, or run them, or whatever else that
can be done. Some known tests and ideas:
</p><div class="itemizedlist"><ul type="disc"><li><p>Automatic install-remove-upgrade-remove-install-purge-upgrade-purge test-suite (distributed as an example, <code class="filename">B91dpkg-i</code>),
or just check that everything installs somewhat (<code class="filename">execute_installtest.sh</code>).</p></li><li><p>Automatically running lintian/linda (distributed as an example in
<code class="filename">/usr/share/doc/pbuilder/examples/B90linda</code>).</p></li><li><p>Automatic debian-test of the package?
The debian-test package has been removed from Debian.
A <span><strong class="command">pbuilder</strong></span> implementation can be found as
debian/pbuilder-test directory, implemented through B92pkg-test script.</p></li></ul></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="altcompiler"></a>11.Using pbuilder for testing builds with alternate compilers</h2></div></div></div><p>
Most packages are compiled with <span><strong class="command">gcc</strong></span>
or <span><strong class="command">g++</strong></span>
and using the default compiler version, which was gcc 2.95 for Debian GNU/Linux 3.0 (i386).
However, Debian 3.0 was distributed with other compilers, under package names
such as <span><strong class="command">gcc-3.2</strong></span> for gcc compiler
version 3.2.
It was therefore possible to try compiling packages against different
compiler versions.
<span><strong class="command">pentium-builder</strong></span> provides an infrastructure for
using a different compiler for building packages than the default gcc, by
providing a wrapper script called gcc which calls the real gcc.
To use <span><strong class="command">pentium-builder</strong></span> in <span><strong class="command">pbuilder</strong></span>, it is possible to set up the
following in the configuration:
</p><pre class="screen">
EXTRAPACKAGES="pentium-builder gcc-3.2 g++-3.2"
export DEBIAN_BUILDARCH=athlon
export DEBIAN_BUILDGCCVER=3.2
</pre><p>
</p><p>
It will instruct <span><strong class="command">pbuilder</strong></span> to install the <span><strong class="command">pentium-builder</strong></span> package
and also the GCC 3.2 compiler packages inside the chroot,
and set the environment variables required for
<span><strong class="command">pentium-builder</strong></span> to function.
</p></div><div class="footnotes"><br><hr width="100" align="left"><div class="footnote"><p><sup>[<a name="ftn.id249721" href="#id249721">1</a>] </sup>
The mirror site should preferably be
a local mirror or a cache server,
so as not to overload the public mirrors with
a lot of access.
Use of tools such as apt-proxy would be advisable.
</p></div><div class="footnote"><p><sup>[<a name="ftn.id249776" href="#id249776">2</a>] </sup>Only upgrading is supported.
Debian does not generally support downgrading (yet?).</p></div></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="pbuilder-uml"></a>Chapter3.Using User-mode-linux with pbuilder</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="#user-mode-linux-config">1. Configuring user-mode-linux</a></span></dt><dt><span class="sect1"><a href="#rootstrap">2. Configuring rootstrap</a></span></dt><dt><span class="sect1"><a href="#pbuilderumlconfig">3. Configuring pbuilder-uml</a></span></dt><dt><span class="sect1"><a href="#consideruml">4. Considerations for running pbuilder-user-mode-linux</a></span></dt><dt><span class="sect1"><a href="#paralleluml">5. Parallel running of pbuilder-user-mode-linux</a></span></dt><dt><span class="sect1"><a href="#pbuilderumlwrap">6. Using pbuilder-user-mode-linux as a wrapper script to start up a virtual machine</a></span></dt></dl></div><p>
It is possible to use user-mode-linux by invoking
<span><strong class="command">pbuilder-user-mode-linux</strong></span> instead of
<span><strong class="command">pbuilder</strong></span>.
<span><strong class="command">pbuilder-user-mode-linux</strong></span> doesn't require root
privileges, and it uses the copy-on-write (COW) disk access
method of <span><strong class="command">User-mode-linux</strong></span> which typically
makes it much faster than the traditional
<span><strong class="command">pbuilder</strong></span>.
</p><p>
<span><strong class="command">User-mode-linux</strong></span> is a somewhat less proven
platform than the standard Unix tools which
<span><strong class="command">pbuilder</strong></span> relies on
(<span><strong class="command">chroot</strong></span>, <span><strong class="command">tar</strong></span>, and
<span><strong class="command">gzip</strong></span>) but mature enough to support
<span><strong class="command">pbuilder-user-mode-linux</strong></span> since its version
0.59. And since then,
<span><strong class="command">pbuilder-user-mode-linux</strong></span> has seen a rapid
evolution.
</p><p>
The configuration of <span><strong class="command">pbuilder-user-mode-linux</strong></span>
goes in three steps:
</p><div class="itemizedlist"><ul type="disc"><li><p>Configuration of user-mode-linux</p></li><li><p>Configuration of rootstrap</p></li><li><p>Configuration of pbuilder-uml</p></li></ul></div><p>
</p><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="user-mode-linux-config"></a>1.Configuring user-mode-linux</h2></div></div></div><p>
user-mode-linux isn't completely trivial to set up. It would
probably be useful to acquaint yourself with it a bit before
attempting to use <span><strong class="command">rootstrap</strong></span> or
<span><strong class="command">pbuilder-user-mode-linux</strong></span>. For details,
read
<code class="filename">/usr/share/doc/uml-utilities/README.Debian</code>
and the <span><strong class="command">user-mode-linux</strong></span> documentation. (It's in a separate
package, user-mode-linux-doc.)
</p><p>
<span><strong class="command">user-mode-linux</strong></span> requires
the user to be in the uml-net group in order to configure the network
unless you are using slirp.
</p><p>
If you compile your own kernel, you may want to
verify that you enable TUN/TAP support,
and you might want to consider the SKAS patch.
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rootstrap"></a>2.Configuring rootstrap</h2></div></div></div><p>
<span><strong class="command">rootstrap</strong></span>
is a wrapper around debootstrap.
It creates a Debian disk image for use with UML.
To configure rootstrap, there are several requirements.
</p><div class="itemizedlist"><ul type="disc"><li><p>Install the rootstrap package.</p></li><li><p>
TUN/TAP only:
add the user to the uml-net group to allow access to the network
</p><pre class="screen">
adduser dancer uml-net
</pre></li><li><p>TUN/TAP only:
Check that the kernel supports the TUN/TAP interface,
or recompile the kernel if necessary.
</p></li><li><p>Set up <code class="filename">/etc/rootstrap/rootstrap.conf</code>.
For example,
if the current host is 192.168.1.2, changing following
entries to something like this seems to work.
</p><pre class="screen">
transport=tuntap
interface=eth0
gateway=192.168.1.1
mirror=http://192.168.1.2:8081/debian
host=192.168.1.198
uml=192.168.1.199
netmask=255.255.255.0
</pre><p>
Some experimentation with configuration and running
<span><strong class="command">rootstrap ~/test.uml</strong></span> to actually
test it would be handy.
</p><p>
Using slirp requires less configuration.
The default configuration comes with a working example.
</p></li></ul></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="pbuilderumlconfig"></a>3.Configuring pbuilder-uml</h2></div></div></div><p>
The following needs to happen:
</p><div class="itemizedlist"><ul type="disc"><li><p>Install the pbuilder-uml package.</p></li><li><p>
Set up the configuration file
<code class="filename">/etc/pbuilder/pbuilder-uml.conf</code>
in the following manner. It will be different for slirp.
</p><pre class="screen">
MY_ETH0=tuntap,,,192.168.1.198
UML_IP=192.168.1.199
UML_NETMASK=255.255.255.0
UML_NETWORK=192.168.1.0
UML_BROADCAST=255.255.255.255
UML_GATEWAY=192.168.1.1
PBUILDER_UML_IMAGE="/home/dancer/uml-image"
</pre><p>
Also, it needs to match the rootstrap configuration.
</p></li><li><p>
Make sure BUILDPLACE is writable by the user.
Change BUILDPLACE in the configuration file to a place
where the user has access.
</p></li><li><p>Run <span><strong class="command">pbuilder-user-mode-linux <code class="option">create --distribution sid</code></strong></span> to create the image.</p></li><li><p>Try running <span><strong class="command">pbuilder-user-mode-linux build</strong></span>.</p></li></ul></div><p>
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="consideruml"></a>4.Considerations for running pbuilder-user-mode-linux</h2></div></div></div><p>
<span><strong class="command">pbuilder-user-mode-linux</strong></span> emulates most of <span><strong class="command">pbuilder</strong></span>, but there
are some differences.
</p><div class="itemizedlist"><ul type="disc"><li><p>
<span><strong class="command">pbuilder-user-mode-linux</strong></span> does not support all options of <span><strong class="command">pbuilder</strong></span>
properly yet. This is a problem, and will be addressed as
specific areas are discovered.
</p></li><li><p>
/tmp is handled differently inside
<span><strong class="command">pbuilder-user-mode-linux</strong></span>. In
<span><strong class="command">pbuilder-user-mode-linux</strong></span>,
<code class="filename">/tmp</code> is mounted as tmpfs inside UML,
so accessing files under <code class="filename">/tmp</code> from
outside user-mode-linux does not work. It affects options
like <span><strong class="command"><code class="option">--configfile</code></strong></span>, and
when trying to build packages placed under
<code class="filename">/tmp</code>.
</p></li></ul></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="paralleluml"></a>5.Parallel running of pbuilder-user-mode-linux</h2></div></div></div><p>
To run <span><strong class="command">pbuilder-user-mode-linux</strong></span> in parallel
on a system, there are a few things to bear in mind.
</p><div class="itemizedlist"><ul type="disc"><li><p>The create and update methods must not be run when
a build is in progress, or the COW file will be invalidated.</p></li><li><p>
If you are not using slirp, user-mode-linux processes which are
running in parallel need to have different IP addresses.
Just trying to run the <span><strong class="command">pbuilder-user-mode-linux</strong></span>
several times will result in failure to access the network.
But something like the following will work:
</p><pre class="screen">
for IP in 102 103 104 105; do
xterm -e pbuilder-user-mode-linux build --uml-ip 192.168.0.$IP \
20030107/whizzytex_1.1.1-1.dsc &
done
</pre><p>
When using slirp, this problem does not exist.
</p></li></ul></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="pbuilderumlwrap"></a>6.Using pbuilder-user-mode-linux as a wrapper script to start up a virtual machine</h2></div></div></div><p>
It is possible to use
<span><strong class="command">pbuilder-user-mode-linux</strong></span> for other uses
than just building Debian packages.
<span><strong class="command">pbuilder-user-mode-linux
<code class="option">login</code></strong></span> will let a user use a shell
inside the user-mode-linux <span><strong class="command">pbuilder</strong></span> base
image, and <span><strong class="command">pbuilder-user-mode-linux
<code class="option">execute</code></strong></span> will allow the user to
execute a script inside the image.
</p><p>
You can use the script to install ssh and add a new user,
so that it is possible to access inside the user-mode-linux through ssh.
</p><p>
Note that it is not possible to use a script from
<code class="filename">/tmp</code> due to the way
<span><strong class="command">pbuilder-user-mode-linux</strong></span> mounts a tmpfs at
<code class="filename">/tmp</code>.
</p><p>
The following example script may be useful in starting a sshd
inside user-mode-linux.
</p><pre class="screen">
#!/bin/bash
apt-get install -y ssh xbase-clients xterm
echo "enter root password"
passwd
cp /etc/ssh/sshd_config{,-}
sed 's/X11Forwarding.*/X11Forwarding yes/' /etc/ssh/sshd_config- > /etc/ssh/sshd_config
/etc/init.d/ssh restart
ifconfig
echo "Hit enter to finish"
read
</pre></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="faq"></a>Chapter4.Frequently asked questions </h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="#id292232">1. pbuilder create fails</a></span></dt><dt><span class="sect1"><a href="#bindmountlimits">2. Directories that cannot be bind-mounted</a></span></dt><dt><span class="sect1"><a href="#modifyupdate">3. Logging in to pbuilder to modify the environment</a></span></dt><dt><span class="sect1"><a href="#BUILDRESULTUID">4. Setting BUILDRESULTUID for sudo sessions</a></span></dt><dt><span class="sect1"><a href="#tmpdir">5. Notes on usage of $TMPDIR</a></span></dt><dt><span class="sect1"><a href="#DISTRIBUTIONSWITCH">6. Creating a shortcut for running <span><strong class="command">pbuilder</strong></span> with a specific distribution</a></span></dt><dt><span class="sect1"><a href="#id292508">7. Using special apt sources lists, and local packages</a></span></dt><dt><span class="sect1"><a href="#id292590">8. How to get pbuilder to run apt-get update before trying to satisfy build-dependency</a></span></dt><dt><span class="sect1"><a href="#id292611">9. Different bash prompts inside pbuilder login</a></span></dt><dt><span class="sect1"><a href="#id292666">10. Using /var/cache/apt/archives for the package cache</a></span></dt><dt><span class="sect1"><a href="#stablebackport">11. pbuilder back ported to stable Debian releases</a></span></dt><dt><span class="sect1"><a href="#LOGNAME">12. Warning about LOGNAME not being defined</a></span></dt><dt><span class="sect1"><a href="#nobuildconflictessential">13. Cannot Build-conflict against an essential package</a></span></dt><dt><span class="sect1"><a href="#id292793">14. Avoiding the "ln: Invalid cross-device link" message</a></span></dt><dt><span class="sect1"><a href="#id292822">15. Using fakechroot</a></span></dt><dt><span class="sect1"><a href="#debconfinsidepbuilder">16. Using debconf inside pbuilder sessions</a></span></dt><dt><span class="sect1"><a href="#nodev">17. nodev mount options hinder pbuilder activity</a></span></dt><dt><span class="sect1"><a href="#faqslowpbuilder">18. pbuilder is slow</a></span></dt><dt><span class="sect1"><a href="#chrootmemo">19. Creating a chroot reminder</a></span></dt><dt><span class="sect1"><a href="#sponsor">20. Using pdebuild to sponsor package</a></span></dt><dt><span class="sect1"><a href="#sourcechanges">21. Why is there a source.changes file in ../?</a></span></dt><dt><span class="sect1"><a href="#amd64i386">22. amd64 and i386-mode</a></span></dt><dt><span class="sect1"><a href="#ccache">23. How to use ccache</a></span></dt><dt><span class="sect1"><a href="#tmpfsforpbuilder">24. Using tmpfs for buildplace</a></span></dt></dl></div><p>
Here, known problems and frequently asked questions are
documented. This portion was initially available in README.Debian
file, but moved here.
</p><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id292232"></a>1.pbuilder create fails</h2></div></div></div><p>
It often happens that <span><strong class="command">pbuilder</strong></span> cannot create the latest chroot.
Try upgrading <span><strong class="command">pbuilder</strong></span> and debootstrap.
It is currently only possible to create software that handles the
past. Future prediction is a feature which may be added later after
we have become comfortable with the past.
</p><p>
There are people who occasionally back port debootstrap to stable
versions; hunt for them.
</p><p>
When there are errors with the debootstrap phase,
the debootstrap script needs to be fixed.
<span><strong class="command">pbuilder</strong></span> does not provide a way to work around debootstrap.
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="bindmountlimits"></a>2.Directories that cannot be bind-mounted</h2></div></div></div><p>
Because of the way <span><strong class="command">pbuilder</strong></span> works, there
are several directories which cannot be bind-mounted when
running <span><strong class="command">pbuilder</strong></span>. The directories include
<code class="filename">/tmp</code>,
<code class="filename">/var/cache/pbuilder</code>, and system
directories such as <code class="filename">/etc</code> and
<code class="filename">/usr</code>. The recommendation is to use
directories under the user's home directory for bind-mounts.
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="modifyupdate"></a>3.Logging in to pbuilder to modify the environment</h2></div></div></div><p>
It is sometimes necessary to modify the chroot environment.
<span><strong class="command">login</strong></span> will remove the contents of the chroot after logout.
It is possible to invoke a shell using hook scripts.
<span><strong class="command">pbuilder update</strong></span> executes 'E' scripts,
and a sample for invoking a shell
is provided as <code class="filename">C10shell</code>.
</p><pre class="screen">
$ mkdir ~/loginhooks
$ cp C10shell ~/loginhooks/E10shell
$ sudo pbuilder update --hookdir ~/loginhooks/E10shell
</pre><p>
It is also possible to add <code class="option">--save-after-exec</code>
and/or <code class="option">--save-after-login</code> options
to the <span><strong class="command">pbuilder login</strong></span> session
to accomplish the goal.
It is possible to add the <code class="option">--uml-login-nocow</code> option
to <span><strong class="command">pbuilder-user-mode-linux <code class="option">login</code></strong></span> session
as well.
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="BUILDRESULTUID"></a>4.Setting BUILDRESULTUID for sudo sessions</h2></div></div></div><p>
It is possible to set
</p><pre class="screen">BUILDRESULTUID=$SUDO_UID</pre><p> in pbuilderrc to set
the proper BUILDRESULTUID when using <span><strong class="command">sudo</strong></span>.
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="tmpdir"></a>5.Notes on usage of $TMPDIR</h2></div></div></div><p>
If you are setting $TMPDIR to an unusual value, of other than
<code class="filename">/tmp</code>, you will find that some errors may occur inside the chroot,
such as <span><strong class="command">dpkg-source</strong></span> failing.
</p><p>There are two options, you may install a hook to create that
directory, or set
</p><pre class="screen">export TMPDIR=/tmp</pre><p>
in pbuilderrc. Take your pick.
</p><p>
An example script is provided as
<code class="filename">examples/D10tmp</code> with <span><strong class="command">pbuilder</strong></span>.
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="DISTRIBUTIONSWITCH"></a>6.Creating a shortcut for running <span><strong class="command">pbuilder</strong></span> with a specific distribution</h2></div></div></div><p>
When working with multiple chroots, it would be nice to work
with scripts that reduce the amount of typing. An example
script <code class="filename">pbuilder-distribution.sh</code> is
provided as an example. Invoking the script as
<code class="filename">pbuilder-sarge</code> will invoke
<span><strong class="command">pbuilder</strong></span> with a sarge chroot.
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id292508"></a>7.Using special apt sources lists, and local packages</h2></div></div></div><p>
If you have some very specialised requirements on your
apt setup inside <span><strong class="command">pbuilder</strong></span>,
it is possible to specify that through
the <span><strong class="command"><code class="option">--othermirror</code></strong></span>
option.
Try something like:
<span><strong class="command"><code class="option">--othermirror "deb http://local/mirror stable main|deb-src http://local/source/repository ./"</code></strong></span>
</p><p>
To use the local file system instead of HTTP, it is necessary to do
bind-mounting.
<span><strong class="command"><code class="option">--bindmounts</code></strong></span>
is a command-line option useful for such cases.
</p><p>
It might be convenient to use your built packages from inside the chroot.
It is possible to automate the task with the following configuration.
First, set up pbuilderrc to bindmount your build results directory.
</p><p>
</p><pre class="screen">BINDMOUNTS="/var/cache/pbuilder/result"
</pre><p>
</p><p>
Then, add the following hook
</p><p>
</p><pre class="screen">
# cat /var/cache/pbuilder/hooks/D70results
#!/bin/sh
cd /var/cache/pbuilder/result/
/usr/bin/dpkg-scanpackages . /dev/null > /var/cache/pbuilder/result/Packages
/usr/bin/apt-get update
</pre><p>
</p><p>
This way, you can use <code class="filename">deb file:/var/cache/pbuilder/result</code>
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id292590"></a>8.How to get pbuilder to run apt-get update before trying to satisfy build-dependency</h2></div></div></div><p>
You can use hook scripts for this.
D scripts are run before satisfying build-dependency.
</p><p>
<a href="http://lists.debian.org/debian-devel/2006/05/msg00550.html" target="_top">
This snippet comes from Ondrej Sury.
</a>
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id292611"></a>9.Different bash prompts inside pbuilder login</h2></div></div></div><p>
To make distinguishing bash prompts inside
<span><strong class="command">pbuilder</strong></span> easier, it is possible to set
environment variables such as PS1 inside
<code class="filename">pbuilderrc</code>
</p><p>
With versions of bash more recent than 2.05b-2-15,
the value of the debian_chroot variable, if set,
is included in the value of PS1 (the Bash prompt)
inside the chroot.
In prior versions of bash,<sup>[<a name="id292637" href="#ftn.id292637">3</a>]</sup>
setting PS1 in pbuilderrc worked.
</p><p>example of debian_chroot</p><pre class="screen">
export debian_chroot="pbuild$$"
</pre><p>example of PS1</p><pre class="screen">
export PS1="pbuild chroot 32165 # "
</pre></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id292666"></a>10.Using /var/cache/apt/archives for the package cache</h2></div></div></div><p>
For the help of low-bandwidth systems, it is possible to use
<code class="filename">/var/cache/apt/archives</code> as the package
cache. Just specify it instead of the default
<code class="filename">/var/cache/pbuilder/aptcache</code>.
</p><p>
It is however not possible to do so currently with the
user-mode-linux version of <span><strong class="command">pbuilder</strong></span>,
because <code class="filename">/var/cache/apt/archives</code> is
usually only writable by root.
</p><p>
Use of dedicated tools such as apt-proxy is recommended, since
caching of packages would benefit the system outside the scope
of <span><strong class="command">pbuilder</strong></span>.
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="stablebackport"></a>11.pbuilder back ported to stable Debian releases</h2></div></div></div><p>
Currently stable back port of pbuilder is avialable at backports.org.
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="LOGNAME"></a>12.Warning about LOGNAME not being defined</h2></div></div></div><p>
You might see a lot of warning messages when running <span><strong class="command">pbuilder</strong></span>.
</p><p>
</p><pre class="screen">
dpkg-genchanges: warning: no utmp entry available and LOGNAME not defined; using uid of process (1234)
</pre><p>
</p><p>
It is currently safe to ignore this warning message. Please
report back if you find any problem with having LOGNAME unset.
Setting LOGNAME caused a few problems when invoking
<span><strong class="command">chroot</strong></span>.
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="nobuildconflictessential"></a>13.Cannot Build-conflict against an essential package</h2></div></div></div><p>
<span><strong class="command">pbuilder</strong></span> does not currently allow Build-Conflicts against
essential packages.
It should be obvious that essential packages should not be
removed from a working Debian system, and a source
package should not try to force removal of such packages
on people building the package.
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id292793"></a>14.Avoiding the "ln: Invalid cross-device link" message</h2></div></div></div><p>
By default, <span><strong class="command">pbuilder</strong></span> uses hard links to
manage the <span><strong class="command">pbuilder</strong></span> package cache. It is
not possible to make hard links across different devices; and
thus this error will occur, depending on your set up. If this
happens, set </p><pre class="screen">APTCACHEHARDLINK=no</pre><p> in your
pbuilderrc file.
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id292822"></a>15.Using fakechroot</h2></div></div></div><p>
It is possible to use <span><strong class="command">fakechroot</strong></span> instead of
being root to run <span><strong class="command">pbuilder</strong></span>; however,
several things make this impractical.
<span><strong class="command">fakechroot</strong></span> overrides library loads and
tries to override default libc functions when providing the
functionality of virtual <span><strong class="command">chroot</strong></span>. However,
some binaries do no use libc to function, or override the
overriding provided by <span><strong class="command">fakechroot</strong></span>. One
example is <span><strong class="command">ldd</strong></span>. Inside
<span><strong class="command">fakechroot</strong></span>, <span><strong class="command">ldd</strong></span> will
check the library dependency outside of the chroot, which is
not the expected behaviour.
</p><p>
To work around the problem, debootstrap has a
<code class="option">--variant fakechroot</code> option. Use that, so
that ldd and ldconfig are overridden.
</p><p>
Make sure you have set your LD_PRELOAD path correctly, as described in
the fakechroot manpage.
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="debconfinsidepbuilder"></a>16.Using debconf inside pbuilder sessions</h2></div></div></div><p>
To use debconf inside <span><strong class="command">pbuilder</strong></span>, setting DEBIAN_FRONTEND to
“<span class="quote">readline</span>” in <code class="filename">pbuilderrc</code> should work.
Setting it to “<span class="quote">dialog</span>” should also work, but make sure
whiptail or dialog is installed inside the chroot.
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="nodev"></a>17.nodev mount options hinder pbuilder activity</h2></div></div></div><p>
If you see messages such as this when building a chroot, you are mounting the file system with
the nodev option.
</p><pre class="screen">
/var/lib/dpkg/info/base-files.postinst: /dev/null: Permission denied
</pre><p>
You will also have problems if you mount the file system with
the noexec option, or nosuid.
Make sure you do not have these flags set when mounting the file system for
<code class="filename">/var/cache/pbuilder</code> or $BUILDPLACE.
</p><p>
This is not a problem when using <span><strong class="command">user-mode-linux</strong></span>.
</p><p>
See <a href="http://bugs.debian.org/316135" target="_top">
316135
</a> for example.
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="faqslowpbuilder"></a>18.pbuilder is slow</h2></div></div></div><p>
<span><strong class="command">pbuilder</strong></span> is often slow. The slowest part of
<span><strong class="command">pbuilder</strong></span> is extracting the tar.gz every
time <span><strong class="command">pbuilder</strong></span> is invoked. That can be
avoided by using <span><strong class="command">pbuilder-user-mode-linux</strong></span>.
<span><strong class="command">pbuilder-user-mode-linux</strong></span> uses COW file
system, and thus does not need to clean up and recreate the
root file system.
</p><p>
<span><strong class="command">pbuilder-user-mode-linux</strong></span> is slower in
executing the actual build system, due to the usual
<span><strong class="command">user-mode-linux</strong></span> overhead for system
calls. It is more friendly to the hard drive.
</p><p>
<span><strong class="command">pbuilder</strong></span> with cowdancer is also an
alternative that improves speed of pbuilder startup.
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="chrootmemo"></a>19.Creating a chroot reminder</h2></div></div></div><p>
You may want a sign that you are inside a chroot, when working
with chroot. Check out the
<code class="filename">examples/F90chrootmemo</code> hook script. It
will create a file called <code class="filename">/CHROOT</code> inside
your chroot.
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sponsor"></a>20.Using pdebuild to sponsor package</h2></div></div></div><p>
To sign a package marking for sponsorship, it is possible to
use<span><strong class="command"><code class="option"> --auto-debsign</code></strong></span> and
<span><strong class="command"><code class="option">--debsign-k</code></strong></span> options of
<span><strong class="command">pdebuild</strong></span>.
</p><pre class="screen">
<span><strong class="command">pdebuild <code class="option">--auto-debsign </code> <code class="option">--debsign-k </code><em class="parameter"><code>XXXXXXXX</code></em></strong></span>
</pre></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sourcechanges"></a>21.Why is there a source.changes file in ../?</h2></div></div></div><p>
When running <span><strong class="command">pdebuild</strong></span>, <span><strong class="command">pbuilder</strong></span> will run dpkg-buildpackage to create a
Debian source package to pass it on to <span><strong class="command">pbuilder</strong></span>.
File named XXXX_YYY_source.changes is what remains from that process.
It is harmless unless you try to upload it to the Debian archive.
</p><p>
This behaviour is different when running through <code class="option">--use-pdebuild-internal</code>
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="amd64i386"></a>22.amd64 and i386-mode</h2></div></div></div><p>
amd64 architectures are capable of running binaries in i386
mode. It is possible to use <span><strong class="command">pbuilder</strong></span> to
run packages, using <span><strong class="command">linux32</strong></span> and
<span><strong class="command">debootstrap <code class="option">--arch</code></strong></span> option.
Specifically, a command-line option like the following will
work.
</p><p>
</p><pre class="screen">
<span><strong class="command">pbuilder create --distribution sid --debootstrapopts --arch --debootstrapopts i386 \
--basetgz /var/cache/pbuilder/base-i386.tgz --mirror http://ftp.jp.debian.org/debian</strong></span>
<span><strong class="command">linux32 pbuilder build --basetgz /var/cache/pbuilder/base-i386.tgz</strong></span>
</pre><p>
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="ccache"></a>23.How to use ccache</h2></div></div></div><p>
To use <span><strong class="command">ccache</strong></span> with
<span><strong class="command">pbuilder</strong></span>, use the following for
configuration. Note that the directory used for CCACHE_DIR
needs to exist, and be writable by user within <span><strong class="command">chroot</strong></span>. The
default user within <span><strong class="command">chroot</strong></span> is </p><pre class="screen">uid=1234</pre><p>.
</p><pre class="screen">
export CCACHE_DIR="/var/cache/pbuilder/ccache"
export PATH="/usr/lib/ccache:${PATH}"
EXTRAPACKAGES=ccache
BINDMOUNTS="${CCACHE_DIR}"
</pre><p>
<a href="http://web.glandium.org/blog/?p=55" target="_top">This entry created thanks to a blog posting.
</a>
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="tmpfsforpbuilder"></a>24.Using tmpfs for buildplace</h2></div></div></div><p>
To improve speed of operation, it is possible to use tmpfs for
pbuilder build location. Mount tmpfs to
<code class="filename">/var/cache/pbuilder/build</code>, and set
</p><pre class="screen">APTCACHEHARDLINK=no</pre><p>.
</p></div><div class="footnotes"><br><hr width="100" align="left"><div class="footnote"><p><sup>[<a name="ftn.id292637" href="#id292637">3</a>] </sup>Versions of bash from and before Debian 3.0</p></div></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="develanddebug"></a>Chapter5.Troubleshooting and development</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="#bugreport">1. Reporting bugs </a></span></dt><dt><span class="sect1"><a href="#mailinglist">2. Mailing list</a></span></dt><dt><span class="sect1"><a href="#IRCchannel">3. IRC Channel</a></span></dt><dt><span class="sect1"><a href="#development">4. Information for pbuilder developers</a></span></dt></dl></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="bugreport"></a>1.Reporting bugs </h2></div></div></div><p>
To report bugs, it would be important to have a log of what's
going wrong. Most of the time, adding a
<span><strong class="command"><code class="option">--debug</code></strong></span> option and
re-running the session should do the trick. Please send the
log of such session along with your problem to ease the
debugging process.
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="mailinglist"></a>2.Mailing list</h2></div></div></div><p>
There is a mailing list for <span><strong class="command">pbuilder</strong></span> on
alioth (pbuilder-maint@lists.alioth.debian.org). You can
subscribe through the alioth web interface.
<a href="http://alioth.debian.org/mail/?group_id=30778" target="_top">
http://alioth.debian.org/mail/?group_id=30778</a>.
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="IRCchannel"></a>3.IRC Channel</h2></div></div></div><p>
For coordination and communication,
IRC channel #pbuilder on irc.oftc.net is used.
Please log your intent there when you are going to
start doing some changes and committing some change.
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="development"></a>4.Information for pbuilder developers</h2></div></div></div><p>
This section tries to document current development practices
and how things generally operate in development.
</p><p>
<span><strong class="command">pbuilder</strong></span> is now co-maintained at alioth.
There is an alioth project page at
<a href="http://alioth.debian.org/projects/pbuilder" target="_top">
http://alioth.debian.org/projects/pbuilder</a>.
CVS Repository is available through anonymous CVS
</p><pre class="screen">
cvs -d:pserver:anonymous@cvs.alioth.debian.org:/cvsroot/pbuilder login
cvs -z3 -d:pserver:anonymous@cvs.alioth.debian.org:/cvsroot/pbuilder co pbuilder
</pre><p>
Test-suites are available in <code class="filename">./testsuite/</code> directory.
Changes are expected not to break the test-suites.
<code class="filename">./run-test.sh</code> is a basic test-suite, which puts a summary in
<code class="filename">run-test.log</code>, and <code class="filename">run-test-cdebootstrap.log</code>.
<code class="filename">./run-test-regression.sh</code> is a regression test-suite,
which puts the result in <code class="filename">run-test-regression.log</code>.
Currently, run-test.sh is ran automatically daily to ensure that pbuilder is working.
</p><div class="table"><a name="id293472"></a><p class="title"><b>Table5.1.Directory structure of the testsuite</b></p><div class="table-contents"><table summary="Directory structure of the testsuite" border="1"><colgroup><col align="left"><col align="left"></colgroup><thead><tr><th align="left">Directory</th><th align="left">Meaning</th></tr></thead><tbody><tr><td align="left"><code class="filename">./testsuite/</code></td><td align="left">Directory for testsuite</td></tr><tr><td align="left"><code class="filename">./testsuite/run-test.sh</code></td><td align="left">Daily regression test to test against Debian Archive changes breaking pbuilder.</td></tr><tr><td align="left"><code class="filename">./testsuite/run-test.log</code></td><td align="left">A summary of testsuite</td></tr><tr><td align="left"><code class="filename">./testsuite/normal/</code></td><td align="left">Directory for testsuite results of running pbuilder with debootstrap</td></tr><tr><td align="left"><code class="filename">./testsuite/cdebootstrap/</code></td><td align="left">Directory for testsuite results of running pbuilder with cdebootstrap</td></tr><tr><td align="left"><code class="filename">./testsuite/run-regression.sh</code></td><td align="left">Regression testsuite, ran every time change is made to pbuilder to make sure there is no regression.</td></tr><tr><td align="left"><code class="filename">./testsuite/run-regression.log</code></td><td align="left">Summary of test result</td></tr><tr><td align="left"><code class="filename">./testsuite/regression/BugID-*.sh</code></td><td align="left">Regression tests, exit 0 for success, exit 1 for failure</td></tr><tr><td align="left"><code class="filename">./testsuite/regression/BugID-*</code></td><td align="left">Files used for the regression testsuite.</td></tr><tr><td align="left"><code class="filename">./testsuite/regression/log/BugID-*.sh.log</code></td><td align="left">Output of the regression test, output from the script is redirected by run-regression.sh</td></tr></tbody></table></div></div><br class="table-break"><p>
When making changes, a description of the change targeted at
developers should be documented in
<code class="filename">ChangeLog</code><sup>[<a name="id293669" href="#ftn.id293669">4</a>]</sup>, and committed. A brief
summary of the change targeting end users should be documented
in <code class="filename">debian/changelog</code>, so that users can
see them.
It is important to note that the description of
<code class="filename">debian/changelog</code> is targeted at users,
and <code class="filename">ChangeLog</code> is targeted at developers.
For CVS commit messages, a cut-n-paste of
<code class="filename">ChangeLog</code> diff should be enough.
</p><p>
A TODO file is available in <code class="filename">debian/TODO</code>.
It's mostly not well-maintained, but hopefully it will be more
up-to-date when people start using it. emacs todoo-mode is
used in editing the file.
</p><p>
When releasing a new version of <span><strong class="command">pbuilder</strong></span>,
the version is tagged with the cvs tag
releaseX_XXX.
</p></div><div class="footnotes"><br><hr width="100" align="left"><div class="footnote"><p><sup>[<a name="ftn.id293669" href="#id293669">4</a>] </sup>ChangeLog is edited using emacs ChangeLog mode.</p></div></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="otheruse"></a>Chapter6.Other uses of pbuilder</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="#chroot">1. Using pbuilder for small experiments</a></span></dt><dt><span class="sect1"><a href="#id293780">2. Running little programs inside the chroot</a></span></dt></dl></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="chroot"></a>1.Using pbuilder for small experiments</h2></div></div></div><p>
There are cases when some small experimenting is required, and
you do not want to damage the main system,
like when installing experimental library packages,
or compiling with experimental compilers.
For such cases, the <span><strong class="command">pbuilder login</strong></span> command is available.
</p><p>
<span><strong class="command">pbuilder login </strong></span> is a debugging feature for
<span><strong class="command">pbuilder</strong></span> itself, but it also allows users to have a temporary chroot.
</p><p>
Note that the chroot is cleaned after logging out of the shell,
and mounting file systems inside it is considered harmful.
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id293780"></a>2.Running little programs inside the chroot</h2></div></div></div><p>
To facilitate using <span><strong class="command">pbuilder</strong></span> for other uses,
<span><strong class="command">pbuilder execute</strong></span> is available.
<span><strong class="command">pbuilder execute </strong></span> will take a script
specified in the command-line argument, and
invoke the script inside the chroot.
</p><p>
The script can be useful for sequences of operations such as
installing ssh and adding a new user inside the chroot.
</p></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="experimental"></a>Chapter7.Experimental or wish-list features of pbuilder</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="#lvm">1. Using LVM</a></span></dt><dt><span class="sect1"><a href="#cowdancer">2. Using cowdancer</a></span></dt><dd><dl><dt><span class="sect2"><a href="#sargecowdancer">2.1. Using cowdancer for sarge</a></span></dt></dl></dd><dt><span class="sect1"><a href="#withouttargz">3. Using pbuilder without tar.gz</a></span></dt></dl></div><p>
There are some advanced features, above that of the
basic feature of <span><strong class="command">pbuilder</strong></span>, for some specific purposes.
</p><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="lvm"></a>1.Using LVM</h2></div></div></div><p>
LVM2 has a useful snapshot function that features Copy-on-write images.
That could be used for <span><strong class="command">pbuilder</strong></span> just as it can be used for
the user-mode-linux <span><strong class="command">pbuilder</strong></span> port.
It may prove to be faster, but it is not implemented yet,
and so no measurement has been made, yet.
</p><p>
<span><strong class="command">User-mode-linux</strong></span> cow support has been
preferred for <span><strong class="command">pbuilder-user-mode-linux</strong></span>, but
the idea of using LVM is interesting.
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="cowdancer"></a>2.Using cowdancer</h2></div></div></div><p>
<span><strong class="command">cowdancer</strong></span> allows copy-on-write semantics on
file system using hard links and hard-link-breaking-on-write
tricks. <span><strong class="command">pbuilder</strong></span> using
<span><strong class="command">cowdancer</strong></span> seems to be much faster and it is
one ideal point for improvement.
<span><strong class="command">cowbuilder</strong></span>, a wrapper for
<span><strong class="command">pbuilder</strong></span> for using
<span><strong class="command">cowdancer</strong></span> is available from
<span><strong class="command">cowdancer</strong></span> package since 0.14
</p><p>
Example command-lines for cowbuilder look like the following.
</p><p>
</p><pre class="screen">
# cowbuilder --create --distribution sid
# cowbuilder --update --distribution sid
# cowbuilder --build XXX.dsc
</pre><p>
</p><p>
It is also possible to use cowdancer with pdebuild command.
Specify with command-line option <code class="option">--pbuilder</code>
or set it in PDEBUILD_PBUILDER configuration option.
</p><p>
</p><pre class="screen">
$ pdebuild --pbuilder cowbuilder
</pre><p>
</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sargecowdancer"></a>2.1.Using cowdancer for sarge</h3></div></div></div><p>
cowdancer was introduced after the release of sarge; if you want to
build packages for sarge with cowbuilder, you will need to workaround
its unavailability.
</p><p>
One way to workaround the problem is to set APTCONFDIR in pbuilderrc
to point to a directory with a list of sources for APT which has both
sarge and sarge-backports.
</p><p>
</p><pre class="screen">
$ cat sources.list
# sarge-backports
deb http://www.backports.org/debian sarge-backports main
deb-src http://www.backports.org/debian sarge-backports main
# sarge
deb http://ftp.de.debian.org/debian sarge main
deb-src http://ftp.de.debian.org/debian sarge main
</pre><p>
</p><p>
It is recommended to "Pin" the cowdancer package appropriately in
this case, via the APT preferences mechanism.
</p><p>
</p><pre class="screen">
$ cat preferences
Explanation: use cowdancer from backports
Package: cowdancer
Pin: release a=sarge-backports
Pin-Priority: 950
</pre><p>
</p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="withouttargz"></a>3.Using pbuilder without tar.gz</h2></div></div></div><p>
The <span><strong class="command"><code class="option">--no-targz</code></strong></span>
option of <span><strong class="command">pbuilder</strong></span>
will allow usage of <span><strong class="command">pbuilder</strong></span> in a different way
from conventional usage.
It will try to use an existing chroot,
and will not try to clean up after
working on it.
It is an operation mode more like
<span><strong class="command">sbuild</strong></span>.
</p><p>
It should be possible to create chroot images
for <span><strong class="command">dchroot</strong></span> with the following commands:
</p><pre class="screen">
# pbuilder create --distribution sarge --no-targz --basetgz /chroot/sarge
# pbuilder create --distribution etch --no-targz --basetgz /chroot/etch
# pbuilder create --distribution sid --no-targz --basetgz /chroot/sid
</pre><p>
</p></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="refs"></a>Chapter8.Reference materials</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="#dirstructoutside">1. Directory structure outside the chroot</a></span></dt><dt><span class="sect1"><a href="#dirstructinside">2. Directory structure inside the chroot</a></span></dt></dl></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="dirstructoutside"></a>1.Directory structure outside the chroot</h2></div></div></div><div class="table"><a name="id294087"></a><p class="title"><b>Table8.1.Directory Structure outside the chroot </b></p><div class="table-contents"><table summary="Directory Structure outside the chroot " border="1"><colgroup><col align="left"><col align="left"></colgroup><thead><tr><th align="left">Directory</th><th align="left">Meaning</th></tr></thead><tbody><tr><td align="left"><code class="filename">/etc/pbuilderrc</code></td><td align="left">configuration file</td></tr><tr><td align="left"><code class="filename">/usr/share/pbuilder/pbuilderrc</code></td><td align="left">Default configuration</td></tr><tr><td align="left"><code class="filename">/var/cache/pbuilder/base.tgz</code></td><td align="left">Default location pbuilder uses for base.tgz, the tar-ball containing a basic Debian installation
with only the build-essential packages.
</td></tr><tr><td align="left"><code class="filename">/var/cache/pbuilder/build/PID/</code></td><td align="left">Default location pbuilder uses for chroot</td></tr><tr><td align="left"><code class="filename">/var/cache/pbuilder/aptcache</code></td><td align="left">Default location <span><strong class="command">pbuilder</strong></span> will use as apt cache, to store deb packages required during <span><strong class="command">pbuilder</strong></span> build.</td></tr><tr><td align="left"><code class="filename">/var/cache/pbuilder/result</code></td><td align="left">Default location <span><strong class="command">pbuilder</strong></span> puts the deb files and other files created after build</td></tr><tr><td align="left"><code class="filename">/var/cache/pbuilder/pbuilder-umlresult</code></td><td align="left">Default location <span><strong class="command">pbuilder-user-mode-linux</strong></span> puts the deb files and other files created after build </td></tr><tr><td align="left"><code class="filename">/var/cache/pbuilder/pbuilder-mnt</code></td><td align="left">Default location <span><strong class="command">pbuilder-user-mode-linux</strong></span> uses for mounting the COW file system, for chrooting.</td></tr><tr><td align="left"><code class="filename">/tmp</code></td><td align="left"><span><strong class="command">pbuilder-user-mode-linux</strong></span> will mount tmpfs for work.</td></tr><tr><td align="left"><code class="filename">${HOME}/tmp/PID.cow</code></td><td align="left"><span><strong class="command">pbuilder-user-mode-linux</strong></span> use this directory for location of COW file system.</td></tr><tr><td align="left"><code class="filename">${HOME}/uml-image</code></td><td align="left"><span><strong class="command">pbuilder-user-mode-linux</strong></span> use this directory for user-mode-linux full disk image.</td></tr></tbody></table></div></div><br class="table-break"></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="dirstructinside"></a>2.Directory structure inside the chroot</h2></div></div></div><div class="table"><a name="id294344"></a><p class="title"><b>Table8.2.Directory Structure inside the chroot </b></p><div class="table-contents"><table summary="Directory Structure inside the chroot " border="1"><colgroup><col align="left"><col align="left"></colgroup><thead><tr><th align="left">Directory</th><th align="left">Meaning</th></tr></thead><tbody><tr><td align="left"><code class="filename">/etc/mtab</code></td><td align="left">
symlink to <code class="filename">/proc/mounts</code>.
</td></tr><tr><td align="left"><code class="filename">/tmp/buildd</code></td><td align="left">Default place used in <span><strong class="command">pbuilder</strong></span>
to place the Debian package to be processed.
<code class="filename">/tmp/buildd/packagename-version/</code>
will be the root directory of the package being
processed. HOME environment variable is set to this
value inside chroot by pbuilder-buildpackage
</td></tr><tr><td align="left"><code class="filename">/run</code></td><td align="left">The script passwd as an argument to <span><strong class="command">pbuilder</strong></span> execute
is passed on.
</td></tr><tr><td align="left"><code class="filename">/tmp/hooks</code></td><td align="left">
The location of hooks.
</td></tr><tr><td align="left"><code class="filename">/var/cache/apt/archives</code></td><td align="left">
<span><strong class="command">pbuilder</strong></span> copies the content of this directory to and from
the aptcache directory of outside chroot.
</td></tr><tr><td align="left"><code class="filename">/tmp/XXXX</code></td><td align="left"><span><strong class="command">pbuilder-user-mode-linux</strong></span> uses
a script in <code class="filename">/tmp</code> to bootstrap into
user-mode-linux</td></tr></tbody></table></div></div><br class="table-break"></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="id294520"></a>Chapter9.Minor archaeological details</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="#id294526">1. Documentation history </a></span></dt><dt><span class="sect1"><a href="#pbuilderbackgroundhistory">2. Possibly inaccurate Background History of pbuilder</a></span></dt><dd><dl><dt><span class="sect2"><a href="#id294628">2.1. The Time Before pbuilder</a></span></dt><dt><span class="sect2"><a href="#birth">2.2. Birth of pbuilder</a></span></dt><dt><span class="sect2"><a href="#secondyear">2.3. And the second year of its life</a></span></dt><dt><span class="sect2"><a href="#fifthyear">2.4. Fifth year of pbuilder</a></span></dt></dl></dd></dl></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id294526"></a>1.Documentation history </h2></div></div></div><p>
This document was started on 28 Dec 2002 by
Junichi Uekawa, trying to document what is known
about <span><strong class="command">pbuilder</strong></span>.
</p><p>
This documentation is available from the <span><strong class="command">pbuilder</strong></span> source tar-ball,
and from the CVS repository of <span><strong class="command">pbuilder</strong></span> (web-based access is possible).
A copy of this documentation can be found on the
<a href="http://pbuilder.alioth.debian.org/pbuilder-doc.html" target="_top">Alioth project page for pbuilder</a>.
<a href="http://pbuilder.alioth.debian.org/pbuilder-doc.pdf" target="_top">There is also a PDF version</a>.
The homepage for <span><strong class="command">pbuilder</strong></span> is
<a href="http://www.netfort.gr.jp/~dancer/software/pbuilder.html" target="_top">
http://www.netfort.gr.jp/~dancer/software/pbuilder.html
</a>
The project has moved its hosting to alioth project since 4 Sep 2005.
It is available
<a href="http://pbuilder.alioth.debian.org/" target="_top">
http://pbuilder.alioth.debian.org/
</a>
</p><p>
Documentation is written using DocBook XML,
with emacs PSGML mode, and using wysidocbookxml for live
previewing.
</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="pbuilderbackgroundhistory"></a>2.Possibly inaccurate Background History of pbuilder</h2></div></div></div><p>
The following is a most possibly inaccurate account of how
<span><strong class="command">pbuilder</strong></span> came to happen, and other attempts to
make something like <span><strong class="command">pbuilder</strong></span> happen.
This part of the document was originally in the AUTHORS file,
to give credit to those who existed before <span><strong class="command">pbuilder</strong></span>.
</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id294628"></a>2.1.The Time Before pbuilder</h3></div></div></div><p>
There was once dbuild, which was a shell script to build
Debian packages from source. Lars Wirzenius wrote that
script, and it was good, short, and simple (probably).
There was nothing like build-depends then (I think), and it was simple.
It could have been improved, I could only find references and no actual source.
</p><p>
debbuild was probably written by James Troup. I don't know it
because I have never seen the actual code, I could only find some
references to it on the net, and mailing list logs.
</p><p>
sbuild is a perl script to build Debian packages from source.
It parses Build-Depends, and performs other miscellaneous checks,
and has a lot of hacks to actually get things building,
including a table of what package to use when virtual packages are
specified (does it do that still?).
It supports the use of a local database for packages which do not
have build-dependencies. It was written by Ronan Hodek,
and I think it was patched and fixed and extended by
several people. It is part of wanna-build, and used extensively
in the Debian buildd system. I think it was maintained
mostly by Ryan Murray.
</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="birth"></a>2.2.Birth of pbuilder</h3></div></div></div><p>
wanna-build (sbuild) was (at the time of year 2001) quite
difficult to set up, and it was never a Debian
package. dbuild was something that predated Build-Depends.
</p><p>
Building packages from source using Build-Depends
information within a chroot sounded trivial; and
<span><strong class="command">pbuilder</strong></span> was born. It was initially a shell script
with only a few lines, which called debootstrap
and chroot and dpkg-buildpackage in the same run,
but soon, it was decided that that's too slow.
</p><p>
Yes, and it took almost an year to get things somewhat
right, and in the middle of the process, Debian 3.0
was released. Yay.
Debian 3.0 wasn't completely buildable with <span><strong class="command">pbuilder</strong></span>,
but the amount of packages which are not buildable
is steadily decreasing. (I hope)
</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="secondyear"></a>2.3.And the second year of its life</h3></div></div></div><p>
Someone wanted <span><strong class="command">pbuilder</strong></span> to not run as
root, and as User-mode-linux has become more useful as time
passed, I've started experimenting with
<span><strong class="command">pbuilder-user-mode-linux</strong></span>.
<span><strong class="command">pbuilder-user-mode-linux</strong></span> has not stayed
functional as much as I would have liked, and bootstrapping
<span><strong class="command">user-mode-linux</strong></span> environment has been
pretty hard, due to the quality of user-mode-linux code or
packaging at that time, which kept on breaking network
support in one way or the other.
</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="fifthyear"></a>2.4.Fifth year of pbuilder</h3></div></div></div><p>
<span><strong class="command">pbuilder</strong></span> is now widely adopted as a 'almost standard' tool
for testing packages, and building packages in a pristine
environment. There are other similar tools that do similar
tasks, but they do not share the exact same goal. To
commemorate this fact, <span><strong class="command">pbuilder</strong></span> is now co-maintained with
several people.
</p><p>
<span><strong class="command">sbuild</strong></span> is now a well-maintained Debian package within
Debian, and with <span><strong class="command">pbuilder</strong></span> being such a slow monster, some
people prefer the approach of sbuild. Development to use
LVM-snapshots, cowloop, or cowdancer is hoped to improve the
situation somewhat.
</p></div></div></div></div></body></html>
|