[bug] mount -o loop meglepetés...

Fórumok

Iso-kat (CD, DVD image-eket) toltottem le, aztan checksum-ot neztem rajtuk, nemelyiket fel is mountoltam ahogy szokas mount -o loop-pal (semmi egyeb opcio). Az egyik ilyen iso-nal -veletlenul- mount elott meg utan is csinaltam checksum ellenorzest, amikor az a meglepetes ert, hogy a checksum megvaltozott! Letezik az, hogy a mount ir valamit az iso-ba? Ez nekem nagyon furan hangzik, de minimum kellemetlen amikor az ember iso-kat tarol valahol checksummal es azokat idonkent felmountolna, igy meg lehetetlen ellenorizni, hogy az iso serult-e. Azt ertem ha a mount beleir egy ext3/4 filerendszerbe, mert pl a last mount time stamp-et modositani kell, na de egy iso-ba ami read only-ba mountolodik?!?

Kb igy nezett ki nalam:


$ sha1sum file.iso
123456
$ sudo mount -o loop file.iso /mnt
$ sha1sum file.iso
654321
$sudo umount /mnt
$ sha1sum file.iso
654321

-------------------------------------------------------------------
update (2014.01.31 21:50)

Lent tobb kerdest meg jo tippet is kaptam, inkabb itt egyben valaszolok.

Szoval az iso-k az MS-tol vannak letoltve, a file szerint "ISO 9660 CD-ROM filesystem", de a mount valamiert udf-kent mountolja. Nemtom, az UDF-nek ugyanaz lenne a header-je...?

A mount ugyan eddig is kiirta, hogy read-only-ra mountol, de az "ro" opcio valoban segitett. Igy nem valtozik a checksum (vagyis nem irodik egy bit sem a file-ba):

mount -o loop,ro file.iso /mnt

Szoval megoldas van, de a dolog azert eleg kellemetlen tud lenni, mert konnyen tonkre lehet vele tenni checksum-okat...

-------------------------------------------------------------------
update (2014.02.06 17:25)

Kicsit elfoglalt voltam az elmult par napban, de ma vegre lejelentettem a bugot. Aki gondolja kommentelheti, vagy megnyomhatja a "This bug affects you" gombot.

https://bugs.launchpad.net/ubuntu/+source/kernel-package/+bug/1277146

Hozzászólások

Az publikus, hogy milyen CD image volt?

#! /bin/bash
dd if=/dev/zero of=/root/ext4.iso bs=1M count=128
mkfs.ext4 /root/ext4.iso
mkdir /media/ext4test
sha1sum /root/ext4.iso

mount -o loop /root/ext4.iso /media/ext4test
umount /media/ext4test

sha1sum /root/ext4.iso
rm -rf /media/ext4test

Szerk.: kétszer írtam alá, de akkor ha már itt vagyok a két checksum:

173782e47d56ca49399ae5ebce0b45ee626ef879 /root/ext4.iso
5ce7cc5f5cf903f8f46fbaeeb449825973a5cb58 /root/ext4.iso

BlackY

UDF image-el sikerült előhoznom. K3b-ben csináltam egy image-t, mount után változott a sha1sum.


cp udf.iso copy.iso
mount -o loop copy.iso /media
mount: /dev/loop0 is write-protected, mounting read-only

umount /media
sha1sum *.iso
7a14326ca09808bd9722a7023c421997249421ce  copy.iso
5450ae4424f1d6177017501c1362a533c89066fd  udf.iso

BlackY

esetleg ntfs-3g csomaggal?
# mount -o loop -t ntfs-3g file.iso /mnt

aztatat nem hiszem
(subscribe)

~~~~~~~~
Linux 3.2.0-4-486
Debian 7.1


sudo mount -o loop,ro file.iso /mnt

Így..?

Az általad vázolt parancsokkal megnéztem egy iso-t. Nálam nem változott.

A file parancs mit mond erre az iso-ra neked?

UDF formátumút?
(nem tudom, a kérdező előtted vagy utánad javította a leírást)
Az biztos, hogy saját gyártású, UDF formátumú, üres image-be beleszemetel a linux annak ellenére, hogy "... write-protected, mounting read-only" üzenettel mountolja.
Mondjuk valahol érthető, hiszen DVD-RAM is létezik, ami szintén UDF formátumot használ(hat).
Amit kevéssé értek: ha opciók nélkül mountolom, akkor is (ro) van mellette, ha -o ro opcióval, akkor is.
Előbbi esetben beleír, utóbbiban nem.

+1
Pontosan ez a tapasztalat. Az hogy ertheto vagy sem nem tudom, mindenesetre engem jol megszivatott, ujra le kellett toltenem az image-eket, egy read only mount miatt...

Egyebkent E-Medve meg az update elott irt, pont emiatt is kerult bele a file kimenete az updatebe. (Direkt irtam idopontot az updatehez.)

Sikerult mostanra teljesen osszezavarodnom: akinek sikerul az adott hibat reprodukalnia (es akinek nem), azok milyen rendszeren sikeresek (vagy sikertelnek)?

Móriczkáztam egy kicsit hirtelen. (azért dd, mert valami elejtett megjegyzés az mkudffst azzal vádolta, hogy sparse fileokat csinál, ami majd úgy nő, ahogy igény van rá)

#!/bin/bash
echo "###creating test file:"
dd if=/dev/zero of=/tmp/test.udf bs=2048 count=10000
sha1sum /tmp/test.udf 
mkudffs --media-type=dvd /tmp/test.udf 10000
sha1sum /tmp/test.udf
echo
echo "###testing with default options:"
mount -o loop /tmp/test.udf /mnt
mount|grep test
echo "##Trying to add file"
echo 'test' > /mnt/testfile.txt
umount /tmp/test.udf 
sha1sum /tmp/test.udf 
echo
echo "###testing with explicit ro:"
mount -o loop,ro /tmp/test.udf /mnt
mount|grep test
echo "##Trying to add file"
echo 'test' > /mnt/testfile.txt
umount /tmp/test.udf 
sha1sum /tmp/test.udf 
echo

echo "###testing with explicit rw:"
mount -o loop,rw /tmp/test.udf /mnt
mount|grep test
echo "##Trying to add file"
echo 'test' > /mnt/testfile.txt
umount /tmp/test.udf 
sha1sum /tmp/test.udf 
echo

rm -f /tmp/test.udf

CentOS 6.4

###creating test file:
10000+0 records in
10000+0 records out
20480000 bytes (20 MB) copied, 0.0912135 s, 225 MB/s
21eac8f53c5e2ed9ae09ccebf2cf7a0261efb8f0 /tmp/test.udf
start=0, blocks=16, type=RESERVED
start=16, blocks=3, type=VRS
start=19, blocks=237, type=USPACE
start=256, blocks=1, type=ANCHOR
start=257, blocks=16, type=PVDS
start=273, blocks=1, type=LVID
start=274, blocks=9469, type=PSPACE
start=9743, blocks=1, type=ANCHOR
start=9744, blocks=239, type=USPACE
start=9983, blocks=16, type=RVDS
start=9999, blocks=1, type=ANCHOR
295f49ebb4b751179dc4aaacd18f5f2d13f02abc /tmp/test.udf

###testing with default options:
/tmp/test.udf on /mnt type udf (rw,loop=/dev/loop0)
##Trying to add file
./test.sh: line 12: /mnt/testfile.txt: Read-only file system
295f49ebb4b751179dc4aaacd18f5f2d13f02abc /tmp/test.udf

###testing with explicit ro:
/tmp/test.udf on /mnt type udf (ro,loop=/dev/loop0)
##Trying to add file
./test.sh: line 20: /mnt/testfile.txt: Read-only file system
295f49ebb4b751179dc4aaacd18f5f2d13f02abc /tmp/test.udf

###testing with explicit rw:
/tmp/test.udf on /mnt type udf (rw,loop=/dev/loop0)
##Trying to add file
./test.sh: line 29: /mnt/testfile.txt: Read-only file system
295f49ebb4b751179dc4aaacd18f5f2d13f02abc /tmp/test.udf

Ubuntu saucy vagy mi a szösz

###creating test file:
10000+0 records in
10000+0 records out
20480000 bytes (20 MB) copied, 0.0875486 s, 234 MB/s
21eac8f53c5e2ed9ae09ccebf2cf7a0261efb8f0 /tmp/test.udf
start=0, blocks=16, type=RESERVED
start=16, blocks=3, type=VRS
start=19, blocks=237, type=USPACE
start=256, blocks=1, type=ANCHOR
start=257, blocks=16, type=PVDS
start=273, blocks=1, type=LVID
start=274, blocks=9469, type=PSPACE
start=9743, blocks=1, type=ANCHOR
start=9744, blocks=239, type=USPACE
start=9983, blocks=16, type=RVDS
start=9999, blocks=1, type=ANCHOR
80b2bdd8ee523e4f0626737c6fa414e3de777aae /tmp/test.udf

###testing with default options:
mount: block device /tmp/test.udf is write-protected, mounting read-only
/tmp/test.udf on /mnt type udf (ro)
##Trying to add file
/home/user/test.sh: line 12: /mnt/testfile.txt: Read-only file system
75d8f7c00494eab728a146fcc404009bd39e6df4 /tmp/test.udf

###testing with explicit ro:
/tmp/test.udf on /mnt type udf (ro)
##Trying to add file
/home/user/test.sh: line 20: /mnt/testfile.txt: Read-only file system
75d8f7c00494eab728a146fcc404009bd39e6df4 /tmp/test.udf

###testing with explicit rw:
mount: block device /tmp/test.udf is write-protected, mounting read-only
/tmp/test.udf on /mnt type udf (ro)
##Trying to add file
/home/user/test.sh: line 29: /mnt/testfile.txt: Read-only file system
293b44fee384092087a50f2d5df186347a9408a2 /tmp/test.udf

Nem értem, hogy a centos miért mondja, hogy rw mountolt, miközben nem, de legalább konzekvensen tényleg nem nyúl hozzá. Az ubuntu láthatóan rw próbál mountolni, és úgy fest, hogy miközben a mount megszüli, hogy ez ro, aközben valamit csinál, amit nem kéne.

Kicseréltem mkisofsre (meg a .udfet .isora), az eredmény ugyanúgy fest:
centos:

###creating test file:
I: -input-charset not specified, using utf-8 (detected in locale settings)
Total translation table size: 0
Total rockridge attributes bytes: 0
Total directory bytes: 0
Path table size(bytes): 10
Max brk space used 0
418 extents written (0 MB)
9291d3dab4517513fb2e9fad35b93eff4fb5c1fc /tmp/test.iso

###testing with default options:
/tmp/test.iso on /mnt type udf (rw,loop=/dev/loop0)
##Trying to add file
./test.sh: line 15: /mnt/testfile.txt: Read-only file system
9291d3dab4517513fb2e9fad35b93eff4fb5c1fc /tmp/test.iso

###testing with explicit ro:
/tmp/test.iso on /mnt type udf (ro,loop=/dev/loop0)
##Trying to add file
./test.sh: line 23: /mnt/testfile.txt: Read-only file system
9291d3dab4517513fb2e9fad35b93eff4fb5c1fc /tmp/test.iso

###testing with explicit rw:
/tmp/test.iso on /mnt type udf (rw,loop=/dev/loop0)
##Trying to add file
./test.sh: line 32: /mnt/testfile.txt: Read-only file system
9291d3dab4517513fb2e9fad35b93eff4fb5c1fc /tmp/test.iso

ubi:

###creating test file:
I: -input-charset not specified, using utf-8 (detected in locale settings)
Total translation table size: 0
Total rockridge attributes bytes: 0
Total directory bytes: 0
Path table size(bytes): 10
Max brk space used 0
418 extents written (0 MB)
ec0f57f65c1fbf7aedefd813d441177d02c505fa /tmp/test.iso

###testing with default options:
mount: block device /tmp/test.iso is write-protected, mounting read-only
/tmp/test.iso on /mnt type udf (ro)
##Trying to add file
./test.sh: line 15: /mnt/testfile.txt: Read-only file system
a419ac3220682f57ed2d11def9bc8611620495be /tmp/test.iso

###testing with explicit ro:
/tmp/test.iso on /mnt type udf (ro)
##Trying to add file
./test.sh: line 23: /mnt/testfile.txt: Read-only file system
a419ac3220682f57ed2d11def9bc8611620495be /tmp/test.iso

###testing with explicit rw:
mount: block device /tmp/test.iso is write-protected, mounting read-only
/tmp/test.iso on /mnt type udf (ro)
##Trying to add file
./test.sh: line 32: /mnt/testfile.txt: Read-only file system
71f5eafc039b9c565e1cca9979e5e317058be42a /tmp/test.iso

SLED11-teszt nem hozza a hibát. Cserébe két érdekesség derült ki: az ebben levő cdrkit - illetve az ebben levő genisoimage mégis tud UDF-et (-udf opció ugyanúgy, mint az eredeti mkisofs-nél), cserébe nem is tudok udftools-t telepíteni, mert látszólag ehhez már nem csinálták meg a csomagot.

Én inkább a mountra gyanakodnék. Lehet, hogy lenne értelme megnézni, hogy pontosan mit is csinál az izé, de gyanús, hogy az ubuntu maintanere jobban ismeri ezeket az izéket belülről, mint én, és tekintve, hogy a többin úgy látom max non-destruktív hülyeség van (centos hazudni rw), én lehet őt dobnám meg először. Aztán max azt mondja, hogy upstream. De akkor legalább talán megmondja, hogy melyik :D