Re: FAI going to the cloud

2016-07-29 Diskussionsfäden Andrew Ruthven
On Fri, 2016-07-29 at 16:27 +0200, Thomas Lange wrote:
> A new beta version of FAI is available. It now includes a new command
> for creating cloud^Wdisk images. fai-diskimage can create a raw or
> qcow2 disk image without starting a virtual machine. This image is
> ready-to-boot for your VM or cloud instance. Currently it has no man
> page, but a help is printed when calling with -h.

Oh, this looks interesting. I was planning on doing something similar
to how we've been using FAI to build Linux-VServers. Use a standard
image, then copy up the FAI config directory and for a fai-softupdate.

> I plan to release FAI 5.2 in september, so any feedback is welcome.

I'll give it a whirl in the new week.

Cheers,
Andrew
-- 
Andrew Ruthven, Wellington, New Zealand
and...@etc.gen.nz | linux.conf.au 2016 
  New Zealand's only Cloud:   | LCA By the Bay, Geelong, AU
https://catalyst.net.nz/cloud | http://lca2016.linux.org.au




Dracut error with fai-cd?

2016-07-29 Diskussionsfäden Louis-Philippe Véronneau
Hi!

I've been trying to create an ISO image with fai-cd without success...

I'm using the Debian Jessie version of the FAI packages.

At first I tried using the default grub.cfg that came with the package,
but when trying to create the VM, it would fail with this error message:

# dracut: FATAL: No or empty root= argument

Since the fai-cd ISO from the website was working just fine I copied
it's grub.cfg. I then got this error with dracut:

# dracut: FATAL! Don't know how to handle `root=live:CDLABEL=FAI_CD`

The cd label is ok though:

$ file fai.iso
fai.iso: DOS/MBR boot sector ISO 9660 CD-ROM filesystem data 'FAI_CD'
(bootable)

Am I doing something wrong or is this a bug I should report? Attached is
the grub.cfg file I'm using.

Thanks,

-- 
Louis-Philippe Véronneau 
Evolix - Hébergement et Infogérance Open Source http://www.evolix.ca/
## grub2 configuration
set default="Boot OS from first partition on first disk"
set timeout=20
set resolution=1024x768

set superusers="fai"
password fai install

if loadfont /boot/grub/ascii.pf2 ; then
   insmod png
   set gfxmode=640x480
   insmod gfxterm
   insmod vbe
   terminal_output gfxterm
fi

if background_image /boot/grub/fai.png ; then
  set color_normal=black/black
  set color_highlight=red/black
  set menu_color_normal=black/black
  set menu_color_highlight=black/yellow
else
  set menu_color_normal=white/black
  set menu_color_highlight=black/yellow
fi

# make sure we can access partitions
insmod part_msdos
insmod part_gpt

if [ ${iso_path} ] ; then
set loopback="findiso=${iso_path}"
fi


menuentry "+--+" 
--unrestricted {
set gfxpayload=$resolution
}

menuentry "|Fully  Automatic  Installation|" 
--unrestricted {
set gfxpayload=$resolution

}
menuentry "|FAI 5.1.2  build 2016 Jul 01 - 18:04  |" 
--unrestricted {
set gfxpayload=$resolution

}
menuentry "|(c) Thomas ange  la...@debian.org|" 
--unrestricted {
set gfxpayload=$resolution
}
menuentry "+--+" 
--unrestricted {
set gfxpayload=$resolution
}

menuentry "Username/password to start the installation:  fai/install " 
--unrestricted {
set gfxpayload=$resolution
}

menuentry "" --unrestricted {
set gfxpayload=$resolution
}
menuentry "Client standalone installation - select installation type from menu 
" --users "fai" {
set gfxpayload=$resolution
linux   /boot/vmlinuz FAI_FLAGS="menu,verbose,createvt" FAI_ACTION=install 
FAI_CONFIG_SRC=file:///var/lib/fai/config rd.live.image 
root=live:CDLABEL=FAI_CD rd.neednet ip=dhcp quiet
initrd  /boot/initrd.img
}



FAI going to the cloud

2016-07-29 Diskussionsfäden Thomas Lange
A new beta version of FAI is available. It now includes a new command
for creating cloud^Wdisk images. fai-diskimage can create a raw or
qcow2 disk image without starting a virtual machine. This image is
ready-to-boot for your VM or cloud instance. Currently it has no man
page, but a help is printed when calling with -h.

I plan to release FAI 5.2 in september, so any feedback is welcome.

Here's a log from a call of fai-diskimage:

# fai-diskimage -u cloudhost -S900M 
-cDEFAULT,DEBIAN,AMD64,FAIBASE,DEMO,GRUB_PC,CLOUD /tmp/disk
Formatting '/tmp/disk.raw', fmt=raw size=943718400 
 -
   Fully Automatic Installation  -  FAI

   5.2~beta11   (c) 1999-2016
   Thomas Lange  
 -
Starting FAI execution - 20160729_153848
Hostname set to cloudhost

Using configuration files from /etc/fai
Calling task_confdir
FAI_FLAGS: 
Setting SERVER=. Value extracted from FAI_CONFIG_SRC.
No monitor daemon defined.
FAI_CONFIG_SRC is set to file:///srv/fai/config
Using local path /srv/fai/config as config space.
Source hook: setup.DEFAULT.sh
setup.DEFAULT.sh OK.
Calling task_setup
FAI_FLAGS: 
Calling task_defclass
List of all classes:  DEFAULT DEBIAN AMD64 FAIBASE DEMO GRUB_PC CLOUD
Calling task_defvar
++ CONSOLEFONT=
++ KEYMAP=us-latin1
++ MODULESLIST='usbhid psmouse'
++ FAI_RAMDISKS='/tmp/fai-diskimage.Di5gWk/var/lib/dpkg 
/tmp/fai-diskimage.Di5gWk/var/cache'
++ FAI_ALLOW_UNSIGNED=1
++ UTC=yes
++ TIMEZONE=Europe/Berlin
++ ROOTPW=X
++ STOP_ON_ERROR=700
++ MAXPACKAGES=800
Calling task_action
FAI_ACTION: install
Performing FAI installation. All data may be overwritten!
Calling task_install
Calling task_partition
Starting setup-storage 2.0
Using config file: /srv/fai/config/disk_config/CLOUD
Parted could not read a disk label (new disk?)
Executing: parted -s /dev/loop0 mklabel msdos
DEGRADED MODE. Incomplete RAID LVs will be processed.
Finding all volume groups
  No volume groups found
