Merge remote-tracking branch 'origin/issue-1761' into calamares
FIXES #1761
This commit is contained in:
commit
6f16d3db83
@ -434,50 +434,66 @@ PartitionViewStep::onLeave()
|
|||||||
{
|
{
|
||||||
const QString espMountPoint
|
const QString espMountPoint
|
||||||
= Calamares::JobQueue::instance()->globalStorage()->value( "efiSystemPartition" ).toString();
|
= Calamares::JobQueue::instance()->globalStorage()->value( "efiSystemPartition" ).toString();
|
||||||
const QString espFlagName = PartitionTable::flagName(
|
|
||||||
#ifdef WITH_KPMCORE4API
|
#ifdef WITH_KPMCORE4API
|
||||||
PartitionTable::Flag::Boot
|
const auto espFlag = PartitionTable::Flag::Boot;
|
||||||
#else
|
#else
|
||||||
PartitionTable::FlagEsp
|
const auto espFlag = PartitionTable::FlagEsp;
|
||||||
#endif
|
#endif
|
||||||
);
|
|
||||||
Partition* esp = m_core->findPartitionByMountPoint( espMountPoint );
|
Partition* esp = m_core->findPartitionByMountPoint( espMountPoint );
|
||||||
|
|
||||||
QString message;
|
QString message;
|
||||||
QString description;
|
QString description;
|
||||||
if ( !esp || ( esp && !PartUtils::isEfiFilesystemSuitable( esp ) ) )
|
|
||||||
|
Logger::Once o;
|
||||||
|
|
||||||
|
const bool okType = esp && PartUtils::isEfiFilesystemSuitableType( esp );
|
||||||
|
const bool okSize = esp && PartUtils::isEfiFilesystemSuitableSize( esp );
|
||||||
|
const bool okFlag = esp && PartUtils::isEfiBootable( esp );
|
||||||
|
|
||||||
|
if ( !esp )
|
||||||
{
|
{
|
||||||
message = tr( "No EFI system partition configured" );
|
message = tr( "No EFI system partition configured" );
|
||||||
description = tr( "An EFI system partition is necessary to start %1."
|
|
||||||
"<br/><br/>"
|
|
||||||
"To configure an EFI system partition, go back and "
|
|
||||||
"select or create a FAT32 filesystem with the "
|
|
||||||
"<strong>%3</strong> flag enabled and mount point "
|
|
||||||
"<strong>%2</strong>.<br/><br/>"
|
|
||||||
"You can continue without setting up an EFI system "
|
|
||||||
"partition but your system may fail to start." )
|
|
||||||
.arg( branding->shortProductName() )
|
|
||||||
.arg( espMountPoint, espFlagName );
|
|
||||||
}
|
}
|
||||||
else if ( esp && !PartUtils::isEfiBootable( esp ) )
|
else if ( !(okType && okSize && okFlag ) )
|
||||||
{
|
{
|
||||||
message = tr( "EFI system partition flag not set" );
|
message = tr( "EFI system partition configured incorrectly" );
|
||||||
description = tr( "An EFI system partition is necessary to start %1."
|
|
||||||
"<br/><br/>"
|
|
||||||
"A partition was configured with mount point "
|
|
||||||
"<strong>%2</strong> but its <strong>%3</strong> "
|
|
||||||
"flag is not set.<br/>"
|
|
||||||
"To set the flag, go back and edit the partition."
|
|
||||||
"<br/><br/>"
|
|
||||||
"You can continue without setting the flag but your "
|
|
||||||
"system may fail to start." )
|
|
||||||
.arg( branding->shortProductName() )
|
|
||||||
.arg( espMountPoint, espFlagName );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( !esp || !(okType&&okSize &&okFlag)) {
|
||||||
|
description = tr( "An EFI system partition is necessary to start %1."
|
||||||
|
"<br/><br/>"
|
||||||
|
"To configure an EFI system partition, go back and "
|
||||||
|
"select or create a suitable filesystem.").arg( branding->shortProductName() );
|
||||||
|
}
|
||||||
|
if (!esp) {
|
||||||
|
cDebug() << o << "No ESP mounted";
|
||||||
|
description.append(' ');
|
||||||
|
description.append(tr("The filesystem must be mounted on <strong>%1</strong>.").arg(espMountPoint));
|
||||||
|
}
|
||||||
|
if (!okType) {
|
||||||
|
cDebug() << o << "ESP wrong type";
|
||||||
|
description.append(' ');
|
||||||
|
description.append(tr("The filesystem must have type FAT32."));
|
||||||
|
}
|
||||||
|
if (!okSize) {
|
||||||
|
cDebug() << o << "ESP too small";
|
||||||
|
description.append(' ');
|
||||||
|
description.append(tr("The filesystem must be at least %1 MiB in size.").arg( PartUtils::efiFilesystemMinimumSize() ));
|
||||||
|
}
|
||||||
|
if (!okFlag)
|
||||||
|
{
|
||||||
|
cDebug() << o << "ESP missing flag";
|
||||||
|
description.append(' ');
|
||||||
|
description.append(tr("The filesystem must have flag <strong>%1</strong> set.").arg(PartitionTable::flagName( espFlag )));
|
||||||
|
}
|
||||||
|
if (!description.isEmpty()) {
|
||||||
|
description.append( "<br/><br/>" );
|
||||||
|
description.append( tr(
|
||||||
|
"You can continue without setting up an EFI system "
|
||||||
|
"partition but your system may fail to start." ));
|
||||||
|
}
|
||||||
if ( !message.isEmpty() )
|
if ( !message.isEmpty() )
|
||||||
{
|
{
|
||||||
cWarning() << message;
|
|
||||||
QMessageBox::warning( m_manualPartitionPage, message, description );
|
QMessageBox::warning( m_manualPartitionPage, message, description );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -447,31 +447,40 @@ isEfiSystem()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
isEfiFilesystemSuitable(const Partition* candidate)
|
isEfiFilesystemSuitableType( const Partition* candidate )
|
||||||
{
|
{
|
||||||
auto type = candidate->fileSystem().type();
|
auto type = candidate->fileSystem().type();
|
||||||
|
|
||||||
|
switch ( type )
|
||||||
|
{
|
||||||
|
case FileSystem::Type::Fat32:
|
||||||
|
return true;
|
||||||
|
#ifdef WITH_KPMCORE4API
|
||||||
|
case FileSystem::Type::Fat12:
|
||||||
|
#endif
|
||||||
|
case FileSystem::Type::Fat16:
|
||||||
|
cWarning() << "FAT12 and FAT16 are probably not supported by EFI";
|
||||||
|
return false;
|
||||||
|
default:
|
||||||
|
cWarning() << "EFI boot partition must be FAT32";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
isEfiFilesystemSuitableSize( const Partition* candidate )
|
||||||
|
{
|
||||||
auto size = candidate->capacity(); // bytes
|
auto size = candidate->capacity(); // bytes
|
||||||
|
|
||||||
using CalamaresUtils::Units::operator""_MiB;
|
using CalamaresUtils::Units::operator""_MiB;
|
||||||
|
if ( size >= 300_MiB )
|
||||||
switch( type )
|
|
||||||
{
|
{
|
||||||
case FileSystem::Type::Fat32:
|
return true;
|
||||||
if ( size >= 300_MiB )
|
}
|
||||||
{
|
else
|
||||||
return true;
|
{
|
||||||
}
|
cWarning() << "Filesystem for EFI is too small (" << size << "bytes)";
|
||||||
cWarning() << "FAT32 filesystem is too small (" << size << "bytes)";
|
return false;
|
||||||
return false;
|
|
||||||
#ifdef WITH_KPMCORE4API
|
|
||||||
case FileSystem::Type::Fat12:
|
|
||||||
#endif
|
|
||||||
case FileSystem::Type::Fat16:
|
|
||||||
cWarning() << "FAT12 and FAT16 are probably not supported by EFI";
|
|
||||||
return false;
|
|
||||||
default:
|
|
||||||
cWarning() << "EFI boot partition must be FAT32";
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -508,6 +517,15 @@ isEfiBootable( const Partition* candidate )
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: this is configurable via the config file **already**
|
||||||
|
size_t
|
||||||
|
efiFilesystemMinimumSize()
|
||||||
|
{
|
||||||
|
using CalamaresUtils::Units::operator""_MiB;
|
||||||
|
return 300_MiB;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QString
|
QString
|
||||||
canonicalFilesystemName( const QString& fsName, FileSystem::Type* fsType )
|
canonicalFilesystemName( const QString& fsName, FileSystem::Type* fsType )
|
||||||
{
|
{
|
||||||
|
@ -84,9 +84,24 @@ bool isEfiSystem();
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Is the @p partition suitable as an EFI boot partition?
|
* @brief Is the @p partition suitable as an EFI boot partition?
|
||||||
* Checks for filesystem type (FAT32) and size (300MiB at least).
|
* Checks for filesystem type (FAT32).
|
||||||
*/
|
*/
|
||||||
bool isEfiFilesystemSuitable( const Partition* candidate );
|
bool isEfiFilesystemSuitableType( const Partition* candidate );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Is the @p partition suitable as an EFI boot partition?
|
||||||
|
* Checks for filesystem size (300MiB, see efiFilesystemMinimumSize).
|
||||||
|
*/
|
||||||
|
bool isEfiFilesystemSuitableSize( const Partition* candidate );
|
||||||
|
|
||||||
|
/** @brief Returns the minimum size of an EFI boot partition.
|
||||||
|
*
|
||||||
|
* This is determined as 300MiB, based on the FAT32 standard
|
||||||
|
* and EFI documentation (and not a little discussion in Calamares
|
||||||
|
* issues about what works, what is effective, and what is mandated
|
||||||
|
* by the standard and how all of those are different).
|
||||||
|
*/
|
||||||
|
size_t efiFilesystemMinimumSize();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Is the given @p partition bootable in EFI? Depending on
|
* @brief Is the given @p partition bootable in EFI? Depending on
|
||||||
|
@ -138,61 +138,63 @@ PartitionLayout::init( FileSystem::Type defaultFsType, const QVariantList& confi
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PartitionLayout::setDefaultFsType(FileSystem::Type defaultFsType)
|
PartitionLayout::setDefaultFsType( FileSystem::Type defaultFsType )
|
||||||
{
|
{
|
||||||
using FileSystem = FileSystem::Type;
|
using FileSystem = FileSystem::Type;
|
||||||
switch ( defaultFsType )
|
switch ( defaultFsType )
|
||||||
{
|
{
|
||||||
case FileSystem::Unknown:
|
case FileSystem::Unknown:
|
||||||
case FileSystem::Unformatted:
|
case FileSystem::Unformatted:
|
||||||
case FileSystem::Extended:
|
case FileSystem::Extended:
|
||||||
case FileSystem::LinuxSwap:
|
case FileSystem::LinuxSwap:
|
||||||
case FileSystem::Luks:
|
case FileSystem::Luks:
|
||||||
case FileSystem::Ocfs2:
|
case FileSystem::Ocfs2:
|
||||||
case FileSystem::Lvm2_PV:
|
case FileSystem::Lvm2_PV:
|
||||||
case FileSystem::Udf:
|
case FileSystem::Udf:
|
||||||
case FileSystem::Iso9660:
|
case FileSystem::Iso9660:
|
||||||
#ifdef WITH_KPMCORE4API
|
#ifdef WITH_KPMCORE4API
|
||||||
case FileSystem::Luks2:
|
case FileSystem::Luks2:
|
||||||
case FileSystem::LinuxRaidMember:
|
case FileSystem::LinuxRaidMember:
|
||||||
case FileSystem::BitLocker:
|
case FileSystem::BitLocker:
|
||||||
#endif
|
#endif
|
||||||
// bad bad
|
// bad bad
|
||||||
cWarning() << "The selected default FS" << defaultFsType << "is not suitable." << "Using ext4 instead.";
|
cWarning() << "The selected default FS" << defaultFsType << "is not suitable."
|
||||||
defaultFsType = FileSystem::Ext4;
|
<< "Using ext4 instead.";
|
||||||
break;
|
defaultFsType = FileSystem::Ext4;
|
||||||
case FileSystem::Ext2:
|
break;
|
||||||
case FileSystem::Ext3:
|
case FileSystem::Ext2:
|
||||||
case FileSystem::Ext4:
|
case FileSystem::Ext3:
|
||||||
case FileSystem::Fat32:
|
case FileSystem::Ext4:
|
||||||
case FileSystem::Ntfs:
|
case FileSystem::Fat32:
|
||||||
case FileSystem::Reiser4:
|
case FileSystem::Ntfs:
|
||||||
case FileSystem::ReiserFS:
|
case FileSystem::Reiser4:
|
||||||
case FileSystem::Xfs:
|
case FileSystem::ReiserFS:
|
||||||
case FileSystem::Jfs:
|
case FileSystem::Xfs:
|
||||||
case FileSystem::Btrfs:
|
case FileSystem::Jfs:
|
||||||
case FileSystem::Exfat:
|
case FileSystem::Btrfs:
|
||||||
case FileSystem::F2fs:
|
case FileSystem::Exfat:
|
||||||
// ok
|
case FileSystem::F2fs:
|
||||||
break;
|
// ok
|
||||||
case FileSystem::Fat16:
|
break;
|
||||||
case FileSystem::Hfs:
|
case FileSystem::Fat16:
|
||||||
case FileSystem::HfsPlus:
|
case FileSystem::Hfs:
|
||||||
case FileSystem::Ufs:
|
case FileSystem::HfsPlus:
|
||||||
case FileSystem::Hpfs:
|
case FileSystem::Ufs:
|
||||||
case FileSystem::Zfs:
|
case FileSystem::Hpfs:
|
||||||
case FileSystem::Nilfs2:
|
case FileSystem::Zfs:
|
||||||
|
case FileSystem::Nilfs2:
|
||||||
#ifdef WITH_KPMCORE4API
|
#ifdef WITH_KPMCORE4API
|
||||||
case FileSystem::Fat12:
|
case FileSystem::Fat12:
|
||||||
case FileSystem::Apfs:
|
case FileSystem::Apfs:
|
||||||
case FileSystem::Minix:
|
case FileSystem::Minix:
|
||||||
#endif
|
#endif
|
||||||
// weird
|
// weird
|
||||||
cWarning() << "The selected default FS" << defaultFsType << "is unusual, but not wrong.";
|
cWarning() << "The selected default FS" << defaultFsType << "is unusual, but not wrong.";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
cWarning() << "The selected default FS" << defaultFsType << "is not known to Calamares." << "Using ext4 instead.";
|
cWarning() << "The selected default FS" << defaultFsType << "is not known to Calamares."
|
||||||
defaultFsType = FileSystem::Ext4;
|
<< "Using ext4 instead.";
|
||||||
|
defaultFsType = FileSystem::Ext4;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_defaultFsType = defaultFsType;
|
m_defaultFsType = defaultFsType;
|
||||||
@ -278,7 +280,7 @@ PartitionLayout::createPartitions( Device* dev,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto correctFS = [d=m_defaultFsType]( FileSystem::Type t ) { return t == FileSystem::Type::Unknown ? d : t; };
|
auto correctFS = [d = m_defaultFsType]( FileSystem::Type t ) { return t == FileSystem::Type::Unknown ? d : t; };
|
||||||
|
|
||||||
// Create the partitions.
|
// Create the partitions.
|
||||||
currentSector = firstSector;
|
currentSector = firstSector;
|
||||||
|
Loading…
Reference in New Issue
Block a user