Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 93395

Summary: sfdisk seek errors unrecognized partition table type
Product: Gentoo Linux Reporter: Tod Herman <tod>
Component: [OLD] Core systemAssignee: Gentoo Linux bug wranglers <bug-wranglers>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: High    
Version: unspecified   
Hardware: x86   
OS: Linux   
URL: http://forums.gentoo.org/viewtopic-t-339197-highlight-.html
Whiteboard:
Package list:
Runtime testing required: ---

Description Tod Herman 2005-05-20 19:13:57 UTC
fdisk and cfdisk work fine.  sfdisk doesn't work, gives seek errors and
unrecognized partition table type errors.  See forum posting from url above

Reproducible: Always
Steps to Reproduce:
1.build system with gcc 3.4 using optimizations as per Jackass Project
2.run command "sfdisk -l"
3.

Actual Results:  
sniffer root # sfdisk -l

Disk /dev/hda: 79408 cylinders, 16 heads, 63 sectors/track

sfdisk: seek error: wanted 0x0000000000000000, got 0x0000000000000000
 /dev/hda: unrecognized partition table type
No partitions found

Disk /dev/sda: 17849 cylinders, 255 heads, 63 sectors/track

sfdisk: seek error: wanted 0x0000000000000000, got 0x0000000000000000
 /dev/sda: unrecognized partition table type
No partitions found

Disk /dev/sdb: 2213 cylinders, 255 heads, 63 sectors/track

sfdisk: seek error: wanted 0x0000000000000000, got 0x0000000000000000
 /dev/sdb: unrecognized partition table type
No partitions found

Expected Results:  
gentoo-1 root # sfdisk -l

Disk /dev/hda: 155061 cylinders, 16 heads, 63 sectors/track
Units = cylinders of 516096 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/hda1   *      0+    194     195-     98248+  83  Linux
/dev/hda2        195    2179    1985    1000440   82  Linux swap / Solaris
/dev/hda3       2180   31942   29763   15000552   83  Linux
/dev/hda4      31943  155060  123118   62051472    5  Extended
/dev/hda5      31943+ 111308   79366-  40000432+  83  Linux

Disk /dev/hdb: 19457 cylinders, 255 heads, 63 sectors/track
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/hdb1          0       -       0          0    0  Empty
/dev/hdb2          1   19456   19456  156280320    f  W95 Ext'd (LBA)
/dev/hdb3          0       -       0          0    0  Empty
/dev/hdb4          0       -       0          0    0  Empty
/dev/hdb5          1+  10444   10444-  83891398+   b  W95 FAT32
/dev/hdb6      10445+  19456    9012-  72388858+   b  W95 FAT32
                start: (c,h,s) expected (1023,254,63) found (1023,1,1)


sfdisk -q responds with correct geometry for all drives.  Found patch online
suggesting this was a problem with compiling util-linux with gcc 3.4.  Patch below:

Submitted By: Jeremy Utley (jeremy@linuxfromscratch.org)
Date: 2004-09-13
Initial Package Version: 2.12b
Upstream Status: Not submitted - fixes GCC miscompilation
Origin: Created from troubleshooting on IRC
Description: When using GCC 3.4.{1,2}, the sfdisk program is miscompiled,
causing a seek error to be output. Troubleshooting narrowed the problem down
to the fact that Util-Linux by default uses the -O2 optimization level,
which includes the unit-at-a-time optimization, exposing this problem. This
patch passes -fno-unit-at-a-time to the sfdisk, fdisk, and cfdisk programs,
resolving this error. Developed by Matthew Burgess, Ronald Hummelink, and
Jeremy Utley.


diff -Naur util-linux-2.12b/fdisk/Makefile util-linux-2.12b-new/fdisk/Makefile
--- util-linux-2.12b/fdisk/Makefile 2002-11-24 17:33:58.000000000 +0000
+++ util-linux-2.12b-new/fdisk/Makefile 2004-09-14 00:45:31.303286087 +0000
@@ -6,6 +6,8 @@
include ../make_include
include ../MCONFIG

+CFLAGS:=$(CFLAGS) -fno-unit-at-a-time
+
MAN8=
SBIN=
CFDISK=cfdisk

Unknown if patch solves problem.  Didn't know how to patch the source.  I did
recompile the util-linux package with the no-unit-at-a-time flag to no avail.
Gcc 3.4 doesn't appear to be the culprit after many recompiles...

BUT changing CFLAGS from -O3 to -O2 solves problem without having to at
-fno-unit-at-a-time.  fdisk and cfdisk don't seem to be affected.  Can the
ebuild be changed to apply -O2 to only sfdisk?

Same results on both my systems and server at work...all x86


My emerge info:
gentoo-1 root # emerge --info
Portage 2.0.51.19 (default-linux/x86/2005.0, gcc-3.4.3-20050110, glibc-2.3.5-r0,
2.6.11-gentoo-r9 i686)
=================================================================
System uname: 2.6.11-gentoo-r9 i686 Intel(R) Pentium(R) 4 CPU 3.20GHz
Gentoo Base System version 1.4.16
Python:              dev-lang/python-2.3.5 [2.3.5 (#1, May 11 2005, 00:24:51)]
ccache version 2.4 [enabled]
dev-lang/python:     2.3.5
sys-apps/sandbox:    [Not Present]
sys-devel/autoconf:  2.59-r6, 2.13
sys-devel/automake:  1.7.9-r1, 1.8.5-r3, 1.5, 1.4_p6, 1.6.3, 1.9.5
sys-devel/binutils:  2.15.92.0.2-r7
sys-devel/libtool:   1.5.16
virtual/os-headers:  2.6.8.1-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-march=pentium4 -mtune=pentium4 -pipe -O3 -fweb -frename-registers
-fforce-addr -momit-leaf-frame-pointer -fomit-frame-pointer -ftracer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.3/env
/usr/kde/3.3/share/config /usr/kde/3.3/shutdown /usr/kde/3.4/env
/usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/kde/3/share/config
/usr/lib/X11/xkb /usr/lib/mozilla/defaults/pref /usr/share/config
/usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/
/usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/
/usr/share/texmf/xdvi/ /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-march=pentium4 -mtune=pentium4 -pipe -O3 -fweb -frename-registers
-fforce-addr -momit-leaf-frame-pointer -fomit-frame-pointer -ftracer
-fvisibility-inlines-hidden"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig ccache distlocks sandbox sfperms strict"
GENTOO_MIRRORS="http://gentoo.mirrors.tds.net/gentoo http://gentoo.ccccom.com
http://gentoo.netnitco.net ftp://mirror.iawnet.sandia.gov/pub/gentoo"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.us.gentoo.org/gentoo-portage"
USE="x86 X a52 aalib acpi alsa apache2 arts avi berkdb bitmap-fonts cdparanoia
cdr crypt cups curl divx4linux dv dvd dvdr dvdread eds emboss encode esd fam
fbcon ffmpeg flac foomaticdb fortran gdbm gif gimpprint gnome gpm gstreamer gtk
gtk2 hal howl imagemagick imlib ipv6 java jpeg kde libg++ libwww mad maildir mmx
motif mozilla mp3 mpeg ncurses nls nptl nvidia offensive ogg oggvorbis opengl
pam pdflib perl pic png ppds python qt quicktime readline samba scanner sdl
slang sockets spell sse sse2 ssl svg svga sysfs tcltk tcpd tetex tiff truetype
truetype-fonts type1-fonts unicode usb userlocales v4l vcd vim-with-x vorbis
win32codecs xine xml2 xmms xv xvid zeroconf zlib userland_GNU kernel_linux
elibc_glibc"
Unset:  ASFLAGS, CBUILD, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2005-05-21 00:47:35 UTC

*** This bug has been marked as a duplicate of 79454 ***