Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Debian Kernel (http://www.linux-archive.org/debian-kernel/)
-   -   Bug#576537: Incorrect labels generated in /etc/fstab during PATA conversion (http://www.linux-archive.org/debian-kernel/351854-bug-576537-incorrect-labels-generated-etc-fstab-during-pata-conversion.html)

Moritz Muehlenhoff 04-05-2010 02:12 PM

Bug#576537: Incorrect labels generated in /etc/fstab during PATA conversion
 
Package: linux-base
Version: 2.6.32-10
Severity: normal

The conversion on my Thinkpad X31 seems to have generated incorrect
labels, which lead to the home partition not being mounted automatically:

This is the /etc/fstab which was generated:

# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
# /dev/hda1 / ext3 defaults,errors=remount-ro 0 1
LABEL=x2f / ext3 defaults,errors=remount-ro 0 1
# /dev/hda6 /home ext3 defaults,noatime 0 2
LABEL=x2fhome /home ext3 defaults,noatime 0 2
# /dev/hda5 none swap sw 0 0
UUID=0603958c-bb68-46df-940b-c562b9fdb4aa none swap sw 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto 0 0
/dev/sda /stick vfat rw,user,noauto 0 0

The labels itself seem correct:

root@galadriel:~# e2label /dev/sda1
/
root@galadriel:~# e2label /dev/sda6
/home
root@galadriel:~#

I have no idea where "x2f" instead of "/" is coming from?

Cheers,
Moritz

-- System Information:
Debian Release: squeeze/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.32-4-686 (SMP w/1 CPU core)
Locale: LANG=C, LC_CTYPE=de_DE.ISO-8859-15@euro (charmap=ISO-8859-15)
Shell: /bin/sh linked to /bin/bash

Versions of packages linux-base depends on:
ii debconf [debconf-2.0] 1.5.30 Debian configuration management sy
ii libapt-pkg-perl 0.1.24 Perl interface to libapt-pkg
ii libuuid-perl 0.02-3+b1 Perl extension for using UUID inte

linux-base recommends no packages.

linux-base suggests no packages.

-- debconf information:
linux-base/disk-id-manual:
linux-base/disk-id-convert-plan-no-relabel: true
* linux-base/disk-id-convert-auto: true
* linux-base/disk-id-convert-plan: true



--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20100405141248.3436.9305.reportbug@localhost.local domain">http://lists.debian.org/20100405141248.3436.9305.reportbug@localhost.local domain

maximilian attems 04-05-2010 03:07 PM

Bug#576537: Incorrect labels generated in /etc/fstab during PATA conversion
 
On Mon, Apr 05, 2010 at 04:12:48PM +0200, Moritz Muehlenhoff wrote:
> Package: linux-base
> Version: 2.6.32-10
> Severity: normal
>
> The conversion on my Thinkpad X31 seems to have generated incorrect
> labels, which lead to the home partition not being mounted automatically:
>
> This is the /etc/fstab which was generated:
>
> # /etc/fstab: static file system information.
> #
> # <file system> <mount point> <type> <options> <dump> <pass>
> proc /proc proc defaults 0 0
> # /dev/hda1 / ext3 defaults,errors=remount-ro 0 1
> LABEL=x2f / ext3 defaults,errors=remount-ro 0 1
> # /dev/hda6 /home ext3 defaults,noatime 0 2
> LABEL=x2fhome /home ext3 defaults,noatime 0 2
> # /dev/hda5 none swap sw 0 0
> UUID=0603958c-bb68-46df-940b-c562b9fdb4aa none swap sw 0 0
> /dev/fd0 /media/floppy0 auto rw,user,noauto 0 0
> /dev/sda /stick vfat rw,user,noauto 0 0
>
> The labels itself seem correct:
>
> root@galadriel:~# e2label /dev/sda1
> /
> root@galadriel:~# e2label /dev/sda6
> /home
> root@galadriel:~#
>
> I have no idea where "x2f" instead of "/" is coming from?
>
> Cheers,
> Moritz

this is how udev encodes / in sysfs as it is not a new dir and
kind of special.

afair initramfs-tools does the conversion from / to x2f,
so it should not be necessary to use that.

anyway newer linux-base should convert you over to UUID and not LABEL.
don't know thus if this bug still applies.



--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20100405150708.GH32211@baikonur.stro.at">http://lists.debian.org/20100405150708.GH32211@baikonur.stro.at

Ben Hutchings 04-05-2010 03:48 PM

Bug#576537: Incorrect labels generated in /etc/fstab during PATA conversion
 
On Mon, 2010-04-05 at 16:12 +0200, Moritz Muehlenhoff wrote:
> Package: linux-base
> Version: 2.6.32-10
> Severity: normal
>
> The conversion on my Thinkpad X31 seems to have generated incorrect
> labels, which lead to the home partition not being mounted automatically:

Oops.

> This is the /etc/fstab which was generated:
>
> # /etc/fstab: static file system information.
> #
> # <file system> <mount point> <type> <options> <dump> <pass>
> proc /proc proc defaults 0 0
> # /dev/hda1 / ext3 defaults,errors=remount-ro 0 1
> LABEL=x2f / ext3 defaults,errors=remount-ro 0 1
> # /dev/hda6 /home ext3 defaults,noatime 0 2
> LABEL=x2fhome /home ext3 defaults,noatime 0 2
> # /dev/hda5 none swap sw 0 0
> UUID=0603958c-bb68-46df-940b-c562b9fdb4aa none swap sw 0 0
> /dev/fd0 /media/floppy0 auto rw,user,noauto 0 0
> /dev/sda /stick vfat rw,user,noauto 0 0
>
> The labels itself seem correct:
>
> root@galadriel:~# e2label /dev/sda1
> /
> root@galadriel:~# e2label /dev/sda6
> /home
> root@galadriel:~#
>
> I have no idea where "x2f" instead of "/" is coming from?
[...]

/sbin/blkid -o udev /dev/sda1 | grep ^ID_FS_LABEL_ENC

We definitely do need to escape whitespace and I thought libblkid would
accept the escaped strings. Evidently not. I think we may just have to
ignore labels with whitespace in, and go for UUIDs on those devices.
(We already prefer UUIDs but it looks like those partitions don't have
them.)

Ben.

--
Ben Hutchings
Once a job is fouled up, anything done to improve it makes it worse.

Moritz Muehlenhoff 04-05-2010 04:38 PM

Bug#576537: Incorrect labels generated in /etc/fstab during PATA conversion
 
On Mon, Apr 05, 2010 at 04:48:13PM +0100, Ben Hutchings wrote:
> On Mon, 2010-04-05 at 16:12 +0200, Moritz Muehlenhoff wrote:
> > Package: linux-base
> > Version: 2.6.32-10
> > Severity: normal
> >
> > The conversion on my Thinkpad X31 seems to have generated incorrect
> > labels, which lead to the home partition not being mounted automatically:
>
> Oops.
>
> > This is the /etc/fstab which was generated:
> >
> > # /etc/fstab: static file system information.
> > #
> > # <file system> <mount point> <type> <options> <dump> <pass>
> > proc /proc proc defaults 0 0
> > # /dev/hda1 / ext3 defaults,errors=remount-ro 0 1
> > LABEL=x2f / ext3 defaults,errors=remount-ro 0 1
> > # /dev/hda6 /home ext3 defaults,noatime 0 2
> > LABEL=x2fhome /home ext3 defaults,noatime 0 2
> > # /dev/hda5 none swap sw 0 0
> > UUID=0603958c-bb68-46df-940b-c562b9fdb4aa none swap sw 0 0
> > /dev/fd0 /media/floppy0 auto rw,user,noauto 0 0
> > /dev/sda /stick vfat rw,user,noauto 0 0
> >
> > The labels itself seem correct:
> >
> > root@galadriel:~# e2label /dev/sda1
> > /
> > root@galadriel:~# e2label /dev/sda6
> > /home
> > root@galadriel:~#
> >
> > I have no idea where "x2f" instead of "/" is coming from?
> [...]
>
> /sbin/blkid -o udev /dev/sda1 | grep ^ID_FS_LABEL_ENC
>
> We definitely do need to escape whitespace and I thought libblkid would
> accept the escaped strings. Evidently not. I think we may just have to
> ignore labels with whitespace in, and go for UUIDs on those devices.
> (We already prefer UUIDs but it looks like those partitions don't have
> them.)

At least blkid shows a UUID:

root@galadriel:~# /sbin/blkid -o udev /dev/sda1
ID_FS_LABEL=/
ID_FS_LABEL_ENC=x2f
ID_FS_UUID=6af102ec-0002-499f-b85d-193ecec7993e
ID_FS_UUID_ENC=6af102ec-0002-499f-b85d-193ecec7993e
ID_FS_SEC_TYPE=ext2
ID_FS_TYPE=ext3

Or was the code which prefers UUIDs over labels added post -10?

The "x2f" encoding is applied through the blkid_encode_string()
function from shlibs/blkid/src/encode.c of util-linux:

/**
* blkid_encode_string:
* @str: input string to be encoded
* @str_enc: output string to store the encoded input string
* @len: maximum size of the output string, which may be
* four times as long as the input string
*
* Encode all potentially unsafe characters of a string to the
* corresponding hex value prefixed by 'x'.
*
* Returns: 0 if the entire string was copied, non-zero otherwise.
**/
int blkid_encode_string(const char *str, char *str_enc, size_t len)

Maybe we should convert it back in linux-base.postinst?

Cheers,
Moritz








--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20100405163850.GA2628@galadriel.inutil.org">http://lists.debian.org/20100405163850.GA2628@galadriel.inutil.org

Ben Hutchings 04-05-2010 05:07 PM

Bug#576537: Incorrect labels generated in /etc/fstab during PATA conversion
 
On Mon, 2010-04-05 at 18:38 +0200, Moritz Muehlenhoff wrote:
> On Mon, Apr 05, 2010 at 04:48:13PM +0100, Ben Hutchings wrote:
> > On Mon, 2010-04-05 at 16:12 +0200, Moritz Muehlenhoff wrote:
> > > Package: linux-base
> > > Version: 2.6.32-10
> > > Severity: normal
> > >
> > > The conversion on my Thinkpad X31 seems to have generated incorrect
> > > labels, which lead to the home partition not being mounted automatically:
> >
> > Oops.
> >
> > > This is the /etc/fstab which was generated:
> > >
> > > # /etc/fstab: static file system information.
> > > #
> > > # <file system> <mount point> <type> <options> <dump> <pass>
> > > proc /proc proc defaults 0 0
> > > # /dev/hda1 / ext3 defaults,errors=remount-ro 0 1
> > > LABEL=x2f / ext3 defaults,errors=remount-ro 0 1
> > > # /dev/hda6 /home ext3 defaults,noatime 0 2
> > > LABEL=x2fhome /home ext3 defaults,noatime 0 2
> > > # /dev/hda5 none swap sw 0 0
> > > UUID=0603958c-bb68-46df-940b-c562b9fdb4aa none swap sw 0 0
> > > /dev/fd0 /media/floppy0 auto rw,user,noauto 0 0
> > > /dev/sda /stick vfat rw,user,noauto 0 0
> > >
> > > The labels itself seem correct:
> > >
> > > root@galadriel:~# e2label /dev/sda1
> > > /
> > > root@galadriel:~# e2label /dev/sda6
> > > /home
> > > root@galadriel:~#
> > >
> > > I have no idea where "x2f" instead of "/" is coming from?
> > [...]
> >
> > /sbin/blkid -o udev /dev/sda1 | grep ^ID_FS_LABEL_ENC
> >
> > We definitely do need to escape whitespace and I thought libblkid would
> > accept the escaped strings. Evidently not. I think we may just have to
> > ignore labels with whitespace in, and go for UUIDs on those devices.
> > (We already prefer UUIDs but it looks like those partitions don't have
> > them.)
>
> At least blkid shows a UUID:
>
> root@galadriel:~# /sbin/blkid -o udev /dev/sda1
> ID_FS_LABEL=/
> ID_FS_LABEL_ENC=x2f
> ID_FS_UUID=6af102ec-0002-499f-b85d-193ecec7993e
> ID_FS_UUID_ENC=6af102ec-0002-499f-b85d-193ecec7993e
> ID_FS_SEC_TYPE=ext2
> ID_FS_TYPE=ext3
>
> Or was the code which prefers UUIDs over labels added post -10?

Some experimental versions preferred labels, but I changed this
behaviour to be consistent with fresh installations. However it looks
like there's a bug in the ID selection code such that we still use
labels sometimes.

> The "x2f" encoding is applied through the blkid_encode_string()
> function from shlibs/blkid/src/encode.c of util-linux:

I know.

> /**
> * blkid_encode_string:
> * @str: input string to be encoded
> * @str_enc: output string to store the encoded input string
> * @len: maximum size of the output string, which may be
> * four times as long as the input string
> *
> * Encode all potentially unsafe characters of a string to the
> * corresponding hex value prefixed by 'x'.
> *
> * Returns: 0 if the entire string was copied, non-zero otherwise.
> **/
> int blkid_encode_string(const char *str, char *str_enc, size_t len)
>
> Maybe we should convert it back in linux-base.postinst?

We can't do that wholesale because (1) whitespace in a label will break
most of the configuration files we deal with and (2) in some
configuration files we have to use /dev/disk/by-label/$label and there
the escaped syntax is correct.

Ben.

--
Ben Hutchings
Once a job is fouled up, anything done to improve it makes it worse.


All times are GMT. The time now is 04:39 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.