Jump to content

EXT4 USB Formatted Drives Not Working


Dr_Bull

Recommended Posts

I received my Packet Squirrel on Monday, and being a Linux user I was happy to see that the squirrel supported USB drives formatted using EXT4.  However when I attempted to try the default tcpdump payload with an EXT4 formatted drive it would not work.  When booted with the switch in position 1 and the EXT4 USB drive inserted I would get a series of Blue/Red/Green lights flashing and had to power down the squirrel.  When rebooted into Arming mode I tried to mount the USB device, and it provided an error that it was not a properly formatted NTFS file system.  This was at the shell using 'mount /dev/sda1 /mnt'.  I tried with multiple cleanly formatted EXT4 drives of various sizes.

After formatting the drives to NTFS they all mounted properly and the tcpdump attack worked correctly. 

 

The same thing happened when trying to upgrade the firmware.  The firmware update would not load on an EXT4 drive, however when using NTFS the firmware update automatically updated on boot.

Link to comment
Share on other sites

Thanks for the speedy reply.  I formatted the USB drives using fdisk and mkfs.ext4 on a Linux system.  I also tried with gparted.  Formatting to ext4 should not be that different on the squirrel, unless the reformat_usb command is adding some extra parameters (I will have to check later).

At any rate I will give this a shot, however it seems that if EXT4 is supported you should be able to use standard partitioning and formatting tools in order to prepare the disk.   

Link to comment
Share on other sites

15 minutes ago, Dr_Bull said:

At any rate I will give this a shot, however it seems that if EXT4 is supported you should be able to use standard partitioning and formatting tools in order to prepare the disk.   

Agreed

I think i recall Darren saying a small number of drives that didnt work with EXT4... maybe it was on the lets code they just did. I might be wrong tho. Are the drives your using the same brand/type?

Link to comment
Share on other sites

Darren said that he had the same problem.  The usb will be formatted for EXT4 but if no partition table is set then it won't read. best way is just do it on the PS itself

 

Link to comment
Share on other sites

Just now, b0N3z said:

Darren said that he had the same problem.  The usb will be formatted for EXT4 but if no partition table is set then it won't read. best way is just do it on the PS itself

 

Nice one b0N3z I knew he mentioned something about it, cheers for clearing that up.

Link to comment
Share on other sites

38 minutes ago, Just_a_User said:

Agreed

I think i recall Darren saying a small number of drives that didnt work with EXT4... maybe it was on the lets code they just did. I might be wrong tho. Are the drives your using the same brand/type?

They were a mix of SanDisk, PNY, and Kingston.  All pretty decent brands and models.  

 

9 minutes ago, b0N3z said:

Darren said that he had the same problem.  The usb will be formatted for EXT4 but if no partition table is set then it won't read. best way is just do it on the PS itself

 

I used FDISK to make the partition table.  So when the drive being tested was plugged into the squirrel it was at /dev/sda1

Link to comment
Share on other sites

function format_disk() {
	echo -e "o\nn\np\n1\n\np\n\nw\n" | fdisk $1
	echo y | mkfs.ext4 ${1}1
}

This is what /usr/bin/reformat_usb is doing on the squirrel

the first line is just working through the fdisk menu, like I did manually on my Linux system.

o - creates dos disklabel 

n - new partition

p - primary partition

1 - first partition

using new line to accept default start position

using new line to accept default end position

p - print partition table

w - write (save) and quit

 

Then it uses mkfs.ext4 on the 1st partition of the device fed into the function ${1}1

Not seeing how this is any different than what I did on my Linux box manually.  Except I never used the (o) option in fdisk since all of the drives were already set to 'dos' partition types.  I will run through my manual process again on a few of my drives with the (o) option in fdisk to see if there is a difference.

 

Link to comment
Share on other sites

So for some reason after I posted my last post my account was unable to respond to this thread or create any new posts.  Anyway I had to create a new account to get a reply box again.

Here is my result after manually doing fdisk with the (o) flag.

Same issue when manually formatting on my Gentoo Linux laptop as well as a Kali Linux desktop using process outlined above.

Here is the error I get when attempting to mount the usb stick formatted as EXT4 on the squirrel
 

root@squirrel:~# mount /dev/sda
sda   sda1
root@squirrel:~# mount /dev/sda1 /mnt/
NTFS signature is missing.
Failed to mount '/dev/sda1': Invalid argument
The device '/dev/sda1' doesn't seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?
mount: mounting /dev/sda1 on /mnt/ failed: Invalid argument

 

