Git Product home page Git Product logo

zhovner / onefilelinux Goto Github PK

View Code? Open in Web Editor NEW
772.0 59.0 74.0 247.1 MB

Live linux distro combined in one ~20MB file. Runs on any UEFI computer.

Home Page: https://hub.zhovner.com/geek/one-file-linux/

Shell 0.12% Perl 0.13% C 96.02% Makefile 0.26% Assembly 1.47% C++ 1.33% Objective-C 0.54% Awk 0.01% Python 0.07% GDB 0.01% Yacc 0.02% Lex 0.01% UnrealScript 0.01% Gherkin 0.01% XS 0.01% Roff 0.01% Clojure 0.01% M4 0.01% sed 0.01% SmPL 0.01%

onefilelinux's Introduction

One File Linux

Live linux distro combined in one ~20MB file. Runs on any UEFI computer (PC or Mac) without installation. Just copy one file to EFI system partition and boot.

One File Linux

Download: https://github.com/zhovner/OneFileLinux/releases

About in russian: https://habrahabr.ru/post/349758/

Main advantages

  • No installation required — no need to create additional paritions. Just copy one file to EFI system partition and add new boot entry to NVRAM.

  • No USB flash needed — once copied to EFI partition, OneFileLinux can boot any time from system disk.

  • No Boot Manager required (GRUB, rEFInd) — boots directly by UEFI firmware, no additional software needed.

  • Doesn't change the boot sequence — can boot only once, next reboot will return default settings.

  • Compatible with disk encryption — works with macOS FileVault and dm-crypt. Because EFI system parition is not encrypted.

Why?

This can be useful when you need Linux on bare metal and can't use USB flash. In comparison with Live USB flash, one file Linux setups permanently in EFI partition and can boot any time later.
My personal goal is to use laptop's internal PCIe WiFi card for cracking WiFi with aircrack-ng and reaver software, since PCIe devices can't be forwarded into virtual machine.

Run on Macbook

1. Download OneFileLinux.efi from link above.

2. Mount EFI System Partition

diskutil mount diskN

where diskN is your EFI disk number.
To find your EFI disk number use diskutil list command.

macOS diskutil list EFI partition

For me it will be: diskutil mount disk0s1

3. Copy OneFileLinux.efi to EFI partition

cp ~/Downloads/OneFileLinux.efi /Volumes/EFI/

4. Set boot option in NVRAM

On macOS since El Capitan enabled by default SIP (System Integrity Protection) prohibits to change boot options.
To check SIP state run csrutil status. In normal situation it should be enabled.

If SIP is enabled you can run bless only from Recovery console, otherwise it returns error.
To boot in Recovery mode press CMD+R while boot and go to Utilities —> Terminal from top menu.
In recovery console follow steps 2 and 4 every time you need to boot OneFileLinux.

bless --mount /Volumes/EFI --setBoot --nextonly --file /Volumes/EFI/OneFileLinux.efi

This command sets NVRAM option to boot OneFileLinux.efi only once. Next reboot will return default boot order.

5. Reboot

Reboot to run OneFileLinux. Once you've done, type reboot in Linux console and go back to macOS.
Every time when you need it again, follow steps 2 and 4 from recovery console.

Run on PC

There are few ways how to run OneFileLinux on PC motherboard. Some motherboards have builtin UEFI Shell that can run any efi binary from console.
I will describe setup process for my old ThinkPad X220 that doesn't have UEFI shell.

1. Copy OneFileLinux.efi to EFI partition

If you use Windows 10 installed in EFI mode, you have EFI system partition 100 MB in size.
You need to find out how to mount by itself. You can do this with OneFileLinux.efi run from USB flash or any other linux distro.

2. Add NVRAM boot option

I can't find out how to do this in Windows, so you probably need Linux for this.
Replace /dev/sda to you disk path and --part 2 to your EFI partition number.

efibootmgr --disk /dev/sda --part 2 --create --label "One File Linux" --loader /OneFileLinux.efi

3. Choose One File Linux from boot menu

On my ThinkPad X220 I press F12 while power on to open boot menu. Hotkey depends on your motherboard.

ThinkPad X220 boot menu

Run from USB flash

The only benefit from running OneFileLinux from USB flash, is that no additional software is required to create bootable flash drive.
Just format flash drive as FAT32 in GPT scheme and copy OneFileLinux.efi to default path:

\EFI\BOOT\BOOTx64.EFI

Format in GPT scheme in Windows

Windows does not allow to format flash drive in GPT scheme from GUI, so you need to use command line tool.

  1. Open cmd.exe as administrtor
  2. Typediskpart
  3. list disk to see all disks
  4. select disk <disknumber>
  5. clean do delete parition table
  6. convert gpt to convert disk in GPT scheme
  7. exit

Then format drive from diskmgmt.msc in FAT32.

Build your own

You can build your own version of One File Linux.
It based on Alpine Linux and vanilla kernel.

  1. Clone repositry
    git clone https://github.com/zhovner/OneFileLinux

  2. Make changes in root filesystem and kernel
    chroot alpine-minirootfs /bin/ash

  3. Build
    ./build.sh

Virtual Machine ready to go build environment

You can download vm image with completely configured environment.
Torrent file: kali64.vmwarevm.7z.torrent
VMware Player/Workstation or VMware Fusion recommended.
Username: root
Password: toor

Just login and run:

cd /root/onefilelinux/
./build.sh

onefilelinux's People

Contributors

foxpdll avatar zhovner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

onefilelinux's Issues

Cannot Build

hello I cannot get sudo ./build.sh to work.

i have installed libelf-dev as instructed (ubuntu 19.10 host)

errer = '''

r_error_r.c: In function ‘str_error_r’:
../lib/str_error_r.c:25:3: error: passing argument 1 to restrict-qualified parameter aliases with argument 5 [-Werror=restrict]
25 | snprintf(buf, buflen, "INTERNAL ERROR: strerror_r(%d, %p, %zd)=%d", errnum, buf, buflen, err);
| ^~~~~~~~
cc1: all warnings being treat
'''

please advise.

.config options to build with newer kernel

I'm trying to make a custom build with a more up-to-date kernel, but so far it always end up with a kernel panic not syncing: VFS: Unable to mount root fs on unknown-block(0,0). I'm certainly missing something in my .config. What are the key kernel config elements to set to get a functional build ?

Setting kernel config

Hi, trying to recreate this from scratch in a docker container for the heck of it, and because it's super cool!

How did you learn to set the right .config options for the Linux kernel? In particular, getting the right Wifi drivers, removing unnecessary modules, etc?

I tried copying this config from the official alpine kernel packages, but it's unnecessarily huge, including a bunch of nvidia graphics drivers, ETC. that are not needed for simple wifi packet injection/sniffing. I could try slimming that one down manually, but it seems like you probably didn't do that, and it would take forever, too.

Any basic instructions on how to recreate your .config file?

Build with LVM?

Hello, this tool would be great to live in EFI for resizing file systems offline.

(especially root)

However I am trying to build a version with lvm compatible as well as with lvm-utilities.

I cannot really build it yet and I am trying to build a version without downloading a 14GB vm.

Can you assist?

build.sh failed to create OneFileLinux EFI file

./build.sh                                                                                                                                                                                                                                                                       
      ____________                                                                                                                                                                                                                                                               
    /|------------|                                                                                                                                                                                                                                                              
   /_|  .---.     |
  |    /     \    |
  |    \.6-6./    |
  |    /`\_/`\    |
  |   //  _  \\   |
  |  | \     / |  |
  | /`\_`>  <_/`\ |
  | \__/'---'\__/ |
  |_______________|

   OneFileLinux.efi
----------------------------------------------------
Checking root filesystem

Kernel modules folder is not empty: alpine-minirootfs/lib/modules/
Removing modules...

Version in banner: v0.3.2
Uncompressed root filesystem size WITHOUT kernel modules: 57M

----------------------------------------------------
Building kernel mobules using 64 threads...

  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  DESCEND  objtool
  CHK     scripts/mod/devicetable-offsets.h
  CHK     include/generated/utsrelease.h
  CHK     include/generated/timeconst.h
  CHK     include/generated/bounds.h
  CHK     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  Building modules, stage 2.
  MODPOST 1404 modules
----------------------------------------------------
Copying kernel modules in root filesystem

  INSTALL arch/x86/crypto/aes-x86_64.ko
  INSTALL arch/x86/crypto/aesni-intel.ko
  INSTALL arch/x86/crypto/blowfish-x86_64.ko
...
  INSTALL net/xfrm/xfrm_ipcomp.ko
  INSTALL net/xfrm/xfrm_user.ko
  INSTALL virt/lib/irqbypass.ko
  DEPMOD  4.14.22-onefile
Uncompressed root filesystem size WITH kernel modules: 133M

----------------------------------------------------
Copying modules.dep

depmod: FATAL: could not load System.map: No such file or directory

(I skipped multiple INSTALL lines)

Driver for Broadcom BCM4331 Wireless Chipset

MacbookPro 10.1 (retina mid-2012) has a Broadcom BCM4331 Wireless Chipset.
Open-source driver is built-in to the kernel (b43) but requires non-free firmware to function. See http://linuxwireless.sipsolutions.net/en/users/Drivers/b43/ or https://aur.archlinux.org/packages/b43-firmware/

There is also proprietary driver from Broadcom found here: https://www.broadcom.com/support/download-search/?pf=Wireless+LAN+Infrastructure

What can be a best way to integrate one of these into OneFileLinux?

WiFi connection wizard

There is no easy wat to connect WiFi.
We need to add some GUI wizard to do this. Like nmtui or wifi-menu. But without depends on NetworkManager or netctl.

Wifite

There is no wifite package in alpine linux. We need to build our own with minimal python dependencies.

Change keyboard layout

Sorry for the dumb question but is it possible to change the keyboard layout configuration?

Cant boot up on PC

I have PC with MSI motherboard. Moved files on EFI partition (1 disk, 3 partitions), and trying to execute .efi files.
IMG_20201102_122531
On version 0.3.2 appers "Loading hardware drivers ...", and then everything freezing. PC was idle for ~20 mins, but nothing changed.
IMG_20201102_120755
Verison 0.3 doesen't even lauched. Freezed on this screen, and then nothing.
IMG_20201102_121607
Version 0.2-beta launched and gave me login screen, but won't react to my (USB) keyboard, so I can't login.
IMG_20201102_122201
In every situation the only option is force reboot with power switch on back of my PC.
Didn't tryed to build it on myself. Shoud I try? Can I write Russian?

Is this still active?

It seems very cool, but i don't see any activity and the kernel hasn't been updated in a while

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.