Re: How to Make Fedora 33 portable usb

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/28/20 5:37 PM, Anil Felipe Duggirala wrote:
Hello.
Ive tried searching for a clear answer to this without avail.
How would I go about creating a usb bootable (portable) installation of Fedora?
I am aware of the Live Fedora 33 Workstation images. But, for example, when boothing from that, your settings (program setting) are not saved.
How can I have a Fedora usb that I can use on different pcs? Where I have additional software installed? And settings? And maybe even a permanent /home storage space?
Thank you.

Hi Anil,

I have one that I take to customer sites, mostly
to diagnose hardware issues and to rescue Windows.

Warning: use at least a 32 GB flash drive and ONLY
use Samsung flash drives or you will be sorry.  The
others can't handle the amount of small file
transfers and will corrupt out on you.

This is how I create it.  Change "todd" to your
user name.  This is for Xfce.

Have fun!

-T

Two files:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dual.Legacy.EUFI.setup.txt

Fedora 30+: how to create a minimal legacy boot on a previously set up EUFI drive:

Note: this requires that you created the first partition as
          1 Meg
          unformatted
          set the partition flag to "bios_grub"
If not, you have to go back and recreate the entire installation

Starting from fresh:

     Requirements:
        Fedora 30+

        Before installing, gparted:
           Wipe the target disk with /dev/zero
          (sets everything to zero for a good dd and gzip backup)
                # dd bs=4096 if=/dev/zero of=/dev/sdx

           create a partition table as GPT

           create a first partition as
               1 Meg
               unformatted
               set the partition flag to "bios_grub"

        Install Fedora 30 from a UEFI machine:
           "/home" was removed at installation and moved into "/"



Background: as of Fedora 30, grub calls entries in /etc/grug.d, so
you have to create a minimal grug.cfg file of your own and you
have to do this for every new kernel you install.

--->>>   PRESUMED !!!   <<<---
      The machine was install and booted from EUFI
      The machine is mounted as /dev/sda


Create a grub2 directory and file structures for legacy to boot off of:
Note: you must have that 1 Meg partition mentioned above

   1) find the device name of your flash drive and substitute it for sdx:

   2) install grub2pc:
         # dnf reinstall grub2-pc
         Note: you might have to remove, then install

   3) install grub on the MBR.  Triple check the USB stick sdx !!!!
        # grub2-install --target=i386-pc /dev/sdx

Note: to repair a corrupted EUFI grub:
Reference: https://docs.fedoraproject.org/en-US/Fedora/22/html/Multiboot_Guide/GRUB-reinstalling.html Boot off a EUFI bios with the Live USB version you used to install with.
        Mount the Dead Stick
Locate the Dead Stick /dev/sdx (usually sda, the live does not have a sd).

        Run the efibootmgr invocation again:
# efibootmgr -c -w -L Fedora -d /dev/sda -p 2 -l \EFI\fedora\shim.efi


You need three pieces of information:

    1) the UUID (not PARTUUID) of the /boot drive
    2) the UUID (not PARTUUID) of the / (root) drive
    3) the vmlinuz and matching initramfs image you will be booting
       off (both are found in /boot)

To get get the UUID of of / and /boot, find their device names
using "df":

Note: sometimes swap and / are reversed

    # df -kPT / /boot
      Filesystem     Type 1024-blocks    Used Available Capacity Mounted on
      /dev/sda5      ext4    58041356 6988764  48074544      13% /
      /dev/sda3      ext4      999320  216612    713896      24% /boot


Then find their UUIDs (not PARTUUID) using "blkid".  Note: "blkid" must be
run as root:

    #  blkid -c /dev/null | grep "sda3\|sda4\|sda5"
/dev/sda3: UUID="c6ce9e85-bf7a-4ee9-a50f-8e965bae26e3" TYPE="ext4" PARTUUID="f7acbc98-51f3-48aa-b7c7-23e0d78f5293" /dev/sda4: UUID="e1161cc5-d591-4d82-bb51-78bc4527b2d9" TYPE="swap" PARTUUID="53350fee-f1cf-4284-a125-d4f1be95d16e" /dev/sda5: UUID="d85c4d68-cd15-4027-af77-4c1e4804b9fd" TYPE="ext4" PARTUUID="6f8f73ac-299b-44bd-8bc0-598a4325835f"


In this instance:
    /boot UUID is c6ce9e85-bf7a-4ee9-a50f-8e965bae26e
    /     UUID is d85c4d68-cd15-4027-af77-4c1e4804b9fd

To find vmlinuz and matching initramfs:

   # ls /boot/vmlinuz*
   /boot/vmlinuz-5.3.8-300.fc31.x86_64

   # ls /boot/initramfs*
   /boot/initramfs-5.3.8-300.fc31.x86_64.img


Create a /boot/grub2/grub.cfg file for booting from a legacy BIOS.

    1) subsitute /boot's UUID in the "search" line  (not PARTUUID)
    2) subsitute /'s (root's) UUID in the "linux" line  (not PARTUUID)
    3) subsitute your vmlinuz in the "vmlinuz" line
    4) subsitute the matching initramfs in the "initrd16" line

~~~~~~~~
set pager=1
terminal_output console
set timeout=5
    menuentry 'Fedora 32 (Thirty Two) Legacy Boot' {
        insmod part_gpt
        insmod ext2
search --no-floppy --fs-uuid --set=root c6ce9e85-bf7a-4ee9-a50f-8e965bae26e3 linux /vmlinuz-5.6.6-300.fc32.x86_64 root=UUID=d85c4d68-cd15-4027-af77-4c1e4804b9fd
        initrd16 /initramfs-5.6.6-300.fc32.x86_64.img
    }

~~~~~~~~

reboot on a legacy system to double check. Qemu-kvm work wonders!


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
usb.Install.Notes.txt

Install Notes:

KAV Rescue Disk:
   Two important files are:
        RegistryEditor   (GUI)
        windowsunlocker  (command line)


To configure Dual Legacy, UEFI boot, see:
           Dual.Legacy.EUFI.setup.txt


Fedora 30+ Bootable USB:


Add-on USB controllers without a POST BIOS ROM will not boot this stick.

If root is assigned a password, it is "password"

Note: the following is the default in Fedora-Live-Workstation-x86_64-22-3.iso,
      but not Fedora-Live-Xfce-x86_64-22-3.iso
After the drive is created, /boot/grub2/grub.cfg, and verify/change the default
"menuentry" line with:
    linux16 ... root=UUID=xxxxxxxxxx
Get the UUID from the "rescue" section or "ls -al /dev/disk/by-uuid"

User "todd" should be set to "user id=500, group=100 (users)";
     500 in /etc/passwd and 100 in /etc/group

          $ grep tony /etc/passwd
          todd:x:500:100:todd:/home/todd:/bin/bash

          $ grep todd /etc/group
          users:x:100:todd
          Note: remove the todd:x entry


Add the following at the end of /etc/sudoers (use "visudo"):
## Allow user=todd to run all commands
todd  ALL=(ALL)       ALL