Executing: parted -s /dev/loop0 mklabel msdos
Executing: parted -s /dev/loop0 mkpart primary "ext3" 1048576B 854589439B
Executing: parted -s /dev/loop0 set 1 boot on
Executing: parted -s /dev/loop0 mkpart primary "ext3" 854589440B 943718399B
Executing: mkfs.ext4  /dev/loop0p1
Executing: tune2fs -c 0 -i 0 /dev/loop0p1
Executing: mkfs.ext4 -L home -m 1 /dev/loop0p2
Executing: tune2fs -c 0 -i 0 /dev/loop0p2
/dev/loop0p2 UUID=300fd2ca-7363-4b74-a41d-969dd722894b
/dev/loop0p2 LABEL=home
/dev/loop0p1 UUID=138cf8b3-bb1d-426b-bdfc-7e27fbedcf2a
Calling task_mountdisks
Calling task_extrbase
Unpacking distro base archive
ftar: extracting /srv/fai/config/basefiles/CLOUD.tar.xz to 
/tmp/fai-diskimage.Di5gWk/
Calling task_debconf
Calling task_repository
'/etc/resolv.conf' -> '/tmp/fai-diskimage.Di5gWk/etc/resolv.conf'
'/etc/hosts' -> '/tmp/fai-diskimage.Di5gWk/etc/hosts' (backup: 
'/tmp/fai-diskimage.Di5gWk/etc/hosts.orig')
fcopy: no matching file for any class for etc/apt/sources.list defined.
'/etc/fai/apt/sources.list' -> '/tmp/fai-diskimage.Di5gWk/etc/apt/sources.list'
fcopy: no matching file for any class for etc/apt/sources.list defined.
fcopy: copied /srv/fai/config/files/etc/apt/apt.conf.d/force_confdef/DEBIAN to 
/tmp/fai-diskimage.Di5gWk/etc/apt/apt.conf.d/force_confdef
Loading APT key from DEBIAN.asc OK
Calling hook: updatebase.DEBIAN
updatebase.DEBIANOK.
Calling task_updatebase
Calling hook: instsoft.DEBIAN
fcopy: destination etc/apt/apt.conf.d/force_confdef remains unchanged
instsoft.DEBIAN  OK.
Calling task_instsoft
Installing software may take a while
Calling task_configure
Executingshell: DEBIAN/10-rootpw
DEBIAN/10-rootpw OK.
Executingshell: DEBIAN/20-capabilities
DEBIAN/20-capabilities OK.
Executingshell: DEBIAN/30-interface
DEBIAN/30-interface  OK.
Executingshell: DEBIAN/40-misc
DEBIAN/40-misc   OK.
Executingshell: FAIBASE/10-misc
FAIBASE/10-misc  OK.
Executingshell: FAIBASE/20-removable_media
FAIBASE/20-removable_media OK.
Executingshell: DEMO/10-misc
DEMO/10-misc OK.
Executingshell: GRUB_PC/10-setup
GRUB_PC/10-setup OK.
Executingshell: CLOUD/99-cleanup
CLOUD/99-cleanup OK.
Calling task_tests
Calling task_finish
Filesystem  Type  Size  Used Avail Use% Mounted on
/dev/loop0p1ext4  786M  627M  103M  86% /tmp/fai-diskimage.Di5gWk
/dev/loop0p2ext4   79M  1.6M   75M   3% 
/tmp/fai-diskimage.Di5gWk/home
Fri Jul 29 15:39:29 CEST 2016
The install took 41 seconds.
Calling task_chboot
Calling task_savelog
$LOGUSER is undefined. Not saving log files to remote.
Calling task_faiend
End of /usr/sbin/fai
Size of disk image and filename: 649M   /tmp/disk.raw
Image created by: /usr/sbin/fai-diskimage -u cloudhost -S900M 
-cDEFAULT,DEBIAN,AMD64,FAIBASE,DEMO,GRUB_PC,CLOUD /tmp/disk
-- 
regards Thomas (Mrfai)


Re: Not reboot/halt after successful installation

2016-07-29 Diskussionsfäden Thomas Lange
> On Mon, 25 Jul 2016 17:01:06 +0200, Steffen Grunewald 
>  said:

> according to the HTML user guide, there seems to be no option to "not 
reboot" a node that
> successfully finished a sysinfo or install run - except to add something 
to the error log
> forcefully (e.g. in a "last" hook).
> Citing the guide, "reboot: ... If this flag is not set, and error.log 
contains anything,
> the install client will stop and wait that you press RETURN. If no errors 
occurred, the
> client will always reboot automatically." (similar for halt).

> I have found an old patch I used to apply to FAI 3.x (with boot=live) 
that deactivated
> the check of the error log, and stopped if neither "reboot" nor "halt" 
were requested:

I rembember there was some confusion about the reboot flag in the
past. This commit removed the test if error.log is empty.

commit 17cecc5cd78bfd2212d5d269d44d43aeca013c27
Author: Thomas Lange 
Date:   Fri Feb 1 21:32:52 2013 +0100

do not reboot if error.log is empty Closes: #699279, #690016



IMO the problem is that we have three different expectations:
 - always reboot
 - never reboot (wait always)
 - reboot if error.log is empty

Since the flag has only two states, we cannot satisfy all three situations.

Should be now just fix the documentation, or is there need for support
of all three situations?

BTW, you may set flag_reboot=1 in hooks/savelog.LAST.sh depending on
the size of error.log.

-- 
regards Thomas