giuppi's picture

My laptop doesn't have a CD/DVD drive. Is there a way to install Turnkey MediaWiki from a thumbdrive?

I tried copying all the files from the CD (after burning the iso file I downloaded here) on the thumbdrive and changing the boot order of the laptop, but I got the following messages:

No operative system found, and

Remove your accessories and press any key to reboot.

Evidently I'm doing something wrong. Any help please? 

Forum: 
Tags: 
Liraz Siri's picture

We don't yet officially support running our software appliances from USB just yet, but it is on our todo list.

Meanwhile, you may want to try a couple of tools I found that claim to do what you want - installing a Live CD ISO image as a Live USB:

I haven't had a chance to try these out yet myself so I will be very interested in the results you get (or don't get). Especially if it works!

Note that converting a Live CD ISO image to a Live USB image is technically possible but it is a bit more complicated than what you tried.

If the GUI tools above don't work for you, you might have better luck with a Python script Alon wrote that installs an extracted ISO filesystem to a USB device:

#!/usr/bin/python
# Copyright (c) 2008 Alon Swartz alon@turnkeylinux.org
"""
Put cdroot onto usb device

Example usage:
    # cdroot2usb.py extracted_iso /dev/sdb

"""
import os
import sys
import getopt
import shutil

from os.path import *

import executil
import temp

#todo:
#  check, and reset mbr?

def usage(s=None):
    if s is not None:
        print "error: " + str(s)

    print "Syntax: %s cdroot usbdev" % sys.argv[0]
    print __doc__.strip()

    sys.exit(1)

class Error(Exception):
    pass

class Cdroot:
    def __init__(self, path, dirs):
        self.path = realpath(path)

        for dir in dirs:
            if not exists(join(path, dir)):
                 raise Error('does not exist: %s' % join(path, dir))

class Partition:
    def __init__(self, s):
        fields = s.split(None, 7)
        if not len(fields) == 8:
            raise Error('unexpected structure')

        self.path = fields[0]

        self.is_bootable = False
        if fields[1] == '*':
            self.is_bootable = True
            fields.pop(1)  # remove bootable field, not present if not bootable

        self.start = fields[1]
        self.end = fields[2]
        self.blocks = fields[3]
        self.id = fields[4]
        self.fs = fields[5]

class UsbDev:
    def __init__(self, path, filesystem_ids):
        self.path = self._get_blockdev_path(path)
        if self.is_mounted():
            raise Error('usbdev is mounted')

        self.bootpart = self._get_bootable_partition()
        if self.bootpart is None:
            raise Error('no bootable partition found on device')

        if self.bootpart.id not in filesystem_ids:
            raise Error('bootable partition type not allowed',
                        filesystem_ids,
                        self.bootpart.id)

    @staticmethod
    def _get_blockdev_path(path):
        p = executil.getoutput("udevinfo -q path -n %s" % path).lstrip('/')
        for path in ( join('/sys', p , 'device'),
                      join('/sys/block', basename(p)),
                      join('/dev', basename(p)) ):
            if not exists(path):
                raise Error('usbdev path error: %s' % path)

        return join('/dev', basename(p))

    @staticmethod
    def _read_partition_table(path):
        partitions = []
        for line in executil.getoutput("fdisk -l %s" % path).splitlines():
            if line.startswith(path):
                partitions.append(Partition(line))

        return partitions

    def _get_bootable_partition(self):
        for partition in self._read_partition_table(self.path):
            if partition.is_bootable:
                return partition

        return None

    def is_mounted(self):
        mounts = file("/proc/mounts").read()
        if mounts.find(self.path) != -1:
            return True

        return False

    def install_bootloader(self):
        if self.is_mounted():
            raise Error('unmount usbdev to install boot loader')

        print "* installing bootloader"
        executil.system('syslinux', self.bootpart.path)

class Cdroot2Usbdev:
    def __init__(self, cdroot, usbdev):
        self.cdroot = cdroot
        self.usbdev = usbdev

        self.mountdir = temp.TempDir(dir='/media')
        self._mount()

    def copy(self):
        print "* copying cdroot"
        executil.system('cp -r %s/* %s' % (self.cdroot.path,
                                           self.mountdir.path))

    def isolinux2syslinux(self):
        print "* making isolinux configuration compatible for syslinux"
        path = self.mountdir.path
        executil.system('mv %s/isolinux/* %s' % (path, path))
        executil.system('mv %s/isolinux.cfg %s/syslinux.cfg' % (path, path))
        executil.system('rmdir %s/isolinux' % path)
        executil.system('rm %s/isolinux.bin' % path)

    def _mount(self):
        print "* mounting %s %s" % (self.usbdev.bootpart.path,
                                    self.mountdir.path)
        executil.system("mount", self.usbdev.bootpart.path, self.mountdir.path)

    def _umount(self):
        if self.usbdev.is_mounted():
            print "* umounting %s" % self.usbdev.bootpart.path
            executil.system("umount", self.usbdev.bootpart.path)

    def __del__(self):
        self._umount()

def main():
    try:
        opts, args = getopt.gnu_getopt(sys.argv[1:], "", [])
    except getopt.GetoptError, e:
        usage(e)

    if not args:
        usage()

    if len(args) != 2:
        usage("bad number of arguments")

    cdroot = Cdroot(path=args[0], dirs=('casper', 'isolinux'))
    usbdev = UsbDev(path=args[1], filesystem_ids=('16')) # Hidden FAT16

    c2u = Cdroot2Usbdev(cdroot, usbdev)
    c2u.copy()
    c2u.isolinux2syslinux()
    del c2u  # we want to make sure __del__ is called

    usbdev.install_bootloader()

if __name__ == "__main__":
    main()

