SELinux relabel API
by Richard W.M. Jones
[
I realized that we were discussing adding this feature, in various
private email, IRC, and this long bugzilla thread:
https://bugzilla.redhat.com/show_bug.cgi?id=1060423
That's not how we should do things. Let's discuss it on the
mailing list.
]
One thing that virt-customize/virt-sysprep/virt-builder have to do is
relabel SELinux guests.
What we do at the moment is run:
if load_policy && fixfiles restore; then
rm -f /.autorelabel
else
touch /.autorelabel
echo '%s: SELinux relabelling failed, will relabel at boot instead.'
fi
while chrooted into the guest (using the 'guestfs_sh' API).
This has a number of problems:
- It has to load the policy using 'load_policy', but this doesn't
work sometimes:
* RHEL 5 load_policy takes a parameter.
* Doesn't work if appliance kernel is significantly different from
guest kernel version, because the binary policy format changes
irregularly and is not backwards compatible.
* Requires the appliance [host] kernel to be compiled with
LSM/SELinux support.
- Touching /.autorelabel is often broken, eg. it's broken in Fedora 20
because of systemd (RHBZ#1049656).
- /etc/resolv.conf will not be relabelled if guestfs network is on,
because of resolv.conf shenanigans in libguestfs.git/daemon/command.c
- It requires running guest code, which we'd like to avoid.
What would be nice would be to have an API to just do this
relabelling. Libguestfs could change this API as required to handle
different guests.
Dan Walsh helpfully pointed out to us that we've been doing it wrong
all along :-) A much better way to relabel is to run:
setfiles /etc/selinux/targeted/contexts/files/file_contexts DIR
where 'file_contexts' is a file which contains the default labels for
files (a set of regexps), and 'DIR' is the directory at which
relabelling starts. Note that 'setfiles' would be the libguestfs
appliance binary, so no guest binary needs to be run.
A simple API could just look like this:
guestfs_selinux_relabel (g);
which would always use the 'targeted' policy from the guest, and
always start relabelling at the root. This would work fine for
virt-builder.
For Colin's requirements for Project Atomic, I suspect he will want to
be able to set the file_contexts file and the root directory, but I'll
leave him to describe what would be useful.
A couple of notes:
- I'd like to avoid baking in assumptions from the 'setfiles' command
as far as possible. libguestfs APIs last for many years and some
have caused us many years of regret (but that's our job) :-/
- Is it a good idea to tie this into inspection in some way -- for
example, inspection could provide us with the path to the current or
default SELinux policy.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top
8 years, 9 months
[PATCH 1/2] appliance: Use dhclient instead of hard-coding IP address of appliance.
by Richard W.M. Jones
qemu in SLIRP mode offers DHCP services to the appliance. We don't
use them, but use a fixed IP address intead. This changes the
appliance to get its IP address using DHCP.
Note: This is only used when the network is enabled. dhclient is
somewhat slower, but the penalty (a few seconds) is only paid for
network users. We could consider using the faster systemd dhcp client
instead.
---
appliance/init | 9 +++------
appliance/packagelist.in | 1 +
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/appliance/init b/appliance/init
index 6d62338..d688a52 100755
--- a/appliance/init
+++ b/appliance/init
@@ -79,12 +79,9 @@ hwclock -u -s
ip addr add 127.0.0.1/8 brd + dev lo scope host
ip link set dev lo up
-ip addr add 169.254.2.10/16 brd + dev eth0 scope global
-ip link set dev eth0 up
-
-ip route add default via 169.254.2.2
-
-echo nameserver 169.254.2.3 > /etc/resolv.conf
+if grep -sq guestfs_network=1 /proc/cmdline; then
+ dhclient
+fi
# Scan for MDs.
mdadm -As --auto=yes --run
diff --git a/appliance/packagelist.in b/appliance/packagelist.in
index 276b4c2..4e93eaf 100644
--- a/appliance/packagelist.in
+++ b/appliance/packagelist.in
@@ -210,6 +210,7 @@ binutils
bzip2
coreutils
cpio
+dhclient
diffutils
dosfstools
e2fsprogs
--
2.0.4
9 years, 11 months
[PATCH v4 0/7] virt-resize: add support for resizing logical partitions
by Hu Tao
Hi Rich,
This is v3 series to add support for resizing MBR logical partitions.
changes to v3:
1. merge patch 1 and patch 3 in v3
2. let mbr_part_type return 'primary' for GPT partitions
3. add test for resizing logical partitions
4. fix extending the extended partition (yet). see patch 7.
changes to v2:
1. remove p_part_num
2. remove filter_parts
3. name the function calculate_target_partitions
4. remove the code to restart guest introduced in v2
changes to v1:
1. spit the patches so it's easier to review
2. fix the parted error caused by unaligned logical partitions
3. extend the content of logical partitions
4. refactor to make logical partitions a seperate list
Hu Tao (7):
resize: add function find_partitions
resize: add function calculate_target_partitions
resize: add function mbr_part_type
resize: add partition type LogicalPartition
resize: add support to resize logical partitions
resize: add test for resizing logical partitions
resize: support resize extended partition
resize/resize.ml | 155 ++++++++++++++++++++++++++++++++++++---------
resize/test-virt-resize.sh | 17 +++++
2 files changed, 142 insertions(+), 30 deletions(-)
--
1.9.3
9 years, 11 months
Change partition type
by Marcos Amorim
Hi,
Is there any way to change the partition type using python-guestfs?
I'm trying to recreate an NTFS partition, but can not change the type to NTFS (7 identifier in frisk)
Filesystem from my disk
g.list_filesystems()
{'/dev/sda1': 'ntfs', '/dev/sda2': 'ntfs’}
Fdisk
print g.sfdisk_l(device)
Disk /dev/sda: 51200 cylinders, 64 heads, 32 sectors/track
Units = cylinders of 1048576 bytes, blocks of 1024 bytes, counting from 0
Device Boot Start End #cyls #blocks Id System
/dev/sda1 * 1 100 100 102400 7 HPFS/NTFS
/dev/sda2 101 51199 51099 52325376 83 Linux
/dev/sda3 0 - 0 0 0 Empty
/dev/sda4 0 - 0 0 0 Empty
Marcos Amorim
9 years, 11 months
IRC question: supermin: ext2fs_namei: parent directory not found: /lib64/pkgconfig: File not found by ext2_lookup
by Richard W.M. Jones
00:18 < dtrainor> Hello. Trying to virt-v2v and using 1.27-55 for testing, and I'm running in to this:
http://fpaste.org/137605/14120326/
00:18 < dtrainor> I'm using this version because I need both ova input file format support, as well as local output
file support
00:18 < dtrainor> basically the error appears to be: supermin: ext2fs_namei: parent directory not found:
/lib64/pkgconfig: File not found by ext2_lookup
00:20 < dtrainor> Some old bugs indicate this might be caused by not having enough free space:
https://bugzilla.redhat.com/show_bug.cgi?id=743024
00:20 < dtrainor> But I don't see any of my disks appearing to get used up
The paste was:
----------------------------------------------------------------------
supermin: ext2: populating from base image
supermin: *** parent directory not found ***
supermin: When reporting this error:
supermin: please include ALL the debugging information below
supermin: AND tell us what system you are running this on.
src=/tmp/supermin07e70c.tmpdir/base.d/lib64/pkgconfig/libntfs-3g.pc
dest=/lib64/pkgconfig/libntfs-3g.pc
dirname=/lib64/pkgconfig
basename=libntfs-3g.pc
supermin: ext2fs_namei: parent directory not found: /lib64/pkgconfig: File not found by ext2_lookup
supermin: failure: ext2fs_namei: parent directory not found
libguestfs: trace: launch = -1 (error)
virt-v2v: error: libguestfs error: /usr/local/bin/supermin exited with
error status 1, see debug messages above
If reporting bugs, run virt-v2v with debugging enabled and include the
complete output:
virt-v2v -v -x [...]
libguestfs: trace: close
libguestfs: closing guestfs handle 0xc9c3e0 (state 0)
libguestfs: command: run: rm
libguestfs: command: run: \ -rf /root/libguestfs-1.27.49/tmp/libguestfsWXUYCZ
----------------------------------------------------------------------
This is a bug.
However I need the complete debugging output, as it says in the
error message in capital letters.
Please don't edit or truncate debugging output when posting.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html
9 years, 11 months
[PATCH] chroot: fix quoting in cp invocation
by Pino Toscano
Make sure to quote source and destination, to avoid failures when
dealing with paths with e.g. spaces, brackets, etc.
---
src/chroot.ml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/chroot.ml b/src/chroot.ml
index 63a5a79..d0ee4c3 100644
--- a/src/chroot.ml
+++ b/src/chroot.ml
@@ -60,7 +60,7 @@ let build_chroot debug files outputdir =
| S_REG | S_CHR | S_BLK | S_FIFO | S_SOCK ->
if debug >= 2 then printf "supermin: chroot: copy %s\n%!" opath;
- let cmd = sprintf "cp -p %s %s" path opath in
+ let cmd = sprintf "cp -p %s %s" (quote path) (quote opath) in
ignore (Sys.command cmd)
with Unix_error _ -> ()
) files;
--
1.9.3
9 years, 11 months
[PATCH 1/2] builder, customize: disable SELinux
by Pino Toscano
Having SELinux enabled (even if not enforcing) in the appliance causes
troubles to applications/libraries that read/write SELinux attributes.
---
builder/builder.ml | 6 +++++-
customize/customize_main.ml | 6 +++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/builder/builder.ml b/builder/builder.ml
index a407924..5195cfd 100644
--- a/builder/builder.ml
+++ b/builder/builder.ml
@@ -633,7 +633,11 @@ let main () =
(match smp with None -> () | Some smp -> g#set_smp smp);
g#set_network network;
- g#set_selinux ops.flags.selinux_relabel;
+ (* Make sure to turn SELinux off to avoid awkward interactions
+ * between the appliance kernel and applications/libraries interacting
+ * with SELinux xattrs.
+ *)
+ g#set_selinux false;
(* The output disk is being created, so use cache=unsafe here. *)
g#add_drive_opts ~format:output_format ~cachemode:"unsafe" output_filename;
diff --git a/customize/customize_main.ml b/customize/customize_main.ml
index 6e0ba2d..2c8b2ef 100644
--- a/customize/customize_main.ml
+++ b/customize/customize_main.ml
@@ -208,7 +208,11 @@ read the man page virt-customize(1).
(match memsize with None -> () | Some memsize -> g#set_memsize memsize);
(match smp with None -> () | Some smp -> g#set_smp smp);
g#set_network network;
- g#set_selinux ops.flags.selinux_relabel;
+ (* Make sure to turn SELinux off to avoid awkward interactions
+ * between the appliance kernel and applications/libraries interacting
+ * with SELinux xattrs.
+ *)
+ g#set_selinux false;
(* Add disks. *)
add g dryrun;
--
1.9.3
9 years, 11 months
Why libguestfs guest exist exceptionally?
by Zhi Yong Wu
HI,
On a RHEL5 box, i tried to directly run guest which was issued by
libguestfs virt-xxx commands as below. But after some minutes, it
exited exceptionally.
Does anyone also hit the issue or know the reason?
#/usr/bin/qemu-kvm -global virtio-blk-pci.scsi=off
-nodefconfig -nodefaults -nographic -drive
file=ubuntu1204_64_20G_aliaegis_20140811.vhd,snapshot=on,if=virtio
-drive file=ubuntu-test.vhd,cache=none,if=virtio -drive
file=/var/tmp/.guestfs-0/root.28754,snapshot=on,if=virtio,cache=unsafe
-machine accel=kvm:tcg -m 500 -no-reboot -no-hpet
-serial stdio -net user,vlan=0,net=10.0.2.0/24 -net
nic,model=virtio,vlan=0 -kernel /var/tmp/.guestfs-0/kernel.28754
-initrd /var/tmp/.guestfs-0/initrd.28754 -append 'panic=1 noapic
console=ttyS0 udevtimeout=600 no_timer_check acpi=off printk.time=1
cgroup_disable=memory root=/dev/vdc selinux=0
guestfs_vmchannel=tcp:10.0.2.2:45041 guestfs_verbose=1 TERM=vt100'
Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
Back to tcg accelerator.
Linux version 2.6.18-274.el5 (mockbuild(a)x86-002.build.bos.redhat.com)
(gcc version 4.1.2 20080704 (Red Hat 4.1.2-51)) #1 SMP Fri Jul 8
17:36:59 EDT 2011
Command line: panic=1 noapic console=ttyS0 udevtimeout=600
no_timer_check acpi=off printk.time=1 cgroup_disable=memory
root=/dev/vdc selinux=0 guestfs_vmchannel=tcp:10.0.2.2:45041
guestfs_verbose=1 TERM=vt100
BIOS-provided physical RAM map:
BIOS-e820: 0000000000010000 - 000000000009fc00 (usable)
BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
BIOS-e820: 00000000000f0000 - 0000000000100000 (reserved)
BIOS-e820: 0000000000100000 - 000000001f3fe000 (usable)
BIOS-e820: 000000001f3fe000 - 000000001f400000 (reserved)
BIOS-e820: 00000000fffc0000 - 0000000100000000 (reserved)
DMI 2.4 present.
No NUMA configuration found
Faking a node at 0000000000000000-000000001f3fe000
Bootmem setup node 0 0000000000000000-000000001f3fe000
Memory for crash kernel (0x0 to 0x0) notwithin permissible range
disabling kdump
Intel MultiProcessor Specification v1.4
Virtual Wire compatibility mode.
OEM ID: BOCHSCPU Product ID: 0.1 APIC at: 0xFEE00000
Processor #0 6:13 APIC version 17
I/O APIC #0 Version 17 at 0xFEC00000.
Setting APIC routing to flat
Processors: 1
Nosave address range: 000000000009f000 - 00000000000a0000
Nosave address range: 00000000000a0000 - 00000000000f0000
Nosave address range: 00000000000f0000 - 0000000000100000
Allocating PCI resources starting at 20000000 (gap: 1f400000:e0bc0000)
SMP: Allowing 1 CPUs, 0 hotplug CPUs
Built 1 zonelists. Total pages: 124645
Kernel command line: panic=1 noapic console=ttyS0 udevtimeout=600
no_timer_check acpi=off printk.time=1 cgroup_disable=memory
root=/dev/vdc selinux=0 guestfs_vmchannel=tcp:10.0.2.2:45041
guestfs_verbose=1 TERM=vt100
Unknown boot option `printk.time=1': ignoring
Initializing CPU#0
PID hash table entries: 2048 (order: 11, 16384 bytes)
Console: colour *CGA 80x25
Dentry cache hash table entries: 65536 (order: 7, 524288 bytes)
Inode-cache hash table entries: 32768 (order: 6, 262144 bytes)
Checking aperture...
ACPI: DMAR not present
Memory: 494496k/511992k available (2603k kernel code, 17044k reserved,
1660k data, 224k init)
Calibrating delay loop (skipped), value calculated using timer
frequency.. 4806.63 BogoMIPS (lpj=2403317)
Security Framework v1.0.0 initialized
SELinux: Disabled at boot.
Capability LSM initialized
Mount-cache hash table entries: 256
CPU: L1 I Cache: 64K (64 bytes/line), D cache 64K (64 bytes/line)
CPU: L2 Cache: 512K (64 bytes/line)
CPU 0/0 -> Node 0
SMP alternatives: switching to UP code
Freeing SMP alternatives: 32k freed
Using local APIC timer interrupts.
Detected 62.582 MHz APIC timer.
Brought up 1 CPUs
WARNING: CPU#0: NMI appears to be stuck (0->0)!
time.c: Using 1.193182 MHz WALL PIT GTOD PIT/TSC timer.
time.c: Detected 2403.317 MHz processor.
checking if image is initramfs... it is
Freeing initrd memory: 2800k freed
NET: Registered protocol family 16
PCI: Using configuration type 1
ACPI: Interpreter disabled.
Linux Plug and Play Support v0.97 (c) Adam Belay
pnp: PnP ACPI: disabled
usbcore: registered new driver usbfs
usbcore: registered new driver hub
PCI: Probing PCI hardware
ACPI Error (tbget-0168): Invalid address flags 8 [20060707]
ACPI Error (tbget-0168): Invalid address flags 8 [20060707]
ACPI Error (tbget-0168): Invalid address flags 8 [20060707]
ACPI Error (tbget-0168): Invalid address flags 8 [20060707]
PCI quirk: region b000-b03f claimed by PIIX4 ACPI
PCI quirk: region b100-b10f claimed by PIIX4 SMB
ACPI Error (tbget-0168): Invalid address flags 8 [20060707]
ACPI Error (tbget-0168): Invalid address flags 8 [20060707]
ACPI Error (tbget-0168): Invalid address flags 8 [20060707]
ACPI Error (tbget-0168): Invalid address flags 8 [20060707]
PCI: Using IRQ router PIIX/ICH [8086/7000] at 0000:00:01.0
NetLabel: Initializing
NetLabel: domain hash size = 128
NetLabel: protocols = UNLABELED CIPSOv4
NetLabel: unlabeled traffic allowed by default
ACPI: DMAR not present
PCI-GART: No AMD northbridge found.
NET: Registered protocol family 2
IP route cache hash table entries: 4096 (order: 3, 32768 bytes)
TCP established hash table entries: 16384 (order: 6, 262144 bytes)
TCP bind hash table entries: 8192 (order: 5, 131072 bytes)
TCP: Hash tables configured (established 16384 bind 8192)
TCP reno registered
audit: initializing netlink socket (disabled)
type=2000 audit(1411892290.357:1): initialized
Total HugeTLB memory allocated, 0
VFS: Disk quotas dquot_6.5.1
Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
Initializing Cryptographic API
alg: No test for crc32c (crc32c-generic)
ksign: Installing public key data
Loading keyring
- Added public key 5E046EE793D43754
- User ID: Red Hat, Inc. (Kernel Module GPG key)
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered (default)
Limiting direct PCI/PCI transfers.
PCI: PIIX3: Enabling Passive Release on 0000:00:01.0
Activating ISA DMA hang workarounds.
pci_hotplug: PCI Hot Plug PCI Core version: 0.5
Real Time Clock Driver v1.12ac
Non-volatile memory driver v1.2
Linux agpgart interface v0.101 (c) Dave Jones
Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing enabled
erial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
brd: module loaded
Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
PIIX3: IDE controller at PCI slot 0000:00:01.1
PIIX3: chipset revision 0
PIIX3: not 100% native mode: will probe irqs later
ide0: BM-DMA at 0xc0e0-0xc0e7, BIOS settings: hda:pio, hdb:pio
ide1: BM-DMA at 0xc0e8-0xc0ef, BIOS settings: hdc:pio, hdd:pio
ide-floppy driver 0.99.newide
usbcore: registered new driver hiddev
usbcore: registered new driver usbhid
drivers/usb/input/hid-core.c: v2.6:USB HID core driver
PNP: No PS/2 controller found. Probing ports directly.
serio: i8042 KBD port at 0x60,0x64 irq 1
serio: i8042 AUX port at 0x60,0x64 irq 12
mice: PS/2 mouse device common for all mice
md: md driver 0.90.3 MAX_MD_DEVS=256, MD_SB_DISKS=27
md: bitmap version 4.39
TCP bic registered
Initializing IPsec netlink socket
NET: Registered protocol family 1
NET: Registered protocol family 17
Initalizing network drop monitor service
Freeing unused kernel memory: 224k freed
Write protecting the kernel read-only data: 527k
febootstrap: mounting /proc
input: AT Translated Set 2 keyboard as /class/input/input0
febootstrap: uptime: 2.92 2.36
febootstrap: ext2 mini initrd starting up: 3.20
febootstrap: cmdline: panic=1 noapic console=ttyS0 udevtimeout=600
no_timer_check acpi=off printk.time=1 cgroup_disable=memory
root=/dev/vdc selinux=0 guestfs_vmchannel=tcp:10.0.2.2:45041
guestfs_verbose=1 TERM=vt100
febootstrap: mounting /sys
febootstrap: internal insmod crc-ccitt.ko
febootstrap: internal insmod crc-itu-t.ko
febootstrap: internal insmod crc16.ko
febootstrap: internal insmod cdrom.ko
febootstrap: internal insmod scsi_mod.ko
input: ImExPS/2 Generic Explorer Mouse as /class/input/input1
SCSI subsystem initialized
febootstrap: internal insmod sr_mod.ko
febootstrap: internal insmod libata.ko
febootstrap: internal insmod ata_piix.ko
febootstrap: internal insmod scsi_transport_spi.ko
febootstrap: internal insmod sym53c8xx.ko
febootstrap: internal insmod sd_mod.ko
febootstrap: internal insmod ide-cd.ko
febootstrap: internal insmod ide-cs.ko
febootstrap: internal insmod ide-scsi.ko
febootstrap: internal insmod virtio.ko
febootstrap: internal insmod virtio_balloon.ko
febootstrap: internal insmod virtio_blk.ko
febootstrap: internal insmod virtio_console.ko
febootstrap: internal insmod virtio_net.ko
febootstrap: internal insmod virtio_ring.ko
febootstrap: internal insmod virtio_pci.ko
PCI: Found IRQ 10 for device 0000:00:02.0
PCI: Found IRQ 11 for device 0000:00:03.0
vda: vda1
PCI: Found IRQ 11 for device 0000:00:04.0
vdb: vdb1
PCI: Found IRQ 10 for device 0000:00:05.0
vdc: unknown partition table
febootstrap: internal insmod jbd2.ko
febootstrap: internal insmod ext4.ko
febootstrap: picked /sys/block/vdc/dev as root device
febootstrap: creating /dev/root as block special 253:32
febootstrap: mounting new root on /root
febootstrap: chroot
Starting /init script ...
mount: unknown filesystem type 'devtmpfs'
Starting udev: piix4_smbus 0000:00:01.3: Found 0000:00:01.3 device
input: PC Speaker as /class/input/input2
[ OK ]
mdadm: No arrays found in config file
device-mapper: uevent: version 1.0.3
device-mapper: ioctl: 4.11.6-ioctl (2011-02-18) initialised: dm-devel(a)redhat.com
/init: line 93: lvmetad: command not found
Reading all physical volumes. This may take a while...
No volume groups found
No volume groups found
/init: line 99: ldmtool: command not found
/init: line 102: /sys/block/vd*/queue/rotational: No such file or directory
/dev:
total 0
lrwxrwxrwx 1 root root 13 Sep 28 16:18 MAKEDEV -> /sbin/MAKEDEV
lrwxrwxrwx 1 root root 4 Sep 28 16:18 X0R -> null
crw------- 1 root root 5, 1 Sep 28 16:18 console
lrwxrwxrwx 1 root root 11 Sep 28 16:18 core -> /proc/kcore
drwxr-xr-x 3 root root 60 Sep 28 16:18 cpu
drwxr-xr-x 3 root root 60 Sep 28 16:18 disk
lrwxrwxrwx 1 root root 13 Sep 28 16:18 fd -> /proc/self/fd
crw-rw-rw- 1 root root 1, 7 Sep 28 16:18 full
crw-rw-rw- 1 root root 10, 229 Sep 28 16:18 fuse
drwxr-xr-x 2 root root 140 Sep 28 16:18 input
crw------- 1 root root 1, 11 Sep 28 16:18 kmsg
brw-r----- 1 root disk 7, 0 Sep 28 16:18 loop0
brw-r----- 1 root disk 7, 1 Sep 28 16:18 loop1
brw-r----- 1 root disk 7, 2 Sep 28 16:18 loop2
brw-r----- 1 root disk 7, 3 Sep 28 16:18 loop3
brw-r----- 1 root disk 7, 4 Sep 28 16:18 loop4
brw-r----- 1 root disk 7, 5 Sep 28 16:18 loop5
brw-r----- 1 root disk 7, 6 Sep 28 16:18 loop6
brw-r----- 1 root disk 7, 7 Sep 28 16:18 loop7
drwxr-xr-x 2 root root 60 Sep 28 16:18 mapper
crw------- 1 root root 10, 227 Sep 28 16:18 mcelog
crw-r----- 1 root kmem 1, 1 Sep 28 16:18 mem
drwxr-xr-x 2 root root 60 Sep 28 16:18 net
crw-rw-rw- 1 root root 1, 3 Sep 28 16:18 null
crw-rw---- 1 root root 10, 144 Sep 28 16:18 nvram
crw------- 1 root root 1, 12 Sep 28 16:18 oldmem
crw-rw---- 1 root lp 99, 0 Sep 28 16:18 parport0
crw-rw---- 1 root lp 99, 1 Sep 28 16:18 parport1
crw-rw---- 1 root lp 99, 2 Sep 28 16:18 parport2
crw-rw---- 1 root lp 99, 3 Sep 28 16:18 parport3
crw-r----- 1 root kmem 1, 4 Sep 28 16:18 port
crw------- 1 root root 108, 0 Sep 28 16:18 ppp
crw-rw-rw- 1 root tty 5, 2 Sep 28 16:18 ptmx
drwxr-xr-x 2 root root 40 Sep 28 16:18 pts
lrwxrwxrwx 1 root root 4 Sep 28 16:18 ram -> ram1
brw-r----- 1 root disk 1, 0 Sep 28 16:18 ram0
brw-r----- 1 root disk 1, 1 Sep 28 16:18 ram1
brw-r----- 1 root disk 1, 10 Sep 28 16:18 ram10
brw-r----- 1 root disk 1, 11 Sep 28 16:18 ram11
brw-r----- 1 root disk 1, 12 Sep 28 16:18 ram12
brw-r----- 1 root disk 1, 13 Sep 28 16:18 ram13
brw-r----- 1 root disk 1, 14 Sep 28 16:18 ram14
brw-r----- 1 root disk 1, 15 Sep 28 16:18 ram15
brw-r----- 1 root disk 1, 2 Sep 28 16:18 ram2
brw-r----- 1 root disk 1, 3 Sep 28 16:18 ram3
brw-r----- 1 root disk 1, 4 Sep 28 16:18 ram4
brw-r----- 1 root disk 1, 5 Sep 28 16:18 ram5
brw-r----- 1 root disk 1, 6 Sep 28 16:18 ram6
brw-r----- 1 root disk 1, 7 Sep 28 16:18 ram7
brw-r----- 1 root disk 1, 8 Sep 28 16:18 ram8
brw-r----- 1 root disk 1, 9 Sep 28 16:18 ram9
lrwxrwxrwx 1 root root 4 Sep 28 16:18 ramdisk -> ram0
crw-rw-rw- 1 root root 1, 8 Sep 28 16:18 random
crw------- 1 root root 162, 0 Sep 28 16:18 rawctl
crw-r--r-- 1 root root 10, 135 Sep 28 16:18 rtc
drwxr-xr-x 2 root root 40 Sep 28 16:18 shm
crw------- 1 root root 10, 231 Sep 28 16:18 snapshot
lrwxrwxrwx 1 root root 15 Sep 28 16:18 stderr -> /proc/self/fd/2
lrwxrwxrwx 1 root root 15 Sep 28 16:18 stdin -> /proc/self/fd/0
lrwxrwxrwx 1 root root 15 Sep 28 16:18 stdout -> /proc/self/fd/1
crw-rw-rw- 1 root tty 5, 0 Sep 28 16:18 tty
crw-rw---- 1 root tty 4, 0 Sep 28 16:18 tty0
crw-rw---- 1 root tty 4, 1 Sep 28 16:18 tty1
crw-rw---- 1 root tty 4, 10 Sep 28 16:18 tty10
crw-rw---- 1 root tty 4, 11 Sep 28 16:18 tty11
crw-rw---- 1 root tty 4, 12 Sep 28 16:18 tty12
crw-rw---- 1 root tty 4, 13 Sep 28 16:18 tty13
crw-rw---- 1 root tty 4, 14 Sep 28 16:18 tty14
crw-rw---- 1 root tty 4, 15 Sep 28 16:18 tty15
crw-rw---- 1 root tty 4, 16 Sep 28 16:18 tty16
crw-rw---- 1 root tty 4, 17 Sep 28 16:18 tty17
crw-rw---- 1 root tty 4, 18 Sep 28 16:18 tty18
crw-rw---- 1 root tty 4, 19 Sep 28 16:18 tty19
crw-rw---- 1 root tty 4, 2 Sep 28 16:18 tty2
crw-rw---- 1 root tty 4, 20 Sep 28 16:18 tty20
crw-rw---- 1 root tty 4, 21 Sep 28 16:18 tty21
crw-rw---- 1 root tty 4, 22 Sep 28 16:18 tty22
crw-rw---- 1 root tty 4, 23 Sep 28 16:18 tty23
crw-rw---- 1 root tty 4, 24 Sep 28 16:18 tty24
crw-rw---- 1 root tty 4, 25 Sep 28 16:18 tty25
crw-rw---- 1 root tty 4, 26 Sep 28 16:18 tty26
crw-rw---- 1 root tty 4, 27 Sep 28 16:18 tty27
crw-rw---- 1 root tty 4, 28 Sep 28 16:18 tty28
crw-rw---- 1 root tty 4, 29 Sep 28 16:18 tty29
crw-rw---- 1 root tty 4, 3 Sep 28 16:18 tty3
crw-rw---- 1 root tty 4, 30 Sep 28 16:18 tty30
crw-rw---- 1 root tty 4, 31 Sep 28 16:18 tty31
crw-rw---- 1 root tty 4, 32 Sep 28 16:18 tty32
crw-rw---- 1 root tty 4, 33 Sep 28 16:18 tty33
crw-rw---- 1 root tty 4, 34 Sep 28 16:18 tty34
crw-rw---- 1 root tty 4, 35 Sep 28 16:18 tty35
crw-rw---- 1 root tty 4, 36 Sep 28 16:18 tty36
crw-rw---- 1 root tty 4, 37 Sep 28 16:18 tty37
crw-rw---- 1 root tty 4, 38 Sep 28 16:18 tty38
crw-rw---- 1 root tty 4, 39 Sep 28 16:18 tty39
crw-rw---- 1 root tty 4, 4 Sep 28 16:18 tty4
crw-rw---- 1 root tty 4, 40 Sep 28 16:18 tty40
crw-rw---- 1 root tty 4, 41 Sep 28 16:18 tty41
crw-rw---- 1 root tty 4, 42 Sep 28 16:18 tty42
crw-rw---- 1 root tty 4, 43 Sep 28 16:18 tty43
crw-rw---- 1 root tty 4, 44 Sep 28 16:18 tty44
crw-rw---- 1 root tty 4, 45 Sep 28 16:18 tty45
crw-rw---- 1 root tty 4, 46 Sep 28 16:18 tty46
crw-rw---- 1 root tty 4, 47 Sep 28 16:18 tty47
crw-rw---- 1 root tty 4, 48 Sep 28 16:18 tty48
crw-rw---- 1 root tty 4, 49 Sep 28 16:18 tty49
crw-rw---- 1 root tty 4, 5 Sep 28 16:18 tty5
crw-rw---- 1 root tty 4, 50 Sep 28 16:18 tty50
crw-rw---- 1 root tty 4, 51 Sep 28 16:18 tty51
crw-rw---- 1 root tty 4, 52 Sep 28 16:18 tty52
crw-rw---- 1 root tty 4, 53 Sep 28 16:18 tty53
crw-rw---- 1 root tty 4, 54 Sep 28 16:18 tty54
crw-rw---- 1 root tty 4, 55 Sep 28 16:18 tty55
crw-rw---- 1 root tty 4, 56 Sep 28 16:18 tty56
crw-rw---- 1 root tty 4, 57 Sep 28 16:18 tty57
crw-rw---- 1 root tty 4, 58 Sep 28 16:18 tty58
crw-rw---- 1 root tty 4, 59 Sep 28 16:18 tty59
crw-rw---- 1 root tty 4, 6 Sep 28 16:18 tty6
crw-rw---- 1 root tty 4, 60 Sep 28 16:18 tty60
crw-rw---- 1 root tty 4, 61 Sep 28 16:18 tty61
crw-rw---- 1 root tty 4, 62 Sep 28 16:18 tty62
crw-rw---- 1 root tty 4, 63 Sep 28 16:18 tty63
crw-rw---- 1 root tty 4, 7 Sep 28 16:18 tty7
crw-rw---- 1 root tty 4, 8 Sep 28 16:18 tty8
crw-rw---- 1 root tty 4, 9 Sep 28 16:18 tty9
crw-rw---- 1 root uucp 4, 64 Sep 28 16:18 ttyS0
crw-rw---- 1 root uucp 4, 65 Sep 28 16:18 ttyS1
crw-rw---- 1 root uucp 4, 66 Sep 28 16:18 ttyS2
crw-rw---- 1 root uucp 4, 67 Sep 28 16:18 ttyS3
cr--r--r-- 1 root root 1, 9 Sep 28 16:18 urandom
crw------- 1 root tty 7, 0 Sep 28 16:18 vcs
crw------- 1 root tty 7, 128 Sep 28 16:18 vcsa
brw-r----- 1 root disk 253, 0 Sep 28 16:18 vda
brw-r----- 1 root disk 253, 1 Sep 28 16:18 vda1
brw-r----- 1 root disk 253, 16 Sep 28 16:18 vdb
brw-r----- 1 root disk 253, 17 Sep 28 16:18 vdb1
brw-r----- 1 root disk 253, 32 Sep 28 16:18 vdc
crw-rw-rw- 1 root root 1, 5 Sep 28 16:18 zero
/dev/cpu:
total 0
drwxr-xr-x 2 root root 80 Sep 28 16:18 0
/dev/cpu/0:
total 0
crw------- 1 root root 203, 0 Sep 28 16:18 cpuid
crw------- 1 root root 202, 0 Sep 28 16:18 msr
/dev/disk:
total 0
drwxr-xr-x 2 root root 80 Sep 28 16:18 by-uuid
/dev/disk/by-uuid:
total 0
lrwxrwxrwx 1 root root 10 Sep 28 16:18
8f91cd21-b0ca-45d7-88ba-616ddc4d37ec -> ../../vdb1
lrwxrwxrwx 1 root root 9 Sep 28 16:18
a239c651-d604-45ea-8e4d-3909a2abb7aa -> ../../vdc
/dev/input:
total 0
crw------- 1 root root 13, 64 Sep 28 16:18 event0
crw------- 1 root root 13, 65 Sep 28 16:18 event1
crw------- 1 root root 13, 66 Sep 28 16:18 event2
crw------- 1 root root 13, 63 Sep 28 16:18 mice
crw------- 1 root root 13, 32 Sep 28 16:18 mouse0
/dev/mapper:
total 0
crw------- 1 root root 10, 63 Sep 28 16:18 control
/dev/net:
total 0
crw------- 1 root root 10, 200 Sep 28 16:18 tun
/dev/pts:
total 0
/dev/shm:
total 0
rootfs / rootfs rw 0 0
proc /proc proc rw 0 0
/dev/root / ext2 rw,noatime 0 0
/proc /proc proc rw 0 0
/sys /sys sysfs rw 0 0
tmpfs /run tmpfs rw,nosuid 0 0
none /dev tmpfs rw 0 0
No volume groups found
No volume groups found
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 brd 127.255.255.255 scope host lo
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 52:54:00:12:34:56 brd ff:ff:ff:ff:ff:ff
inet 10.0.2.0/24 brd 10.0.2.255 scope global eth0
10.0.2.0/24 dev eth0 proto kernel scope link src 10.0.2.0
default via 10.0.2.2 dev eth0
Module Size Used by
dm_mod 102673 0
pcspkr 36289 0
serio_raw 40517 0
i2c_piix4 43724 0
i2c_core 57537 1 i2c_piix4
ext4 301753 0
jbd2 97737 1 ext4
virtio_pci 41673 0
virtio_ring 37953 1 virtio_pci
virtio_net 48449 0
virtio_console 50681 0
virtio_blk 41673 1
virtio_balloon 41025 0
virtio 39365 5
virtio_pci,virtio_net,virtio_console,virtio_blk,virtio_balloon
ide_scsi 51017 0
ide_cs 44481 0
ide_cd 73825 0
sd_mod 56513 0
sym53c8xx 109545 0
scsi_transport_spi 59841 1 sym53c8xx
ata_piix 57669 0
libata 209233 1 ata_piix
sr_mod 50789 0
scsi_mod 199641 6
ide_scsi,sd_mod,sym53c8xx,scsi_transport_spi,libata,sr_mod
cdrom 68713 2 ide_cd,sr_mod
crc16 35137 1 ext4
crc_itu_t 35265 0
crc_ccitt 35265 0
Sun Sep 28 16:18:46 CST 2014
uptime: 36.11 2.70
verbose daemon enabled
linux commmand line: panic=1 noapic console=ttyS0 udevtimeout=600
no_timer_check acpi=off printk.time=1 cgroup_disable=memory
root=/dev/vdc selinux=0 guestfs_vmchannel=tcp:10.0.2.2:45041
guestfs_verbose=1 TERM=vt100
vmchannel: tcp:10.0.2.2:45041
connect: Connection timed out
Failed to connect to virtio-serial channel.
This is a fatal error and the appliance will now exit.
Usually this error is caused by either QEMU or the appliance
kernel not supporting the vmchannel method that the
libguestfs library chose to use. Please run
'libguestfs-test-tool' and provide the complete, unedited
output to the libguestfs developers, either in a bug report
or on the libguestfs redhat com mailing list.
last error: Connection timed out
md: stopping all md devices.
Restarting system.
.
machine restart
#
--
Regards,
Zhi Yong Wu
9 years, 11 months
Re: [Libguestfs] Virt-v2v conversion issue
by Richard W.M. Jones
[Please keep replies on the list]
On Thu, Sep 25, 2014 at 08:33:52AM +0000, VONDRA Alain wrote:
> Hi,
> Can we expect a new build today ?
Possibly. There is at least another problem with the Windows
conversion code that hasn't been resolved yet, so it will depend on
whether I'm able to reproduce and/or fix that.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/
9 years, 11 months
Bash bug
by Richard W.M. Jones
I don't really consider these to be bugs in libguestfs, but a few
places are affected by the infamous bash bug.
* virt-edit passes the '-e' script to Perl using an environment
variable, and runs Perl using the shell, so:
$ virt-edit -a /tmp/fedora-20.img /etc/motd -e '() { :; } ; echo hello'
hello
Mitigating this is that you shouldn't really be passing untrusted Perl
scripts to virt-edit in the first place, since Perl itself can do
pretty much anything.
* the virt-builder/virt-customize --edit flags are similarly affected:
$ virt-customize --edit '/etc/motd:() { :; } ; echo hello' -a /tmp/fedora-20.img
[ 0.0] Examining the guest ...
[ 6.0] Setting a random seed
[ 6.0] Editing: /etc/motd
hello
[ 6.0] Finishing off
* guestfish 'edit' command, same as above
* The guestfish 'event' command lets you specify an environment
variable that is later passed to bash.
* Probably most seriously, the library passes TERM from its
environment through to the appliance, and thence through to the
daemon, which of course runs shell commands all over the place. TERM
may contain any characters *except* spaces, which may make this route
impossible to exploit, although I wouldn't be sure.
Anyway, best thing is to update bash.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html
9 years, 11 months