codema.in

Debian Packaging pre requisites

PP Pirate Praveen Public Seen by 709

On previous packaging workshops, we had to spend a lot of time troubleshooting issues when people used older versions of Ubuntu which had an older version of dh-make, gem2deb, npm2deb etc. So we thought of clearly mentioning the prerequisites so we can use the available time more efficiently.

If you have Machine with Debian-Sid it is well and good. if not we are having several other ways to set up a packaging environment. those are following but not limited to it.
1. Schroot chroot (lightweight and preferred)
2. LXC Container (saving bandwidth with apt-cacher-ng is easy)
3. Docker Container (if you are familiar with docker already)
4. VM (Using Vagrant or Manually installed. Host system should be sufficiently powerful to run a Virtual Machine)

If you have a GNU/Linux system already with schroot and sbuild packages, using Schroot is recommended (schroot and sbuild can be run on the host system). LXC or docker will work fine for the beginners (for simple packages). Also running docker as privileged container is important otherwise sbuild command will not work, which is required to build packages in clean Debian sid environment.

  1. You MUST have a Debian unstable system (physical, virtual machine, container or a chroot). See instructions given below to setup Debian Sid.
  1. Install packaging tools inside the container
    # apt-get install dh-make OR
    # apt-get install gem2deb OR
    # apt-get install npm2deb as required. For Node.js modules, use npm2deb; for ruby gems, use gem2deb; for go packages, use dh-make-golang. If there is no tool specific to a language, dh-make can be used as a generic tool for any language.

  2. Understand how a basic command line program is created and installed using a simple Makefile
    See https://git.fosscommunity.in/praveen/hello for an example

  3. Get a basic overview of packaging from Debian New Maintainer's Guide
    https://www.debian.org/doc/manuals/maint-guide/

  4. Understand basic git usage (add, commit, clone, push, pull, branch, tag)

  5. Run a hello world program with NodeJs. Follow http://nodeguide.com/beginner.html You can apt-get install nodejs

  6. Go through https://wiki.debian.org/Javascript/Nodejs/Npm2Deb/Tutorial

Join our real-time chat group using one of the 3 options (all 3 services are bridged/interconnected) and say hi. If you have difficulty with pre-requisites please ask here or on our chat room.

  1. Matrix: #debian-browserify:diasp.in
  2. IRC: #debian-browserify on irc.oftc.net
  3. Telegram: https://t.me/debian_browserify

If you are new to these technologies, I suggest you try matrix, see https://matrix.org for details. https://riot.im has a list of apps you can use.

http://webchat.oftc.net/?channels=debian-browserify&uio=MT11bmRlZmluZWQb1 to join the IRC room

A

amarpreetsingha Mon 26 Dec 2016 9:14AM

@praveenarimbrathod their is something wrong in this command "lxc-create -n debian-sid -t debian --- -r sid". So i used "lxc-create -t debian -n debian-sid" as explained by scott's weblog.

YK

Yogiraj Kulkarni Mon 26 Dec 2016 11:01AM

For root login, "lxc-create -n debian-sid -t debian -- -r sid" seems to work (notice one less hyphen here), but not for non-root login.

PP

Pirate Praveen Wed 28 Dec 2016 7:26AM

@amarpreetsingha that was a typo. As corrected by @yogirajkulkarni, it should be -- -r sid (I have updated the steps above). If you don't give -- -r sid, it will create debian stable/jessie instead of debian unstable/sid. lxc-create is using debootstrap internally and -r sid will be passed to debootstrap by lxc-create when we give -- -r sid to lxc-create.

VPD

Vinay Prakash Desai Thu 29 Dec 2016 7:53AM

@praveenarimbrathod I am having some problem while starting the container.
$ sudo lxc-create -n debian-sid -t debian -- -r sid
$ sudo lxc-start -n debian-sid
lxc-start: lxc_start.c: main: 344 The container failed to start.
lxc-start: lxc_start.c: main: 346 To get more details, run the container in foreground mode.
lxc-start: lxc_start.c: main: 348 Additional information can be obtained by setting the --logfile and --logpriority options.
$ sudo lxc-start -F -n debian-sid
lxc-start: sync.c: __sync_wait: 52 An error occurred in another process (expected sequence number 4)
lxc-start: start.c: __lxc_start: 1329 failed to spawn 'debian-sid'
lxc-start: lxc_start.c: main: 344 The container failed to start.
lxc-start: lxc_start.c: main: 348 Additional information can be obtained by setting the --logfile and --logpriority options.

I am using Ubuntu 16.04

PP

Pirate Praveen Fri 30 Dec 2016 3:05AM

"Additional information can be obtained by setting the --logfile and --logpriority options." Can you try these options? Give --logpriority=DEBUG. Did you get any error with lxc-create? If you cannot fix it, try installing it in VirtualBox.

VPD

Vinay Prakash Desai Fri 30 Dec 2016 8:07AM

Yes, I got many errors with lxc-create (many warnings)
like: Copying rootfs to /var/lib/lxc/debian-sid/rootfs...perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_IN:en",
LC_ALL = (unset),
LANG = "en_IN"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
update-rc.d: error: cannot find a LSB script for checkroot.sh
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_IN:en",
LC_ALL = (unset),
LANG = "en_IN"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
update-rc.d: error: cannot find a LSB script for umountfs

PP

Pirate Praveen Sat 31 Dec 2016 3:26AM

update-rc.d: error: cannot find a LSB script for umountfs

Seems you are missing umountfs,

$ dpkg -S /etc/init.d/umountfs # search which package provides umountfs script
initscripts: /etc/init.d/umountfs

Try installing initscripts and run lxc-create again. I can see it is still available in xenial (16.04), though it seems missing from yakkety (16.10) http://packages.ubuntu.com/search?searchon=contents&keywords=umountfs&mode=&suite=xenial&arch=any

VPD

Vinay Prakash Desai Sat 31 Dec 2016 1:59PM

I tried. umountfs and all other files for wch it was giving error are present. But still same errors and warnings

PP

Pirate Praveen Sun 1 Jan 2017 5:59AM

Not sure what is the problem then, we can troubleshoot that later. Now you can install it on GNOME Boxes or VirtualBox, see https://wiki.debian.org/InstallFAQ#Q._How_do_I_install_.22unstable.22_.28.22sid.22.29.3F

VPD

Vinay Prakash Desai Mon 2 Jan 2017 3:30PM

The problem is solved. I upgraded the packages. Using sudo apt-get upgrade. Now lxc-start is not giving errors.

Load More