aboutsummaryrefslogtreecommitdiff
path: root/Documentation/pbuilder-doc.xml
blob: bc3617032841e09de35205d579bd0790f669113b (plain)
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
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "docbookx.dtd"> 
<!-- the original of this documentation is in pbuilder source tar-ball -->
<book>
  <bookinfo>
    <date>2003-03-01</date>
    <title>pbuilder User's Manual</title>
    <abbrev>pbuilder-doc</abbrev>
    <subtitle>Usage and operations</subtitle>
    <releaseinfo>documentation in progress</releaseinfo>
    <authorgroup>
      <author>
	<firstname>Junichi</firstname>
	<surname>Uekawa</surname>
      </author>
    </authorgroup>
  </bookinfo>
  <chapter>
    <title>Introducing pbuilder</title>
    <sect1 id="aim">
      <title>Aims of pbuilder</title>
      <para>
	<command>pbuilder</command> stands for 
	Personal Builder, and it is a automatic Debian Package Building system
	for personal environments.
	<command>pbuilder</command> 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.
	Clean-room environment is achieved through use of a chroot image,
	so that only minimal packages will be installed inside the
	chroot.
      </para>
      <para>
	Debian distribution consists of free software
	accompanied with source.
	The source code within Debian "main" section
	must build within Debian "main",
	with only the explicitly specified build-dependencies
	installed.
      </para>
      <para>
	The aim of pbuilder is very different from other 
	auto-building systems in that its aim is not in trying to build
	as many packages. It does not try to guess
	what a package needs, and in most cases it tries the
	worst choice of all if there was a choice to be made.
      </para>
      <para>
	In this way, <command>pbuilder</command> tries to ensure 
	that packages 
	tested against pbuilder will build in 
	most Debian environments, hopefully resulting
	in a good overall Debian source-buildability.
      </para>
      <para>
	The goal of making Debian buildable from source is 
	somewhat achieved, and has progressed well.
	It is known that Debian 3.0 is not quite 
	buildable from source, but the next version should 
	be better.
      </para>
    </sect1>
  </chapter>
  <chapter id="usingpbuilder">
    <title>Using pbuilder</title>
    <sect1 id="creatingbase">
      <title>Creating base chroot image</title>
      <para>
	<command>pbuilder create</command>
	will create base chroot image.
	Distribution code-name needs to be specified with 
	<command><option>--distribution</option></command>
	command-line option.
	Usually, "sid" is the proper distribution.
      </para>
      <para>
	<command>debootstrap</command> is used to create 
	the bare minimum Debian installation, 
	and then build-essential packages are installed on top 
	of the minimum installation using <command>apt-get</command> 
	inside the chroot.
      </para>
      <para>
	For fuller documentation of command-line options, see
	pbuilder.8 manual page.
	Some configuration will be required for <filename>/etc/pbuilderrc</filename>
	for the mirror site
	<footnote>
	  <para>
	    The mirror site should preferably a local one,
	    to not to overload the public mirrors with
	    a lot of access.
	  </para>
	</footnote>
	to use, and proxy configuration is probably required to allow access
	through HTTP.
	See pbuilderrc.5 manual page for details.
      </para>
    </sect1>
    <sect1>
      <title>Updating base chroot image</title>
      <para><command>pbuilder update</command>
	will update the chroot image.
	It will extract the chroot, invoke <command>apt-get update</command>
	and <command>apt-get dist-upgrade</command> inside the 
	chroot, and then recreate the base tarball.
      </para>
      <para>
	It is possible to switch the distribution which the chroot 
	tarball is targeted at at this point.
	Specify <command><option>--distribution <parameter>sid</parameter></option> <option>--override-config</option></command> to change the distribution
	to sid.
	<footnote>
	  <para>However, only upgrading is really supported.</para>
	</footnote>
      </para>
      <para>
	For fuller documentation of command-line options, see
	pbuilder.8 manual page
      </para>
    </sect1>
    <sect1 id="buildpackagechroot">
      <title>Building a package using chroot image</title>
      <para>
	To build a package inside the chroot, invoke
	<command>pbuilder build <option>whatever.dsc</option></command>.
	<command>pbuilder</command> will extract 
	chroot image to a temporal working directory,
	and satisfy the build-dependency inside the chroot,
	and build the package.
	The built packages will be moved to a 
	directory specified with 
	<command><option>--buildresult</option></command>
	command-line option.
      </para>
      <para>
	<command><option>--basetgz</option></command> option can be 
	used to specify which chroot image to use.
      </para>
      <para>
	<command>pbuilder</command> will extract a fresh chroot image
	created with <command>pbuilder build</command>
	and updated with <command>pbuilder update</command>,
	and populate the chroot with build-dependency by parsing 
	debian/control and invoking <command>apt-get</command>.
      </para>
      <para>
	For fuller documentation of command-line options, see
	pbuilder.8 manual page
      </para>
    </sect1>
    <sect1 id="pdebuild">
      <title>Facilitating Debian Developers from typing, pdebuild</title>
      <para>
	<command>pdebuild</command> is a little wrapper 
	script that does the most frequent of all tasks.
	A Debian Developer may try to do <command>debuild</command>, and 
	build a package, inside a Debian source directory.
	<command>pdebuild</command> 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.
      </para>
      <para>
	<command>pdebuild</command> calls <command>dpkg-source</command>
	to build the source packages, and then invoke
	<command>pbuilder</command> on the resulting source package.
	However, unlike debuild, the resulting deb files will be
	found somewhere in BUILDRESULT directory.
      </para>
      <para>
	See pdebuild.1 manual page for more details.
      </para>
    </sect1>
    <sect1 id="configfile">
      <title>Configuration Files</title>
      <para>
	It is possible to specify all settings by command-line
	option. However, for convenience it is possible to 
	use a configuration file.
      </para>
      <para>
	<filename>/etc/pbuilderrc</filename> and 
	<filename>${HOME}/.pbuilderrc</filename>
	are read in when pbuilder is invoked.
	The possible options are documented in 
	pbuilderrc.5 documentation.
      </para>
      <para>
	It is useful when switching between configuration files for 
	different distributions.
      </para>
    </sect1>
    <sect1 id="nonrootchroot">
      <title>Building packages as non-root inside the chroot</title>
      <para>
	<command>pbuilder</command> requires full root privilege 
	when it is satisfying the build-dependency but most packages do not 
	need root privilege, or even do not build when they are root.
	<command>pbuilder </command> can create a user only used 
	inside <command>pbuilder </command> and use that user id when
	building, and use <command>fakeroot</command> command
	when root privilege is required.
      </para>
      <para>
	BUILDUSERID needs should be set to a value for a user id that
	does not exist on the system, so that it is harder for 
	packages that are being built with 
	<command>pbuilder</command> to do harm to the main system.
	BUILDUSERNAME needs to be set to some value, and 
	pbuilder will use that user id and use fakeroot for building.
      </para>
      <para>
	Using the fakerooting method, pbuilder will run with 
	root privilege when it is required, when installing
	packages to the chroot.
      </para>
      <para>
	To be able to invoke pbuilder without being 
	root, you need to use user-mode-linux, as explained
	in <xref linkend="pbuilder-uml"/>.
      </para>
    </sect1>
    <sect1 id="backporting">
      <title>Using pbuilder for back-porting</title>
      <para>
	pbuilder can be used for back-porting software from 
	the latest Debian distribution to 
	older stable distribution, by using a chroot that contains
	image of 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:
      </para>
      <itemizedlist>
	<listitem>
	  <para>Build-Dependency in stable may not be enough to build a package in unstable distribution, so package may need more than what exists in stable</para>
	</listitem>
	<listitem>
	  <para>Stable distribution may have bugs that have been fixed in unstable that needs to be worked around.</para></listitem>
	<listitem>
	  <para>Package in unstable distribution may have problem building even for unstable.</para>
	</listitem>
      </itemizedlist>
    </sect1>
    <sect1 id="massbuild">
      <title>Mass-building packages</title>
      <para>
	pbuilder can be automated, because its operations are
	non-interactive.
	It is possible to run pbuilder through multiple packages 
	non-interactively.
	There are several such scripts known to exist.
	Junichi Uekawa has been running such script since 2001,
	and has been filing bugs on packages that fail the 
	test of pbuilder. There were several problems with auto-building:
      </para>
      <itemizedlist>
	<listitem>
	  <para>Build-Dependency needs to install non-interactively, but 
	    some packages are so broken that they cannot install 
	    without interaction (like postgresql)</para>
	</listitem>
	<listitem>
	  <para>When a library package breaks, or gcc/gcj/g++ breaks, 
	    or even bison, a large number of build failure are reported.
	    (gcj-3.0 which had no "javac", bison which got more strict, etc.)
	  </para>
	</listitem>
	<listitem>
	  <para>Some people were quite hostile against build failure reports.</para>
	</listitem>
      </itemizedlist>
      <para>
	But most of these problems are now getting solved.
	Only about 10% of Debian now fail to build from source (29 Dec 2002).
      </para>
      <para>
	A script that was used by Junichi Uekawa is now included in 
	pbuilder distribution, as <command>pbuildd.sh</command>.
	It is available in <filename>/usr/share/doc/pbuilder/examples/pbuildd/</filename>
	and its configuration is in <filename>/etc/pbuilder/pbuildd-config.sh</filename>.
	It should be easy enough to set up for people who are used to 
	pbuilder. 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.
      </para>
      <para>
	To set up pbuildd, there are some points to be aware of.
      </para>
      <itemizedlist>
	<listitem>
	  <para>A file <filename>./avoidlist</filename> needs to be available with the list of packages to avoid building. </para>
	</listitem>
	<listitem>
	  <para>It will try building anything, even packages that are not aimed for your architecture</para>
	</listitem>
	<listitem>
	  <para>Because you are running random build scripts, it is better to use 
	  fakeroot option of pbuilder, to avoid running build in root privilege</para>
	</listitem>
	<listitem>
	  <para>Because not all builds are guaranteed to finish in a finite time,
	    setting timeout is probably necessary, or build may stall with
	    a bad build</para>
	</listitem>
	<listitem>
	  <para>
	    Some packages require a lot of disk space, 
	    around 2GB seems to be quite sufficient for the time being.
	  </para>
	</listitem>
      </itemizedlist>
    </sect1>
    <sect1>
      <title>Auto-backporting scripts</title>
      <para>
	There are some people who use pbuilder to automatically back-port
	a subset of packages to the stable distribution.
      </para>
      <para>
	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.
      </para>
    </sect1>
    <sect1 id="autotesting">
      <title>Using pbuilder for automated testing of packages</title>
      <para>
	pbuilder 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:
      </para>
      <itemizedlist>
	<listitem>
	  <para>Automatic install-remove-upgrade-remove-install-purge-upgrade-purge testsuite (distributed as an example)</para>
	</listitem>
	<listitem>
	  <para>Automatically running lintian/linda (distributed as an example in
	    <filename>/usr/share/doc/pbuilder/examples/B90linda</filename>)</para>
	</listitem>
	<listitem>
	  <para>Automatic debian-test of the package?</para>
	</listitem>
      </itemizedlist>
    </sect1>
    <sect1 id="altcompiler">
      <title>Using pbuilder for testing build with alternate compilers</title>
      <para>
	Most packages are compiled with <command>gcc</command> 
	or <command>g++</command>
	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, and provided
	binaries such as <command>gcc-3.2</command> for gcc compiler 
	version 3.2.
	It was therefore possible to try compiling packages against different
	compiler versions.
	<command>pentium-builder</command> provides an infrastructure for 
	using different compiler for building packages than the default gcc, by
	becoming a wrapper script called gcc, that calls the real gcc.
	To use <command>pentium-builder</command> in <command>pbuilder</command>, it is possible to set up the
	following in the configuration:
	<screen>
