Re: [gentoo-user] Is a USB-key-to-hard-drive-tap-dance-boot possible?
> I think fdisk couldn't handle GPT at first. I guess that's why gdisk > came along. Then I think the fdisk folks added support for GPT and > since then it handles both. That's my understanding of it. If > possible, you may want to check the time stamps on the info you have > found. I suspect the ones saying fdisk can't handle GPT are older posts > or people who don't know it can now. From the man page: > fdisk is a dialog-driven program for creation and manipulation of > partition tables. It understands GPT, MBR, Sun, SGI and BSD partition > tables. > For gdisk: > GPT fdisk (aka gdisk) is a text-mode menu-driven program for creation > and manipulation of partition tables. It will automatically convert an > old-style Master Boot Record (MBR) partition table or BSD disklabel > stored without an MBR carrier partition to the newer Globally > Unique Identifier (GUID) Partition Table (GPT) format, or will load a > GUID partition table. > Odds are, you can likely use either tool but if you are using GPT, you > may as well use the tool made for that purpose. I think a lot of it is > very similar as far as options that do the same things in each program. > Also, there is also cfdisk and cgdisk too. The interface is different. > You may want to try the proper one and see which you like. I use c*disk > tools myself. You may prefer the others. Same result I guess. > Hope that helps. > Dale I remember from when nobody ever heard of GPT, fdisk was used to partition a hard drive, long before the days of GPT or USB. Then Rod Smith developed a gdisk to partition a drive using GPT; could even be used on a USB hard drive or USB stick. Linux fdisk was much easier to use than FreeBSD or NetBSD versions of fdisk. I don't know how newer versions of Linux fdisk would do with traditional BSD disklabels, which are not compatible between the various BSDs. But now FreeBSD and NetBSD can run on GPT with no traditional BSD disklabel. I am not familiar with Sun or SGI partition tables. Tom
Re: [gentoo-user] UEFI install noob questions
On Sat, Dec 26, 2020 at 02:21:51PM -0700, Dan Egli wrote > /boot is part of /: > /dev/sda1 /boot/EFI vfatdefaults,noatime 1 2 > /dev/sda3 / xfs defaults,noatime 1 1 > /dev/sda2 noneswapdefaults 0 0 I've got an empty /boot/EFI directory on the root system (/dev/sda2), and a 256 megabyte vfat-formatted partition as /dev/sda1. Here's my take on /etc/fstab... (chroot) livecd ~ # cat /etc/fstab /dev/cdrom/mnt/cdrom auto noauto,users,noatime,async,ro 0 0 /dev/sda1 /boot/EFI vfat defaults,noatime1 2 /dev/sda2 / ext3 noatime,nodiratime,async,user_xattr 0 1 /dev/sda3 noneswap sw 0 0 /dev/sdb /mnt/drive0 auto noauto,users,noatime,async 0 0 /dev/sdb1 /mnt/drive1 auto noauto,users,noatime,async 0 0 /dev/sdc1 /mnt/drive2 auto noauto,users,noatime,async 0 0 /dev/sdd1 /mnt/drive3 auto noauto,users,noatime,async 0 0 I've got two scripts in /usr/src that I run from /usr/src/linux. The script "makeover" is run just after "make menuconfig" and includes (amongst other things) make && \ make modules_install && \ cp arch/x86_64/boot/bzImage /boot/kernel.experimental && \ cp System.map /boot/System.map.experimental && \ cp .config /boot/config.experimental && \ lilo ...and the script "promote" includes... cp /boot/System.map.experimental /boot/System.map.production cp /boot/config.experimental /boot/config.production cp /boot/kernel.experimental /boot/kernel.production lilo Obviously won't need the "lilo" command. Replace all references to "/boot" with "/boot/EFI" and the kernels go to /boot/EFI which leaves just the question of how to set up grub. I'd like a text-based menu that defaults to the production kernel if no keypress after 15 seconds. Question: does grub have to be re-run or otherwise re-initialised when I overwrite a kernel with a newer one of the same name? -- Walter Dnes I don't run "desktop environments"; I run useful applications
Re: [gentoo-user] Re: Is a USB-key-to-hard-drive-tap-dance-boot possible?
antlists wrote: > On 25/12/2020 18:24, Neil Bothwick wrote: >> On Fri, 25 Dec 2020 11:41:03 -0500, Walter Dnes wrote: >> >>> After 20 years on linux, I've been reduced to a newbie. BIOS boot, >>> Lilo, and fdisk served me well for 2 decades. Now I'm going to have to >>> learn UEFI, grub, and parted all at once. I'll start a new thread >>> tomorrow once I have my config files copied off. Then I'll install >>> UEFI >>> mode properly. >> >> UEFI is dead simple, and you can use gdisk, which is the GPT variant of >> fdisk. So that only leave the boot manager to learn, and if you don't >> already know GRUB, I'd say start with something simpler. >> >> > I got the impression that on newer systems, gdisk and fdisk were the > same thing ... > > Certainly I moved to gdisk because "fdisk can't handle GPTs", and then > someone said "oh yes it can" so I investigated and oh yes it could. I > still use gdisk, but as I say they now appear to be the same thing. > > Cheers, > Wol > > I think fdisk couldn't handle GPT at first. I guess that's why gdisk came along. Then I think the fdisk folks added support for GPT and since then it handles both. That's my understanding of it. If possible, you may want to check the time stamps on the info you have found. I suspect the ones saying fdisk can't handle GPT are older posts or people who don't know it can now. From the man page: fdisk is a dialog-driven program for creation and manipulation of partition tables. It understands GPT, MBR, Sun, SGI and BSD partition tables. For gdisk: GPT fdisk (aka gdisk) is a text-mode menu-driven program for creation and manipulation of partition tables. It will automatically convert an old-style Master Boot Record (MBR) partition table or BSD disklabel stored without an MBR carrier partition to the newer Globally Unique Identifier (GUID) Partition Table (GPT) format, or will load a GUID partition table. Odds are, you can likely use either tool but if you are using GPT, you may as well use the tool made for that purpose. I think a lot of it is very similar as far as options that do the same things in each program. Also, there is also cfdisk and cgdisk too. The interface is different. You may want to try the proper one and see which you like. I use c*disk tools myself. You may prefer the others. Same result I guess. Hope that helps. Dale :-) :-)
Re: [gentoo-user] UEFI install noob questions
On Sat, Dec 26, 2020 at 04:49:16PM -0800, cal wrote > > After partitioning (in parted), did you use `mkfs.vfat -F 32 > /dev/` to initialize the FAT32 filesystem on that > partition? > > https://wiki.gentoo.org/wiki/Handbook:Parts/Installation/Disks#Applying_a_filesystem_to_a_partition > > `parted` is only editing the partition table, not the filesystems > applied to those partitions. I did "mkfs.vfat /dev/sda1" afterwards and parted showed... Number Start End SizeFile system Name Flags 1 1049kB 269MB 268MB fat16EFI boot, esp I had never used the "-F" option before. Anyways, I tried "mkfs.vfat -F 32 /dev/sda1" and parted shows... Number Start End SizeFile system Name Flags 1 1049kB 269MB 268MB fat32EFI boot, esp. So far so good; it was more a scare than a real problem. Thanks for that hint about "-F". -- Walter Dnes I don't run "desktop environments"; I run useful applications
Re: [gentoo-user] Re: Is a USB-key-to-hard-drive-tap-dance-boot possible?
On 25/12/2020 18:24, Neil Bothwick wrote: On Fri, 25 Dec 2020 11:41:03 -0500, Walter Dnes wrote: After 20 years on linux, I've been reduced to a newbie. BIOS boot, Lilo, and fdisk served me well for 2 decades. Now I'm going to have to learn UEFI, grub, and parted all at once. I'll start a new thread tomorrow once I have my config files copied off. Then I'll install UEFI mode properly. UEFI is dead simple, and you can use gdisk, which is the GPT variant of fdisk. So that only leave the boot manager to learn, and if you don't already know GRUB, I'd say start with something simpler. I got the impression that on newer systems, gdisk and fdisk were the same thing ... Certainly I moved to gdisk because "fdisk can't handle GPTs", and then someone said "oh yes it can" so I investigated and oh yes it could. I still use gdisk, but as I say they now appear to be the same thing. Cheers, Wol
Re: [gentoo-user] UEFI install noob questions
On 12/26/20 4:39 PM, Walter Dnes wrote: > On Sat, Dec 26, 2020 at 06:35:05PM -0500, Walter Dnes wrote >> On Sat, Dec 26, 2020 at 02:21:51PM -0700, Dan Egli wrote >> >>Thanks. I've managed to figure out parted... >> >> Number StartEnd SizeFile system Name Flags >> 1 1.00MiB 257MiB 256MiB fat32EFI boot, esp > >OK, now what? I closed parted, came back later and I see that the > filesystem type has changed from fat32 to ext3. How do I over-ride > this? > > Number Start EndSizeFile system Name Flags > 1 1.00MiB 257MiB 256MiB ext3 EFI boot, esp > After partitioning (in parted), did you use `mkfs.vfat -F 32 /dev/` to initialize the FAT32 filesystem on that partition? https://wiki.gentoo.org/wiki/Handbook:Parts/Installation/Disks#Applying_a_filesystem_to_a_partition `parted` is only editing the partition table, not the filesystems applied to those partitions. Cal
Re: [gentoo-user] UEFI install noob questions
On Sat, Dec 26, 2020 at 06:35:05PM -0500, Walter Dnes wrote > On Sat, Dec 26, 2020 at 02:21:51PM -0700, Dan Egli wrote > > Thanks. I've managed to figure out parted... > > Number StartEnd SizeFile system Name Flags > 1 1.00MiB 257MiB 256MiB fat32EFI boot, esp OK, now what? I closed parted, came back later and I see that the filesystem type has changed from fat32 to ext3. How do I over-ride this? Number Start EndSizeFile system Name Flags 1 1.00MiB 257MiB 256MiB ext3 EFI boot, esp -- Walter Dnes I don't run "desktop environments"; I run useful applications
Re: [gentoo-user] UEFI install noob questions
On Sat, Dec 26, 2020 at 02:21:51PM -0700, Dan Egli wrote Thanks. I've managed to figure out parted... Number StartEnd SizeFile system Name Flags 1 1.00MiB 257MiB 256MiB fat32EFI boot, esp I've salvaged the config files from my failed install, so that part should be quick. Expect a break in the questions until I get to grub+fstab. -- Walter Dnes I don't run "desktop environments"; I run useful applications
Re: [gentoo-user] \ \ \ 2021 / / /
‐‐‐ Original Message ‐‐‐ On Friday, December 25, 2020 4:32 PM, Neil Bothwick wrote: > On Fri, 25 Dec 2020 15:07:59 +, caveman رجل الكهف wrote: > > > hi. i just want to help a bit by sharing a > > thought that i think is useful to the civilisation > > of life forms in general: > > > > - new year celebrations are wasteful in > > several ways (e.g. waste on needless > > purchases [aka gifts], useless fireworks, > > useless trees with socks on them, etc). > > > > - the vacation is nice to allow potential good > > use of it. but even this is usually abused > > by most people as they end up just wasting > > it alongside their money for purely doing > > silly things such as purposeless tourism. > > > > Dear Ebenezer, > > Some of us would welcome the opportunity to waste time with their > families over Christmas and the New Year, instead of having to spend it > isolating at home following a positive COVID-19 test. > > Don't underestimate the therapeutic value of doing nothing with the people > that are important to you. i'm not against that. in fact, this goes in the list of the productive things. remember, i said "not limited to"? i literally stated that my list of productive things is not exhaustive. spending time with family is productive, since it's an opportunity to inspect the situation of family members to help them become even better people. this happens implicitly even though dad/mom doesn't say "hey kids time for annual performance inspection!". it's part of us which we inherited from evolution that actually helps maximise our survival. there is a reason why we've evolved to like it. but, worthy to note, not everything we like is good. e.g. there are bugs in evolution. e.g. some people enjoy drugs up to a point they become addicts. this is not inline with survival maximisation, so we can say this is a vulnerability in evolution that drug dealers try to exploit. rgrds, ebonzer.
Re: [gentoo-user] UEFI install noob questions
Let's see. I have done it two ways, depending on the machine. /boot is a separate partition, and /boot is part of / while /boot/EFI is a separate. I'll post both. /boot is EFI partition: /dev/cdrom /mnt/cdrom auto noauto,ro 0 0 /dev/sda1 /boot vfat defaults 1 2 /dev/sda2 / xfs defaults,noatime 1 1 /boot is part of /: /dev/sda1 /boot/EFI vfat defaults,noatime 1 2 /dev/sda3 / xfs defaults,noatime 1 1 /dev/sda2 none swap defaults 0 0 As for parted, I still use fdisk myself. I know the way I created each was simple enough. fdisk> g fdisk> n 1 +128M t 1 The way this works is the g command creates a new gpt table, destroying any other partition table, then your usual N for new, 1 for partition 1, enter to start at the first available point, and +128M to select a 128 MB partition. If you're looking for the prompt for primary vs extended vs logical, those don't exist in gpt tables. EVERYTHING is primary. The t 1 changes the partition type to EFI System Partition. It's technically not needed as I neglected to do it to one of my virtual machines. But it's not a bad idea. Now format as fat32: mkfs.vfat -F32 /dev/sda1 Still, here's parted output for the /boot is ESP (EFI System Partition): (parted) print Model: ATA VBOX HARDDISK (scsi) Disk /dev/sda: 68.7GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 1049kB 135MB 134MB fat32 boot, esp 2 135MB 68.7GB 68.6GB xfs and here's the output for the one where /boot is one partition and /boot/EFI is a different one (and I didn't change the partition type): (parted) print Model: ATA VBOX HARDDISK (scsi) Disk /dev/sda: 34.4GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 1049kB 68.2MB 67.1MB fat32 2 68.2MB 8658MB 8590MB linux-swap(v1) swap 3 8658MB 34.4GB 25.7GB xfs EFI really isn't THAT complicated once you remember the restrictions. For example, on the first instance, using fdisk, the following is exactly what I did: Command (m for help): g Created a new GPT disklabel (GUID: 448CFABB-EBB6-AF44-8A36-A5679DB2EF76). Command (m for help): n Partition number (1-128, default 1): First sector (2048-134217694, default 2048): Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-134217694, default 134217694): +128M Created a new partition 1 of type 'Linux filesystem' and of size 128 MiB. Command (m for help): n Partition number (2-128, default 2): First sector (264192-134217694, default 264192): Last sector, +/-sectors or +/-size{K,M,G,T,P} (264192-134217694, default 134217694): Created a new partition 2 of type 'Linux filesystem' and of size 63.9 GiB. Command (m for help): t Partition number (1,2, default 2): 1 Partition type (type L to list all types): 1 Changed type of partition 'Linux filesystem' to 'EFI System'. Command (m for help): w # mkfs.vfat /dev/sda1 -F32 #mkfs.xfs /dev/sda2 mount /dev/sda2 /mnt/gentoo mkdir /mnt/gentoo/boot mount /dev/sda1 /mnt/gentoo/boot Then once grub is emerged and the kernel compiled: # grub-install --target=x86_64-efi --efi-directory=/boot # grub-mkconfig -o /boot/grub/grub.cfg That's it, I swear. If you still have questions, you can keep asking the list, or write to me off the list and I'd be happy to help. Your choice. -- Dan Egli From my Test Server
Re: [gentoo-user] UEFI install noob questions
On Sat, 26 Dec 2020 14:37:14 -0500, Walter Dnes wrote: > On Sat, Dec 26, 2020 at 01:28:44AM -0500, Walter Dnes wrote > > This is my first UEFI install, so please pardon the questions. > > More questions about partitioning... > > * I need a sample /etc/fstab listing from someone who boots UEFI. I'm > mostly interested in how the /boot partition is set up. /dev/nvme0n1p1 /boot vfat defaults 1 2 /dev/nvme0n1p2 none swap sw0 0 /dev/nvme0n1p1 / btrfs defaults 0 1 > * I need a screen capture of the output of the "print" command in > "parted" from someone who boots UEFI. Stick with gdisk, it's what you're familiar with: % gdisk -l /dev/nvme0n1 GPT fdisk (gdisk) version 1.0.5 Partition table scan: MBR: protective BSD: not present APM: not present GPT: present Found valid GPT with protective MBR; using GPT. Disk /dev/nvme0n1: 500118192 sectors, 238.5 GiB Model: WDC WDS256G1X0C-00ENX0 Sector size (logical/physical): 512/512 bytes Disk identifier (GUID): 0EB51C66--494C-80F3-9ACB1D95325D Partition table holds up to 128 entries Main partition table begins at sector 2 and ends at sector 33 First usable sector is 34, last usable sector is 500118158 Partitions will be aligned on 2048-sector boundaries Total free space is 2014 sectors (1007.0 KiB) Number Start (sector)End (sector) Size Code Name 12048 2099199 1024.0 MiB EF00 boot 2 209920018876415 8.0 GiB 8200 swap 318876416 458174463 209.5 GiB 8300 main 4 458174464 500118158 20.0 GiB8300 spare Note that I am using partition 1 as both the ESP and /boot. This is a popular approach and keeps things simpler. It needs to be a FAT filesystem on a partition of type EF00 to keep UEFI happy, but Linux doesn't care but any of that as long as it's a readable filesystem. Don't forget to build FAT filesystem support into your kernel. -- Neil Bothwick "Woody, I said TUCK the children in bed!" --Mia Farrow pgp5QgIckaNjy.pgp Description: OpenPGP digital signature
Re: [gentoo-user] UEFI install noob questions
On Sat, Dec 26, 2020 at 01:28:44AM -0500, Walter Dnes wrote > This is my first UEFI install, so please pardon the questions. More questions about partitioning... * I need a sample /etc/fstab listing from someone who boots UEFI. I'm mostly interested in how the /boot partition is set up. * I need a screen capture of the output of the "print" command in "parted" from someone who boots UEFI. -- Walter Dnes I don't run "desktop environments"; I run useful applications
Re: [gentoo-user] Re: Is a USB-key-to-hard-drive-tap-dance-boot possible?
On 12/25/2020 9:41 AM, Walter Dnes wrote: On Thu, Dec 24, 2020 at 03:49:35PM -0700, Dan Egli wrote I see your problem, I think. You don't have your ESP mounted, so grub can't write the EFI files to it. You are likely trying to use grub with grub-install /dev/sda. That won't work for EFI. mkdir /boot/efi mount -t vfat /dev/sda1 /boot/efi grub-install --target=x86_64-efi --efi-directory=/boot/efi grub-mkconfig -o /boot/grub/grub.cfg you MAY need to add --removable to the grub-install line. Some EFI setups prefer that. I have this sinking feeling in my stomach that I need to blow away the install (after scp'ing config files to my desktop) and start over. There is no room for another partition. Apparently, using fdisk (like I did) to partition a GPT system is begging for problems down the road. After 20 years on linux, I've been reduced to a newbie. BIOS boot, Lilo, and fdisk served me well for 2 decades. Now I'm going to have to learn UEFI, grub, and parted all at once. I'll start a new thread tomorrow once I have my config files copied off. Then I'll install UEFI mode properly. One thing you could try is using gparted to shrink the partition ever so slightly. It doesn't need to be big at all. The standard windows EFI partition is 100MB! That's it. It's not a matter of using FDisk, as I did too. It's just a matter of remembering to make the partition. -- Dan Egli From my Test Server
Re: [gentoo-user] UEFI install noob questions
On Saturday, 26 December 2020 06:28:44 GMT Walter Dnes wrote: > This is my first UEFI install, so please pardon the questions. > > 1) Partitioning questions: The standard layout example in > https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation#What_is_the_BI > OS_boot_partition.3F says... > > > The BIOS boot partition is needed when a GPT partition layout is used > > with GRUB2 in BIOS/Legacy mode. It is not required when booting in > > EFI/UEFI mode. > > The standard layout example is... > > Number Start End Size File system Name Flags > 1 1.00MiB3.00MiB 2.00MiB grub bios_grub > 2 3.00MiB131MiB 128MiBboot boot > 3 131MiB 643MiB 512MiBswap > 4 643MiB 20479MiB 19836MiB rootfs > > Given that my machine is incapable of booting in BIOS/Legacy mode, I > assume that the 2-megabyte partition is unnecessary, grub or no grub. Your assumption is correct. This BIOS-GRUB partition is used on GPT partitioned drives to hold the GRUB 2nd Stage files. Since you're not familiar with GRUB it may help to add some background on the GRUB boot manager architecture. It contains two stages, some argue 3 stages if you include /boot/grub/. The Boot Loader code takes up 446 bytes and is stored in the MBR - sector 0 of the disk. This is the 1st Stage. The 2nd Stage contains files and drivers required by GRUB to be able to jump to and read the contents of any filesystems used on the OS /boot partition. On a disk with a conventional DOS partition table, the 2nd stage files would be normally stored in the "MBR gap", the empty space in the sectors following sector 0 and before the OS partitions start. This presents a problem on disks partitioned with a GPT, when installed on a legacy BIOS MoBo. This is because sector 1 of the GPT partitioned disk is used by the GPT partitioning structure to store the partition table. So, the solution for a GPT disk is to use a dedicated partition, the GRUB-BIOS partition, in which the 2nd Stage GRUB files can be stored. On a UEFI MoBo, the Boot Loader code is in the UEFI firmware itself, stored in the EEPROM. This code contains all requisite drivers to be able to scan the disk, identify the ESP partition and pick up any .efi executables in its VFAT filesystem. No other boot loader MBR code is required. 3rd party Boot Managers like GRUB will install their grubx64.efi image in the ESP and this in turn will load any necessary drivers and files to load the GRUB boot menu and any selected OS kernel image thereafter. > Also, given bloat over time, is 128 megabytes still sufficient for the > boot partition today? I plan to keep 2 kernels around at all times, > "Production" and "Experimental". I tend to keep 2 - 3 kernels at a time in the ESP. Along with their corresponding System.map and kernel config files also stored there, 2 kernels currently occupies 26MB. This is on a Gentoo system with no other OS present and no 3rd party boot managers. A laptop, which also has MSWindows OS on it, takes up 54MB of the ESP. I use the UEFI firmware to switch between kernels and live media at boot time. I manage the UEFI menu entries and their order using the efibootmgr application on a CLI, whenever I install a new kernel. If you switch between OSs and live media all the time, then GRUB, rEFInd, et al., would arguably be more convenient. I use 250-500MB for ESP partitions and for my needs this is way more than adequate. If you install 10s of multiple OSs, initramfs, and other applications, then you might need more space. HTH. signature.asc Description: This is a digitally signed message part.
Re: [gentoo-user] UEFI install noob questions
On Saturday, 26 December 2020 06:28:44 GMT Walter Dnes wrote: > This is my first UEFI install, so please pardon the questions. > > 1) Partitioning questions: The standard layout example in > https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation#What_is_the_BI > OS_boot_partition.3F says... > > > The BIOS boot partition is needed when a GPT partition layout is used > > with GRUB2 in BIOS/Legacy mode. It is not required when booting in > > EFI/UEFI mode. > > The standard layout example is... > > Number Start End Size File system Name Flags > 1 1.00MiB3.00MiB 2.00MiB grub bios_grub > 2 3.00MiB131MiB 128MiBboot boot > 3 131MiB 643MiB 512MiBswap > 4 643MiB 20479MiB 19836MiB rootfs > > Given that my machine is incapable of booting in BIOS/Legacy mode, I > assume that the 2-megabyte partition is unnecessary, grub or no grub. Some people say you don't need it, but I found that I did. I suppose it's a quirk of the motherboard or its BIOS. > Also, given bloat over time, is 128 megabytes still sufficient for the > boot partition today? I plan to keep 2 kernels around at all times, > "Production" and "Experimental". Mine's 1GB. It contains the most recenet kernel plus one for a small rescue system; also the most recent one of each that I know to work. -- Regards, Peter.