Kickstart-list Digest, Vol 137, Issue 2

Abhijit Das abhijitd at apple.com
Fri Jan 29 17:51:27 UTC 2016


If i do not have my disk partitioning (for the purpose of dynamically calculating swap, note my logic is bit flawed for dynamic calculation, yes i divided it by a hardcoded value, but this was to test if it works) in %pre and have it outside, this works.

OS is Redhat 6.6

On Jan 29, 2016, at 9:36 AM, kickstart-list-request at redhat.com wrote:

Send Kickstart-list mailing list submissions to
	kickstart-list at redhat.com

To subscribe or unsubscribe via the World Wide Web, visit
	https://www.redhat.com/mailman/listinfo/kickstart-list
or, via email, send a message with subject or body 'help' to
	kickstart-list-request at redhat.com

You can reach the person managing the list at
	kickstart-list-owner at redhat.com

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Kickstart-list digest..."
Today's Topics:

  1. Re: Kickstart-list Digest, Vol 137, Issue 1 (Abhijit Das)

From: Abhijit Das <abhijitd at apple.com>
Subject: Re: Kickstart-list Digest, Vol 137, Issue 1
Date: January 29, 2016 at 9:35:50 AM PST
To: kickstart-list at redhat.com
Reply-To: Discussion list about Kickstart <kickstart-list at redhat.com>


@ Arun - I believe it shouldn’t matter where the %pre is located. However, i have tried and the same error.

@ Chris - I appended —log /tmp/ks-pre.log to %pre but the log file is blank. /ks/anaconda.log tells me that %pre is executed but not .. 

Here i have modified %pre

%pre --log=/tmp/pre-log
#!/bin/bash
exec < /dev/tty6 > /dev/tty6 2> /dev/tty6
chvt 6

disk=`sfdisk -s | head -1 | awk -F':' '{print $1}'`
mem=`cat /proc/meminfo | grep MemTotal: | sed 's/^.*MemTotal: \(.*\)kB*$/\1/'`
mem_mb=`expr $mem / 2048`
allparts=$( sfdisk -d | grep "/dev/"| grep -v "^#" | cut -d ":" -f1 )
for part in $allparts
do
 dd if=/dev/zero of=$part bs=512 count=16
done

cat << EOF > /tmp/disk_partition.sh
clearpart --all --drives=$disk
part /boot/efi --fstype=efi --grow --maxsize=200 --size=20
part /boot --fstype=ext4 --size=500
part pv.01 --grow --size=1
volgroup VolGroup01 --pesize=4096 pv.01
logvol / --fstype=ext4 --name=lv_root --vgname=VolGroup01 --grow --size=1024
logvol swap --fstype=swap --name=lv_swap --vgname=VolGroup01 –-size=$mem_mb
EOF

APIKEY=aea1e3bb412e0e8273340f5e5ec22c33
HOSTNAME=$(hostname)
curl -s -o /tmp/deploytoken --data "private_token=${APIKEY}&hostname=${HOSTNAME}&message=preinstall_start" https://1.1.1.1/api/v2/deploy/log/start <https://1.1.1.1/api/v2/deploy/log/start>

chvt 1
exec < /dev/tty1 > /dev/tty1 2> /dev/tty1





On Jan 29, 2016, at 9:00 AM, kickstart-list-request at redhat.com <mailto:kickstart-list-request at redhat.com> wrote:

Send Kickstart-list mailing list submissions to
	kickstart-list at redhat.com <mailto:kickstart-list at redhat.com>

To subscribe or unsubscribe via the World Wide Web, visit
	https://www.redhat.com/mailman/listinfo/kickstart-list
or, via email, send a message with subject or body 'help' to
	kickstart-list-request at redhat.com

You can reach the person managing the list at
	kickstart-list-owner at redhat.com

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Kickstart-list digest..."
Today's Topics:

  1. Dynamic allocation of swap not working. (Abhijit Das)
  2. Re: Dynamic allocation of swap not working. (Abhijit Das)
  3. Re: Dynamic allocation of swap not working. (Arun SAG)
  4. Re: Dynamic allocation of swap not working. (Chris Lumens)

From: Abhijit Das <abhijitz at icloud.com>
Subject: Dynamic allocation of swap not working.
Date: January 28, 2016 at 8:34:49 PM PST
To: kickstart-list at redhat.com
Reply-To: Discussion list about Kickstart <kickstart-list at redhat.com>



Trying to dynamically allocate swap

logvol / --fstype=ext4 --name=lv_root --vgname=VolGroup00 --grow --size=1024
%include /tmp/swap_partition

%pre
#!/bin/bash
mem=`cat /proc/meminfo | grep MemTotal: | sed 's/^.*MemTotal: \(.*\)kB*$/\1/'`
mem_mb=`expr $mem / 1024`
echo "logvol swap --name=lv_swap --vgname=VolGroup00 –-size=$mem_mb" > /tmp/swap_partition

It throws an error that /tmp/swap_partition is not found. Please advise how should i proceed.










From: Abhijit Das <abhijitz at icloud.com>
Subject: Re: Dynamic allocation of swap not working.
Date: January 28, 2016 at 9:14:56 PM PST
To: kickstart-list at redhat.com
Reply-To: Discussion list about Kickstart <kickstart-list at redhat.com>


I tried every possible way … still same error, 

Here is my command section. 

clearpart --linux
zerombr

part /boot/efi --fstype=efi --grow --maxsize=200 --size=20
part /boot --fstype=ext4 --size=500
part pv.008002 --grow --size=1

%include /tmp/disk_partition.cfg




Here is my complete %pre section now.

%pre
mem=`cat /proc/meminfo | grep MemTotal: | sed 's/^.*MemTotal: \(.*\)kB*$/\1/'`
mem_mb=`expr $mem / 1024`

cat << EOF > /tmp/disk_partition.cfg
volgroup VolGroup00 --pesize=4096 pv.008002
logvol / --fstype=ext4 --name=lv_root --vgname=VolGroup00 --grow --size=1024
logvol swap --name=lv_swap --vgname=VolGroup00 –-size=$mem_mb
EOF

sleep 5

exec < /dev/tty6 > /dev/tty6 2> /dev/tty6
chvt 6

APIKEY=xxxx
HOSTNAME=$(hostname)
curl -s -o /tmp/deploytoken --data "private_token=${APIKEY}&hostname=${HOSTNAME}&message=preinstall_start" https://<internal_URL>

chvt 1



On Jan 28, 2016, at 8:34 PM, Abhijit Das <abhijitz at icloud.com> wrote:


Trying to dynamically allocate swap

logvol / --fstype=ext4 --name=lv_root --vgname=VolGroup00 --grow --size=1024
%include /tmp/swap_partition

%pre
#!/bin/bash
mem=`cat /proc/meminfo | grep MemTotal: | sed 's/^.*MemTotal: \(.*\)kB*$/\1/'`
mem_mb=`expr $mem / 1024`
echo "logvol swap --name=lv_swap --vgname=VolGroup00 –-size=$mem_mb" > /tmp/swap_partition

It throws an error that /tmp/swap_partition is not found. Please advise how should i proceed.











From: Arun SAG <sagarun at gmail.com>
Subject: Re: Dynamic allocation of swap not working.
Date: January 28, 2016 at 9:44:53 PM PST
To: Discussion list about Kickstart <kickstart-list at redhat.com>
Reply-To: Discussion list about Kickstart <kickstart-list at redhat.com>


On Thu, Jan 28, 2016 at 09:14:56PM -0800, Abhijit Das wrote:
> I tried every possible way … still same error, 
> 
> Here is my command section. 
> 
> clearpart --linux
> zerombr
> 
> part /boot/efi --fstype=efi --grow --maxsize=200 --size=20
> part /boot --fstype=ext4 --size=500
> part pv.008002 --grow --size=1
> 
> %include /tmp/disk_partition.cfg
> 

Try moving the %include /tmp/disk_partition.cfg below the %pre section in
your kickstart file



From: Chris Lumens <clumens at redhat.com>
Subject: Re: Dynamic allocation of swap not working.
Date: January 29, 2016 at 8:09:08 AM PST
To: kickstart-list at redhat.com
Reply-To: Discussion list about Kickstart <kickstart-list at redhat.com>


> Trying to dynamically allocate swap
> 
> logvol / --fstype=ext4 --name=lv_root --vgname=VolGroup00 --grow --size=1024
> %include /tmp/swap_partition
> 
> %pre
> #!/bin/bash
> mem=`cat /proc/meminfo | grep MemTotal: | sed 's/^.*MemTotal: \(.*\)kB*$/\1/'`
> mem_mb=`expr $mem / 1024`
> echo "logvol swap --name=lv_swap --vgname=VolGroup00 ???-size=$mem_mb" > /tmp/swap_partition
> 
> It throws an error that /tmp/swap_partition is not found. Please advise how should i proceed.

What OS and version?  Are there any other errors in your
/tmp/anaconda.log or on tty1?

- Chris




_______________________________________________
Kickstart-list mailing list
Kickstart-list at redhat.com
https://www.redhat.com/mailman/listinfo/kickstart-list



_______________________________________________
Kickstart-list mailing list
Kickstart-list at redhat.com
https://www.redhat.com/mailman/listinfo/kickstart-list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/kickstart-list/attachments/20160129/28dc5274/attachment.htm>


More information about the Kickstart-list mailing list