Alon Swartz's picture

I just replied to a mail from Herson regarding the python modules cdroot2usb depends on, so I thought it would be a good idea to post a comment about it here.

My reply on the turnkey-discuss mailing list.
Liraz Siri's picture

Note that it just occured to me that you may be trying to solve the wrong problem.

Instead of trying to install an appliance on the laptop's bare metal you'll find it is probably much easier to install it into a Virtual Machine (e.g., VirtualBox or VMWare) which can load the ISO into its "virtual" CD drive.

BTW, that's how we do most of our testing. Only rarely do we actually burn physical CDs.

giuppi's picture

Thank you liraz, I followed your advice and installed MediaWiki through the Virtual Machine solution. I am sorry I can´t give you any feedback on the other proposed solution (running the scripts to use the USB thumbdrive in live mode). Now I have one followup question, but I don´t know if it belongs here or on the MediaWiki forums: now that the wiki is up and running within the virtual machine (i use VirtualBox), how do i access it? The IP address that MediaWiki provides on startup is the one of the hosting machine, and I don´t seem to be able to access it. Any help?
giuppi's picture

Jackdotnet's picture

I'm a home user...using a Synology ds220j NAS but I have a very curious 76 year old mind. I am interested in linux NAS like TrueNAS and TKL File Server. Why install TLK File Server into a VM (other than for testing and playing with before actually deploying for everyday use)? I can share files over my home lan via linux or Windows shares, so why would I set up TKL File Server in a VM on the same machine? My main box runs MX-Linux 21.3 and I use VirtualBox on it to get to a few programs (& a 13 yr old Lexmark printer) under Win7 & Win10. Thanks....Jack
Jeremy Davis's picture

I don't think that there are many (if any) people running a TurnKey fileserver as a VM on their desktop for anything other than testing/playing as you note.

I think most home users and probably all SMB users, have a dedicated "server" of some sort. The "server" may be anything from an old repurposed desktop, through to high end dedicated server hardware. Something that is "always on" and can be linked to from other PCs and devices. So you don't need to leave your desktop running all the time to access your files (say on your phone or your smart TV). That may be Linux or Windows server distro installed to bare metal, perhaps some sort of Hypervisor as a base. When the bare metal OS provides some sort of hypervisor component, then (usually multiple) VMs can be used to provide the desired services.

For me, the point of running servers as VMs is so that they can essentially be disposable. The data contained within them is the important bit, not the actual server itself. An analogy that I think is useful when thinking about VMs is "Pets vs Cattle". A pet is a member of the family, it is constantly tended and cared for. When unwell, generally no effort or expense is spared to nurse it back to health. Cattle on the other hand are generally not tended to with that same degree of care. They are much more "replaceable". If cattle are unwell, unless it's easily treatable (and it's cost effective), it will likely be put down and replaced. My VMs are mostly cattle - and IMO that's the best way to treat them. For more reading about that model, please google something like "vm pets vs cattle"

TurnKey itself is simply a starting point. It's ready to use (and hopefully useful out of the box) for those that don't have the knowledge, patience and/or time and energy to set it up. But can be built-on and customized for those that know what they are doing and/or an opportunity to learn. By design, TurnKey can lend itself to either usage pattern, pet or cattle.

For me in my personal setup, I have a small low power headless server that acts as my hypervisor host (it runs ProxmoxVE - a Debian based headless hypervisor). FWIW for many years I ran PVE (as my home server) on an old (repurposed) desktop. I replaced that with dedicated hardware (a supermicro ITX server board with soldered low power Atom CPU - in a NAS style box) a few years ago when I ran out of RAM (the Core2Duo CPU was still doing the job, but the motherboard wouldn't take anymore than 8GB - the new board has 32GB).

One of the extra benefits of using a hypervisor like Proxmox is that it not only supports "real" VMs, it also supports (LXC) containers. You may not have heard of LXC, but if you've been playing in the server space over the last few years, you would have likely heard of Docker. LXC and Docker are very similar, with the fundamental difference being that LXC is a complete OS (leveraging the host's kernel), whereas Docker is designed to provide a single application (and only it's direct dependencies). The big advantage of LXC is that LXC guests run at near bare metal performance (relative the the resources that you allocate them).

Using a hypervisor allows me to completely separate and isolate functionality of my servers. I can reboot my fileserver without affecting my DNS (for example). The VM host (i.e. ProxmoxVE) is still a single point of failure, but other than simple maintenance (and full OS upgrade every few years), that is rarely touched as everything else happens on VMs. Failure of one service doesn't bring my whole network down. When it comes time to do upgrades on individual servers, I can easily take a snapshot so can easily rollback if anything goes wrong. Worst case scenario, it will only affect the service(s) related to that VM. It allows me to build in redundancy, replace one service with a different one with zero downtime and it allows me to compare different services/pieces of software side-by-side (in separate VMs or containers).

How you separate the data and the actual server depends on your preferences. I use customized backups to keep backups of all my important data (both locally and remotely). I have a huge collection of multimedia and whilst I don't really want to lose any of it, most of it is not that important to me. So most of that is not backed up in the same way. I have that all just stored on local disk (mirrored on another disk for data integrity). I have that drive mounted within my fileserver (actually I use the TurnKey Mediaserver as an LXC container - but that includes the fileserver functionality).

Hope that answers your question?!

m3ch4n15m's picture

And it's got the advantage of working also in windows (for those who are like myself, stuck dealing with it at work).

 

It works like a charm on the test unit I have here (An HP T5300 thin client. So potentially I could in theory recycle a thin client and make it into a domain controller. Not a bad idea, but meh.)

 

Now, to see if I can slap that baby on a CF flash card...

 

 

Add new comment