Install on USB-stick used in different hardware - no access to Bootloader in YaST


Installed TW to a USB-stick some years ago and boot/update on different notebooks over the years. Today I wanted to enter Bootlader in YaST, but I get

“Could not connect to root file system”

while the system works otherwise fine.

Any idea what the YaSt Bootloader might get wrong here? Short how-to for how to edit the bootloader options via console?

Many thanks in advance!

Too little information.

It is not at all clear what you did.

Open Yast -> Bootloader and get

“Error Yast cannot configure the bootloader because it failed to find the root file system”

The TW has been booted/updated on different hardware in the past.

What else needed?

Did you boot that particular USB?

When booted to that USB, what is the output from

df /

If this is a standard live USB that uses “squashfs”, then I would not be surprised at that output message. If the system was directly installed on the USB and “/” is a partition on the USB, then I’m surprised and wondering if the file system is corrupt.

Thanks for helping out, I have here

df /
Filesystem     1K-blocks     Used Available Use% Mounted on
/dev/sda1       20465616 15217148   4183512  79% /


sudo blkid
[sudo] password for root: 
/dev/sda2: UUID="c1e8f7c4-ca48-437d-82c9-e167c790df30" BLOCK_SIZE="4096" TYPE="ext4"
/dev/sda3: UUID="e91bb70b-bceb-40da-8f1c-f28815bcb270" TYPE="swap" PARTUUID="2ab74234-03"
/dev/sda1: UUID="1c45fbf6-2bf2-40aa-a3f2-4e4f1f8ea0f3" BLOCK_SIZE="4096" TYPE="ext4" PTTYPE="dos" PARTUUID="2ab74234-01"


cat /etc/fstab
UUID=1c45fbf6-2bf2-40aa-a3f2-4e4f1f8ea0f3  /      ext4  acl,user_xattr  1  1
UUID=c1e8f7c4-ca48-437d-82c9-e167c790df30  /home  ext4  acl,user_xattr  1  2
#UUID=f9c8abd7-a327-4420-899e-f9a7b100ddb1  swap   swap  defaults        0  0

The TW was installed to the USB-stick as if it was a SSD/HDD. I dd’ed the USB-stick to a fresh one today, but the problem persisted… Otherwise I see no problems so far thig might be related to a failing file system.

It could also be a YAST bug. I have never run into that error message.

What exactly do you want to change?

I wanted to add ipv6.disable=1 and maybe som other fine-tuning (like with that resume=) so basically the kernel boot parameters…

You can change those in “/etc/default/grub” and then run “update-bootloader”.

Ok, work-arround is the better solution :wink:

Fun fact: the YaST Partitioner shows the USB-stick with / and /home (only storage present at the moment) as unpartitioned 0x0781usb Sandisk -SanDisk Ultra Fit…

How come?!?

sudo fdisk -l
[sudo] password for root: 
Disk /dev/sda: 57.28 GiB, 61505273856 bytes, 120127488 sectors
Disk model: Ultra Fit       
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x2ab74234

Device     Boot    Start       End  Sectors  Size Id Type
/dev/sda1  *     4208640  46153727 41945088   20G 83 Linux
/dev/sda2       46153728 124059647 77905920 37.1G 83 Linux
/dev/sda3           2048   4208639  4206592    2G 82 Linux swap / Solaris

Partition table entries are not in disk order.

Yast uses “parted” behind the scenes. So check the output of

parted -l

Here we go:

sudo parted -l
[sudo] password for root: 
Error: Can't have a partition outside the disk!
Ignore/Cancel? i                                                          
Model: SanDisk Ultra Fit (scsi)
Disk /dev/sda: 61.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system     Flags
 3      1049kB  2155MB  2154MB  primary  linux-swap(v1)  swap
 1      2155MB  23.6GB  21.5GB  primary  ext4            boot
 2      23.6GB  63.5GB  39.9GB  primary  ext4

Hmmm… I dd’ed the original USB-stick to a HDD and dd’ed this .img to a fresh USB-stick. Is the new USB-stick smaller than the old one?!?

How to fix that?

That is quite possible. But we can not know. You should know (and better before you dd and not after).

Hmm, the .img is 28.6 GiB, the USB-stick is 64 GB, so that should fit. How to reareange the partition data for the stck?

Why don’t you show out of yourself what you have, do, etc. Just muttering things in yourself like “Hmm, the .img is 28.6 GiB” will not convince anybody that you are providing exact and precise information. What is “the .img”"? Use any appropriate command to show it’s size when you want to tell us. But don’t just talk into yourself and hope that others make time to ask you for the most obvious things.

Anybody can see that the size of the disk is 61.5GB and that the partition table goes up to 63.5GB.

The earlier fdisk -l shows that the disk has 120127488 sectors and that the last partition is defined as ending at sector 124059647. Which is again impossible.

You made it, you know (I hope) what you did. We may be able to help you in understanding where you went wrong. But then you need to provide exact and precise information!

The size of image is completely irrelevant here. The problem is not in the size, but in the information written in MBR. This information is independent from actual size of the disk. Looks like you already cloned this disk at least once from larger onto smaller device.

I wonder when filesystems have been created.

How to reareange the partition data for the stck?

The problem is not partition order, but size of partition 2. You need to shrink it (to fit onto your stick), and before doing it you may need to shrink filesystem on it. But may be filesystem size is smaller. We do not know. You can check the current filesystem size with “tune2fs -l /dev/sda2” and looking at “Block count” and “Block size” values.

Many thanks for replying, I have here:

sudo tune2fs -l /dev/sda2
[sudo] password for root: 
tune2fs 1.46.5 (30-Dec-2021)
Filesystem volume name:   <none>
Last mounted on:          /home
Filesystem UUID:          c1e8f7c4-ca48-437d-82c9-e167c790df30
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery extent 64bit flex_bg sparse_super large_file huge_file dir_nlink extra_isize
Filesystem flags:         signed_directory_hash 
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              343392
Block count:              1349888
Reserved block count:     36446
Overhead clusters:        95290
Free blocks:              1002987
Free inodes:              340613
First block:              0
Block size:               4096
Fragment size:            4096
Group descriptor size:    64
Reserved GDT blocks:      1024
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         8176
Inode blocks per group:   511
Flex block group size:    16
Filesystem created:       Mon Dec 26 11:51:46 2016
Last mount time:          Tue Oct  4 19:18:36 2022
Last write time:          Tue Oct  4 19:18:36 2022
Mount count:              354
Maximum mount count:      -1
Last checked:             Mon Dec 26 11:51:46 2016
Check interval:           0 (<none>)
Lifetime writes:          76 GB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:              256
Required extra isize:     32
Desired extra isize:      32
Journal inode:            8
First orphan inode:       397
Default directory hash:   half_md4
Directory Hash Seed:      6f105881-385f-4142-997b-2d7f8588919c
Journal backup:           inode blocks

So filesystem size is 1349888*4096 == 10799104 sectors (where sector is 512 bytes). While partition size is 77905920 sectors which is 7 times more. It should be safe to resize partition to fit onto your current USB stick without affecting filesystem. After doing it you may even grow filesystem to the full partition size (somewhere around 35G after resizing).

Many thanks again!

I resized and moved /home partition (a little to the right, but with some unallocated space in theend), after that I increase / and removed the unused swap.

Boots fine, and both Partitioner and Bootloader in YaST work just fine now. That helped a lot! :slight_smile: