Skip to main content
Topic: Issue with cfdisk & mkfs (Read 116 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Issue with cfdisk & mkfs

Hi I am new to Artix but really want to move to it. I used Manjaro on this machine before but wanted a fresh install.

I was using these instructions when I got to cfdisk and had a very odd graphical bug:


Looked it up and can't find any information. I didnt delete any partitions and went back into Manjaro to check the sha256sum and it is the same.

I continued on with the installation and ignored the bug, and now I ran into an issue with mkfs once I partitioned and created /dev/sda1 for swap and /dev/sda2 for root/home.

mkswap works, and successfully made /dev/sda1 into swap but when I use mkfs.ext4 for /dev/sda2, it says the following:

"The file /dev/sda2 does not exist and no size was specified."

Does anyone know how to fix this?

Re: Issue with cfdisk & mkfs

Reply #1
Since you said you want a new install, I assume you've taken a backup of your personal files from the 1TB disk, right?

If such is the case and you don't mind wiping the disk, please do the following before running cfdisk:
(make sure /dev/sda is the problematic disk whose partition table you want to fix, this is irreversible!)
Code: [Select]
# dd if=/dev/zero of=/dev/sda bs=100M count=1 status=progress



Once dd has finished in a couple of seconds, run cfdisk and choose the partition label type:
Code: [Select]
┌ Select label type ───┐
│ gpt                  │
│ dos                  │
│ sgi                  │
│ sun                  │
└──────────────────────┘
I usually go with "dos", which I'm more familiar with. From the picture, it seems that your current partition scheme is GPT.

Re: Issue with cfdisk & mkfs

Reply #2
@nous Thank you for your help. Yes, I have everything I want to keep backed up. IIRC it never showed me that prompt (Select label type), I don't know much about partition schemes but I usually select "dos" as well.

I used the dd command you gave and then used cfdisk. I'm only creating the swap and root partition. Following the installation guide I used mkswap again for /dev/sda1 (the swap):
"mkswap: error: /dev/sda1 is mounted; will not make swapspace"

However, when I run "umount /dev/sda1" it says that /dev/sda1 isn't mounted.

I tried to see if the same would happen with the root partition running "mkfs.ext4 -L Root /dev/sda2" and it ran fine. So now it is the opposite (earlier mkswap was working, mkfs.ext4 wasnt)

Re: Issue with cfdisk & mkfs

Reply #3
in order to mount it you need it to be partitioned and with File System on it.  It wasn't mounted.  dd is not used on a mounted partition and mkswap doesn't either.  And you don't mount a swap a partition.

Code: [Select]
/dev/sda2 on / type ext4 (rw,relatime)
none on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
/dev/sda1 on /boot/efi type vfat (rw,noatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
/dev/sdd1 on /home/ruben/mnt_flash type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
/dev/sde1 on /home/ruben/mnt_flash type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)

Code: [Select]
[[email protected] ~]$ sudo fdisk -l  /dev/sda
Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: TOSHIBA DT01ACA1
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: CF8DE4F2-CDCA-4949-A2D0-9FFF8EC9E3FB

Device          Start        End    Sectors   Size Type
/dev/sda1        4097     618497     614401   300M EFI System
/dev/sda2      618498 1881523267 1880904770 896.9G Linux filesystem
/dev/sda3  1881523268 1953520064   71996797  34.3G Linux swap

Partition 1 does not start on physical sector boundary.
Partition 2 does not start on physical sector boundary.
Partition 3 does not start on physical sector boundary.

Re: Issue with cfdisk & mkfs

Reply #4
I used the dd command you gave and then used cfdisk. I'm only creating the swap and root partition. Following the installation guide I used mkswap again for /dev/sda1 (the swap):
"mkswap: error: /dev/sda1 is mounted; will not make swapspace"
However, when I run "umount /dev/sda1" it says that /dev/sda1 isn't mounted.
I tried to see if the same would happen with the root partition running "mkfs.ext4 -L Root /dev/sda2" and it ran fine. So now it is the opposite (earlier mkswap was working, mkfs.ext4 wasnt)
I suppose you're using the our installation ISO. Make sure /dev/sda is really your intended target (e.g. by using fdisk -l or lsblk, some times sda gets assigned to the usb stick of the installation medium, which might be the source of the errors. If that's your case, then your disk is probably /dev/sdb. You can see what's mounted where by issuing 'mount | grep sd' and your active swaps with 'cat /proc/swaps', in case somehow the installer has activated any (deactivate with, e.g., 'swapoff /dev/sda1').
AFAIK, the installation can continue even without a swap partition and you can set it up later within the running system.

Re: Issue with cfdisk & mkfs

Reply #5
I suppose you're using the our installation ISO.

I am. This is the first time I've ever done a real installation from the command line (Ive always wanted to try Arch, but systemd has been a pain for me even on Manjaro), so I apologize for my lack of understanding.

The usb stick is in fact /dev/sdb, I checked. I'm able to do the rest of the installation but now the problem I have is with GRUB or fstab. I follow the instructions (now without the swap partition like you suggested) and I always get stuck once I reach this section.

I install grub and os-prober but once I run "grub-install --recheck /dev/sda/", it says it cannot find the EFI directory. I then passed that to see what would happen. "grub mkconfig" also didn't work because it couldnt find the /boot/grub directory so I had to make it myself.

After that first part of Configure the base system the instructions worked fine, until I got to Post-installation configuration where I exited, unmounted and rebooted. I removed the USB and it says "No Bootable Device".

This is on a UEFI system, so won't I need a seperate partition for booting? If so the instructions do not cover this. 


Re: Issue with cfdisk & mkfs

Reply #6
I totally overlooked this... For EFI systems, a small (300MB) partition must be present, type EFI, FAT32-formatted and mounted on /boot. You're right, the instructions do not cover this setup.

Re: Issue with cfdisk & mkfs

Reply #7
I totally overlooked this... For EFI systems, a small (300MB) partition must be present, type EFI, FAT32-formatted and mounted on /boot. You're right, the instructions do not cover this setup.
Does grub need to be in that partition?

Re: Issue with cfdisk & mkfs

Reply #8
I totally overlooked this... For EFI systems, a small (300MB) partition must be present, type EFI, FAT32-formatted and mounted on /boot. You're right, the instructions do not cover this setup.
does cfdisk produce partitions that complies with the UEFI partition scheme?

Re: Issue with cfdisk & mkfs

Reply #9
Does grub need to be in that partition?


no, but it can be. 

http://www.nylxs.com/docs/journal_2_2015.pdf

Page 20

Quote
27control of the system.  These services include systemclock functions, NVRAMvariables, and systemresetoperations.  This is unlike EFI_BOOT_SERVIES which are only available during the preboot phase. 7In order to accommodate all this complex preboot operating system, UEFI specifies that boot mediummusthave an EFI partition which contains binaries, and bootloader.  This is something that must astute observershave seen on flash drives for a number of years.  In order to allow themto function as bootable devices, theyhave EFI partitions on their front.   These small partitions must be either FAT12, FAT16 or FAT32.  All UEFIcompliant systems must be able to read all of these FAT variations."The file systemsupported by the Extensible Firmware Interface is based on the FAT file system. EFI definesa specific version of FAT that is explicitly documented and testable. Conformance to the EFI specification andits associate reference documents is the only definition of FAT that needs to be implemented to support EFI.To differentiate the EFI file systemfrompure FAT, a new partition file systemtype has been defined." 4As such a EFI partition is a partition defined as such type in a gpart record and which has a valid EFIapproved version of the FAT file systeminstalled within it.UEFI specifies a UEFI Boot Manager.  Since the purpose of all this is to boot an operating system, somethingthe BIOS Specification seems to do so matter of factly, UEFI includes a boot manager with specificationsWITHIN its environment, rather than leaving it to the operating system. Just as BIOS reads extensions that itexpects to find at predefined locations, the UEFI Boot Manager is defined as follows:“The UEFI boot manager is a firmware policy engine that can be configured bymodifying architecturally defined global NVRAMvariables. The boot manager will attempt to loadUEFI drivers and UEFI applications (including UEFI OS boot loaders) in an order defined bythe global NVRAMvariables.”4



Re: Issue with cfdisk & mkfs

Reply #12
Yes. See instructions at our wiki. Also read the Arch wiki entry for GRUB.


that will work but it is absolutely not necessary if there is a UEFI booter in the partition.  If you take a windows preinstalled box with a UEFI shell, you can just point the shell to grub in a partition anywhere.  In fact, that is the easiest means of doing a dual boot on thos systems - but then you might need a crypto key for the new OS, for which SuSE made software for that purpose which is GPLed.

Take a thumb drive and look into the EFI partition and see what is there.

Code: [Select]
[sudo] password for ruben: 
mount: /mnt: WARNING: device write-protected, mounted read-only.
[[email protected] boot]$ ls -al
total 124
dr-xr-xr-x 1 root root   2048 Aug  8  2017 .
dr-xr-xr-x 1 root root   2048 Aug  8  2017 ..
-r--r--r-- 1 root root 122880 Aug  8  2017 bootx64.efi
[[email protected] boot]$ ls -al
total 124
dr-xr-xr-x 1 root root   2048 Aug  8  2017 .
dr-xr-xr-x 1 root root   2048 Aug  8  2017 ..
-r--r--r-- 1 root root 122880 Aug  8  2017 bootx64.efi
[[email protected] boot]$ pwd
/mnt/efi/boot

boot64.efi is not grub

grub is under chroot /boot

[[email protected] mnt]$ find ./ -iname "grub" -print
./boot/grub


That is one of the major points of the whole UEFI sceme is to break from the limitations of the MBR and add the ability to boot from anywhere on a boot medium.



https://www.happyassassin.net/2014/01/25/uefi-boot-how-does-that-actually-work-then/