EXTRAPACKAGES="pentium-builder gcc-3.2 g++-3.2"
export DEBIAN_BUILDARCH=athlon
export DEBIAN_BUILDGCCVER=3.2
	</screen>
      </para>
      <para>
	It will instruct <command>pbuilder</command> to install <command>pentium-builder</command> package 
	and also the GCC 3.2 compiler packages inside the chroot,
	and set the environment variables required for 
	<command>pentium-builder</command> to function.
      </para>
    </sect1>
  </chapter>
  <chapter id="faq">
    <title>Frequently asked questions</title>
    <para>
      Here, known problems and frequently asked questions are
      documented. This portion was initially available in README.Debian
      file, but moved into here.
    </para>
    <sect1>
      <title>pbuilder create fails</title>
      <para>
	It often happens that pbuilder cannot create latest chroot.
	Try upgrading pbuilder and debootstrap.
	It is currently only possible to create software that handles the 
	past. Future prediction features may be added later when 
	we can successfully handle the past.
      </para>
      <para>
	There are people who occasionally backport debootstrap to stable
	versions, hunt for them.
      </para>
    </sect1>
    <sect1>
      <title>Notes on usage of $TMPDIR</title>
      <para>
	If you are setting $TMPDIR to an unusual value, of other than
	<filename>/tmp</filename>, you will find that some errors may occur inside the chroot,
	such as <command>dpkg-source</command> failing.
      </para>
      <para>There are two options, you may install a hook to create that
	directory, or set 
	<screen>export TMPDIR=/tmp</screen>
	in pbuilderrc. Take your pick.
      </para>
    </sect1>
    <sect1>
      <title>Using special apt sources list other than the default</title>
      <para>
	If you have some very specialized requirements on your 
	apt setup inside pbuilder, 
	it is possible to specify that through 
	<command><option>--othermirror</option></command>
	option.
	Try something like:
	<command><option>--othermirror "deb http://local/mirror stable main|deb-src http://local/source/repository ./"</option></command>
      </para>
      <para>
	To use the local filesystem instead of http, it is necessary to do 
	bind-mounting.
	<command><option>--bindmounts</option></command>
	is a command-line option useful for such cases.
      </para>
    </sect1>
    <sect1>
      <title>How to get pbuilder to run apt-get update before trying to satisfy build-dependency</title>
      <para>
	You can use hook scripts for this.
	D scripts are run before satisfying build-dependency.
      </para>
    </sect1>
    <sect1>
      <title>Different bash prompts inside pbuilder login</title>
      <para>
	To make distinguishing bash prompts inside pbuilder
	easier, it is possible to set environmental variables such as PS1
	inside <filename>pbuilderrc</filename>
      </para>
      <screen>
	export PS1="pbuild chroot 32165 # "
      </screen>
    </sect1>
    <sect1>
      <title>Using /var/cache/apt/archives for package cache</title>
      <para>
	For the help of low-bandwidth systems,
	it is possible to use <filename>/var/cache/apt/archives</filename> as the 
	package cache.
	Just specify it instead of the default <filename>/var/cache/pbuilder/aptcache</filename>.
      </para>
      <para>
	It is however not possible to do so currently with user-mode-linux 
	version of pbuilder, because <filename>/var/cache/apt/archives</filename>
	is usually only writable as root.
      </para>
    </sect1>
    <sect1 id="woodybackport">
      <title>pbuilder backported to stable Debian releases</title>
      <para>
	It is known that Brian May does a backport of 
	pbuilder, available at:
	<screen>deb http://www.microcomaustralia.com.au/debian/ woody main</screen>
      </para>
    </sect1>
    <sect1 id="LOGNAME">
      <title>Warning on LOGNAME not being defined</title>
      <para>
	You might see a lot of warning messages when running pbuilder.
      </para>
      <para>
	<screen>
	dpkg-genchanges: warning: no utmp entry available and LOGNAME not defined; using uid of process (1234)
	</screen>
      </para>
      <para>
	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 chroot.
      </para>
    </sect1>
    <sect1 id="nobuildconflictessential">
      <title>Cannot Build-conflict against an essential package</title>
      <para>
	pbuilder 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 
	to people building the package.
      </para>
    </sect1>
    <sect1>
      <title>Avoiding the "ln: Invalid cross-device link" message</title>
      <para>
	By default, pbuilder uses hard links to manage pbuilder 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 <screen>APTCACHEHARDLINK=no</screen>
	in your pbuilderrc file.
      </para>
    </sect1>
  </chapter>
  <chapter id="otheruse">
    <title>Other uses of pbuilder</title>
    <sect1 id="chroot">
      <title>Using pbuilder for small experiments</title>
      <para>
	There are cases when some small experimenting is required, and 
	do not want to damage the main system,
	like installing experimental library packages,
	or compiling with experimental compilers.
	For such cases, <command>pbuilder login</command> command is available.
      </para>
      <para>
	<command>pbuilder login </command> is a debugging feature for 
	pbuilder itself, but it also allows users to have a temporal chroot.
      </para>
      <para>
	Note that chroot is cleaned after logging out of the shell,
	and mounting file systems inside it is considered harmful.
      </para>
    </sect1>
    <sect1>
      <title>Running little programs inside the chroot</title>
      <para>
	To facilitate using pbuilder for other uses, 
	<command>pbuilder execute</command> is available.
	<command>pbuilder execute </command> will take a script 
	specified in the command-line argument, and 
	invoke the script inside the chroot.
      </para>
      <para>
	The script can be useful for sequence of operations such as
	installing ssh and adding a new user inside the chroot.
      </para>
    </sect1>
  </chapter>
  <chapter id="experimental">
    <title>Experimental or wish list features of pbuilder</title>
    <para>
      There are some advanced features, above that of the 
      basic feature of pbuilder, for some specific purposes.
    </para>
    <sect1 id="pbuilder-uml">
      <title>Using User-mode-linux</title>
      <para>
	<command>pbuilder-uml</command> exists.
	Invoking that command instead of <command>pbuilder</command>
	it is possible to use user-mode-linux.
	The advantage of using user-mode-linux is that 
	it does not require root privilege to run,
	and it does Copy-on-write, which is probably  much faster than
	conventional pbuilder method.
      </para>
      <para>
	The problem is that this relies on User-mode-linux
	which is a relatively new project, and has not quite
	matured, as opposed to conventional pbuilder which rely 
	on <command>chroot</command> and <command>tar</command> 
	and <command>gzip</command>, which are known to work
	on most Unix systems.
	However, <command>pbuilder-uml</command>  uses COW method for 
	file access, and it is so much more faster than pbuilder 
	when building most packages.
      </para>
      <para>
	It has been verified that pbuilder-uml works,
	as of version 0.59.
	And since then, pbuilder-uml has seen a rapid evolution.
	The configuration of pbuilder-uml goes in two steps:
	<itemizedlist>
	  <listitem>
	    <para>Configuration of rootstrap</para>
	  </listitem>
	  <listitem>
	    <para>Configuration of pbuilder-uml</para>
	  </listitem>
	</itemizedlist>
      </para>
      <sect2 id="rootstrap">
	<title>Configuring rootstrap</title>
	<para>
	  <command>rootstrap</command> is a program that 
	  is a wrapper to debootstrap, creating a Debian disk image inside
	  UML.
	  To configure rootstrap, there are several requirements.
	</para>
	<itemizedlist>
	  <listitem>
	    <para>install rootstrap package</para>
	  </listitem>
	  <listitem>
	    <para>add the user to uml-net group to allow access to network
	      <screen>