I went a little deeper and looked at dmesg after I ran the mount command, here is some interesting output:
 

[ 1002.220000] scsi 2:0:0:0: Direct-Access              USB Flash Memory PMAP PQ: 0 ANSI: 4
[ 1004.010000] sd 2:0:0:0: [sda] 15240576 512-byte logical blocks: (7.80 GB/7.26 GiB)
[ 1004.010000] sd 2:0:0:0: [sda] Write Protect is off
[ 1004.020000] sd 2:0:0:0: [sda] Mode Sense: 23 00 00 00
[ 1004.020000] sd 2:0:0:0: [sda] No Caching mode page found
[ 1004.020000] sd 2:0:0:0: [sda] Assuming drive cache: write through
[ 1004.060000]  sda: sda1
[ 1004.080000] sd 2:0:0:0: [sda] Attached SCSI removable disk
[ 1004.240000] EXT4-fs (sda1): Cannot load crc32c driver.
[ 1004.250000] EXT4-fs (sda1): Cannot load crc32c driver.
[ 1004.260000] EXT4-fs (sda1): Cannot load crc32c driver.
[ 1008.450000] EXT4-fs (sda1): Cannot load crc32c driver.
[ 1008.460000] EXT4-fs (sda1): Cannot load crc32c driver.
[ 1008.470000] EXT4-fs (sda1): Cannot load crc32c driver.

So it looks like the mount is failing because of the "Cannot load crc32c driver" required by ext4-fs
 

Link to comment
Share on other sites

Good job finding this.  I had a hell of a time getting my USB to work to flash.  I just went with the recovery option which worked fine.  After your post I checked my USB formatting and noticed it was ext4 and not mounting.  Redid to NTFS and was able to mount.

 

Link to comment
Share on other sites

Seems to me like it automatically assumes NTFS is the filesystem you want to mount, but if you specify type as ext4 it mounts that ok. 

Example:
mount -t ext4 /dev/sda1 /media/usb 

Output:

root@squirrel:~/tmp/media# mount /dev/sda1 ./usb
NTFS signature is missing.
Failed to mount '/dev/sda1': Invalid argument
The device '/dev/sda1' doesn't seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?

root@squirrel:~/tmp/media# umount /dev/sda1

root@squirrel:~/tmp/media# mount -t ext4 /dev/sda1 ./usb

root@squirrel:~/tmp/media# ls usb/
lost+found

root@squirrel:~/tmp/media# mount

rootfs on / type rootfs (rw)
/dev/root on /rom type squashfs (ro,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
/dev/mtdblock3 on /overlay type jffs2 (rw,noatime)
overlayfs:/overlay on / type overlay (rw,noatime,lowerdir=/,upperdir=/overlay/upper,workdir=/overlay/work)
tmpfs on /dev type tmpfs (rw,nosuid,relatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,mode=600)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)
/dev/sda1 on /root/tmp/media/usb type ext4 (rw,relatime,data=ordered)

 

Then I did a poweroff command, then re-powered Packet Squirrel in arming mode and it shows ext4 automatically mounted ok

 

BusyBox v1.23.2 (2017-06-28 18:58:08 PDT) built-in shell (ash)

    __ (\\_          Packet Squirrel          _//) __
   (_ \( '.)             by Hak5             (.' )/ _)
     ) \ _))     _                     __    ((_ / (
    (_   )_     (') Nuts for Networks ((')    _(   _)


root@squirrel:~# mount
rootfs on / type rootfs (rw)
/dev/root on /rom type squashfs (ro,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
/dev/mtdblock3 on /overlay type jffs2 (rw,noatime)
overlayfs:/overlay on / type overlay (rw,noatime,lowerdir=/,upperdir=/overlay/upper,workdir=/overlay/work)
tmpfs on /dev type tmpfs (rw,nosuid,relatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,mode=600)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)
/dev/sda1 on /mnt type ext4 (rw,relatime,data=ordered)
root@squirrel:~#

 

btw, looks like I should sync my clock too...

 

 

Link to comment
Share on other sites

  • 3 years later...
On 11/1/2017 at 10:39 PM, Sebkinne said:

Hi Everyone,

We'll include the crc32c drivers in the next firmware. My apologies for not catching this during development.

Hi, 

How can I upgrade the firmware… when crc32C is missing for my USB stick!
(I's a vicious circle!!!)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...