How to correctly start a Ubuntu user-mode-linux from the command line
I have installed the package user-mode-linux for the UML kernel. I have built a user mode linux filesystem using the these commands I have even tried the Ubuntu filesystem from: http://fs.devloop.org.uk/ But it seems that I can not get a Ubuntu filesystem started correctly. Even though both the Fedora and Suse filesystems work and present a prompt. I have started the system using various methods but I don’t seem to be able to get a login prompt. My current command line is: linux ubda=./Ubuntu-MaverickMeerkat-i386-root_fs mem=512M umid=maverick con0=xterm con1=xterm con=null But this causes me to have errors and no prompt for accessing the system.
Initializing cgroup subsys cpuset Linux version 2.6.35.1 (root@rothera) (gcc version 4.4.5 20100813 (Linaro prerelease) [release 2010.08-0] (Ubuntu/Linaro 4.4.4-8ubuntu2) ) #2 Mon Aug 16 10:45:47 UTC 2010 () Built 1 zonelists in Zone order, mobility grouping on. Total pages: 135115 Kernel command line: ubda=./Ubuntu-MaverickMeerkat-i386-root_fs mem=512M con0=xterm con1=xterm con=null root=98:0 PID hash table entries: 4096 (order: 2, 16384 bytes) Dentry cache hash table entries: 131072 (order: 7, 524288 bytes) Inode-cache hash table entries: 65536 (order: 6, 262144 bytes) allocated 2723580 bytes of page_cgroup please try 'cgroup_disable=memory' option if you don't want memory cgroups Memory: 507252k available SLUB: Genslabs=13, HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1 Hierarchical RCU implementation. RCU-based detection of stalled CPUs is disabled. Verbose stalled-CPUs detection is disabled. NR_IRQS:15 Calibrating delay loop. 3774.87 BogoMIPS (lpj=18874368) pid_max: default: 32768 minimum: 301 Security Framework initialized AppArmor: AppArmor initialized Yama: becoming mindful. Mount-cache hash table entries: 512 Initializing cgroup subsys ns Initializing cgroup subsys cpuacct Initializing cgroup subsys memory Initializing cgroup subsys devices Initializing cgroup subsys freezer Checking for host processor cmov support. Yes Checking that host ptys support output SIGIO. Yes Checking that host ptys support SIGIO on close. No, enabling workaround Using 2.6 host AIO NET: Registered protocol family 16 bio: create slab at 0 NetLabel: Initializing NetLabel: domain hash size = 128 NetLabel: protocols = UNLABELED CIPSOv4 NetLabel: unlabeled traffic allowed by default Switching to clocksource itimer AppArmor: AppArmor Filesystem Enabled NET: Registered protocol family 2 IP route cache hash table entries: 8192 (order: 3, 32768 bytes) TCP established hash table entries: 32768 (order: 6, 262144 bytes) TCP bind hash table entries: 32768 (order: 5, 131072 bytes) TCP: Hash tables configured (established 32768 bind 32768) TCP reno registered UDP hash table entries: 512 (order: 1, 8192 bytes) UDP-Lite hash table entries: 512 (order: 1, 8192 bytes) NET: Registered protocol family 1 mconsole (version 2) initialized on /home/andrew/.uml/maverick/mconsole Checking host MADV_REMOVE support. OK Mapper v0.1 mmapper_init - find_iomem failed UML Watchdog Timer Host TLS support detected Detected host type: i386 (GDT indexes 6 to 9) audit: initializing netlink socket (disabled) type=2000 audit(1302186437.301:1): initialized VFS: Disk quotas dquot_6.5.2 Dquot-cache hash table entries: 1024 (order 0, 4096 bytes) squashfs: version 4.0 (2009/01/31) Phillip Lougher JFS: nTxBlock = 3962, nTxLock = 31703 SGI XFS with ACLs, security attributes, realtime, large block/inode numbers, no debug enabled SGI XFS Quota Management subsystem Btrfs loaded msgmni has been set to 990 alg: No test for stdrng (krng) io scheduler noop registered io scheduler deadline registered (default) SoftDog: cannot register miscdev on minor=130 (err=-16) TCP cubic registered NET: Registered protocol family 17 Initialized stdio console driver Console initialized on /dev/tty0 console [tty0] enabled Initializing software serial port version 1 console [mc-1] enabled ubda: unknown partition table registered taskstats version 1 EXT3-fs (ubda): error: couldn't mount because of unsupported optional features (240) EXT2-fs (ubda): error: couldn't mount because of unsupported optional features (240) EXT4-fs (ubda): mounted filesystem with ordered data mode. Opts: (null) VFS: Mounted root (ext4 filesystem) readonly on device 98:0. modprobe: FATAL: Could not load /lib/modules/2.6.35.1/modules.dep: No such file or directory init: ureadahead main process (756) terminated with status 5 init: console-setup main process (777) terminated with status 1 udevd[787]: failed to create queue file: No such file or directory udevd[787]: error creating queue file init: udev main process (787) terminated with status 1 init: udev main process ended, respawning init: udevmonitor main process (789) terminated with status 2 udevadm[1406]: error sending message: Connection refused modprobe: FATAL: Could not load /lib/modules/2.6.35.1/modules.dep: No such file or directory modprobe: FATAL: Could not load /lib/modules/2.6.35.1/modules.dep: No such file or directory modprobe: FATAL: Could not load /lib/modules/2.6.35.1/modules.dep: No such file or directory modprobe: FATAL: Could not load /lib/modules/2.6.35.1/modules.dep: No such file or directory line_ioctl: tty7: unknown ioctl: 0x4b70 line_ioctl: tty7: unknown ioctl: 0x5602 line_ioctl: tty7: unknown ioctl: 0x5603 line_ioctl: tty7: unknown ioctl: 0x4b3a line_ioctl: tty7: unknown ioctl: 0x5606 line_ioctl: tty1: unknown ioctl: 0x4b3a mountall: Disconnected from Plymouth init: plymouth main process (757) killed by SEGV signal init: plymouth-splash main process (1407) terminated with status 2
UserModeLinux
User-Mode Linux is another virtualisation technique for running VirtualMachines under GNU/Linux. A simplified version of the Linux kernel is run as a normal user-space process.
See the User-Mode Linux project page for more information.
This page will help you get started using User-Mode Linux with Ubuntu. Guide is created for Hardy LTS, but will most likely work with other releases.
Installing required packages
The first thing we need is to install the uml kernel and utilities we will need.
sudo apt-get install user-mode-linux uml-utilities bridge-utils debootstrap
Creating a virtual machine image
The next step is getting us a nice ubuntu hardy filesystem:
# Create an empty file to contain the root filesystem dd if=/dev/zero of=uml-root-hardy bs=4096 seek=1M count=1 # Create the filesystem on the file mkfs.xfs uml-root-hardy # Mount the filesystem sudo mount -o loop uml-root-hardy /mnt # Switch to root account for the rest sudo -i # Install a base system on the mounted partition. Use i386 or amd64 for the --arch option debootstrap --arch amd64 hardy /mnt http://us.archive.ubuntu.com/ubuntu # Create an fstab file echo "/dev/ubd0 / xfs defaults 0 1" > /mnt/etc/fstab echo "proc /proc proc defaults 0 0" >> /mnt/etc/fstab # Create the device file for the root file system and configure permissions mknod --mode=660 /mnt/dev/ubd0 b 98 0 chown root:disk /mnt/dev/ubd0 # Create a hosts file echo "127.0.0.1 localhost" > /mnt/etc/hosts # Configure network interfaces: eth0 using dhcp echo "auto lo" > /mnt/etc/network/interfaces echo "iface lo inet loopback" >> /mnt/etc/network/interfaces echo "auto eth0" >> /mnt/etc/network/interfaces echo "iface eth0 inet dhcp" >> /mnt/etc/network/interfaces # Add first terminal and serial terminal to secure list echo "tty0" >> /mnt/etc/securetty echo "ttys/0" >> /mnt/etc/securetty # Remove the other terminal events rm /mnt/etc/event.d/tty2 rm /mnt/etc/event.d/tty3 rm /mnt/etc/event.d/tty4 rm /mnt/etc/event.d/tty5 rm /mnt/etc/event.d/tty6 rm /mnt/etc/udev/rules.d/75-persistent-net-generator.rules # Return to normal account exit
Basically what we’ve done is created an empty filesystem, mounted it, and made some changes that we want done on all our VMs. Most of the commands need to be run as root using sudo in order to set the permissions correctly.
Running the VM
We should be ready to run our new VM now:
linux ubd0=uml-root-hardy.cow1,uml-root-hardy umid=uml1
- Note: if your virtual machine crashes when mounting the root filesystem, the copy-on-write mechanism doesn’t work. Use the following command instead:
linux ubd0=uml-root-hardy umid=uml1
Networking
Just started
To have your UML talking to the rest of the world, you have some options and one would be to use a TAP-interface in the host-OS. This interface is created with the use of tunctl as in:
where uml-net is the user who should own the interface /dev/net/tun. It’s very important this user matches the one specified in /etc/default/uml-utilities or the network won’t work.
UserModeLinux (последним исправлял пользователь 217 2009-04-16 07:50:07)
The material on this wiki is available under a free license, see Copyright / License for details
You can contribute to this wiki, see Wiki Guide for details