adduser dancer uml-net
	      </screen></para>
	  </listitem>
	  <listitem>
	    <para>Check that compile supports tun/tap interface,
	      and recompile the kernel if necessary
	    </para>
	  </listitem>
	  <listitem>
	    <para>Set up /etc/rootstrap/rootstrap.conf, for example,
	      if the current host is 192.168.1.2, changing following 
	      entries to something like this seems to work.
	      <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
	      </screen>
	      Some experimentation with configuration and running
	      <command>rootstrap ~/test.uml</command> to actually 
	      test it would be handy.
	    </para>
	  </listitem>
	</itemizedlist>
      </sect2>
      <sect2 id="pbuilderumlconfig">
	<title>Configuring pbuilder-uml</title>
	<para>
	  The following needs to happen:
	  <itemizedlist>
	    <listitem>
	      <para>install pbuilder-uml package</para>
	    </listitem>
	    <listitem>
	      <para>
		Set configuration file <filename>/etc/pbuilder/pbuilder-uml.conf</filename> as follows
		<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"
		</screen>
		and it needs to match rootstrap configuration.
	      </para>
	    </listitem>
	    <listitem>
	      <para>Run <command>pbuilder-user-mode-linux create --distribution sid</command> to create the image</para>
	    </listitem>
	    <listitem>
	      <para>Try running <command>pbuilder-user-mode-linux build </command></para>
	    </listitem>
	  </itemizedlist>
	</para>
      </sect2>
      <sect2 id="consideruml">
	<title>Considerations for running pbuilder-uml</title>
	<para>
	  pbuilder-user-mode-linux emulates most of pbuilder, but there
	  are some differences.
	</para>
	<itemizedlist>
	  <listitem>
	    <para>	  
	      pbuilder-user-mode-linux does not support all options of pbuilder
	      properly yet. This is a problem, and will be addressed as 
	      specific areas are discovered.
	    </para>
	  </listitem>
	  <listitem>
	    <para>
	      /tmp is handled differently inside pbuilder-uml.
	      In pbuilder-uml, /tmp is mounted as tmpfs inside UML,
	      so accessing files under /tmp outside the user-mode-linux
	      does not work.
	      It affects options like
	      <command><option>--configfile</option></command>.
	    </para>
	  </listitem>
	</itemizedlist>
      </sect2>
      <sect2 id="paralleluml">
	<title>Parallel running of pbuilder-user-mode-linux</title>
	<para>
	  To run pbuilder-uml parallel on a system, there are a few things 
	  to bear in mind.
	</para>
	<itemizedlist>
	  <listitem>
	    <para>create and update methods must not be ran when build is in progress, or COW file will be invalid</para>
	  </listitem>
	  <listitem>
	    <para>UML processes that are running in parallel needs to have 
	      different IP addresses.
	      So, something like the following will work, 
	      <command>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&amp; done 
	      </command>
	      but just trying to run <command>pbuilder-uml</command> 
	      several times will result in failure to access the network.
	    </para>
	  </listitem>
	</itemizedlist>
      </sect2>
      <sect2 id="pbuilderumlwrap">
	<title>Using pbuilder-uml as a wrapper script to start up virtual machine</title>
	<para>
	  It is possible to use pbuilder-uml for other uses than just building Debian 
	  packages.
	  <command>pbuilder-user-mode-linux login</command>
	  will let a user use a shell inside the user-mode-linux using the 
	  pbuilder base image,
	  and <command>pbuilder-user-mode-linux execute</command> will
	  allow the user to execute a script inside the chroot.
	</para>
	<para>
	  You can use the script to install ssh and add a new user,
	  so that it is possible to access inside the UML through ssh.
	</para>
	<para>
	  Note that it is not possible to use a script from 
	  <filename>/tmp</filename> due to the way pbuilder-uml mounts 
	  tmpfs at <filename>/tmp</filename>.
	</para>
	<para>
	  The following is an example script  that may be useful in starting a sshd 
	  inside uml.
	</para>
	<screen>
