booting livecd ISO files and livecd-iso-to-disk.sh
by Joe Boyle
Hi all,
I've been digging into the problem of trying to book livecd ISO images
directly using GRUB2. I understand that this isn't intended to work "out
of the box" given the existence of the livecd-iso-to-disk script. However,
I'm hoping to skip writing ISO contents to a partition. I don't understand
the obstacles yet, but I'm willing to contribute to finding a solution.
So, Is there a reason the livecds created by livecd creator could not be
extended to support a more sophisticated initrd/initramfs which was able to:
a) locate and mount the HDD partition containing the ISO,
b) loopback mount the ISO,
c) set the root and continue booting?
Is livecd-iso-to-disk a temporary workaround or is this the intended
endgame for booting ISOs?
I've experimented some with dracut and mkinitramfs in an effort to better
learn the available alternatives but haven't successfully hacked a
livecd-creator ISO into booting. Currently, my problem is that my
initrd/initramfs/dracut images and corresponding kernels all fail to bring
up the /dev entries for my HDD devices. Even with an emergency shell, I
cannot locate the ISO image.
Any/all input would be appreciated.
Sincerely,
Joe
10 years, 9 months
Changes to 'refs/tags/livecd-tools-18.14'
by Brian C. Lane
Tag 'livecd-tools-18.14' created by Brian C. Lane <bcl(a)redhat.com> at 2012-12-15 00:33 +0000
Tag as livecd-tools-18.14
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iQEVAwUAUMvFThF+jBaO/jp/AQKvigf9E8aCmE3QdIEn/diI3K1DeTIiJGRPY0fN
ucoQGUBW05C3GLaOhKP3wDdexTrSrv5g3JWtGHWeQJaU+93xmZwCgzzXiyoekpg8
qltsnx/izz1LCK43BOCRiZSp4r7NP2g0wDIYb3CRVJdxZB/vzrh5NYbrLP9fDJsB
IZlUIbNfbDUvpxtfkQPIAaPtziODUe3K4U71PXSwVVoYgbWtR4GK8jVdS9q8whir
qJC+IyLWfi1C7wgrpCStXXOMOR0Ptv2Rj0FGnuwPgYlByzTpsWmDfRzT/MkLCgdo
MyPYtOaFCUZohWqaXMDJbBvV6wmkXpKzxYrwwJgG/n9xDkmEnsJl5w==
=8RN2
-----END PGP SIGNATURE-----
Changes since livecd-tools-18.13:
Brian C. Lane (2):
add --verifyudev to dmsetup (#885385)
Version 18.14
---
Makefile | 2 +-
imgcreate/fs.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
---
10 years, 9 months
Branch 'f18-branch' - 2 commits - imgcreate/fs.py Makefile
by Brian C. Lane
Makefile | 2 +-
imgcreate/fs.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
New commits:
commit ba5710bf1cba4c60ae938eefff1f3d84aef05713
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Fri Dec 14 16:33:01 2012 -0800
Version 18.14
diff --git a/Makefile b/Makefile
index 394a8fc..ab3768b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
-VERSION = 18.13
+VERSION = 18.14
INSTALL = /usr/bin/install -c
INSTALL_PROGRAM = ${INSTALL}
commit 7adb3b214f5a01e6c7ad8233eda09a90b1304227
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Fri Dec 14 12:01:00 2012 -0800
add --verifyudev to dmsetup (#885385)
diff --git a/imgcreate/fs.py b/imgcreate/fs.py
index d4558d3..bd327c1 100644
--- a/imgcreate/fs.py
+++ b/imgcreate/fs.py
@@ -559,7 +559,7 @@ class DeviceMapperSnapshot(object):
self.imgloop.device,
self.cowloop.device)
- args = ["/sbin/dmsetup", "create", self.__name,
+ args = ["/sbin/dmsetup", "create", self.__name, "-vv", "--verifyudev",
"--uuid", "LIVECD-%s" % self.__name, "--table", table]
if call(args) != 0:
self.cowloop.cleanup()
10 years, 9 months
Branch 'f17-branch' - 3 commits - Makefile tools/livecd-iso-to-disk.sh
by Brian C. Lane
Makefile | 2 +-
tools/livecd-iso-to-disk.sh | 22 ++++++++++++++--------
2 files changed, 15 insertions(+), 9 deletions(-)
New commits:
commit dc7412038e2324de5cf2a4f209d95e32b679fed6
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Thu Sep 6 16:56:49 2012 -0700
Version 17.15
diff --git a/Makefile b/Makefile
index cccd82c..7329fd6 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
-VERSION = 17.14
+VERSION = 17.15
INSTALL = /usr/bin/install -c
INSTALL_PROGRAM = ${INSTALL}
commit 93b9ba6be19af0b9436d1d9dcc5768048e0d3bf1
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Thu Sep 6 15:27:31 2012 -0700
use cp -r instead of -a
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index cd9a89c..fd10232 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -1089,7 +1089,7 @@ BOOTCONFIG=$TGTMNT/$SYSLINUXPATH/isolinux.cfg
BOOTCONFIG_EFI=
if [ -n "$efi" ]; then
echo "Setting up $EFI_BOOT"
- cp -a $SRCMNT$EFI_BOOT/* $TGTMNT$EFI_BOOT
+ cp -r $SRCMNT$EFI_BOOT/* $TGTMNT$EFI_BOOT
# The GRUB EFI config file can be one of:
# boot?*.conf
commit 9b6c0e067714989241308339fbaae39fb7f0159a
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Wed Sep 5 14:58:59 2012 -0700
New location for GRUB2 config on UEFI (#851220)
With Secure Boot and shim the GRUB2 config is no grub.cfg
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index 71fb288..cd9a89c 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -1089,14 +1089,20 @@ BOOTCONFIG=$TGTMNT/$SYSLINUXPATH/isolinux.cfg
BOOTCONFIG_EFI=
if [ -n "$efi" ]; then
echo "Setting up $EFI_BOOT"
- cp $SRCMNT$EFI_BOOT/* $TGTMNT$EFI_BOOT
-
- # FIXME
- # There is a problem here. On older LiveCD's the files are boot?*.conf
- # They really should be renamed to BOOT?*.conf
-
- # this is a little ugly, but it gets the "interesting" named config file
- BOOTCONFIG_EFI=$TGTMNT$EFI_BOOT/+(BOOT|boot)?*.conf
+ cp -a $SRCMNT$EFI_BOOT/* $TGTMNT$EFI_BOOT
+
+ # The GRUB EFI config file can be one of:
+ # boot?*.conf
+ # BOOT?*.conf
+ # grub.cfg
+ if [ -e $TGTMNT$EFI_BOOT/grub.cfg ]; then
+ BOOTCONFIG_EFI=$TGTMNT$EFI_BOOT/grub.cfg
+ elif [ -e $TGTMNT$EFI_BOOT/+(BOOT|boot)?*.conf ]; then
+ BOOTCONFIG_EFI=$TGTMNT$EFI_BOOT/+(BOOT|boot)?*.conf
+ else
+ echo "Unable to find EFI config file."
+ exitclean
+ fi
rm -f $TGTMNT$EFI_BOOT/grub.conf
# On some images (RHEL) the BOOT*.efi file isn't in $EFI_BOOT, but is in
10 years, 9 months
Changes to 'refs/tags/livecd-tools-18.13'
by Brian C. Lane
Tag 'livecd-tools-18.13' created by Brian C. Lane <bcl(a)redhat.com> at 2012-12-04 23:07 +0000
Tag as livecd-tools-18.13
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iQEVAwUAUL6COhF+jBaO/jp/AQLKowgAl5a2l4drTYOSqODXyq8hNyLVbaiIjSAb
TRPpndakomZMDg5AIl/TdonkgaLjbUMev9b4mdChXZRzwprtiL15jLFFosDgZakz
obSBaMxTc01ttiCurLhZA33HpcWB5+P4HdAMhjygRXUNx9mh2HAYhOZJxxx+svah
cHi4zZFVN7kISDW7UrnFcw3YizzUa3iiAiil+jp5xcI9CocHQ8blbSPhNpadwaqx
Tuhhzfk0ykgKUxz3guR5ZXizIAg+dk+gCvVQw4nrfJ5iWkFuQO4+XsAmBnPio8LT
JS8r5HmcTm9hxWeqmyQ5QLxmclbgk9U/LpNtJcaTOqcpFs5ilNxNBg==
=E8NF
-----END PGP SIGNATURE-----
Changes since livecd-tools-18.12:
Brian C. Lane (11):
add remainder of virtio modules to initrd (#864012)
don't write clock (#870805)
use locale.conf not sysconfig/i18n (#870805)
remove lokkit usage
add nocontexts for selinux (#858373)
write hostname to /etc/hostname (#870805)
fix kickstart logging entry
set selinux permissive mode when building
use systemd instead of inittab for startx
silence the selinux umount error
Version 18.13
---
Makefile | 2
imgcreate/creator.py | 15 +------
imgcreate/kickstart.py | 101 ++++++++++++++++++++++++++++---------------------
imgcreate/live.py | 3 -
imgcreate/yuminst.py | 1
tools/livecd-creator | 11 +++++
6 files changed, 78 insertions(+), 55 deletions(-)
---
10 years, 9 months
Branch 'f18-branch' - Makefile
by Brian C. Lane
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 4d61763eaad82409b400b9b8aac2b9e896e82ca4
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Tue Dec 4 15:07:17 2012 -0800
Version 18.13
diff --git a/Makefile b/Makefile
index bb1f5c6..394a8fc 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
-VERSION = 18.12
+VERSION = 18.13
INSTALL = /usr/bin/install -c
INSTALL_PROGRAM = ${INSTALL}
10 years, 9 months
Branch 'f18-branch' - 5 commits - imgcreate/creator.py imgcreate/kickstart.py tools/livecd-creator
by Brian C. Lane
imgcreate/creator.py | 6 ++++--
imgcreate/kickstart.py | 36 +++++++++++++++++++++++-------------
tools/livecd-creator | 11 +++++++++++
3 files changed, 38 insertions(+), 15 deletions(-)
New commits:
commit 93cfdfd84be5170532ca2cc103b1ea76c86aba62
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Tue Dec 4 15:03:08 2012 -0800
silence the selinux umount error
diff --git a/imgcreate/creator.py b/imgcreate/creator.py
index 0e5ed6b..64cd188 100644
--- a/imgcreate/creator.py
+++ b/imgcreate/creator.py
@@ -474,8 +474,10 @@ class ImageCreator(object):
return
# if the system was running selinux clean up our lies
- arglist = ["/bin/umount", self._instroot + self.__selinux_mountpoint + "/load"]
- subprocess.call(arglist, close_fds = True)
+ path = self._instroot + self.__selinux_mountpoint + "/load"
+ if os.path.exists(path):
+ arglist = ["/bin/umount", path]
+ subprocess.call(arglist, close_fds = True)
def mount(self, base_on = None, cachedir = None):
"""Setup the target filesystem in preparation for an install.
commit 6c8585f724ee1fa624ff3fd1e51791303a400934
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Tue Dec 4 13:33:50 2012 -0800
use systemd instead of inittab for startx
diff --git a/imgcreate/kickstart.py b/imgcreate/kickstart.py
index e3d4697..809b694 100644
--- a/imgcreate/kickstart.py
+++ b/imgcreate/kickstart.py
@@ -236,19 +236,23 @@ class ServicesConfig(KickstartConfig):
class XConfig(KickstartConfig):
"""A class to apply a kickstart X configuration to a system."""
+ RUNLEVELS = {3: 'multi-user.target', 5: 'graphical.target'}
+
def apply(self, ksxconfig):
- if ksxconfig.startX:
- f = open(self.path("/etc/inittab"), "rw+")
- buf = f.read()
- buf = buf.replace("id:3:initdefault", "id:5:initdefault")
- f.seek(0)
- f.write(buf)
- f.close()
if ksxconfig.defaultdesktop:
f = open(self.path("/etc/sysconfig/desktop"), "w")
f.write("DESKTOP="+ksxconfig.defaultdesktop+"\n")
f.close()
+ if ksxconfig.startX:
+ if not os.path.isdir(self.path('/etc/systemd/system')):
+ logging.warning("there is no /etc/systemd/system directory, cannot update default.target!")
+ return
+ default_target = self.path('/etc/systemd/system/default.target')
+ if os.path.islink(default_target):
+ os.unlink(default_target)
+ os.symlink(self.path('/lib/systemd/system/graphical.target'), default_target)
+
class RPMMacroConfig(KickstartConfig):
"""A class to apply the specified rpm macros to the filesystem"""
def apply(self, ks):
commit efc4fa2e962ac20c0a19ae5aa09e8e8c4ef1f791
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Tue Dec 4 12:34:58 2012 -0800
set selinux permissive mode when building
diff --git a/tools/livecd-creator b/tools/livecd-creator
index 44d07a1..a39e43f 100755
--- a/tools/livecd-creator
+++ b/tools/livecd-creator
@@ -23,6 +23,7 @@ import sys
import time
import optparse
import logging
+import selinux
import imgcreate
from imgcreate.fs import makedirs
@@ -143,6 +144,12 @@ def main():
print >> sys.stderr, "You must run %s as root" % sys.argv[0]
return 1
+ # Set selinux to Permissive if it is enforcing
+ selinux_enforcing = False
+ if selinux.is_selinux_enabled() and selinux.security_getenforce():
+ selinux_enforcing = True
+ selinux.security_setenforce(0)
+
if options.fslabel:
fslabel = options.fslabel
name = fslabel
@@ -196,6 +203,8 @@ def main():
else:
# Cannot happen, we validate this when parsing options.
logging.error(u"'%s' is not a valid image type" % options.image_type)
+ if selinux_enforcing:
+ selinux.security_setenforce(1)
return 1
creator.compress_type = options.compress_type
@@ -219,6 +228,8 @@ def main():
return 1
finally:
creator.cleanup()
+ if selinux_enforcing:
+ selinux.security_setenforce(1)
return 0
commit 925d47614b1b49360dfc1be0af0c7ed5330d9d12
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Tue Dec 4 10:53:28 2012 -0800
fix kickstart logging entry
diff --git a/imgcreate/kickstart.py b/imgcreate/kickstart.py
index 7ee4102..e3d4697 100644
--- a/imgcreate/kickstart.py
+++ b/imgcreate/kickstart.py
@@ -159,7 +159,7 @@ class TimezoneConfig(KickstartConfig):
shutil.copy2(self.path("/usr/share/zoneinfo/%s" %(tz,)),
self.path("/etc/localtime"))
except (OSError, shutil.Error) as e:
- log.error("Error copying timezone: %s" %(e.strerror,))
+ logging.error("Error copying timezone: %s" %(e.strerror,))
class AuthConfig(KickstartConfig):
commit 2f58f519a2693d4eecac9adb968061c503c18ab1
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Tue Dec 4 10:52:19 2012 -0800
write hostname to /etc/hostname (#870805)
diff --git a/imgcreate/kickstart.py b/imgcreate/kickstart.py
index 7adb37a..7ee4102 100644
--- a/imgcreate/kickstart.py
+++ b/imgcreate/kickstart.py
@@ -328,11 +328,6 @@ class NetworkConfig(KickstartConfig):
else:
f.write("NETWORKING_IPV6=no\n")
- if hostname:
- f.write("HOSTNAME=%s\n" % hostname)
- else:
- f.write("HOSTNAME=localhost.localdomain\n")
-
if gateway:
f.write("GATEWAY=%s\n" % gateway)
@@ -354,6 +349,16 @@ class NetworkConfig(KickstartConfig):
f.write("::1\t\tlocalhost6.localdomain6 localhost6\n")
f.close()
+ def write_hostname(self, hostname):
+ if not hostname:
+ return
+
+ path = self.path("/etc/hostname")
+ f = file(path, "w+")
+ os.chmod(path, 0644)
+ f.write("%s\n" % (hostname,))
+ f.close()
+
def write_resolv(self, nodns, nameservers):
if nodns or not nameservers:
return
@@ -407,6 +412,7 @@ class NetworkConfig(KickstartConfig):
self.write_sysconfig(useipv6, hostname, gateway)
self.write_hosts(hostname)
+ self.write_hostname(hostname)
self.write_resolv(nodns, nameservers)
class SelinuxConfig(KickstartConfig):
10 years, 9 months