Difference between revisions of "Undead USB Install"

From Funtoo
Jump to: navigation, search
m (add link to Install/Stage3_Desktop, force symlink on localtime instead of deleting previous file.)
(Bootloader)
 
(13 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
==A linux nomadbsd alternative==
 
==A linux nomadbsd alternative==
{{tip|GPT for everybody, see [[Talk:Undead_USB_Install]] for a uEFI forward compatible install}}
+
This is an install strategy to target a USB flash stick as / instead of a traditional hard drive or internal solid state drive.  this isn't a live cd, this is a persistent root funtoo install that changes will keep living on.  Since were treating a USB stick as a root partition, it requires much more space than a live usb like area31.  32gb minimum for gnome, 16gb are ok for xfce, lxde, lxqt, & server only type builds.  get a fast usb3 drive even if you don't have usb3 ports as the flash memory on them is much faster than the flash memory on usb2 keys which will improve usability.
This is an install strategy to target a USB flash stick as / instead of a traditional hard drive or internal solid state drive.  this isn't a live cd, this is a persistent root funtoo install that changes will keep living on.
 
  
In this run i will use a 64gb 100 mb/s sandisk, 32gb minimum for gnome, 16gb are ok for xfce lxde lxqt type builds.  get a fast usb3 drive even if you dont have usb3 ports as the flash memory on them is much faster than the flash memory on usb2 keys which will improve usability.
+
*List the device to be partitioned, mine is on /dev/sdc
 +
{{console|body=
 +
###i## lsblk -o name,size,label,partlabel
 +
}}
 +
 
 +
==Partition==
 +
{{console|body=
 +
###i## cgdisk /dev/sdc}}
 +
 
 +
delete everything.
 +
 
 +
{{console|body=
 +
Command: ##i## new ↵
 +
First sector: ##i##↵
 +
Last sector: ##i##+1M ↵
 +
Hex Code: ##i##EF02 ↵
 +
Enter name: ##i##BIOS Boot ↵
 +
}}
 +
 
 +
scroll down to large chunk of free space:
 +
{{console|body=
 +
Command: ##i##new ↵
 +
First sector: ##i##↵
 +
Last sector: ##i##+128M ↵
 +
Hex Code: ##i##EF00 ↵
 +
Enter name: ##i##BOOT ↵
 +
}}
  
{{tip|this section is for mbr partitioning with gparted, use uefi with bios boot partition for legacy support}}
+
scroll down to large chunk of free space:
I'm using gparted on xubuntu (any running linux system with gparted should be able to follow this guide) to delete the flash key fat32 partition and create a single jfs / partition labeled as FUNTOO, and mount it to /mnt/funtoo.  USE JFS, IT'S FAST!!!  ext is a turtle, and it's fsck is slow, XFS is fast but doesn't have mature fscking, JFS has a mature fsck, and it's fast.
+
{{console|body=
 +
Command: ##i##new ↵
 +
First sector: ##i##↵
 +
Last sector: ##i##↵
 +
Hex Code: ##i## 8304 ↵
 +
Enter name: ##i##FUNTOO ↵
 +
}}
 +
 
 +
{{console|body=
 +
 
 +
                              Disk Drive: /dev/sdc
 +
                            Size: 62333952, 29.7 GiB
 +
 
 +
Part. #    Size        Partition Type            Partition Name
 +
----------------------------------------------------------------
 +
            1007.0 KiB  free space
 +
  1        1024.0 KiB  BIOS boot partition   BIOS Boot
 +
  2        256.0 MiB  EFI System                BOOT
 +
  3        29.5 GiB    Linux x86-64 root (/)    FUNTOO
 +
}}
 +
 
 +
{{console|body=
 +
Command: ##i##write ↵
 +
Command: ##i##quit ↵
 +
}}
 +
 
 +
{{console|body=
 +
###i## mkfs.vfat -F 32 /dev/sdc2
 +
###i## fatlabel /dev/sdc2 "BOOT"
 +
}}
 +
 
 +
{{console|body=
 +
###i## mkfs.jfs /dev/sdc3
 +
###i## jfs_tune -L "FUNTOO" /dev/sdc3
 +
}}
  
we want our USB to be targeting generic hardware so we can have our root funtoo compatible with most modern hardware.  prefer nouveau drivers over nvidia because KMS loads intel and possibly other video card systems.
+
==Mount==
 +
{{console|body=
 +
###i## mount /dev/sdc3 /mnt/funtoo
 +
###i## mkdir /mnt/funtoo/boot
 +
###i## mount /dev/sdc2 /mnt/funtoo/boot
 +
}}
  
you can also pull your [[Subarches]] gnome tarball if you're installing to specific hardware.
+
==Get Funtoo==
 +
You can pull your [[Subarches]] gnome tarball if you're installing to specific hardware, not moving the disk between systems, or installing to a SSD/nvme.  Use generic 64 so your USB os can roam on strange hardware.
  
 
{{console|body=
 
{{console|body=
 
###i## cd /mnt/funtoo
 
###i## cd /mnt/funtoo
 
###i## wget https://build.funtoo.org/1.4-release-std/x86-64bit/generic_64/gnome-latest.tar.xz
 
###i## wget https://build.funtoo.org/1.4-release-std/x86-64bit/generic_64/gnome-latest.tar.xz
###i## tar --numeric-owner -xpf *gnome* && rm -f *gnome*
+
###i## tar --numeric-owner --xattrs --xattrs-include='*' -xpf *gnome* && rm -f *gnome*
 
}}
 
}}
 +
 +
==Load Funtoo==
 +
*expand your run tmpfs to be half of your ram:
 
{{console|body=
 
{{console|body=
 
###i## mount -t tmpfs tmpfs /run
 
###i## mount -t tmpfs tmpfs /run
 
}}
 
}}
 +
 +
*mount up:
 
{{console|body=
 
{{console|body=
 
###i## cd /mnt/funtoo && mount -t proc none proc
 
###i## cd /mnt/funtoo && mount -t proc none proc
Line 27: Line 97:
 
}}
 
}}
  
were using googles name server simply because its universal, and anyone can access it anywhere. 
+
*chroot in:
 
 
 
{{console|body=
 
{{console|body=
 
###i## cd /mnt/funtoo && env -i HOME=/root TERM=$TERM chroot . bash -l
 
###i## cd /mnt/funtoo && env -i HOME=/root TERM=$TERM chroot . bash -l
###i## echo "nameserver 8.8.8.8" > /etc/resolv.conf && passwd
+
}}
###i## mv /etc/fstab /etc/fstab.backup}}
 
  
If you're using gpt partitioning run this block:
+
*Set yo password:
 +
*set cloudflare dns resolution for installing:
 +
*Set yo time zone:
 
{{console|body=
 
{{console|body=
###i## echo "LABEL=BOOT /boot vfat noauto,noatime 1 2" >> /etc/fstab
+
###i## passwd
 +
###i## echo "nameserver 1.1.1.1" > /etc/resolv.conf
 +
###i## ln -sf /usr/share/zoneinfo/America/Detroit /etc/localtime
 
}}
 
}}
  
were disabling swap because we didn't partition for it, and switching the compile directory to ram instead of on disk.  im compiling on 16gb of ram but 8 should be sufficient, possibly even 4gb or less if you avoid large packages.  Were setting the host name, and merging a handful of packages.
+
*Deploy your fstab:
 +
{{console|body=
 +
###i## cat > /etc/fstab << "EOF"
 +
LABEL=BOOT /boot vfat noauto,noatime 1 2
 +
LABEL=FUNTOO / jfs noatime 0 1
 +
tmpfs /run tmpfs rw,nodev,nosuid 0 0
 +
EOF
 +
}}
  
 +
*compile in ram:
 
{{console|body=
 
{{console|body=
###i## echo 'PORTAGE_TMPDIR="/run"' > /etc/portage/make.conf && rc-update del swap boot
+
###i## echo 'PORTAGE_TMPDIR="/run"' > /etc/portage/make.conf
 
}}
 
}}
 +
 +
*set the host name:
 +
*merge stuff:
 
{{console|body=
 
{{console|body=
###i## echo "LABEL=FUNTOO / jfs noatime 0 1" >> /etc/fstab
 
###i## echo "tmpfs /run tmpfs rw,nodev,nosuid 0 0" >> /etc/fstab
 
 
###i## echo 'hostname="undead"' > /etc/conf.d/hostname
 
###i## echo 'hostname="undead"' > /etc/conf.d/hostname
###i## ego sync && emerge jfsutils grub haveged linux-firmware discord-bin firefox-bin media-fonts/noto eix}}
+
###i## echo "sys-kernel/linux-firmware initramfs" >> /etc/portage/package.use
 +
###i## ego sync && emerge jfsutils grub haveged intel-microcode linux-firmware eix discord-bin firefox-bin media-fonts/noto}}
  
you can also install [[Package:Brave]]
+
you can also install [[Package:Brave]] or other browsers.
  
funtoo's official chat:
+
*funtoo's official chat:
 
https://discord.gg/BNUSpUU
 
https://discord.gg/BNUSpUU
  
Install grub in legacy mode.
+
*Set your startup services:
 
{{console|body=
 
{{console|body=
###i## grub-install --target=i386-pc --no-floppy /dev/sdc
+
###i## rc-update del swap boot && rc-update add haveged && rc-update add gpm && rc-update add busybox-ntpd
###i## ego boot update && rc-update add haveged && rc-update add gpm}}
+
}}
  
If you're installing with GPT you can insert grub EFI entries now.
+
==Bootloader==
 +
*Install grub in legacy mode:
 +
{{console|body=
 +
###i## grub-install --target=i386-pc /dev/sdc
 +
###i## ego boot update}}
  
 +
*manually make efi directory:
 +
*remount /dev/sdc2 to /boot/efi:
 +
*install efi images:
 
{{console|body=
 
{{console|body=
 
###i## mkdir /boot/efi
 
###i## mkdir /boot/efi
Line 68: Line 157:
 
}}
 
}}
  
this produces a hybrid GPT install, it will boot on legacy computers, and uefi computers when secure boot is disabled in bios.
+
this produces a hybrid GPT boot that will boot on legacy computers, and uefi computers when secure boot is disabled in bios.
 +
 
 +
Now is a good time to install [[Package:Fchroot]] so you can install to raspberry pi's from your undead media when you reboot into it.
  
 
final install size is around 14,500MB gnome can fit in a 16gb usb stick, but it's a tight squeeze and unix file systems degrade in performance at around 80%-90% full.  32gb keys are good, 64gb are excellent, 128gb keys can emerge the world.
 
final install size is around 14,500MB gnome can fit in a 16gb usb stick, but it's a tight squeeze and unix file systems degrade in performance at around 80%-90% full.  32gb keys are good, 64gb are excellent, 128gb keys can emerge the world.
Line 79: Line 170:
 
==DONE!==
 
==DONE!==
 
If you used a generic stage3 now would be a good time to merge in a DE: [[Install/Stage3_Desktop]]
 
If you used a generic stage3 now would be a good time to merge in a DE: [[Install/Stage3_Desktop]]
 +
 +
===clean dismount===
 +
{{console|body=
 +
###i## exit
 +
###i## cd .. && sync
 +
###i## umount -lR funtoo
 +
}}
  
 
When you boot into your new system use nmtui to setup networking:
 
When you boot into your new system use nmtui to setup networking:
Line 99: Line 197:
 
{{console|body=
 
{{console|body=
 
###i## pkill pulseaudio
 
###i## pkill pulseaudio
}}
 
 
to fix the clock to eastern standard time:
 
{{console|body=
 
###i## ln -sf /usr/share/zoneinfo/America/Detroit /etc/localtime
 
 
}}
 
}}
  
Line 159: Line 252:
 
EndSection
 
EndSection
 
EOF
 
EOF
}}
 
 
{{file|name=/etc/X11/xorg.conf.d/10-monitor.conf|desc=Disable DPMS blanking|body=
 
Section "Extensions"
 
    Option      "DPMS" "Disable"
 
EndSection
 
 
}}
 
}}
  

Latest revision as of 19:05, November 26, 2020

A linux nomadbsd alternative

This is an install strategy to target a USB flash stick as / instead of a traditional hard drive or internal solid state drive. this isn't a live cd, this is a persistent root funtoo install that changes will keep living on. Since were treating a USB stick as a root partition, it requires much more space than a live usb like area31. 32gb minimum for gnome, 16gb are ok for xfce, lxde, lxqt, & server only type builds. get a fast usb3 drive even if you don't have usb3 ports as the flash memory on them is much faster than the flash memory on usb2 keys which will improve usability.

  • List the device to be partitioned, mine is on /dev/sdc
root # lsblk -o name,size,label,partlabel

Partition

root # cgdisk /dev/sdc

delete everything.

Command:  new ↵
First sector: 
Last sector: +1M ↵
Hex Code: EF02 ↵
Enter name: BIOS Boot ↵

scroll down to large chunk of free space:

Command: new ↵
First sector: 
Last sector: +128M ↵
Hex Code: EF00 ↵
Enter name: BOOT ↵

scroll down to large chunk of free space:

Command: new ↵
First sector: 
Last sector: 
Hex Code:  8304 ↵
Enter name: FUNTOO ↵
Disk Drive: /dev/sdc
                            Size: 62333952, 29.7 GiB

Part. #     Size        Partition Type            Partition Name
----------------------------------------------------------------
            1007.0 KiB  free space
   1        1024.0 KiB  BIOS boot partition	  BIOS Boot
   2        256.0 MiB   EFI System                BOOT
   3        29.5 GiB    Linux x86-64 root (/)     FUNTOO
Command: write ↵
Command: quit ↵
root # mkfs.vfat -F 32 /dev/sdc2
root # fatlabel /dev/sdc2 "BOOT"
root # mkfs.jfs /dev/sdc3
root # jfs_tune -L "FUNTOO" /dev/sdc3

Mount

root # mount /dev/sdc3 /mnt/funtoo
root # mkdir /mnt/funtoo/boot
root # mount /dev/sdc2 /mnt/funtoo/boot

Get Funtoo

You can pull your Subarches gnome tarball if you're installing to specific hardware, not moving the disk between systems, or installing to a SSD/nvme. Use generic 64 so your USB os can roam on strange hardware.

root # cd /mnt/funtoo
root # wget https://build.funtoo.org/1.4-release-std/x86-64bit/generic_64/gnome-latest.tar.xz
root # tar --numeric-owner --xattrs --xattrs-include='*' -xpf *gnome* && rm -f *gnome*

Load Funtoo

  • expand your run tmpfs to be half of your ram:
root # mount -t tmpfs tmpfs /run
  • mount up:
root # cd /mnt/funtoo && mount -t proc none proc
mount --rbind /sys sys
mount --rbind /dev dev
mount --rbind /run run
  • chroot in:
root # cd /mnt/funtoo && env -i HOME=/root TERM=$TERM chroot . bash -l
  • Set yo password:
  • set cloudflare dns resolution for installing:
  • Set yo time zone:
root # passwd
root # echo "nameserver 1.1.1.1" > /etc/resolv.conf
root # ln -sf /usr/share/zoneinfo/America/Detroit /etc/localtime
  • Deploy your fstab:
root # cat > /etc/fstab << "EOF"
LABEL=BOOT /boot vfat noauto,noatime 1 2
LABEL=FUNTOO / jfs noatime 0 1
tmpfs /run tmpfs rw,nodev,nosuid 0 0
EOF
  • compile in ram:
root # echo 'PORTAGE_TMPDIR="/run"' > /etc/portage/make.conf
  • set the host name:
  • merge stuff:
root # echo 'hostname="undead"' > /etc/conf.d/hostname
root # echo "sys-kernel/linux-firmware initramfs" >> /etc/portage/package.use
root # ego sync && emerge jfsutils grub haveged intel-microcode linux-firmware eix discord-bin firefox-bin media-fonts/noto

you can also install Package:Brave or other browsers.

  • funtoo's official chat:

https://discord.gg/BNUSpUU

  • Set your startup services:
root # rc-update del swap boot && rc-update add haveged && rc-update add gpm && rc-update add busybox-ntpd

Bootloader

  • Install grub in legacy mode:
root # grub-install --target=i386-pc /dev/sdc 
root # ego boot update
  • manually make efi directory:
  • remount /dev/sdc2 to /boot/efi:
  • install efi images:
root # mkdir /boot/efi
root # mount /dev/sdc2 /boot/efi
root # grub-install --target=x86_64-efi /boot/efi

this produces a hybrid GPT boot that will boot on legacy computers, and uefi computers when secure boot is disabled in bios.

Now is a good time to install Package:Fchroot so you can install to raspberry pi's from your undead media when you reboot into it.

final install size is around 14,500MB gnome can fit in a 16gb usb stick, but it's a tight squeeze and unix file systems degrade in performance at around 80%-90% full. 32gb keys are good, 64gb are excellent, 128gb keys can emerge the world.

rebuild the kernel video drivers modules.

root # emerge -1 x11-drivers/nvidia-kernel-modules

DONE!

If you used a generic stage3 now would be a good time to merge in a DE: Install/Stage3_Desktop

clean dismount

root # exit
root # cd .. && sync 
root # umount -lR funtoo

When you boot into your new system use nmtui to setup networking:

root # nmtui

to not run nvidia:

root # ego profile mix-in gfxcard-nouveau
root # ego profile mix-in -gfxcard-nvidia

remove the nouveau blacklist so it grabs the screen.

root # rm /etc/modprobe.d/nouveau*
root # rm /etc/modprobe.d/nvidia*

If you're having problems with nouveau not playing sound over HDMI restart pulse audio:

root # pkill pulseaudio

The magic words to update:

root # emerge -avuND @world 
root # emerge -av --depclean
root # ego boot update

every so often you will want to purge sources to keep the stick as low memory usage as possible

root # rm /var/cache/portage/distfiles/*.tar.bz2
root # rm /var/cache/portage/distfiles/*.tar.xz
root # rm /var/cache/portage/distfiles/*.tar.gz

further securing

i use Package:Sudo, and disable root login.

i use Package:Dnsmasq to block advertising, and cache DNS traffic to accelerate web browsing.

i use Package:Dnscrypt to encrypt all dns requests so the vast majority of the web traffic from my undead usb is encrypted.

Admining

use Package:Eix to browse portage to see packages you can emerge.

use Package:Eselect to set various system options.

Branding

root # echo "www.funtoo.org" > /etc/motd

add fortunes piped through cowsay to the shells

root # emerge fortune-mod cowsay
root # cd && echo "fortune | cowsay" >> .bashrc

Disable DPMS

dpms disrespects screen blanking settings, so you can't watch movies in VLC without the screen turning off.

root # xset s off -dpms
root # cat > /etc/X11/xorg.conf.d/10-monitor.conf << "EOF"
Section "Extensions"
    Option      "DPMS" "Disable"
EndSection
EOF

Alternate Drives

   Warning

avoid adding fstab entries for drives that will not be present on other computers. JFS will mount read only if fsck fails!

I have a jfs home drive labeled HOME. This is the fstab entry to have funtoo use my rotating hard drive as /home

root # echo "LABEL=HOME /home jfs noatime 0 2" >> /etc/fstab

Swapping by file

For a swap file on $HOME:

root # dd if=/dev/zero of=/home/swapfile bs=1M count=4096 status=progress
chmod 600 /home/swapfile
mkswap /home/swapfile
swapon /home/swapfile
echo "/home/swapfile none swap defaults 0 0" >> /etc/fstab
rc-update add swap boot
echo 'rc_need="localmount"' >> /etc/conf.d/swap

For a swap file on $VAR:

root # dd if=/dev/zero of=/var/swapfile bs=1M count=4096 status=progress
chmod 600 /var/swapfile
mkswap /var/swapfile
swapon /var/swapfile
echo "/var/swapfile none swap defaults 0 0" >> /etc/fstab
rc-update add swap boot
echo 'rc_need="localmount"' >> /etc/conf.d/swap

windows 10 utc

if you're running ntp on undead usb you will want to set any dual booting windows clocks to be universal. in an administrator run command prompt run this:

reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation" /v RealTimeIsUniversal /d 1 /t REG_QWORD /f

Remote Help

Package:Logmein-hamachi is a easy to setup VPN allowing friends easy access to SSH should you run into trouble.

Install Video

coming soon.