#!/bin/bash

apt-get install -y ssh xbase-clients xterm
echo "enter root password"
passwd 
cp /etc/ssh/sshd_config{,-}
cat /etc/ssh/sshd_config- | sed 's/X11Forwarding.*/X11Forwarding yes/' &gt; /etc/ssh/sshd_config

/etc/init.d/ssh restart
ifconfig
echo "Hit enter to finish"
read
	</screen>
      </sect2>
    </sect1>
    <sect1 id="lvm">
      <title>Using LVM</title>
      <para>
	LVM has snapshot function that features Copy-on-write images.
	That could be used for pbuilder just it can be used for 
	user-mode-linux pbuilder port.
	It may prove to be faster, but it is not implemented yet,
	and so no measurement has been made, yet.
      </para>
      <para>
	Since user-mode-linux port seems to be more interesting,
	this is abandoned.
      </para>
    </sect1>
    <sect1 id="withouttargz">
      <title>Using pbuilder without tar.gz</title>
      <para>
	<command><option>--no-targz</option></command>
	option of <command>pbuilder</command>
	will allow usage of pbuilder in a different way
	to conventional usage.
	It will try to use existing chroot, 
	and will not try to clean up after 
	working on it.
	It is an operation mode more like 
	<command>sbuild</command>.
      </para>
      <para>
	It should be possible to create chroot images
	for <command>dchroot</command> with following commands:
	<screen>
