How To Create A Custom Ubuntu Live From Scratch

In the following tutorial we create a custom Debian 9 and 10 live installation image by using debian-live. Our live image carries some private software that we want to execute every time someone boots the live cd. The resulting live-cd boots with an USB stick, a CD, and the network by PXE.

A better way to create a customized USB drive with Ubuntu Live on itGot a thumb USB drive or an SD card, and you'd like to put Linux on it? Did the other HOWTOs fail you? This is the real deal, through and through. This trick also works out-of-the-box with Kubuntu and other Ubuntu variants as well. Moreover, you can adapt it with very few changes to any other live CD Linux distributions out there.https://rudd-o.com/linux-and-free-software/a-better-way-to-create-a-customized-ubuntu-live-usb-drivehttps://rudd-o.com/@@site-logo/g4402.png
by admin — published2009/01/09 10:00:00 GMT+0, last modified2013-06-26T16:00:20+00:00
Got a thumb USB drive or an SD card, and you'd like to put Linux on it? Did the other HOWTOs fail you? This is the real deal, through and through. This trick also works out-of-the-box with Kubuntu and other Ubuntu variants as well. Moreover, you can adapt it with very few changes to any other live CD Linux distributions out there.

Note that these instructions have been superseded by the Portable Linux creator. Visit that link to find out how to create your own live Linux distribution in minutes, and how to run memtest86+ or MS-DOS from your USB stick easily as well.

Many modern Linux distributions (Ubuntu included) provide a Live CD that you can download, burn and run directly without installing Linux on your computer.

