====== Installing Debian Lenny onto a LDOM logical domain ====== ===== Introduction ===== In this wiki, we will detail all steps followed to create a LDOMs logical domain ready to run Debian Lenny, and then to install that operating system. //Disclaimer: This procedure includes some actions over partition tables in virtual hard drives, and any mistake can leave your virtual disk unusable. Please, follow the steps carefully ;-)// ===== Logical domain creation ===== To create the logical domain, we will follow the standard procedure but, once created virtual disk and bound the domain, we should overwrite the partition table with 512 null bytes, since LDOMs version included in Opensolaris 2009.06 will overwrite partition tables with fake Sun VTOCs, and this will leave unusable the disk for Linux. So, let's go with the configuration steps. Our test domain will have 1 Gb RAM, 1 CPU thread and 4 Gb disk: global# ldm list-domain NAME STATE FLAGS CONS VCPU MEMORY UTIL UPTIME primary active -n-cv- SP 8 4G 0.2% 10m global# ldm add-domain debiandom global# ldm add-vcpu 1 debiandom global# ldm add-memory 1024m debiandom global# ldm add-vnet vnet1 primary-vsw0 debiandom global# mkfile 4G /export/ldomsvdisks/debian01.img Now, let's add virtual disk to the domain and bind it: global# ldm add-vdsdev /export/ldomsvdisks/debian01.img vol2@primary-vds0 global# ldm add-vdisk vdisk1 vol2@primary-vds0 debiamdom global# ldm bind debiandom After binding, we should restore an empty partition table: global# dd if=/dev/zero of=/export/ldomsvdisks/debian01.img conv=notrunc count=1 Last, we will change auto-boot variable to false, to avoid autoboots while installing it: global# ldm set-variable auto-boot\?=false debiandom So, our domain is ready to receive a Debian installation. Let's go with it. ===== Network installation ===== We cannot install Debian with a CDROM image, so we will do it with the most basic (and compatible) network installation: by using TFTP. ==== Installing the install server ==== We need to configure RARP and TFTP. Let's start with TFTP, serving the Debian Lenny for Sparc boot.img through the network: global# mkdir /tftpboot ; cd /tftpboot global# http://ftp.us.debian.org/debian/dists/lenny/main/installer-sparc/current/images/netboot/boot.img Now, we need an additional link in /tftpboot, dependent on assigned IP address to our client, in our case 192.168.91.2. That is, the following commands: global# cd /tftpboot global# ln -sf boot.img `printf %02x 192 168 91 2|tr [:lower:] [:upper:]` global# ls -l ... lrwxrwxrwx 1 root root 15 Sep 18 19:42 C0A85B02 -> boot.img ... Now, we will configure the tftp service: global# echo "tftp dgram udp6 wait root /usr/sbin/in.tftpd in.tftpd -s /tftpboot" > ~/tftp.inetd.conf global# inetconv -i tftp.inetd.conf global# svcs -a|grep tftp online 19:05:45 svc:/network/tftp/udp6:default And then, we will install and configure RARP: global# pkg install SUNWbs Now, we need to know the virtual MAC and save it to /etc/ethers: global# ldm ls -l debiandom |grep vnet1 vnet1 primary-vsw0@primary network@0 00:14:4f:fb:02:4a 1 1500 So, let's save this MAC in /etc/ethers and put the IP address in /etc/hosts. Finally, we start the RARP service. In our example: global# echo "00:14:4f:fb:02:4a debiandom" > /etc/ethers global# echo "192.168.91.2 debiandom" >> /etc/hosts global# svcadm enable rarp We should also to configure NAT in control domain, in order to permit our Debian to reach Internet and download packages. For example, we need to configure an IP address in virtual switch used for the LDOMs: global# ifconfig vsw0 plumb ; ifconfig vsw0 192.168.91.1 netmask 255.255.255.0 up And we should add the following lines for NAT to /etc/ipf/ipnat.conf: map e1000g0 192.168.91.0/24 -> 0/32 proxy port ftp ftp/tcp map e1000g0 192.168.91.0/24 -> 0/32 portmap tcp/udp auto map e1000g0 192.168.91.0/24 -> 0/32 Let's reload NAT tables: global# ipnat -CF -f /etc/ipf/ipnat.conf ==== Starting installation ==== Now, it's time to start logical domain and connect us to its console, by using the commands: global# ldm start debiandom ; telnet localhost 5000 Connecting to console "t2000-01" in group "t2000-01" .... Press ~? for control options .. ~ ? {0} ok boot net Boot device: /virtual-devices@100/channel-devices@200/network@0 File and args: Requesting Internet Address for 0:14:4f:fb:2:4a /- After booting net, we will see the boot messages for Linux. Now, we will start the Debian Lenny installation, with the following tips: * Manually select //sunvnet// network driver as soon as Debian ask us for it since Debian will not find it automatically. * Manually configure IP address and rest of network parameters, since we are not using DHCP. For example: IP address: 192.168.91.2 Netmask: 255.255.255.0 GW: 192.168.91.1 Nameserver: x.x.x.x (put here your favourite DNS server) Hostname: debian * Select the closest Debian mirror and then Debian installer will download some files. The installer will stop again since it will not see hard drives and we will need to select the disk driver from a list. Here, manually select //sunvdc//. * We should then to see the partition manager, detecting our disk. Now, partition the disk at your own style. We have tested a single big partition and separate for /home, and it worked in both cases. The process will continue normally. We recommend to simplify it, so avoid any selection in tasksel step, and this will leave a base system installed and bootable, with network. In the last step, when the installer ask us about end process and reboot, **do not confirm** and go back, in order to launch a shell. Then go the next section. ==== Important steps before rebooting ==== We need to change some things after installation, before rebooting. If we omit the step, the system will be left unbootable. Changes here are for including //sunvdc// disk driver in the initial ramdisk. Also, Linux virtual consoles do not work ok and we should replace them with a generic console driver. (//we are studying this issue in order to fix it//). So, let's exit the Debian Installer menu by selecting execute the shell. Then, we should chroot to the installed system and then include the sunvdc driver in the initial ramdisk: # chroot /target # mount /proc # echo "sunvdc" >> /etc/initramfs-tools/modules # update-initramfs -u -k all # umount /proc Next step, we should change /etc/inittab to avoid use of virtual consoles and, instead, to getty the default console (/dev/console). To do this, edit /etc/inittab and comment all getty lines, and write one line for console getty, as follows: #1:2345:respawn:/sbin/getty 38400 tty1 1:2345:respawn:/sbin/getty 38400 console #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 It is all ready to boot. Leave the shell (with exit, again exit), and we will see again the install menu. Select the option Finish Installation and the system will be rebooted. We will see the boot prompt again since we deactivated auto-boot. ==== The first boot: post-install steps ==== After rebooting, best option is to install openssh-server to continue installation steps by ssh. Let's see the first boot log: Sun Fire T200, No Keyboard Copyright 2009 Sun Microsystems, Inc. All rights reserved. OpenBoot 4.30.3, 1024 MB memory available, Serial #83521591. Ethernet address 0:14:4f:fa:70:37, Host ID: 84fa7037. ok boot disk Boot device: /virtual-devices@100/channel-devices@200/disk@0 File and args: SILO Version 1.4.13 boot: Linux Allocated 8 Megs of memory at 0x40000000 for kernel Uncompressing image... Loaded kernel version 2.6.26 Loading initial ramdisk (6396281 bytes at 0x9000000 phys, 0x40C00000 virt)... - ... ... Starting OpenBSD Secure Shell server: sshd[697845.670757] NET: Registered protocol family 10 [697845.670757] NET: Registered protocol family 10 [697845.675673] lo: Disabled Privacy Extensions [697845.675673] lo: Disabled Privacy Extensions . Starting periodic command scheduler: crond. Debian GNU/Linux 5.0 debian console debian login: root Password: ... -bash: no job control in this shell debian:~# apt-get install openssh-server We should have ready also the normal user account in order to log in as it by ssh, and then su or sudo to root. For the curious, here we have [[debianldomboot|the complete boot log]]. ===== References ===== * [[http://tech.libresoft.es/doku.php/ldominstall|Main procedures to install LDOMs (in spanish)]] * [[http://blogs.sun.com/achartre/entry/linux_with_ldoms|Avoiding overwriting partition table problems]]