LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   HOW-TO: Install Debian using debootstrap. (https://www.linuxquestions.org/questions/debian-26/how-to-install-debian-using-debootstrap-4175465295/)

replica9000 06-09-2013 12:35 AM

HOW-TO: Install Debian using debootstrap.
 
Using a live cd or existing Linux install to install Debian GNU/Linux using debootstrap.
Updated: 2015-01-11

debootstrap is used to create a Debian base system from scratch, without requiring the availability of dpkg or apt. It does this by downloading .deb files from a mirror site, and carefully unpacking them into a directory which can eventually be chrooted into.

This guide is intended to be a basic installation for those who wish to run Debian's unstable branch, or run a minimal system. It does not cover partitioning schemes, file system details, or proprietary drivers. For this guide, we will assume the following:

Branch: unstable (codename 'Sid')
Architecture: amd64
Boot Style: BIOS / MBR
Target partition: /dev/sda1
Filesystem: ext4
Network Interface: eth0
Debian Mirror: http://ftp.us.debian.org/debian - (Mirror List: http://www.debian.org/mirror/list)
debootstrap version: 1.0.66
Dependencies: binutils, perl, tar, wget (if not using a Debian based distro)





Installing debootstrap from a Debian based distribution
For Debian based distributions, this will be as simple as:

Code:

root@host# apt-get update
root@host# apt-get install debootstrap





Installing debootstrap from a non-Debian based distribution
If you are installing from a non-Debian based distribution, you distribution may or may not have debootstrap available. To get debootstrap, you can download it directly from a Debian mirror.

To view the packages available, use a web browser, or use this command:
Code:

root@host# wget --no-remove-listing -O /tmp/deboot.html -q http://ftp.us.debian.org/debian/pool/main/d/debootstrap && grep 'all.deb' /tmp/deboot.html | awk -F 'href' '{print $2}' | cut -d '"' -f2

Look for the latest version listed, and download:
Code:

root@host# wget -P /tmp/debootstrap http://ftp.us.debian.org/debian/pool/main/d/debootstrap/debootstrap_1.0.66_all.deb
Unpacking the .deb file:
Code:

root@host# cd /tmp/debootstrap
root@host# ar vx debootstrap_1.0.66_all.deb
root@host# tar -xf data.tar.gz

Temporary setup:
Code:

root@host# ln -s /tmp/debootstrap/usr/sbin/debootstrap /usr/sbin/debootstrap
root@host# ln -s /tmp/debootstrap/usr/share/debootstrap /usr/share/debootstrap





Setup the target partition for install
Create your filesystem, your mount point, and mount your partition:

Code:

root@host# mkfs.ext4 -L Debian /dev/sda1
root@host# mkdir /mnt/deboot
root@host# mount -t ext4 /dev/sda1 /mnt/deboot





Installing the base system with network access
Here, debootstrap will download, extract and install the base system packages to our target partition. debootstrap only fetches the base system without a kernel or bootloader, so we'll use the --include option to fetch those too. If you need packages not found in the main repository, you can include packages from contrib and non-free with this option --components main,contrib,non-free

Usage: debootstrap --include <additional_packages,comma-separated> --arch <architecture> <release> <target> <mirror>

Code:

root@host# debootstrap --include linux-image-amd64,grub-pc,locales --arch amd64 unstable /mnt/deboot http://ftp.us.debian.org/debian
debootstrap can also be used to install Ubuntu (ex. Raring Ringtail):
Code:

root@host# debootstrap --arch amd64 raring /mnt/deboot http://archive.ubuntu.com/ubuntu




Installing the base system without network access, or to a different architecture
If you do not have network or Internet access, you can use the --foreign option to start installation on a machine with network access, and finish on the machine that does not. This is also useful if your target machine is a different architecture than your host machine. Since your target won't have network access, make sure to use the --include option to have debootstrap fetch your kernel, bootloader, and any other packages you will want installed.

Create a temporary directory, and use debootstrap to fetch the packages for the first stage of the install.
Code:

root@host# mkdir /home/<user-name>/deboot
root@host# debootstrap --foreign --include linux-image-amd64,grub-pc,locales --arch amd64 unstable /home/<user-name>/deboot http://ftp.us.debian.org/debian

If we were installing to a PowerPC...
Code:

root@host# debootstrap --foreign --include linux-image-powerpc,yaboot,locales --arch powerpc unstable /home/<user-name>/deboot http://ftp.us.debian.org/debian
Next we'll change to our temporary directory and create a tarball for use on the target machine.
Code:

root@host# cd /home/<user-name>/deboot
root@host# tar czf ../debian-stage2.tgz .

Copy the debian-stage2.tgz file to the target machine. Assuming your target partition is ready, change to the target directory and extract the tarball.
Code:

root@host# cd /mnt/deboot
root@host# tar xzf /path/to/debian-stage2.tgz

Next we'll enter the chroot environment for a moment to complete the second stage of the install.
Code:

root@host# chroot /mnt/deboot /bin/bash
root@chroot# /debootstrap/debootstrap --second-stage
root@chroot# exit





Preparing the chroot environment
Copy the mounted file systems table. It keeps the df command happy. (Will be overwritten upon boot.)
Code:

root@host# cp /etc/mtab /mnt/deboot/etc/mtab
Binding the virtual filesystems. Until your new install is booting on it's own, we'll borrow these from the host.
Code:

root@host# mount -o bind /dev /mnt/deboot/dev
root@host# mount -o bind /proc /mnt/deboot/proc
root@host# mount -o bind /sys /mnt/deboot/sys





Continuing the installation within chroot
Entering the chroot environment:
Code:

root@host# chroot /mnt/deboot /bin/bash
Since we used the --include option to get grub, it was installed, but not configured.
Code:

root@chroot# grub-install /dev/sda
root@chroot# update-grub

Setting up /etc/fstab for the root filesystem. Use the blkid command to get the UUID of /dev/sda1.
Code:

root@chroot# blkid /dev/sda1
Then add this entry to /etc/fstab using the UUID output from the command above:
Code:

UUID=79168060-9d9c-4cf6-8ee9-bb846aee589b / ext4 defaults,errors=remount-ro 0 1
Give your new install a name. If not, your new install won't have a name, or inherit the name of the host you are installing from.
Code:

root@chroot# echo "<name-your-host>" > /etc/hostname
Configure your locale:
Code:

root@chroot# dpkg-reconfigure locales
Create a password for root:
Code:

root@chroot# passwd
Create a normal user:
Code:

root@chroot# adduser <your-user-name>




Setting up the network (eth0):

Some basic tools are already included to manage your network, but nothing is configured for you yet. If you plan on installing a desktop environment, that may bring in tools such as network-manager or wicd to automatically configure your network.

You can bring up your network manually each boot with the tools dhclient or ifconfig.

For a dynamic IP (DHCP):
Code:

root@host# dhclient -v eth0
For a static IP:
Code:

root@host# ifconfig -v eth0 192.0.2.7 netmask 255.255.255.0 up
You can have this automatically done for you when the system boots by editing the file below.

For DHCP, the /etc/network/interfaces file should look like this:
Code:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp

For a static IP, the /etc/network/interfaces file should look like this:
Code:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
  address 192.0.2.7
  netmask 255.255.255.0
  gateway 192.0.2.254





Install a display manager and a window manager
Unless you're using this for a headless server, might be nice to have some sort of desktop to play with.
Don't forget to update the package manager if you wish to install new packages:
Code:

root@chroot# apt-get update
Here are some examples of installing a desktop:
Code:

root@chroot# apt-get install xserver-xorg wdm fluxbox xterm
- or -
root@chroot# apt-get install xserver-xorg lightdm xfce4
- or -
root@chroot# apt-get install gdm3 gnome
- or -
root@chroot# apt-get install kdm kde-standard

You can use also use tasksel to install a desktop for you. To see the available options:
Code:

root@chroot# tasksel --new-install




Finishing the install
Clean the package cache:
Code:

root@chroot# apt-get clean
Update the ramdisk:
Code:

root@chroot# update-initramfs -u -k all
Exit the chroot environment:
Code:

root@chroot# exit


-- Enjoy your fresh install of Debian! --



Additional Info
Approx space used after base install: 491 MiB
Approx bandwidth used: 94 MiB

Approx space used after Fluxbox / wdm install: 714 MiB
Approx bandwidth used including base: 152 MiB

Approx space used after XFCE4 / lightdm install: 1077 MiB
Approx bandwidth used including base: 266 MiB

Approx space used after KDE 4 Standard install: 2036 MiB
Approx bandwidth used including base: 597 MiB

Approx space used after Gnome3 full install: 3329 MiB
Approx bandwidth used including base: 994 MiB





Troubleshooting
Code:

W: Failure trying to run: chroot /mnt/deboot dpkg --force-depends --install /var/cache/apt/archives.....
W: See /mnt/deboot/debootstrap/debootstrap.log

Check that :/sbin is in your PATH, if not:

Code:

root@host# export PATH=$PATH:/sbin
root@host# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

----------------------------------------------------------------------------------------

Code:

E: No pkgdetails available; either install perl, or pkgdetails.c from the base-installer source package
Perl probably isn't installed. Please install Perl.

----------------------------------------------------------------------------------------

Debian doesn't boot!

Code:

fsck exited with status code 0
sulogin: cannot open password database!
Segmentation fault

Chances are, your root filesystem isn't configured properly in /etc/fstab. Fix the root entry, then run:
Code:

root@chroot# update-initramfs -u -k all

EDDY1 06-09-2013 12:41 PM

Now we have it here at LQ.
Cool!
Not too many people use debootstrap but I've tried it & works great. The last time I did it I had to use 2 different tutorials because some of the commands didn't work. I'll try yours later.

replica9000 06-09-2013 12:44 PM

Let me know how it works for you. I've tested using Aptosid, Fedora, Arch and Slax.

EDDY1 06-09-2013 12:48 PM

I will, but I'm sure that it works I have to bookmark it so I don't have to search for it later.

Wocky 08-05-2013 03:52 AM

A couple of comments. Firstly, debootstrap won't work from a cdrom/DVDrom; if you've got one and no internet connection, you can do something like
Code:

# mount /dev/sr0 /cdrom
# tar czf /home/Wocky/linux.tgz /cdrom/pool

Then use (for example)
Code:

# debootstrap --unpack-tarball=/home/Wocky/linux.tgz wheezy /mnt/deboot
Secondly, if you're running on a 64-bit machine, having /lib in your LD_LIBRARY_PATH environment variable can cause problems (because multiarch support also uses /lib64). Before you do any of the above, check that LD_LIBRARY_PATH doesn't contain /lib.

Higgsboson 01-01-2015 12:46 AM

Quote:

Originally Posted by replica9000 (Post 4968093)

Setup the target partition for install:
----------------------------------------------------------------------------------------
Create your filesystem, your mount point, and mount your partition:
Code:

root@host# mkfs.ext4 -L Debian /dev/sda1
root@host# mkdir /mnt/deboot
root@host# mount -t ext4 /dev/sda1 /mnt/deboot


Can the target partition be on a seperate empty hard disk?

For example, I am running debian on live USB. It is /dev/sdg and it's partititon is /dev/sdg1. Will I be able to make my target partition /dev/sda1 which is a seperate hdd which has no OS or anything?

EDDY1 01-01-2015 02:36 AM

No need for you to deboostrap the live-cd has an installer, but you need to have unallocated space to install to unless you're using the whole hdd.

replica9000 01-01-2015 09:28 AM

Quote:

Originally Posted by Higgsboson (Post 5293523)
Can the target partition be on a seperate empty hard disk?

For example, I am running debian on live USB. It is /dev/sdg and it's partititon is /dev/sdg1. Will I be able to make my target partition /dev/sda1 which is a seperate hdd which has no OS or anything?

Yes. You can use any empty partition for your target.

Higgsboson 01-02-2015 03:07 AM

Thank you for your reply replica9000!

I have just a few more questions:

Quote:

Originally Posted by replica9000 (Post 4968093)
Setup the target partition for install:
----------------------------------------------------------------------------------------
Create your filesystem, your mount point, and mount your partition:
Code:

root@host# mkfs.ext4 -L Debian /dev/sda1
root@host# mkdir /mnt/deboot
root@host# mount -t ext4 /dev/sda1 /mnt/deboot


I can't see a command for the sizing of the partition. How does that work?
I have a 160gb hdd and I was looking to install a distro to a 40gb partition.

Quote:

Installing the base system:
----------------------------------------------------------------------------------------
Here, debootstrap will download, extract and install the base system packages to our target partition. Debootstrap only fetches the
base system without a kernel or bootloader, so we'll use the --include option to fetch those too.
Usage: debootstrap --include=<addtional_packages,comma-separated> --arch <architecture> <release> <target> <mirror>
[code]
root@host# debootstrap --include=linux-image-amd64,grub-pc --arch amd64 unstable /mnt/deboot http://ftp.us.debian.org/debian
What would be the command if I want to install the stable debian 7.7?
I imagine I have to substitute 'arch' for something else. I have an amd64 processor.
Incidentally, would I be OK to simply install 'Sid' anyway, even if it is the unstable version?

Quote:

Create a password for root:
Code:

root@chroot# passwd

So is the command to create a password like this:

Code:

root@chroot# passwd mypassword
Is this correct?

Quote:

Install a display manager and a window manager:
----------------------------------------------------------------------------------------
Unless you're using this for a headless server, might be nice to have some sort of desktop to play with.

Code:

root@chroot# apt-get install xserver-xorg wdm fluxbox xterm
- or -
root@chroot# apt-get install xserver-xorg lightdm xfce4


What is the command for using the gnome shell, please?

colorpurple21859 01-02-2015 07:32 AM

Quote:

What would be the command if I want to install the stable debian 7.7?
You can run tasksel. https://wiki.debian.org/tasksel https://wiki.debian.org/DebianDesktop/Tasks

Quote:

I imagine I have to substitute 'arch' for something else. I have an amd64 processor
If I remember correctly it is based on the arch of the system you running debootstrap from.

Quote:

Incidentally, would I be OK to simply install 'Sid' anyway, even if it is the unstable version?
Yes, just beware, you may get breakage from time to time that you will have to fix, but usually doesn't happen very often.

Quote:

So is the command to create a password like this:
Code:

passwd root

replica9000 01-02-2015 11:23 AM

Quote:

Originally Posted by Higgsboson (Post 5294000)
Thank you for your reply replica9000!

I have just a few more questions:


I can't see a command for the sizing of the partition. How does that work?
I have a 160gb hdd and I was looking to install a distro to a 40gb partition.

I didn't cover partitioning in this how-to. Maybe next time I update it.



Quote:

Originally Posted by Higgsboson (Post 5294000)
What would be the command if I want to install the stable debian 7.7?
I imagine I have to substitute 'arch' for something else. I have an amd64 processor.
Incidentally, would I be OK to simply install 'Sid' anyway, even if it is the unstable version?

In this line change unstable to stable:
Code:

debootstrap --include=linux-image-amd64,grub-pc --arch amd64 unstable /mnt/deboot http://ftp.us.debian.org/debian


Quote:

Originally Posted by Higgsboson (Post 5294000)
So is the command to create a password like this:

Code:

root@chroot# passwd mypassword
Is this correct?

Yes. simply entering passwd will prompt to change to root password. Entering passwd <someone's username> will prompt to change the password for that user.



Quote:

Originally Posted by Higgsboson (Post 5294000)
What is the command for using the gnome shell, please?

should be apt-get install gnome-shell

Higgsboson 01-02-2015 12:13 PM

Quote:

Originally Posted by replica9000 (Post 5294199)
I didn't cover partitioning in this how-to. Maybe next time I update it.

In fairness, the beginning of your how-to has already mentioned it will not cover partitions.
However, since the example target partition is 'sda1' then I can simply create a partition of my choice on a hdd and use that as the example partition.

Thank you very much!! The debootstrap program is the way to go!

EDDY1 01-02-2015 07:54 PM

Quote:

Thank you very much!! The debootstrap program is the way to go!
It's actually the way to go when you can't boot to any media cd/dvd/usb other than that you're better off using the installer from the cd/dvd/usb.

replica9000 01-02-2015 10:58 PM

Quote:

Originally Posted by Higgsboson (Post 5294224)
In fairness, the beginning of your how-to has already mentioned it will not cover partitions.
However, since the example target partition is 'sda1' then I can simply create a partition of my choice on a hdd and use that as the example partition.

Thank you very much!! The debootstrap program is the way to go!

Glad I could be some help. Partitioning can get tricky depending on if one was using msdos or gpt with bios or uefi setups.

Quote:

Originally Posted by EDDY1 (Post 5294442)
It's actually the way to go when you can't boot to any media cd/dvd/usb other than that you're better off using the installer from the cd/dvd/usb.

I suppose this method is good for users who wish to use unstable, or have special setups. I used to use the net-install CDs, but those aren't released for unstable. So after install, I had to update/upgrade the whole system again anyways.

EDDY1 01-03-2015 03:08 AM

That sounds good but I believe that it's a little advanced for a newbie.

Higgsboson 01-05-2015 05:46 AM

I have used this method but have encountered a problem. The distro won't open up when I boot up my hard disk.
I have a black screen appearing with:

Code:

Debian GNU/linux 7 host ttyl
I then have a login prompt. I've logged in as root and user, but after that I simply get:

Code:

root@host:"#
After that, I don't know what to do.
Can anyone help please?

Head_on_a_Stick 01-05-2015 06:04 AM

@Higgsboson -- I did try to tell you this wasn't the way to go...

Have you installed xorg & some some of desktop environment/window manager?

Did you read post #10?

Use tasksel to install a desktop exactly how the installer would have done it (without your intervention and much quicker):
https://wiki.debian.org/DebianDesktop/Tasks

Higgsboson 01-05-2015 06:34 AM

Quote:

Originally Posted by Head_on_a_Stick (Post 5295575)
@Higgsboson -- I did try to tell you this wasn't the way to go...

Have you installed xorg & some some of desktop environment/window manager?

Did you read post #10?

Use tasksel to install a desktop exactly how the installer would have done it (without your intervention and much quicker):
https://wiki.debian.org/DebianDesktop/Tasks

The problem is I used debootstrap to install a full debian OS with a gnome desktop package.
I'm just wondering why the OS allows me to login but doesn't open up the desktop.

When I boot up my live debian USB the hdd with the new OS doesn't mount automatically.
When I mount the correct partition, it shows there is 3.9GB of data on it.
This must mean the OS has been installed.
However, I'm wondering why the gnome desktop won't open up.

Head_on_a_Stick 01-05-2015 07:38 AM

You shouldn't use the X server (graphical desktop) as root -- it is fundamentally insecure.

Generate a normal user for day-to-day tasks using the `adduser` command.

If you have a console login and you have used tasksel to install GNOME then you can start the desktop using:
Code:

startx
However, tasksel would have also dragged in & installed the GNOME Display Manager (GDM) and you would use this to login rather than the console.

If you have installed GNOME manually, you may also need GDM (although I'm pretty sure this is part of the GNOME package in Debian) and you may need to enable it.

With systemd I would use:
Code:

# systemctl enable gdm3
But there seem to be some problems with this under jessie:
http://forums.debian.net/viewtopic.php?f=6&t=119768

I'm not sure how to do this under SysVinit; try using:
Code:

# chkconfig gdm3 on

Higgsboson 01-05-2015 07:47 AM

Quote:

Originally Posted by replica9000 (Post 4968093)

Setup the target partition for install:
----------------------------------------------------------------------------------------
Create your filesystem, your mount point, and mount your partition:
Code:

root@host# mkfs.ext4 -L Debian /dev/sda1
root@host# mkdir /mnt/deboot
root@host# mount -t ext4 /dev/sda1 /mnt/deboot


I wonder if you can help again please.

1. Since I already have a hdd with an ext4 partition, at this stage I used the following commands (my partition is also sda1):
Code:

root@host# mkdir /mnt/deboot
root@host# mount /dev/sda1 /mnt/deboot

As you can see, I didn't use:
Code:

root@host# mount -t ext4 /dev/sda1 /mnt/deboot
Will this have caused the problem in my install?
Since I'm using a live USB without persistence, unfortunately I can't go into debootstrap.log for error messages.


Quote:

Installing the base system:
----------------------------------------------------------------------------------------
Code:

root@host# debootstrap --include=linux-image-amd64,grub-pc --arch amd64 unstable /mnt/deboot http://ftp.us.debian.org/debian

2. As per your previous answer, I substituted 'unstable' with 'stable' to get the stable version of Debian.
However, whilst the package was installing, I did read some error messages about not having relevant firmware.
So what would be the command to get the debian_non-free version?

I'm thinking of using debootstrap again for a different target partition on my hdd.
Once I have the answers to the above questions, then I should be good to go.

3. The debootstrap method binds and copies files from the host OS which is very economical. In my particular situation, I'm using a slightly altered debian live USB. So I'm hoping that the relevant host files haven't had some records deleted.
However, that's just my situation and shouldn't affect others who didn't make their live USB with the Yumi program.

replica9000 01-05-2015 09:24 AM

Like Head_on_a_stick suggested, gdm3 wasn't automatically installed, since gnome-shell doesn't seem to depend on it. You can install it using apt-get install gdm3 .

Quote:

Originally Posted by Higgsboson (Post 5295601)
As you can see, I didn't use:
Code:

root@host# mount -t ext4 /dev/sda1 /mnt/deboot
Will this have caused the problem in my install?
Since I'm using a live USB without persistence, unfortunately I can't go into debootstrap.log for error messages.

I can't see that causing an issue. debootstrap.log would be on the partition you are installing Debian to, but is removed once debootstrap is successfully completed.

I just did a test install of stable in a virtual machine, only doing apt-get install gdm3 gnome-shell, and everything appears fine.

Higgsboson 01-05-2015 11:41 AM

Quote:

Originally Posted by replica9000 (Post 5295653)
Like Head_on_a_stick suggested, gdm3 wasn't automatically installed, since gnome-shell doesn't seem to depend on it. You can install it using apt-get install gdm3 .

Thank you. So I have a workable debian installation on my hdd! Well, that's a good thing!
Also, gdm3 is to do with the shell. But somehow the shell isn't loading.

I used:
Code:

apt-get install gdm3
The output was 'unable to get some archives'. The error message suggested 'apt-get update', which I did.
The update worked which must mean the network connection is fine. I also did 'apt-get upgrade'.

But the repeated error message is 'could not resolve ftp.us.debian.org'

I then tried:
Code:

apt-get install gnome-shell
But the output is '0 upgraded, 0 newly installed' etc...
So this seems like it's got all the gnome files but for some reason it's not activating.

Even so, this clearly shows debootstrap works. I'm just wondering what the problem is in my scenario.

replica9000 01-05-2015 12:09 PM

Quote:

Originally Posted by Higgsboson (Post 5295707)
The output was 'unable to get some archives'. The error message suggested 'apt-get update', which I did.
The update worked which must mean the network connection is fine. I also did 'apt-get upgrade'.

But the repeated error message is 'could not resolve ftp.us.debian.org'

So I'm confused whether your network connection is good or not. What does ifconfig show? You should see an entry for eth0 and for lo. If only for lo, then you should run dhclient eth0 to activate your network connection (assuming you use DHCP). If that solves your network issue, you need to add this to your /etc/network/interfaces file.
Code:

# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp

Once your network is working, you'll probably want to run apt-get install gnome-terminal, so you have a terminal emulator under Gnome.

Higgsboson 01-05-2015 12:39 PM

Quote:

Originally Posted by replica9000 (Post 5295728)
So I'm confused whether your network connection is good or not. What does ifconfig show? You should see an entry for eth0 and for lo. If only for lo, then you should run dhclient eth0 to activate your network connection (assuming you use DHCP).

I don't actually have that.
The output for 'ifconfig' is:

'Link encap:Local loopback
inet addr: 127. 'etc...' Mask:'etc...'
inet6addr: ::1/128 Scope:Host
RX Packets: 0 errors:0 dropped:0 overruns:0 'etc...'

My network connection is DHCP as far as I know.
Does that mean there's a problem with a network connection?

colorpurple21859 01-05-2015 07:37 PM

This may help http://www.debian.org/releases/stable/i386/apds03.html
Quote:

However, whilst the package was installing, I did read some error messages about not having relevant firmware.
The firmware you will need to install depends on your hardware. Maybe what is causing problems with internet connection. Add contrib and non-free to the end of each line in /etc/apt/sources.list then run update apt for nonfree and additional repositories. Then
Code:

apt-cache search firmware
will give a list of firmware packages available.

Higgsboson 01-06-2015 01:49 AM

Quote:

Originally Posted by colorpurple21859 (Post 5295945)

Thanks for your post. That is a good site for using debootstrap.
However, it is very complicated for me. It seems the debootstrap tutorial on this thread is a much simpler version. And replica9000 has tested it.

I did find on the debian site, it asks you to use a local mirror site. I was using
Code:

ftp.us.debian.org/debian/
but since I'm in the UK, I should be better off using
Code:

ftp.uk.debian.org/debian/
Quote:

The firmware you will need to install depends on your hardware. Maybe what is causing problems with internet connection. Add contrib and non-free to the end of each line in /etc/apt/sources.list then run update apt for nonfree and additional repositories. Then
Code:

apt-cache search firmware
will give a list of firmware packages available.
I'm not entirely sure how to do that.
I could run debootstrap and install onto a different partition on my hdd. I could then use the UK mirror for downloads. Then I could install debian 7.7 non-free rather than debian 7.7 stable. But I don't know how to substitute the following command for the non-free version:
Code:

debootstrap --include=linux-image-amd64,grub-pc --arch amd64 stable /mnt/deboot http://ftp.uk.debian.org/debian
Do I simply add 'stable_non_free' where it says 'stable'?
Will debian 7.7 non-free sort out my firmware problem, do you think?
Also, is trying the above method a viable option?

Higgsboson 01-06-2015 02:03 AM

The debian website also mentions

'D.3.4.4. Configure Networking' on their debootsrap tutorial. http://www.debian.org/releases/stable/i386/apds03.html

I'm wondering if I need to do something like that?

Head_on_a_Stick 01-06-2015 02:18 AM

@Higgsboson -- this is getting really silly now.

Just download an unofficial netinstall .iso with the non-free firmware included and install using the "normal" method (ie, burn the image to a CD and boot up from that):
http://ftp.acc.umu.se/mirror/cdimage...ding-firmware/

You seem intent on using debbootstrap (against all advice to the contrary) and then complain because it's "very complicated"...

If you had used the same method of installation that 99% of Debian users employ you would be using your Debian system by now rather than making countless posts on a support forum.
http://www.skidmore.edu/~pdwyer/e/eoc/help_vampire.htm

Higgsboson 01-06-2015 02:56 AM

Quote:

Originally Posted by Head_on_a_Stick (Post 5296088)
Just download an unofficial netinstall .iso with the non-free firmware included and install using the "normal" method (ie, burn the image to a CD and boot up from that):
http://ftp.acc.umu.se/mirror/cdimage...ding-firmware/

Yes, I have ordered some dvd r-w and will be making a cd netinstall soon.

Quote:

You seem intent on using debbootstrap (against all advice to the contrary) and then complain because it's "very complicated"...
Yes, but this is a thread about debootstrap - not cd neinstalls. Debian is offering more programs for people to use.
The programs will be a complete waste if nobody uses them. Their benefits never be understood.
I'm just trying to learn about the debootstrap program and see what benefits it can offer.

colorpurple21859 01-06-2015 05:28 AM

Quote:

Originally Posted by Higgsboson (Post 5296085)
The debian website also mentions

'D.3.4.4. Configure Networking' on their debootsrap tutorial. http://www.debian.org/releases/stable/i386/apds03.html

I'm wondering if I need to do something like that?

That is the reason I posted that website. If copying the /etc/network/interfaces from the host system isn't working maybe setting up static ip and/or copy /etc/resolv.conf from the host system will help, if your using a wired connection. Before you use wireless, firmware will have to be installed and extra configuration steps taken.

Quote:

However, it is very complicated for me. It seems the debootstrap tutorial on this thread is a much simpler version. And replica9000 has tested it.
It is if everything works. If not, then you got to pop the hood, as the saying goes, find out what is wrong and fix it. Which usually means using the command line and lots of googling.

replica9000 01-06-2015 09:25 AM

Quote:

Originally Posted by Higgsboson (Post 5296095)
Yes, but this is a thread about debootstrap - not cd neinstalls. Debian is offering more programs for people to use.
The programs will be a complete waste if nobody uses them. Their benefits never be understood.
I'm just trying to learn about the debootstrap program and see what benefits it can offer.

I'm glad you're not giving up so easily, but using debootstrap is more for someone experienced building up a system with minimal tools included. Be glad you didn't try the variant=minbase option. :)

Quote:

Originally Posted by colorpurple21859 (Post 5296157)
That is the reason I posted that website. If copying the /etc/network/interfaces from the host system isn't working maybe setting up static ip and/or copy /etc/resolv.conf from the host system will help, if your using a wired connection. Before you use wireless, firmware will have to be installed and extra configuration steps taken.

It is if everything works. If not, then you got to pop the hood, as the saying goes, find out what is wrong and fix it. Which usually means using the command line and lots of googling.

In the test I did yesterday, I used Mint 17.1. The /etc/network/interfaces file doesn't included entries for eth0. I'll have to update the OP later since copying that file won't be a reliable option.

Higgsboson 01-06-2015 10:53 AM

Quote:

Originally Posted by colorpurple21859 (Post 5296157)
That is the reason I posted that website. If copying the /etc/network/interfaces from the host system isn't working maybe setting up static ip and/or copy /etc/resolv.conf from the host system will help, if your using a wired connection. Before you use wireless, firmware will have to be installed and extra configuration steps taken.

I went into /etc/network/interfaces on the host system (debian live USB) and it shows the following:
Code:

auto lo
iface lo inet loopback

If I go into /etc/resolv.config on the host system - then it seems to be showing my IP address. So this might be a good option.

However, before I did the debootstrap install I partitioned my hdd with gparted.
But after the install, I realised I was getting an error code for all my partitions:
Code:

root@debian:/# fdisk -l /dev/sda1
Disk /dev/sda1: 41.9 GB, 41943040000 bytes
255 heads, 63 sectors/track, 5099 cylinders, total 81920000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/sda1 doesn't contain a valid partition table

So now I'm checking up this error code on a different thread.
Funny thing is, debootstrap did seem to have a successful install albeit without a shell and no apparent network connection.
Once I've sorted out the partition problem, I might well re-install with debootstrap and copy /etc/resolv.conf from the host system like you suggested.
Thanks for your help!

replica9000 01-06-2015 11:04 AM

Quote:

Originally Posted by Higgsboson (Post 5296374)
I went into /etc/network/interfaces on the host system (debian live USB) and it shows the following:
Code:

auto lo
iface lo inet loopback

If I go into /etc/resolv.config on the host system - then it seems to be showing my IP address. So this might be a good option.

/etc/network/interfaces should like this:
Code:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp


Quote:

Originally Posted by Higgsboson (Post 5296374)
However, before I did the debootstrap install I partitioned my hdd with gparted.
But after the install, I realised I was getting an error code for all my partitions:
Code:

root@debian:/# fdisk -l /dev/sda1
Disk /dev/sda1: 41.9 GB, 41943040000 bytes
255 heads, 63 sectors/track, 5099 cylinders, total 81920000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/sda1 doesn't contain a valid partition table

So now I'm checking up this error code on a different thread.
Funny thing is, debootstrap did seem to have a successful install albeit without a shell and no apparent network connection.
Once I've sorted out the partition problem, I might well re-install with debootstrap and copy /etc/resolv.conf from the host system like you suggested.
Thanks for your help!

You probably want to use fdisk -l /dev/sda instead of fdisk -l /dev/sda1

EDDY1 01-06-2015 11:55 AM

@higgsbosn
I think that you jumped into an arena which is too advanced for you.
Learning how to install from cd would be 1st step.
chrooting & recovering a broken system would be 2nd
Debootstrapping 3rd
Then installing LFS, Gentoo or Arch.

Higgsboson 01-06-2015 12:03 PM

Quote:

Originally Posted by replica9000 (Post 5296389)
/etc/network/interfaces should like this:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp

This is good to know. I may try copying this onto the relevant file on the hdd and rebooting.

Quote:

You probably want to use fdisk -l /dev/sda instead of fdisk -l /dev/sda1
I see. I'm using the fdisk cmd incorrectly. Well, that's a relief! I thought all my partitions were messed up! Thanks dude!

Higgsboson 01-06-2015 12:07 PM

Quote:

Originally Posted by EDDY1 (Post 5296438)
@higgsbosn
I think that you jumped into an arena which is too advanced for you.
Learning how to install from cd would be 1st step.
chrooting & recovering a broken system would be 2nd
Debootstrapping 3rd
Then installing LFS, Gentoo or Arch.

The dvd rw discs have been ordered and are on their way.

replica9000 01-06-2015 12:14 PM

Quote:

Originally Posted by Higgsboson (Post 5296448)
The dvd rw discs have been ordered and are on their way.

You should be able to download a net-install cd image, and copy it to a USB drive instead of burning iso images.

Assuming /dev/sdc is an empty USB drive:
Code:

dd if=debian-7.7.0-amd64-netinst.iso of=/dev/sdc

EDDY1 01-06-2015 12:21 PM

Quote:

Originally Posted by Higgsboson (Post 5296448)
The dvd rw discs have been ordered and are on their way.

The dvd's or cd's can be downloaded & burned just like the live-cd that you have.

Higgsboson 01-06-2015 12:58 PM

Quote:

Originally Posted by replica9000 (Post 5296452)
You should be able to download a net-install cd image, and copy it to a USB drive instead of burning iso images.

Yes, I've downloaded a debian netinstall .iso onto my live USB.
Unfortunately, the live USB version I have comes without debian-installer.
'Apt-get install debian-installer' doesn't work because Synaptic shows it's just a bunch of page files.
The proper debian-installer is a .iso file. I can fetch that with 'apt-get install' cmd.

But in order to extract the debian-installer .iso and install it - I need debian installer!
That's why I turned to debootstrap.
However, I have a partitioned hdd in ext4 format and a debian live USB without debian-installer. Any possibility I could install a debian OS onto a hard disk without a cd?

Higgsboson 01-06-2015 01:08 PM

Quote:

Originally Posted by EDDY1 (Post 5296459)
The dvd's or cd's can be downloaded & burned just like the live-cd that you have.

Yes, I need to burn the .iso onto a disc.
I just don't have the rw discs yet. Never used the rw function on my dvd player. I don't even know if it actually works!

I have a debian live USB. The debian OS was installed onto USB via a downloaded 'bootloader' program. There wasn't any burning of discs needed.

colorpurple21859 01-06-2015 01:45 PM

What menu options do you get when you first boot the usb?

Head_on_a_Stick 01-06-2015 01:48 PM

Quote:

Originally Posted by Higgsboson (Post 5296491)
Yes, I've downloaded a debian netinstall .iso onto my live USB.
Unfortunately, the live USB version I have comes without debian-installer.
'Apt-get install debian-installer' doesn't work because Synaptic shows it's just a bunch of page files.
The proper debian-installer is a .iso file. I can fetch that with 'apt-get install' cmd.

But in order to extract the debian-installer .iso and install it - I need debian installer!
That's why I turned to debootstrap.
However, I have a partitioned hdd in ext4 format and a debian live USB without debian-installer. Any possibility I could install a debian OS onto a hard disk without a cd?

You have this all mixed up -- the .iso needs to be transferred verbatim to a USB stick; just "copying" it or "downloading" it on to the USB stick will not work.

You do not "extract" the .iso, you just transfer the contents to the USB stick.

As I have already told you, the "debian-installer" package is not the Debian Installer -- it is the documentation for the installer.

Download the netinstall .iso and then use this command:
Code:

sudo dd if=netinstall.iso of=/dev/sdb bs=4096;sync
Where "netinstall.iso" is the name of the .iso and "/dev/sdb" is the location of your USB stick (plug in the stick in & then run the command `dmesg|tail` to find this).

Once the `dd` command has finished, you can reboot the computer (with the stick in) and select the USB stick from your firmware (BIOS) menu -- it will then boot up from the USB stick and run the installer.

Higgsboson 01-06-2015 02:51 PM

Quote:

Originally Posted by colorpurple21859 (Post 5296518)
What menu options do you get when you first boot the usb?

That's a good point. There isn't any login screen - debian opens up automatically. The gnome shell doesn't load.

If I want to be 'root', I open the root terminal - no password is needed.
My debian live USB was installed via Yumi bootloader (from pendrivelinux). It's a scaled down version of the proper live debian USB because it doesn't have debian installer.

There are few bootloaders which will allow you to install linux onto a USB from a Windows environment.
And even if you use the well-known Unetbootin program, it will see your well-known Sandisk USB as a hard disk and therefore will not run.

Higgsboson 01-06-2015 03:01 PM

Quote:

Originally Posted by Head_on_a_Stick (Post 5296522)
Download the netinstall .iso and then use this command:
Code:

sudo dd if=netinstall.iso of=/dev/sdb bs=4096;sync
Where "netinstall.iso" is the name of the .iso and "/dev/sdb" is the location of your USB stick (plug in the stick in & then run the command `dmesg|tail` to find this).

I don't have a linux OS on hard disk.
The only linux OS I have is on the live USB I'm using right now.

I'm not sure I can transfer a .iso file onto the USB while I'm using the same USB as the operating system.

Head_on_a_Stick 01-06-2015 03:23 PM

Quote:

Originally Posted by Higgsboson (Post 5296583)
I'm not sure I can transfer a .iso file onto the USB while I'm using the same USB as the operating system.

No, you can't.

You could transfer it to a different USB stick though.

If you have a working Windows system, you can use the "USBWriter" utility to transfer the .iso:
http://sourceforge.net/p/usbwriter/wiki/Documentation/

EDDY1 01-06-2015 03:34 PM

Quote:

Originally Posted by Head_on_a_Stick (Post 5296604)
No, you can't.

You could transfer it to a different USB stick though.

If you have a working Windows system, you can use the "USBWriter" utility to transfer the .iso:
http://sourceforge.net/p/usbwriter/wiki/Documentation/

The iso can be loaded to the hdd using unetbootin, but I don't believe it can be an iso already loade & bootable from the usb. What would work is a system that was loade by Wubi in a wins environment.

colorpurple21859 01-06-2015 09:44 PM

Quote:

In the test I did yesterday, I used Mint 17.1. The /etc/network/interfaces file doesn't included entries for eth0. I'll have to update the OP later since copying that file won't be a reliable option.
Won't work if the host system is Slackware either.

EDDY1 01-06-2015 10:27 PM

Quote:

Originally Posted by replica9000 (Post 5296306)
I'm glad you're not giving up so easily, but using debootstrap is more for someone experienced building up a system with minimal tools included. Be glad you didn't try the variant=minbase option. :)



In the test I did yesterday, I used Mint 17.1. The /etc/network/interfaces file doesn't included entries for eth0. I'll have to update the OP later since copying that file won't be a reliable option.

It may be /etc/resolv.conf & /etc/interfaces which maybe listed under /mnt or /media which might need the uuid

colorpurple21859 01-06-2015 10:56 PM

To help Higgsboson out I continued over on the ops other thread. This installs the full gnome desktop with working internet after installing the base system. What it doesn't do is install grub, add-users, set time zone, and set locales.
http://www.linuxquestions.org/questi...5/#post5296741

Higgsboson 01-10-2015 07:05 AM

I have had success with debootstrap in installing a debian stable release onto a hard disk partition without installing from cd-rom!
I now have dvd-rw discs to make a normall installation, but the optical drive is writing too fast. Also, for some reason my debian OS doesn't have debian-installer.
So rather than spending days finding out how to remedy the problem, I'd like to use debootstrap again.

I have the commands to use debootstrap set out below. It's the OP's original 'HOW-TO' modified for my situation. I don't really understand the commands but have a vague idea what it's doing. Can anyone please look through the source and advise if it's correct and in the right order? Many thanks.

1. Install debootstrap:
Code:

root@host# apt-get update
root@host# apt-get install debootstrap

2. Mount target partition to a mount point. The target partition (sda2) is already in ext4 format.
Code:

root@host# mkdir /mnt/deboot
root@host# mount /dev/sda2 /mnt/deboot

3. Install base system, kernel and bootloader. I'll be using a UK mirror site. Unfortunately, I have a Radeon 4200 sound card - so I'll need 'contrib' and 'non-free' versions of debian.
Code:

root@host# debootstrap --include=linux-image-amd64,grub-pc --arch amd64 stable main contrib nonfree  /mnt/deboot http://ftp.uk.debian.org/debian
4. Copy the mounted file systems table:
Code:

root@host# cp /etc/mtab /mnt/deboot/etc/mtab
5. Bind the virtual filesystems:
Code:

root@host# mount -o bind /dev /mnt/deboot/dev
root@host# mount -o bind /proc /mnt/deboot/proc
root@host# mount -o bind /sys /mnt/deboot/sys

6. Copy correct file onto install for network access. I needed to do this after the install but I'm not sure when to put in the command:
Code:

cp /etc/resolv.conf /mnt/etc/resolv.conf
7. Entering the chroot environment:
Code:

root@host# chroot /mnt/deboot /bin/bash
root@chroot# grub-install /dev/sda
root@chroot# update-grub

root@chroot# passwd
root@chroot# adduser <your-user-name>
root@chroot# getuuid=$(blkid | grep /dev/sda1 | awk 'match($0,/UUID/) {print substr($0,RSTART,100)}' | sed 's/"//g' | cut -d ' ' -f1) && echo "$getuuid / ext4 defaults 0 1" >> /etc/fstab

8. '(Optional) Give your install a name. If not, your new install won't have a name, or inherit the name of the host you are installing from':
Code:

root@chroot# echo "<name-your-host>" > /etc/hostname
9. 'Install a display manager and a window manager':
Code:

root@chroot# apt-get install xserver-xorg wdm fluxbox xterm
- or -
root@chroot# apt-get install xserver-xorg lightdm xfce4

It would be good here to know commands for different GUIs.

10.'Clean the package cache':
Code:

root@chroot# apt-get clean
root@chroot# exit

So now I should have a debian installation on sda2. I already have a distro on sda1 with GRUB bootloader.
So now I'm hoping GRUB will allow me to boot from sda2 so the new installation can begin.

Can anyone please say if the above is ok for a new install?


All times are GMT -5. The time now is 04:11 AM.