# pbuilder  create --distribution potato --no-targz --basetgz /chroot/potato
# pbuilder  create --distribution woody --no-targz --basetgz /chroot/woody
# pbuilder  create --distribution sid --no-targz --basetgz /chroot/sid
	</screen>
      </para>
    </sect1>
  </chapter>
  <chapter>
    <title>Minor details</title>
    <sect1>
      <title>Documentation history </title>
      <para>
	This document is started on 28 Dec 2002 by
	Junichi Uekawa, trying to document what is known
	about pbuilder.
      </para>
      <para>
	This documentation is available from pbuilder source tarball,
	and from CVS repository of pbuilder (which might not be 
	public yet now).
	A copy of this documentation can be found in
	<ulink url="http://www.netfort.gr.jp/~dancer/software/pbuilder-doc/pbuilder-doc.html">Netfort page for pbuilder</ulink>.
	The homepage for pbuilder is 
	<ulink url="http://www.netfort.gr.jp/~dancer/software/pbuilder.html">
	  http://www.netfort.gr.jp/~dancer/software/pbuilder.html
	</ulink>
      </para>
    </sect1>
    <sect1>
      <title>Inaccurate Background of pbuilder</title>
      <para>
	The following is most possibly inaccurate account of how 
	pbuilder happened to come, and other attempts to 
	make something like pbuilder to happen.
	This part of document was originally in AUTHORS file,
	to give credit to those who existed before pbuilder.
      </para>
      <sect2>
	<title>The Time Before pbuilder</title>
	<para>
	  There were 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 don't have the source off-hand.
	</para>
	<para>
	  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.
	</para>
	<para>
	  sbuild is a perl script to build Debian package from source.
	  It parses Build-Dependency, and performs other misc 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 use of local database for packages which do not 
	  have build-dependency. 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 Debian buildd system. I think it was maintained
	  mostly by Ryan Murray.
	</para>
      </sect2>
      <sect2>
	<title>Birth of pbuilder</title>
	<para>
	  wanna-build (sbuild) was quite difficult to set up, and it was 
	  never a Debian package. dbuild was something that predated
	  Build-Depends.
	</para>
	<para>
	  Building package from source using Build-Depends 
	  information within a chroot sounded trivial; and 
	  pbuilder 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's too slow.
	</para>
	<para>
	  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 pbuilder,
	  but the amount of packages which are not buildable
	  are steadily decreasing. (I hope)
	</para>
      </sect2>
      <sect2>
	<title>And the second year of its life</title>
	<para>
	  And someone wanted pbuilder to run as not root,
	  and User-mode-linux has become more useful as time passed,
	  I've started experimenting with pbuilder-uml.
	  pbuilder-uml has not been able to run as often as it should,
	  and bootstrapping user-mode-linux environment has been
	  pretty hard.
	</para>
      </sect2>
    </sect1>
  </chapter>
</book>