But what if your computer doesn't have a working CD drive? Or perhaps you'd like to carry your Linux around in your pocket? Well, no problem. Ubuntu and many other distributions can also boot and install themselves from an USB thumb drive or an SD card (henceforth, for simplicity's sake, 'USB drive'). All you need is a drive that is 1GB or bigger.

Problem is, not everybody can use the famous liveusb program to create bootable live USB drives. Some of us are using Fedora on our workstations. Others might actually want to run Knoppix or another live distribution, not Ubuntu. Yet others might not like the way liveusb partitions the disk space in your USB drive, or might want extra functionality not provided by it.

So we'll cover those bases, using Ubuntu as the distribution (and tips for other distributions).

After following it:

  1. Your USB drive will allow you to boot Live Ubuntu Linux on any computer you plug it into. Just reboot, select USB boot, and off you go.
  2. Any customizations or files you create or change within your Linux will be preserved even after rebooting the computer or using the USB drive in another machine.
  3. You will be able to use your USB drive to install your Linux system on your friends' computers, or (if you know how) even use it to recover Linux installations that don't boot correctly anymore.
  4. (With some extra steps) you will even be able to use the drive to boot Memtest+ (to test hardware) and many other legacy programs such as MS-DOS (for those pesky BIOS updates).
  5. You will have learned valuable Linux knowledge.
  6. Best thing is, only a small portion of your USB drive will be used for this tutorial, so you get to keep the rest to do what you normally do: save music, share movies, move files around, either in Windows or in Linux.

So here's what you need to do, explained step by step. On each step, colored insets will show you example console commands you can run to accomplish the step; you're free to do each step in the way you feel the most comfortable, and referring to the commands as merely guidelines.

Creating the bootable USB drive

Get the utilities we'll be using in this tutorial

Install the following programs (that might not already be installed) on your computer:

  1. dosfstools
  2. cfdisk

Use your distribution's software installation tool do to this job.

Get Ubuntu (or your favorite Linux distribution)

What you need to do first is get Ubuntu. You can use either a CD or an ISO CD image downloaded from the Internet.

How To Create A Custom Ubuntu Live From Scratch

If you have an ISO image ready, great. Verify the image using the MD5 sums generally availableon the place you downloaded it -- trust me, you don't want to burn amalfunctioning image on your USB drive, it happened to me and it's veryfrustrating. If, conversely, you have a CD, extract an ISO image from it:

This and all subsequent examples assume that your distribution uses sudo to run administrative commands. If your distribution does not use sudo, become an administrator with the command su, then ignore the sudo prefix in all examples that follow.

Adjust the path of the of= parameter to point to the directory where you want to save the ISO image. For the rest of this tutorial, /path/to/iso/image.iso will represent the path to your ISO image.

Itnext How To Create A Custom Ubuntu Live From Scratch

Plug your USB drive in

Now plug your USB drive and ensure it is not mounted. The system log (accessible by issuing the command dmesg) will tell you what the device file corresponding to the USB drive is (it is usually /dev/sdb or /dev/sdc). For the purposes of this tutorial, we'll assume that the device file is named /dev/sdc.

Repartition your USB drive

Be very, very careful to specify the correct device to any partitioning tool -- a mistake can cost you all your data. And don't forget to back up the files in your USB drive -- this procedure will destroy any files present on the drive.

What we'll do now is simple. We'll create two partitions:

  1. The first partition will contain a regular Windows FAT32 filesystem where you can put whatever files you want, wherever you go. It will also store whatever customizations you perform in your Linux installation.
  2. The second partition will hold the contents of your CD's ISO image. It will be hidden from view.

So the real trick here is to get the second partition to be just a tiny bit larger than the ISO image (which is just under 700 MB in Ubuntu). We'll use cfdisk to do this job.

cfdisk is pretty easy to use: you select partitions by usingthe up/down arrows, and you select functions by using the left/rightarrows plus the ENTER key. Here's what you'll do:

  1. Delete any existing partitions.
  2. Create a new, primary partition. Make it the entire size of your USB drive minus 730 MB or so.
  3. Create a new, primary partition, covering the 730 MB you left out.
  4. Make the first partition bootable.
  5. Change the type of the first partition to C (Windows FAT32).
  6. Write the new partition table.
  7. Quit the program.

After doing this, your USB drive will be divided in two partitions. One partition will be visibleon My Computer, and you'll be able to store files just fine. The otherone will contain the Linux live CD, and will be invisible.

If you did it right, you should see no errors and the partition table in your USB drive has been re-read. If not (probably because you forgot to unmount any old partitions in the drive), unplug it, plug it again, and check that the device file name did not change. As long as no partitions on your USB drive are mounted, you do not needto reboot or unplug your USB drive for the partition table to bere-read by Linux.

Linux automatically names partitions with the device file name and anumber at the end, so /dev/sdc1 represents the first partition wecreated, and /dev/sdc2 represents the second, hidden one.

Verify that your USB drive does not have bad blocks

Before youcommit to using the USB drive, you need to know whether the USB drivehas sectors that have gone bad -- a common occurrence in USB drives. If a bad block damages the area where the live CD image is stored, your USB drive may malfunction or cause you to lose data.

This command will tell you if your USB drive is not usable as a live USB drive.

Format the newly created partition for Windows to use

Now it's time to create a brand new, Windows file system on the recently created partition (the first one) in your USB drive.

This creates the FAT32 file system and labels it UBUNTULIVE. The formatting process will take some time because the command tries to detect bad sectors and mark them as unusable.

Mount the Windows partition

This mounts your USB drive in the folder /media/USBDRIVE. From now on, we'll assume that's where it's mounted.

Custom ubuntu cd

Install GRUB on the Windows partition of your USB drive

GRUB is the GRand Unified Bootloader, and its job is to pick up from where the BIOS of your computer left off and continue loading the operating system. We'll use GRUB to bootstrap Ubuntu. The reason we use GRUB is because GRUB is much more resilient and easier to set up than other boot managers like Syslinux.

This command installs GRUB on the /media/USBDRIVE directory where your USB drive is mounted -- more accurately, on a boot/grub subdirectory inside it.

Copy the kernel and initial RAM disk from the ISO image to your GRUB directory

Now we're going to copy two key files from your ISO image to the boot/grub directory in the Windows partition of your USB drive (not the one in the root of your Linux file system). GRUB needs to load these two files successfully; since apparently GRUB cannot 'see' what's within an ISO image, we're simply going to copy these files from the ISO to the GRUB directory.

This example assumes your ISO image is Ubuntu or Kubuntu -- in those ISO images, the kernel and RAM disk are in the /casper directory within the disc. You may adjust accordingly for the live distribution you're going to run.

Now you should have two new files in the GRUB directory, named vmlinuz and initrd.gz.

Create a persistent file system to store data and customizations

Now we're going to create a small file. This file will contain a Linux file system which will be automatically used by Ubuntu and other similar distributions to store your data, configuration, updated and extra software you install on it. Ableton live 10 serial crack. This step is not required if you do not want your data and customizations be remembered after rebooting your computer.

This example creates a file 256 MB large, named casper-rw, in the Windows partition of your USB drive. Adjust the number 256 to make it bigger or smaller (try not to make it smaller, though -- 256 MB is pretty small).

Write the ISO image to the hidden partition

Now we need to make a byte-by-byte copy of your Ubuntu ISO image tothe hidden partition (the second one we created on the step before thisone). For that, we can use the dd command:

Be very careful when running the dd command, and double-check the of= parameter before hitting ENTER. One typo can cost you all of your data.

This will take a long time. If everything went well, you will bereturned to the prompt with a small message noting how many bytes werecopied in total, but no error messages.

Create a nice GRUB boot menu

Because GRUB is so flexible, you can use any live CD distribution instead of Ubuntu on your USB drive.
Refer to your favorite distribution's documentation to find out where you may obtain the appropriate vmlinuz and initrd.gz files (usually in the ISO image of your favorite distribution) and what parameters to specify in the kernel line of the GRUB configuration file.

Once you've done that, you can create the GRUB boot menu that will let you select and boot Ubuntu when the computer boots up. We're going to create a file named grub.conf within the /media/USBDRIVE/boot/grub directory we created earlier using grub-install.

That command will launch the nano text editor ready to edit the file. Put the following contents inside that brand new file:

If you're using a Kubuntu image, you need to make a small tweak: instead of ubuntu.seed, type kubuntu.seed. Other Ubuntu flavors may need similar tweaks.

Save the file and exit the text editor (if you're using nano, hit Ctrl+X, answer Yes to the answer to save the file, hit ENTER, and you're done).

How

Unmount the Windows partition of your USB drive

Once you're done with the file, you can safely unmount the partition containing those files. Close any text editors, terminals or folder windows you might have open with the contents of the USB drive, then run:

That's it. Now your USB drive has only one folder named boot inside it, with some pretty important files. Don't touch them from now on, and don't use a disk defragmenter on your USB drive either.

Sync up, then unplug

sync writes any pending data to all the disk drives in your computer. This guarantees that everything is safely stored on disk before unplugging any device. Normally, when you click the Eject icon on your desktop, sync is run for you automatically.

How To Create A Custom Ubuntu Live From Scratch Download

Now that you've done all of these steps, run:

Once sync returns you to the prompt, it's safe to unplug the USB drive.

Now you're done.

Using your USB drive

Starting up your Linux system

Wherever you go, all you have to do (in this order) is:

Some BIOSes let you press a key (usually F8) to give you a boot menu. Using this boot menu, you can temporarily choose to boot from your USBdrive without changing any BIOS configuration permanently.
  1. Plug your USB drive in.
  2. Reboot the computer.
  3. As soon as the computer starts up, repeatedly press DEL, F1, F2 or F10 until you get to the BIOS configuration menu. The correct key is usually briefly flashed across the screen as soon as the computer powers up.
  4. On the BIOS configuration menu, locate the Boot order options (usually under a Boot or an Advanced options menu)
  5. Select as first boot device your USB drive. Ssometimes you need to select Hard Disk, and within Hard Disk, your USB flash or thumb drive. On other BIOSes, you might need to first select Hard Disk, then go to a separate submenu to select which hard disk.
  6. Save the changes and reboot.

That's it. If you did it right, next time the computer boots, your USB drive will be used as a 'hard disk', and your Live Linux will come to life right away.

Accessing your Windows partition from within your Linux system

If you want to access the files stored on your Windows partition on your Linux system:

  1. Add the following commands to the /etc/rc.local file (before the exit 0 line):
  2. reboot

From this point on, you can simply browse to /media/windows to see your files. The partition mounts automatically on boot.

Care and feeding of your USB drive

Upgrading your USB drive to the latest Linux

We've got, what, six months between Linux releases? Well, you don't want to be caught running an old Linux distribution, do you?

Fortunately, upgrading is extremely easy. All you have to do is:

  1. download the latest Linux release, then
  2. re-run the step named Write the ISO image to the hidden partition, then
  3. re-run the step named Copy the kernel and initial RAM disk from the ISO image to your GRUB directory, then

If you've already performed software installations or upgrades, you might want to remove them from your persistent casper-rw file, because they will overshadow files in your new Linux distribution. To do that, mount the file (using the loopback driver) on an installed Linux system, then remove /var, /usr, /bin, /sbin and /lib from it. Note that you will have to reinstall any third-party packages that do not ship with your new Linux distribution.

Periodic file system checks

The following tests you need to run as an administrator on a Linux computer every once in a while, or if you experience malfunctions while using your USB drive. You can't run these tests while running the live distribution on the USB drive.

The first test checks whether the area where the live CD is stored has gone bad and is no longer usable:

The second test checks and repairs bad sectors in the Windows partition where you store files and the persistent file system is located:

The third test checks whether there is any corruption in the persistent file system itself (if you are using this feature):

Dealing with low disk space on your persistent file system

You might find that the 128 MB we assigned earlier for your persistent file system turn out to be too small. You can fix this by making the file larger without deleting your customizations.

  1. Plug the USB drive in a computer that has Linux, but do not boot from it. Mount the Windows partition on your USB drive. Become an administrator to run the subsequent steps.
  2. Create an empty temporary file using the dd command:This example command creates a 256 MB file. That's a bit small, but it should suffice to install a few programs -- like multimedia codecs and VLC in case you want to roll around with an all-purpose multimedia machine.
  3. Now tack that file onto the end of your casper-rw persistent file You can do that with the command:
  4. Finally, enlarge the file system to encompass the added disk space:
  5. Now unmount your USB drive.

Linux, it’s a word that makes many a non-geek’s eyes glaze over almost immediately. However, desktop Linux offerings are now pretty much on par with the big names such as Windows and MacOS.

Thanks to decades of community work and support from organizations like Canonical, you can download something like Ubuntu Linux today and do almost all the things you can with Windows. All without needing a degree in computer science. Modern desktop Linux distros look good, work well and are suitable for average users.

However, they have one huge differencecompared to commercial operating systems – Open Source licensing.

This means we have full access to all theinner workings of Linux. You don’t have to pay to use it and you can customizeit in just about any way you like. That’s great for power users who like totinker with the nut and bolts, but what if you just want to preserve your owntweaked custom Linux installation?

You can actually create a fresh install of Linux, set it up just the way you want it and then turn it into a live, bootable installation. This is super-useful for a few reasons. First of all, it means you won’t have any downtime if you have to reinstall your operating system.

All your settings and software will already be waiting right from the start. It also makes it very easy to create custom installations for distribution. Let’s say you have to install Linux on a whole computer lab full of PCs and then install educational packages. Using a custom distribution tool means you only have to do that customization once and then simply install as usual.

One of the easiest tools out there is calledLinux Live Kit and we’re going to look at exactly how you can change anexisting Linux installation back into a custom distro.

Setting Up The Machine

In order to use the Linux Live Kit, you needan installation of Linux to customize. While you can go ahead and do it withyour main installation, it’s not the most practical approach if you want tocreate customized distributions for something other than your main computer.

So what we’ll be doing is installing UbuntuLinux to a VirtualBox virtual machine. That gives us a clean, controlledinstallation environment. It also means you can make custom Linux distros froma Windows machine if you like. Finally, it’s a good way to test the distroyou’ve just created, to make sure it works properly.

We are going to use the following components:

  • Windows 10
  • VirtualBox
  • Ubuntu 18 LTS

Remember, the process works exactly the sameif you use the Linux Live Kit on a Linux installation that running as normal ona computer, rather than in a virtual machine.

Installing Linux

The first thing to do is install Linux.Obviously if you want to use an existing installation, you can skip this step.

Installing Linux the usual way simply requiresthat you boot from the DVD or USB installation media. Because we’re usingVirtualBox, we just have to create a new virtual machine and then point ittowards the Ubuntu disc image we downloaded. Here are the steps you need tofollow.

Taking Care of Dependencies

Since Linux Live Kit is just a clevercollection of scripts, it needs certain other software packages to be presenton your Linux machine. In many cases they will already be a default part of theversion of Linux you have chosen, but you’ll have to verify this either way.

You need to make sure that aufs is supported by the kernel used by your chosen Linux distribution. You can check which kernel versions supports aufs here. If your chosen kernel does not support aufs, you’ll need to look at an alternative solution to Linux Live Kit.

Now we need to make sure that Squashfs isinstalled on the system. This is the compression technology used by Linux LiveKit. To install it, here’s what to do.

First, open the Terminal. In Ubuntu you can do this by clicking the “Show Application” button at the bottom left of the screen.This will bring up a search bar. Search for “Terminal” and click it when it comes up.

Now, in the terminal, type the following:

sudoapt-get update && sudo apt-get install squashfs-tools

If all goes well the package will beinstalled. If you run into trouble, you’ll have to refer to your version of theOS documentation. Troubleshooting repository and installation issues areoutside our scope for this tutorial.

Jan 03, 2014  Virtual DJ Help - Sepperate Screen For Video briansredd. Unsubscribe from briansredd? How to split video's from laptop to 2 TV'S Using HDMI - Duration: 3:12. How to freeze the split screen on djay. Sep 26, 2017  - Go to the start menu and click onto settings. Then click to System and go to display settings. Click on the monitor that is frozen, and check the box where it says 'Make this my main display' - Once that's done your monitor should be back the way it should and take out the unclosed apps.

Trimming the Fat

Since your live distro iw going to have allthe same content as your installed one, you should remove any files you don’tneed from your installation. You don’t have to do this and storage is cheapthese days if you’re using a flash drive. If you don’t know what’s safe to remove,skip this part for now.

Customizing

Now you can go ahead and make the changes youwant for your live distro. Install applications, tweak settings and so on. Onceyou are done with that, we can move on to the Live Kit itself.

Download Linux Live Kit

Now it’s time to download the scripts we need.You can find it on GitHub. Pay special attention to the tips inthe README here. Some of them may be relevant to your needs or situation. Forexample, there are specific instructions if you want to make a bootable liveCD.

Savethe downloaded files to /tmp. In the download you’llfind a folder named “/DOC/. This is filled with additional readme informationto help you in case you hit a snag.

Generating Your Live OS

Now that the script files are where theyshould be, we want to actually run the script. To do this, we’ll have to switchfrom being a regular user to being a Super User. In Ubuntu, open the terminal and type the following:

cd /tmp

This switches you to the TMP folder where weunpacked the Live Kit files.

The last thing we need to do is run the script, so type:

sudo ./build

Now just wait until the script is done!

Running Your Live Distro

So how do you get your live distro? The scriptgenerates two version in the /TMP folder. There’s an ISO image that you canburn to a disc or load up in a virtual machine to test. Most people are howevergoing to care about the bootable USB files. These are also in the /TMP folder.

Copy them to your flash drive, remember tounzip them in the process. Once they are on there, use the Terminal andnavigate to the /boot directory. Then run the “bootinst.sh” script to make thatflash drive bootable.

If all goes well, you’ll now have your ownlive OS!