User-Mode Linux
Listing 2. Destruction can be fun if you are just testing.
Debian GNU/Linux testing/unstable (none) tty0 (none) login: root Linux (none) 2.6.14.3-bs3 #7 Fri Dec 16 17:47:00 CET 2005 i686 GNU/Linux The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. (none):~# rm -rf / rm: cannot remove `//proc/meminfo': Operation not permitted rm: cannot remove `//proc/uptime': Operation not permitted (... Many warnings about read-only filesystems omitted ...) rm: cannot remove `//proc/loadavg': Operation not permitted rm: `//proc/self' changed dev/ino: Operation not permitted (none):~# df -k -bash: df: command not found (none):~# ps -ef -bash: ps: command not found (none):~# halt -bash: /sbin/halt: No such file or directory (none):~#
It's hosed up pretty good at this point. In fact, you can't even run halt, because the halt program itself is gone. From another command window, kill the system with:
killall -9 vmlinux-2.6.14.3-bs3
Then, see what happens when you try to boot it up again using the same command (Listing 3).
Listing 3. A Very Ill Debian UML Guest
(... boot messages omitted ...) EXT3-fs: INFO: recovery required on readonly filesystem. EXT3-fs: write access will be enabled during recovery. kjournald starting. Commit interval 5 seconds EXT3-fs: ubda: orphan cleanup on readonly fs EXT3-fs: ubda: 66 orphan inodes deleted EXT3-fs: recovery complete. EXT3-fs: mounted filesystem with ordered data mode. VFS: Mounted root (ext3 filesystem) readonly. Warning: unable to open an initial console. Kernel panic - not syncing: No init found. Try passing init= option to kernel. EIP: 0073:[<a01c6691>] CPU: 0 Not tainted ESP: 007b:b7f3afac EFLAGS: 00000282 Not tainted EAX: 00000000 EBX: 000012eb ECX: 00000013 EDX: 000012eb ESI: 000012e8 EDI: 00000000 EBP: b7f3afb8 DS: 007b ES: 007b a10afb80: [<a0032d2a>] show_regs+0x21a/0x230 a10afbb0: [<a0016c8c>] panic_exit+0x2c/0x50 a10afbc0: [<a004a275>] notifier_call_chain+0x25/0x40 a10afbe0: [<a0037501>] panic+0x71/0x100 a10afc00: [<a000e2c0>] init+0x100/0x170 a10afc20: [<a002bf59>] run_kernel_thread+0x39/0x50 a10afce0: [<a001c3d4>] new_thread_handler+0xc4/0x120 a10afd20: [<b7f3b420>] 0xb7f3b420
That's gotta hurt. So, as a lesson, do not do that on a real system. But because this is a UML guest with a COW file, you simply can delete the DangerDanger.cow file, and this guest system will boot up back to its initial state.
The utility uml_moo included in the UML utilities will read a filesystem image and an associated COW file and create a new merged filesystem image. This allows you to merge changes stored in the COW file into a new master filesystem image. This makes it easy to clone working guest filesystem images when you have them set up the way you want.
User-mode Linux is fun to play with, but it also has some real-world uses. You can use it to test unknown or untrusted applications while limiting possible damage to the running host system. You can create virtual networks of UMLs by starting up multiple guests at once. This allows you to create a test-lab-in-a-box environment with very little time and effort, so you can try all those “Stupid Linux Tricks” you were afraid to try on a real system!
The code for this article is available at ftp.linuxjournal.com/pub/lj/listings/issue145/8803.tgz.
Resources for this article: /article/8883.
Matthew E. Hoskins is a Senior UNIX System Administrator for The New Jersey Institute of Technology where he maintains many of the corporate administrative systems. He enjoys trying to get wildly different systems and software working together, usually with a thin layer of Perl (locally known as “MattGlue”). When not hacking systems, he often can be found hacking in the kitchen. Matt is a member of the Society of Professional Journalists. He is eager to hear your feedback and can be reached at matt@njit.edu.
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.
Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.
Sponsored by ActiveState
| Speed Up Your Web Site with Varnish | Jun 19, 2013 |
| Non-Linux FOSS: libnotify, OS X Style | Jun 18, 2013 |
| Containers—Not Virtual Machines—Are the Future Cloud | Jun 17, 2013 |
| Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer | Jun 12, 2013 |
| Weechat, Irssi's Little Brother | Jun 11, 2013 |
| One Tail Just Isn't Enough | Jun 07, 2013 |
- Speed Up Your Web Site with Varnish
- Containers—Not Virtual Machines—Are the Future Cloud
- Linux Systems Administrator
- Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer
- Senior Perl Developer
- Technical Support Rep
- Non-Linux FOSS: libnotify, OS X Style
- UX Designer
- Web & UI Developer (JavaScript & j Query)
- Android's Limits
- Reachli - Amplifying your
44 min 28 sec ago - excellent
1 hour 33 min ago - good point!
1 hour 36 min ago - Varnish works!
1 hour 45 min ago - Reply to comment | Linux Journal
2 hours 14 min ago - Reply to comment | Linux Journal
4 hours 40 min ago - Reply to comment | Linux Journal
8 hours 40 min ago - Yeah, user namespaces are
9 hours 56 min ago - Cari Uang
13 hours 28 min ago - user namespaces
16 hours 21 min ago




Comments
Redhat 7.3
Redhat 7.3
Redhat 8.0
Redhat 9.0
Fedora 4