If no root password is set:
      CUPS without an Admin password:
      /etc/cups/cupsd.conf
      Remard (#) out all the lines with "Require"

AFTER the first successful boot, to force the stick to scan for new hardware
on each boot, edit dracut:
      /usr/lib/dracut/dracut.conf.d/01-dist.conf
      hostonly="no"

      And to keep dracut updates from overwriting the above line into
      /etc/dracut.conf.d/01-custom.conf

/etc/fstab: forces writing to occur immediately on execution of the command by adding
      "sync" after defaults (comma separated).  For example:

UUID=977e3532-f988-483c-b6f6-476ac6e299c0 / ext4 defaults,sync 1 1 UUID=479150af-f3cd-448c-bdad-a0b3c3aac778 /boot ext4 defaults,sync 1 2 UUID=4541ee45-9f7b-45f7-b239-b6e8d43f8a3e swap swap defaults,sync 0 0

Autologin:
     gdm:     gnome
     lightdm: lxde, xfce, MATE-Compiz
     kdmrc:   KDE4

     To double check:
         $ ps ax | grep -i "lightdm\|gdm" | grep -v grep

     GDM (gnome Live installer):
It only auto-logs in on first boot, and it must be a non-root user.

          edit /etc/gdm/custom.conf:
              [daemon]
              AutomaticLoginEnable=true
              AutomaticLogin=whatever_username
              TimedLoginEnable=true
              TimedLogin=whatever_username
              TimedLoginDelay=0

          The autologin doesn't require a reboot to work, just issue the
          following command:
              /etc/init.d/gdm restart

     Lightdm (Xfce Live installer):
           edit /etc/lightdm/lightdm.conf:
            Note: as of FC25, copy lightdm.conf.rpmnew to lightdm.conf
               [SeatDefaults]
               autologin-user=todd
               autologin-user-timeout=0

           FC27:
              [Seat:*]
              autologin-user=todd
              autologin-user-timeout=0


            Set up LightDM, PAM and autologin
               # groupadd autologin
               # gpasswd --add todd autologin
               # reboot

          The autologin doesn't require a reboot to work, just issue the
          following command:
              service lightdm restart
          or  init 3; init 5


The initial DNF installs and updates should not be done from a Virtual Machine:
Note: as of SL 7.2, this is not an issue


Install utilities: Note as of FC23, dnf replaced "localinstall" with "install"
  FC22:
# dnf install xterm firefox midori gdisk ntfsprogs chntpw gsmartcontrol \ kde-runtime krusader libreoffice xscreensaver-base xscreensaver-extras \
     xscreensaver-extras-base xscreensaver-gl-base xscreensaver-gl-extras \
file-roller system-config-printer gparted glibc.i686 gtk2.i686 libSM.i686 \
     libpng12.i686 florence

# dnf install /home/todd/Desktop/USB.Desktop/xdiskusage-1.48.1-15.2.x86_64.rpm


  FC23+ (glibc is now native):
   # dnf install xterm firefox gdisk ntfsprogs chntpw gsmartcontrol \
kde-runtime krusader libreoffice xscreensaver-base xscreensaver-extras \
     xscreensaver-extras-base xscreensaver-gl-base xscreensaver-gl-extras \
file-roller system-config-printer gparted ark florence onboard lm_sensors-libs \
     lm_sensors xsensors dmidecode hivex libhivex.so.0 libQtCore.so.4 \
     libQtGui.so.4 dump xfsdump gpart arp-scan rakudo rakudo-zef leafpad \
     zerofree baobab

   # dnf remove abiword midori
   # mkdir /home/todd/Desktop/USB.Desktop
   # cd /home/todd/Desktop/USB.Desktop
   # mkdir /mnt/MyCDs
   # mount -t cifs //192.168.255.10/CDs /mnt/MyCDs
   # cp -R /mnt/MyCDs/Keepers/Linux/USB.Desktop/* .
   # chown -R todd.users /home/todd/Desktop
# dnf install xdiskusage-1.48.1-15.2.x86_64.rpm fred-0.1.1-1.fc25.x86_64.rpm
   # ./AutoScan-Network-1.12.bin
   # dnf --enablerepo=updates-testing upgrade chntpw

# dnf config-manager --add-repo https://brave-browser-rpm-release.s3.brave.com/x86_64/ # rpm --import https://brave-browser-rpm-release.s3.brave.com/brave-core.asc
   # sudo dnf install brave-browser

   # dnf upgrade
   # dnf clean packages

Screensaver: disable lock and set to bouncing cows (BouncingCow)

Hostname:
   # hostnamectl set-hostname deadstick.rent-a-nerd.local --static

Note: to browse the server's smb shares from Krusader: smb://192.168.255.10/

Kaspersky Registry Editor:
   cp /mnt/MyCDs/Kaspersky/KavRescue.RegistryEditor /home/todd/Desktop/.

Create launcher icons for:
   Terminal pop up:
       xterm
       florence
       onboard

   File (system) pop up:
       leafpad
       xdiskusage (sudo /usr/bin/xdiskusage)
       baobab (called "Disk Usage Analyzer"; sudo baobab)
       gsmartcontrol (sudo)
       krusader
       file-roller (called "Archive Manager")
       libreoffice
       gparted
       gdisk (sudo /usr/sbin/gdisk and "Run in terminal")
       fred  (Forensic [Windows] Registry EDitor)  (/usr/bin/fred)
Kaspersky Registry Editor (/home/todd/Desktop/USB.Desktop/KavRescue.RegistryEditor)

   Internet pop up:
       brave    Add `--password-store=basic` to the run string
       firefox
       AutoScan (sudo /opt/AutoScan/bin/autoscan-network)
       Arp Scan (sudo /usr/sbin/arp-scan --localnet and "Run in terminal")
       minicom (sudo /usr/bin/minicom and "Run in terminal")

Last things:
  Shutdown

  ; Make a backup of "home" and "opt" from the server
  ; Mount UsbBoot and UsbRoot
  ;
  ;  change the date!
  ;  # cd /run/media/todd/UsbBoot
  ;  # tar czvf /home/CDs/DeadStick.FC24.usbboot.DATE.tar.gz .
  ;
  ;  # cd /run/media/todd/UsbRoot
  ;  # tar czvf /home/CDs/DeadStick.FC24.home.opt.DATE.tar.gz home opt

  Note: at 64 GB, the stick is now too big to do this.
        Workaround: use Samsung flash drives, they do not corrupt

     And the whole stick:  sdc may not be the drive letter.
        change the DATE!
        # cd /home/CDs/ISOs
        # dd bs=4096 if=/dev/sdb of=Dead.Stick.FC28.DATE.dd


Backup:

   1) shutdown: zero out unused space

         Figure out which partitions / and /boot are located on.  Gparted
         works well for this..l Usually they are /dev/sdb3 and /dev/sdb5:

         partitions must not be mounted

         # zerofree -v  /dev/sd..
         # zerofree -v  /dev/sd..

   2) shutdown: make a dd (gzip mangles the structure)

         Find the device name (/dev/sdx)

         Note: if the "dd" crashes on a USB3 port, try a USB2 port
               status=progress cuts your size in half.

               structure is mangled if you gzip

# dd status=progress bs=4096 if=/dev/sdx of=DeadStick.FC31_$(date +%Y-%m-%d).dd

         Note: if USB 2 fails, try using "ddrescue"

         The reverse to restore is:
# dd status=progress bs=4096 if=DeadStick.FC31_2019-09-06.dd of=/dev/sdx



A one liner to peak at the progress:
$ ls -al | p6 'my @x=$*IN.lines; say (@x[3].words[4].Int) / 1000000000 ~ " GB";'
64.1604009 GB


_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux