User Tools

Site Tools


operating_systems:linux:debian:flash_card

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
operating_systems:linux:debian:flash_card [2012/07/16 10:09] – [Suppression des partitions] tretoperating_systems:linux:debian:flash_card [2013/12/20 09:56] – [Configuration de l'image] jzaehrin
Line 3: Line 3:
 Installation d'une Debian sur une carte flash. Installation d'une Debian sur une carte flash.
  
 +Version humainement lisible: [[Flash Card Tret]]
 +
 +[[operating_systems:linux:debian:flash_card:Ubuntu_upstart|Bug de upstart en chroot]]
 ===== Préparation de la carte ===== ===== Préparation de la carte =====
  
-==== Suppression des partitions ==== 
- 
-On commence par supprimer les partitions déjà crées sur la carte. 
- 
-''debian:/home/sbolay# fdisk /dev/sdb'' 
- 
-    Command (m for help): p 
-     
-    Disk /dev/sdb: 4000 MB, 4000317440 bytes 
-    124 heads, 62 sectors/track, 1016 cylinders 
-    Units = cylinders of 7688 * 512 = 3936256 bytes 
-    Disk identifier: 0xbf7f3f48 
-     
-      Device Boot      Start         End      Blocks   Id  System 
-    /dev/sdb1                    1013     3893941   83  Linux 
-    /dev/sdb2            1014        1016       11532   83  Linux 
-     
-    Command (m for help): d 1 
-    Partition number (1-4): 1 
-     
-    Command (m for help): p 
-     
-    Disk /dev/sdb: 4000 MB, 4000317440 bytes 
-    124 heads, 62 sectors/track, 1016 cylinders 
-    Units = cylinders of 7688 * 512 = 3936256 bytes 
-    Disk identifier: 0x00000000 
-     
-    Device Boot      Start         End      Blocks   Id  System 
-    /dev/sdb2            1014        1016       11532   83  Linux 
-     
-    Command (m for help): d 1 
-    Selected partition 2 
-     
-    Command (m for help): p 
-     
-    Disk /dev/sdb: 4000 MB, 4000317440 bytes 
-    124 heads, 62 sectors/track, 1016 cylinders 
-    Units = cylinders of 7688 * 512 = 3936256 bytes 
-    Disk identifier: 0x00000000 
-     
-    Device Boot      Start         End      Blocks   Id  System 
-     
-    Command (m for help): w 
-    The partition table has been altered! 
-     
-    Calling ioctl() to re-read partition table. 
-    Syncing disks.  
  
-Une fois les partitions supprimées, on réinitialise la carte à zéro.+Réinitialiser la carte à zéro.
  
 ''debian:/home/sbolay# dd if=/dev/zero of=/dev/sdb'' ''debian:/home/sbolay# dd if=/dev/zero of=/dev/sdb''
Line 73: Line 29:
     Units = cylinders of 7688 * 512 = 3936256 bytes     Units = cylinders of 7688 * 512 = 3936256 bytes
     Disk identifier: 0xbf7f3f48     Disk identifier: 0xbf7f3f48
 +    
     Device Boot      Start         End      Blocks   Id  System     Device Boot      Start         End      Blocks   Id  System
          
Line 103: Line 59:
     Syncing disks.     Syncing disks.
  
-debian:/home/sbolay# mkfs.ext3 -v /dev/sdb1 +==== Formatage de la partition ====
-mke2fs 1.41.3 (12-Oct-2008) +
-fs_types for mke2fs.conf resolution: 'ext3', 'default' +
-Filesystem label= +
-OS type: Linux +
-Block size=4096 (log=2) +
-Fragment size=4096 (log=2) +
-244320 inodes, 976368 blocks +
-48818 blocks (5.00%) reserved for the super user +
-First data block=+
-Maximum filesystem blocks=1002438656 +
-30 block groups +
-32768 blocks per group, 32768 fragments per group +
-8144 inodes per group +
-Superblock backups stored on blocks:  +
- 32768, 98304, 163840, 229376, 294912, 819200, 884736+
  
-Writing inode tables: done                             +On crée la partition qui contiendra notre Debian.
-Creating journal (16384 blocks): done +
-Writing superblocks and filesystem accounting information: done+
  
-This filesystem will be automatically checked every 31 mounts or +''debian:/home/sbolay# mkfs.ext3 -v /dev/sdb1''
-180 days, whichever comes first Use tune2fs -c or -i to override.+
  
 +    mke2fs 1.41.3 (12-Oct-2008)
 +    fs_types for mke2fs.conf resolution: 'ext3', 'default'
 +    Filesystem label=
 +    OS type: Linux
 +    Block size=4096 (log=2)
 +    Fragment size=4096 (log=2)
 +    244320 inodes, 976368 blocks
 +    48818 blocks (5.00%) reserved for the super user
 +    First data block=0
 +    Maximum filesystem blocks=1002438656
 +    30 block groups
 +    32768 blocks per group, 32768 fragments per group
 +    8144 inodes per group
 +    Superblock backups stored on blocks: 
 +        32768, 98304, 163840, 229376, 294912, 819200, 884736
 +    
 +    Writing inode tables: done                            
 +    Creating journal (16384 blocks): done
 +    Writing superblocks and filesystem accounting information: done
 +    
 +    This filesystem will be automatically checked every 31 mounts or
 +    180 days, whichever comes first.  Use tune2fs -c or -i to override.
  
-debian:/mnt# mount /dev/sdb1 /mnt/cf/+===== Installation de Debian =====
  
-debian:/mnt# debootstrap --arch i386 squeeze /mnt/cf/ http://ftp.ch.debian.org/debian +==== Installation de l'image ====
-.... +
-I: Configuring aptitude... +
-I: Configuring tasksel-data... +
-I: Configuring tasksel... +
-I: Base system installed successfully.+
  
----- debian:/mnt# mount -t proc none /mnt/cf/proc +L'utilitaire 'debootstrap' va installer une image de Debian sur la carte.
----- debian:/mnt# mount -t sysfs nonen /mnt/cf/sys+
  
-debian:/mnt# mount -o bind /proc /mnt/cf/proc +''debian:/mnt# mount /dev/sdb1 /mnt/cf/''
-debian:/mnt# mount -o bind /dev /mnt/cf/dev +
-debian:/mnt# mount -o bind /sys /mnt/cf/sys+
  
-debian:/mnt# LANG=C chroot /mnt/cf/ /bin/bash+''debian:/mnt# debootstrap --arch i386 squeeze /mnt/cf/ http://ftp.ch.debian.org/debian'' 
 +    .... 
 +    I: Configuring aptitude... 
 +    I: Configuring tasksel-data... 
 +    I: Configuring tasksel... 
 +    I: Base system installed successfully.
  
-root@debian:/# mount devpts /dev/pts -t devpts+==== Configuration de l'image ====
  
-root@debian:/# UUID=$(dumpe2fs /dev/sdb1 | grep 'UUID' | cut -d':' -f2 | sed 's/[[:space:]]//g'+''debian:/mntmount -t proc none /mnt/cf/proc''
-dumpe2fs 1.41.12 (17-May-2010) +
-root@debian:/# echo $UUID +
-8c14d9c1-48cb-4ac1-b91d-780de47f8b8a+
  
-root@debian:/# sed -i "1s/$/\n proc \/proc proc nodev,noexec,nosuid 0 0/" /etc/fstab +''debian:/mntmount -t sysfs none /mnt/cf/sys''
-root@debian:/# sed -i "1s/$/\n UUID=$UUID \/ ext3 defaults,noatime 0 1/" /etc/fstab+
  
-root@debian:/# dpkg-reconfigure tzdata+''debian:/mntmount -o bind /proc /mnt/cf/proc''
  
-Current default time zone: 'Europe/Zurich' +''debian:/mnt# mount -o bind /dev /mnt/cf/dev''
-Local time is now     Fri Oct 14 17:16:25 CEST 2011. +
-Universal Time is now:  Fri Oct 14 15:16:25 UTC 2011.+
  
-root@debian:/# vi /etc/network/interfaces  +''debian:/mntmount -o bind /sys /mnt/cf/sys''
-# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or +
-# /usr/share/doc/ifupdown/examples for more information. +
-auto lo +
-iface lo inet loopback+
  
-auto eth0 +''debian:/mnt# LANG=C chroot /mnt/cf/ /bin/bash''
-iface eth0 inet dhcp+
  
-root@debian:/# cat /etc/fstab  +''root@debian:/# mount devpts /dev/pts -t devpts''
-# UNCONFIGURED FSTAB FOR BASE SYSTEM +
-proc /proc proc defaults 0 0 +
-UUID=8c14d9c1-48cb-4ac1-b91d-780de47f8b8a / ext3 defaults,noatime 0 1 +
-#/dev/sda1 /         ext3  defaults,noatime 0 1 +
-tmpfs     /tmp      tmpfs defaults,noatime 0 0 +
-tmpfs     /var/tmp  tmpfs defaults,noatime 0 0 +
-tmpfs     /var/run  tmpfs defaults 0 0 +
-tmpfs     /var/log  tmpfs defaults 0 0 +
-tmpfs     /var/lock tmpfs defaults 0 0+
  
 +''root@debian:/# UUID=$(dumpe2fs /dev/sdb1 | grep 'UUID' | cut -d':' -f2 | sed 's/ [ [:space:] ]/ /g')''
  
-root@debian:/# vi /etc/hostname  +    dumpe2fs 1.41.12 (17-May-2010)
-NiX+
  
-root@debian:/# sed -i '1s/$/\ndeb http:\/\/security\.debian\.org\/ squeeze\/updates main//etc/apt/sources.list +''root@debian:/# echo $UUID''
-root@debian:/# sed -i '1s/$/\ndeb-src http:\/\/security\.debian\.org\/ squeeze\/updates main//etc/apt/sources.list+
  
-root@debian:/# cat /etc/apt/sources.list +    8c14d9c1-48cb-4ac1-b91d-780de47f8b8a
-deb http://ftp.ch.debian.org/debian squeeze main +
-deb-src http://security,debian.org/ squeeze/updates main +
-deb http://security,debian.org/ squeeze/updates main+
  
-root@debian:/# aptitude update +''root@debian:/# sed -i "1s/$/\n proc \/proc proc nodev,noexec,nosuid 0 0/" /etc/fstab''
-root@debian:/# aptitude install locales+
  
-root@debian:/# dpkg-reconfigure locales +''root@debian:/# sed -i "1s/$/\n UUID=$UUID \/ ext3 defaults,noatime 0 1/" /etc/fstab''
-Generating locales (this might take a while)... +
-  fr_CH.ISO-8859-1... done +
-Generation complete.+
  
-root@debian:/# aptitude install console-data+''root@debian:/# dpkg-reconfigure tzdata''
  
-root@debian:/# aptitude install linux-image-486+    Current default time zone'Europe/Zurich' 
 +    Local time is now:      Fri Oct 14 17:16:25 CEST 2011. 
 +    Universal Time is now:  Fri Oct 14 15:16:25 UTC 2011.
  
-root@debian:/# aptitude install grub+''root@debian:/# vi /etc/network/interfaces ''
  
-root@debian:/vi /etc/default/grub  +    Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or 
-# If you change this file, run 'update-grub' afterwards to update +    # /usr/share/doc/ifupdown/examples for more information. 
-# /boot/grub/grub.cfg.+    auto lo 
 +    iface lo inet loopback 
 +     
 +    auto eth0 
 +    iface eth0 inet dhcp
  
-GRUB_DEFAULT=+''root@debian:/# cat /etc/fstab'' 
-GRUB_TIMEOUT=+    # UNCONFIGURED FSTAB FOR BASE SYSTEM 
-GRUB_DISTRIBUTOR=`lsb_release --s 2> /dev/null || echo Debian` +    proc /proc proc defaults 0 
-#GRUB_CMDLINE_LINUX_DEFAULT="quiet" +    UUID=8c14d9c1-48cb-4ac1-b91d-780de47f8b8a / ext3 defaults,noatime 0 1 
-GRUB_CMDLINE_LINUX_DEFAULT="verbose console=ttyS0,38400n8 reboot=bios" +    #/dev/sda1 /         ext3  defaults,noatime 0 1 
-GRUB_SERIAL_COMMAND="serial --unit=--speed=38400" +    tmpfs     /tmp      tmpfs defaults,noatime 0 0 
-GRUB_CMDLINE_LINUX=""+    tmpfs     /var/tmp  tmpfs defaults,noatime 0 0 
 +    tmpfs     /var/run  tmpfs defaults 0 
 +    tmpfs     /var/log  tmpfs defaults 0 0 
 +    tmpfs     /var/lock tmpfs defaults 0 0
  
-Uncomment to enable BadRAM filtering, modify to suit your needs +''root@debian:/vi /etc/hostname''
-# This works with Linux (no patch required) and with any kernel that obtains +
-# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...) +
-#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"+
  
-# Uncomment to disable graphical terminal (grub-pc only) +    NiX
-#GRUB_TERMINAL=console +
-GRUB_TERMINAL=serial+
  
-# The resolution used on graphical terminal +''root@debian:/sed -i '1s/$/\ndeb http:\/\/security\.debian\.org\/ squeeze\/updates main/' /etc/apt/sources.list''
-# note that you can use only modes which your graphic card supports via VBE +
-# you can see them in real GRUB with the command `vbeinfo' +
-#GRUB_GFXMODE=640x480+
  
-# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux +''root@debian:/sed -i '1s/$/\ndeb-src http:\/\/security\.debian\.org\/ squeeze\/updates main/' /etc/apt/sources.list''
-#GRUB_DISABLE_LINUX_UUID=true+
  
-Uncomment to disable generation of recovery mode menu entries +''root@debian:/cat /etc/apt/sources.list''
-#GRUB_DISABLE_LINUX_RECOVERY="true"+
  
-# Uncomment to get a beep at grub start +    deb http://ftp.ch.debian.org/debian squeeze main 
-#GRUB_INIT_TUNE="480 440 1"+    deb-src http://security,debian.org/ squeeze/updates main 
 +    deb http://security,debian.org/ squeeze/updates main 
 +     
 +<note important>a partir de cette étape, il est possible qu'une erreur de Upstart survient, pour contourné ce problème, suivez c'est quelques lignes [[operating_systems:linux:debian:flash_card:Ubuntu_upstart|ici]] et reprenez les mise à jour des packets du début.</note>
  
-debian:/mnt/cf/boot/grubecho '(hd0) /dev/sdb> /boot/grub/device.map+''root@debian:/# aptitude update''
  
-root@debian:/# grub-install /dev/sdb +''root@debian:/# aptitude install locales''
-Installation finished. No error reported.+
  
-root@debian:/# update-grub +''root@debian:/# dpkg-reconfigure locales'' 
-Generating grub.cfg ... +    Generating locales (this might take a while)... 
-Found linux image: /boot/vmlinuz-2.6.32-5-486 +      fr_CH.ISO-8859-1... done 
-Found initrd image: /boot/initrd.img-2.6.32-5-486 +    Generation complete.
-done+
  
---CHECK-- root@debian:/# sed -'s/hd1/hd0/g/boot/grub/grub.cfg +''root@debian:/# aptitude install console-data''
  
-root@debian:/# vi /etc/inittab  +''root@debian:/# aptitude install linux-image-486''
-#1:2345:respawn:/sbin/getty 38400 tty1 +
-#2:23:respawn:/sbin/getty 38400 tty2 +
-#3:23:respawn:/sbin/getty 38400 tty3 +
-#4:23:respawn:/sbin/getty 38400 tty4 +
-#5:23:respawn:/sbin/getty 38400 tty5 +
-#6:23:respawn:/sbin/getty 38400 tty6+
  
-T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100+''root@debian:/# aptitude install grub''
  
-root@debian:/# passwd root    (nixpw+''root@debian:/# vi /etc/default/grub'' 
-Enter new UNIX password:  +    # If you change this file, run 'update-grub' afterwards to update 
-Retype new UNIX password:  +    # /boot/grub/grub.cfg. 
-passwd: password updated successfully+     
 +    GRUB_DEFAULT=0 
 +    GRUB_TIMEOUT=5 
 +    GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian` 
 +    #GRUB_CMDLINE_LINUX_DEFAULT="quiet" 
 +    GRUB_CMDLINE_LINUX_DEFAULT="verbose console=ttyS0,38400n8 reboot=bios" 
 +    GRUB_SERIAL_COMMAND="serial --unit=0 --speed=38400" 
 +    GRUB_CMDLINE_LINUX="" 
 +     
 +    # Uncomment to enable BadRAM filtering, modify to suit your needs 
 +    # This works with Linux (no patch requiredand with any kernel that obtains 
 +    # the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...) 
 +    #GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef" 
 +     
 +    # Uncomment to disable graphical terminal (grub-pc only) 
 +    #GRUB_TERMINAL=console 
 +    GRUB_TERMINAL=serial 
 +     
 +    # The resolution used on graphical terminal 
 +    # note that you can use only modes which your graphic card supports via VBE 
 +    # you can see them in real GRUB with the command `vbeinfo' 
 +    #GRUB_GFXMODE=640x480 
 +     
 +    # Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux 
 +    #GRUB_DISABLE_LINUX_UUID=true 
 +     
 +    # Uncomment to disable generation of recovery mode menu entries 
 +    #GRUB_DISABLE_LINUX_RECOVERY="true" 
 +     
 +    # Uncomment to get a beep at grub start 
 +    #GRUB_INIT_TUNE="480 440 1"
  
-root@debian:/# aptitude install rsyslog sudo +''debian:/mnt/cf/boot/grubecho '(hd0) /dev/sdb' > /boot/grub/device.map''
-root@debian:/# tasksel install standard +
-root@debian:/# tasksel install ssh-server +
-root@debian:/# aptitude clean +
-root@debian:/# umount /dev/pts +
-root@debian:/# exit +
-exit+
  
-debian:/# umount /mnt/cf/proc+''root@debian:/# grub-install /dev/sdb'' 
-debian:/# umount /mnt/cf/sys +    Installation finished. No error reported.
-debian:/# umount /mnt/cf/dev +
-debian:/# umount /mnt/cf+
  
 +''root@debian:/# update-grub''
  
-debian:/mnt# df -+    Generating grub.cfg ... 
-Filesystem            Size  Used Avail Use% Mounted on +    Found linux image: /boot/vmlinuz-2.6.32-5-486 
-/dev/sdb1             3.7G  547M  3.0G  16% /mnt/cf+    Found initrd image: /boot/initrd.img-2.6.32-5-486 
 +    done
  
 +''root@debian:/# sed -i 's/hd1/hd0/g' /boot/grub/grub.cfg''
 +
 +''root@debian:/# vi /etc/inittab''
 +
 +    #1:2345:respawn:/sbin/getty 38400 tty1
 +    #2:23:respawn:/sbin/getty 38400 tty2
 +    #3:23:respawn:/sbin/getty 38400 tty3
 +    #4:23:respawn:/sbin/getty 38400 tty4
 +    #5:23:respawn:/sbin/getty 38400 tty5
 +    #6:23:respawn:/sbin/getty 38400 tty6
 +    
 +    T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
 +
 +''root@debian:/# passwd root    (nixpw)''
 +
 +    Enter new UNIX password: 
 +    Retype new UNIX password: 
 +    passwd: password updated successfully
 +
 +''root@debian:/# aptitude install rsyslog sudo''
 +
 +''root@debian:/# tasksel install standard''
 +
 +''root@debian:/# tasksel install ssh-server''
 +
 +''root@debian:/# aptitude clean''
 +
 +''root@debian:/# umount /dev/pts''
 +
 +''root@debian:/# exit''
 +
 +    exit
 +
 +''debian:/# umount /mnt/cf/proc/''
 +
 +''debian:/# umount /mnt/cf/sys''
 +
 +''debian:/# umount /mnt/cf/dev''
 +
 +''debian:/# umount /mnt/cf''
 +
 +''debian:/mnt# df -h''
 +
 +    Filesystem            Size  Used Avail Use% Mounted on
 +    /dev/sdb1             3.7G  547M  3.0G  16% /mnt/cf
 +    
  
-Links:+Si le système d'exploitation ne démarre pas, revérifier fichier /etc/fstab. la variable UUID doit est impérativement collé au '=' et à l'UUID du stockage.  
 +===== Links: =====
 http://www.youtube.com/watch?v=6VPsgR4pMik http://www.youtube.com/watch?v=6VPsgR4pMik
 https://mseiwald.at/doc/alix/installation https://mseiwald.at/doc/alix/installation
operating_systems/linux/debian/flash_card.txt · Last modified: 2013/12/20 09:57 by jzaehrin