Modifications de fichiers sur une carte SD non-prises en compte

Bonjour à tous,

J’ai un problème sur un Raspberry Pi (B+). Au boot, l’heure est générée par fake-hwclock et me renvoie une date au 29/10/2015. Il bloque ensuite en essayant de monter la partition (parce que la partition indique avoir été montée à la date du 16/03/2016 donc plus tard que l’heure système).

Je monte donc la carte SD sur mon ordinateur et je veux forcer la date actuelle dans fake-hwclock.data , mes modifications sont bien sauvegardées.

$ sudo vim /media/SD/5d18be51-3217-4679-9c72-a54e0fc53d6b/etc/fake-hwclock.data
$ cat /media/SD/5d18be51-3217-4679-9c72-a54e0fc53d6b/etc/fake-hwclock.data
2016-03-17 11:12:00

Seulement, les modifications que j’ai faites sur le fichier disparaissent quand je démonte la carte SD.

$ sudo umount /dev/sdh1
$ sudo umount /dev/sdh2
(je retire et remet la carte SD)
$ cat /media/SD/5d18be51-3217-4679-9c72-a54e0fc53d6b/etc/fake-hwclock.data
2015-10-29 15:30:47

Je commence un peu à désespérer… :triumph: Quelqu’un peut m’expliquer pourquoi ce fichier ne s’enregistre pas correctement ?:slight_smile:

Merci d’avance!

[edit: Je me rends compte que c’est pareil pour d’autres fichiers (la modification de configuration réseau dans /etc/network/interfaces pas prise en compte non plus…)

J’ai passé la journée dessus, je n’arrive à rien du tout. Désespérant.

dmesg ne t’aide pas ?

Il me semble avoir déjà vue un article abordant le problème, cela survient lorsque le raspberry est déconnecté car il n’utilise pas le protocole RTC.
As-tu configuré un serveur de temps ?
Peux-tu nous renvoyer le contenu des fichiers suivants :

  • /etc/ntp.conf
  • /etc/cron.hourly/fake-hwclock

Le contenu de *var/log/dmesg :

$ sudo cat  /media/SD/5d18be51-3217-4679-9c72-a54e0fc53d6b/var/log/dmesg
[sudo] password for sim: 
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
[    0.000000] Linux version 4.1.7+ (dc4@dc4-XPS13-9333) (gcc version 4.8.3 20140303 (prerelease) (crosstool-NG linaro-1.13.1+bzr2650 - Linaro GCC 2014.03) ) #817 PREEMPT Sat Sep 19 15:25:36 BST 2015
[    0.000000] CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
[    0.000000] Machine model: Raspberry Pi Model B Plus Rev 1.2
[    0.000000] cma: Reserved 8 MiB at 0x1b800000
[    0.000000] Memory policy: Data cache writeback
[    0.000000] On node 0 totalpages: 114688
[    0.000000] free_area_init_node: node 0, pgdat c088beac, node_mem_map db403000
[    0.000000]   Normal zone: 1008 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 114688 pages, LIFO batch:31
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0 
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 113680
[    0.000000] Kernel command line: dma.dmachans=0x7f35 bcm2708_fb.fbwidth=1280 bcm2708_fb.fbheight=1024 bcm2708.boardrev=0x10 bcm2708.serial=0x566c67e4 smsc95xx.macaddr=B8:27:EB:6C:67:E4 bcm2708_fb.fbswap=1 bcm2708.disk_led_gpio=47 bcm2708.disk_led_active_low=0 sdhci-bcm2708.emmc_clock_freq=250000000 vc_mem.mem_base=0x1ec00000 vc_mem.mem_size=0x20000000  dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
[    0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Memory: 436504K/458752K available (6132K kernel code, 490K rwdata, 1780K rodata, 348K init, 720K bss, 14056K reserved, 8192K cma-reserved)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xdc800000 - 0xff000000   ( 552 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xdc000000   ( 448 MB)
[    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)
[    0.000000]       .text : 0xc0008000 - 0xc07c23ec   (7913 kB)
[    0.000000]       .init : 0xc07c3000 - 0xc081a000   ( 348 kB)
[    0.000000]       .data : 0xc081a000 - 0xc0894824   ( 491 kB)
[    0.000000]        .bss : 0xc0894824 - 0xc09489b0   ( 721 kB)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000] 	Additional per-CPU info printed with stalls.
[    0.000000] NR_IRQS:522
[    0.000000] clocksource stc: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275 ns
[    0.000015] sched_clock: 32 bits at 1000kHz, resolution 1000ns, wraps every 2147483647500ns
[    0.000057] Switching to timer-based delay loop, resolution 1000ns
[    0.000336] Console: colour dummy device 80x30
[    0.001740] console [tty1] enabled
[    0.001805] Calibrating delay loop (skipped), value calculated using timer frequency.. 2.00 BogoMIPS (lpj=10000)
[    0.001903] pid_max: default: 32768 minimum: 301
[    0.002277] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.002356] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.003452] Initializing cgroup subsys blkio
[    0.003551] Initializing cgroup subsys memory
[    0.003627] Initializing cgroup subsys devices
[    0.003693] Initializing cgroup subsys freezer
[    0.003758] Initializing cgroup subsys net_cls
[    0.003881] CPU: Testing write buffer coherency: ok
[    0.004010] ftrace: allocating 19773 entries in 58 pages
[    0.108945] Setting up static identity map for 0x81c0 - 0x81f8
[    0.111728] devtmpfs: initialized
[    0.122687] VFP support v0.3: implementor 41 architecture 1 part 20 variant b rev 5
[    0.123147] clocksource jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.125180] pinctrl core: initialized pinctrl subsystem
[    0.126136] NET: Registered protocol family 16
[    0.131737] DMA: preallocated 4096 KiB pool for atomic coherent allocations
[    0.133315] bcm2708.uart_clock = 3000000
[    0.138869] hw-breakpoint: found 6 breakpoint and 1 watchpoint registers.
[    0.138964] hw-breakpoint: maximum watchpoint size is 4 bytes.
[    0.139154] Serial: AMBA PL011 UART driver
[    0.139469] 20201000.uart: ttyAMA0 at MMIO 0x20201000 (irq = 83, base_baud = 0) is a PL011 rev2
[    0.527150] console [ttyAMA0] enabled
[    0.531557] bcm2835-mbox 2000b880.mailbox: mailbox enabled
[    0.599720] bcm2708-dmaengine 20007000.dma: DMA legacy API manager at f2007000, dmachans=0xf35
[    0.608612] bcm2708-dmaengine 20007000.dma: Initialized 7 DMA channels (+ 1 legacy)
[    0.617129] bcm2708-dmaengine 20007000.dma: Load BCM2835 DMA engine driver
[    0.624130] bcm2708-dmaengine 20007000.dma: dma_debug:0
[    0.630327] SCSI subsystem initialized
[    0.634567] usbcore: registered new interface driver usbfs
[    0.640227] usbcore: registered new interface driver hub
[    0.645827] usbcore: registered new device driver usb
[    0.651910] raspberrypi-firmware soc:firmware: Attached to firmware from 2015-09-23 12:12
[    0.687766] Switched to clocksource stc
[    0.738948] FS-Cache: Loaded
[    0.742270] CacheFiles: Loaded
[    0.762068] NET: Registered protocol family 2
[    0.768107] TCP established hash table entries: 4096 (order: 2, 16384 bytes)
[    0.775314] TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
[    0.782118] TCP: Hash tables configured (established 4096 bind 4096)
[    0.788687] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.794590] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.801350] NET: Registered protocol family 1
[    0.806380] RPC: Registered named UNIX socket transport module.
[    0.812509] RPC: Registered udp transport module.
[    0.817259] RPC: Registered tcp transport module.
[    0.822044] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.829844] hw perfevents: enabled with armv6_1176 PMU driver, 3 counters available
[    0.839154] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.861688] VFS: Disk quotas dquot_6.6.0
[    0.866084] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.875753] FS-Cache: Netfs 'nfs' registered for caching
[    0.882858] NFS: Registering the id_resolver key type
[    0.888201] Key type id_resolver registered
[    0.892437] Key type id_legacy registered
[    0.900458] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
[    0.908565] io scheduler noop registered
[    0.912580] io scheduler deadline registered (default)
[    0.918345] io scheduler cfq registered
[    0.924702] BCM2708FB: allocated DMA memory 5bc00000
[    0.930062] BCM2708FB: allocated DMA channel 0 @ f2007000
[    0.953358] Console: switching to colour frame buffer device 160x64
[    0.973358] Serial: 8250/16550 driver, 0 ports, IRQ sharing disabled
[    0.981647] vc-cma: Videocore CMA driver
[    0.985706] vc-cma: vc_cma_base      = 0x00000000
[    0.990682] vc-cma: vc_cma_size      = 0x00000000 (0 MiB)
[    0.996213] vc-cma: vc_cma_initial   = 0x00000000 (0 MiB)
[    1.002227] vc-mem: phys_addr:0x00000000 mem_base=0x1ec00000 mem_size:0x20000000(512 MiB)
[    1.031382] brd: module loaded
[    1.044348] loop: module loaded
[    1.049006] vchiq: vchiq_init_state: slot_zero = 0xdbc80000, is_master = 0
[    1.058246] Loading iSCSI transport class v2.0-870.
[    1.064849] usbcore: registered new interface driver smsc95xx
[    1.071138] dwc_otg: version 3.00a 10-AUG-2012 (platform bus)
[    1.277368] Core Release: 2.80a
[    1.280745] Setting default values for core params
[    1.285695] Finished setting default values for core params
[    1.491766] Using Buffer DMA mode
[    1.495196] Periodic Transfer Interrupt Enhancement - disabled
[    1.501208] Multiprocessor Interrupt Enhancement - disabled
[    1.506912] OTG VER PARAM: 0, OTG VER FLAG: 0
[    1.511421] Dedicated Tx FIFOs mode
[    1.515466] WARN::dwc_otg_hcd_init:1047: FIQ DMA bounce buffers: virt = 0xdbc14000 dma = 0x5bc14000 len=9024
[    1.525600] FIQ FSM acceleration enabled for :
[    1.525600] Non-periodic Split Transactions
[    1.525600] Periodic Split Transactions
[    1.525600] High-Speed Isochronous Endpoints
[    1.542771] dwc_otg: Microframe scheduler enabled
[    1.542900] WARN::hcd_init_fiq:412: FIQ on core 0 at 0xc0423ab8
[    1.548965] WARN::hcd_init_fiq:413: FIQ ASM at 0xc0423d90 length 36
[    1.555373] WARN::hcd_init_fiq:438: MPHI regs_base at 0xdc896000
[    1.561641] dwc_otg 20980000.usb: DWC OTG Controller
[    1.571913] dwc_otg 20980000.usb: new USB bus registered, assigned bus number 1
[    1.584505] dwc_otg 20980000.usb: irq 32, io mem 0x00000000
[    1.595290] Init: Port Power? op_state=1
[    1.604304] Init: Power Port (0)
[    1.612983] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    1.624951] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.637299] usb usb1: Product: DWC OTG Controller
[    1.647087] usb usb1: Manufacturer: Linux 4.1.7+ dwc_otg_hcd
[    1.657828] usb usb1: SerialNumber: 20980000.usb
[    1.668663] hub 1-0:1.0: USB hub found
[    1.677592] hub 1-0:1.0: 1 port detected
[    1.687339] dwc_otg: FIQ enabled
[    1.687366] dwc_otg: NAK holdoff enabled
[    1.687381] dwc_otg: FIQ split-transaction FSM enabled
[    1.687445] Module dwc_common_port init
[    1.688218] usbcore: registered new interface driver usb-storage
[    1.700084] mousedev: PS/2 mouse device common for all mice
[    1.712126] bcm2835-cpufreq: min=700000 max=700000
[    1.722663] sdhci: Secure Digital Host Controller Interface driver
[    1.734067] sdhci: Copyright(c) Pierre Ossman
[    1.744270] mmc-bcm2835 20300000.mmc: mmc_debug:0 mmc_debug2:0
[    1.755260] mmc-bcm2835 20300000.mmc: DMA channels allocated
[    1.798278] sdhci-pltfm: SDHCI platform and OF driver helper
[    1.817578] ledtrig-cpu: registered to indicate activity on CPUs
[    1.830307] hidraw: raw HID events driver (C) Jiri Kosina
[    1.843416] usbcore: registered new interface driver usbhid
[    1.856215] usbhid: USB HID core driver
[    1.868956] Initializing XFRM netlink socket
[    1.878522] Indeed it is in host mode hprt0 = 00021501
[    1.888892] NET: Registered protocol family 17
[    1.908099] Key type dns_resolver registered
[    1.925167] registered taskstats version 1
[    1.934531] mmc0: host does not support reading read-only switch, assuming write-enable
[    1.958175] vc-sm: Videocore shared memory driver
[    1.977955] [vc_sm_connected_init]: start
[    1.987290] mmc0: new high speed SDHC card at address 59b4
[    2.009053] mmcblk0: mmc0:59b4 00000 7.35 GiB 
[    2.028312] [vc_sm_connected_init]: end - returning 0
[    2.040319]  mmcblk0: p1 p2
[    2.086587] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[    2.100325] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.
[    2.114332] devtmpfs: mounted
[    2.123855] Freeing unused kernel memory: 348K (c07c3000 - c081a000)
[    2.167908] usb 1-1: new high-speed USB device number 2 using dwc_otg
[    2.179965] Indeed it is in host mode hprt0 = 00001101
[    2.388373] usb 1-1: New USB device found, idVendor=0424, idProduct=9514
[    2.401775] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    2.419596] hub 1-1:1.0: USB hub found
[    2.430133] hub 1-1:1.0: 5 ports detected
[    2.717956] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
[    2.828325] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00
[    2.841082] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    2.857273] smsc95xx v1.0.4
[    2.925621] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-20980000.usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:6c:67:e4
[    3.177861] usb 1-1.3: new low-speed USB device number 4 using dwc_otg
[    3.323098] usb 1-1.3: New USB device found, idVendor=04f3, idProduct=0110
[    3.335658] usb 1-1.3: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    3.366363] input: HID 04f3:0110 as /devices/platform/soc/20980000.usb/usb1/1-1/1-1.3/1-1.3:1.0/0003:04F3:0110.0001/input/input0
[    3.438335] hid-generic 0003:04F3:0110.0001: input,hidraw0: USB HID v1.10 Keyboard [HID 04f3:0110] on usb-20980000.usb-1.3/input0
[    3.483324] input: HID 04f3:0110 as /devices/platform/soc/20980000.usb/usb1/1-1/1-1.3/1-1.3:1.1/0003:04F3:0110.0002/input/input1
[    3.558601] hid-generic 0003:04F3:0110.0002: input,hidraw1: USB HID v1.10 Mouse [HID 04f3:0110] on usb-20980000.usb-1.3/input1
[    5.290086] udevd[159]: starting version 175
[    6.910490] gpiomem-bcm2835 20200000.gpiomem: Initialised: Registers at 0x20200000
[    8.580282] random: nonblocking pool is initialized
[   12.046246] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[   12.738606] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[   22.951469] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
[   24.556244] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xC1E1

Le contenu du *etc/ntp.conf :

# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help
driftfile /var/lib/ntp/ntp.drift

# Enable this if you want statistics to be logged.
#statsdir /var/log/ntpstats/

statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable

# You do need to talk to an NTP server or two (or three).
#server ntp.your-provider.example

# pool.ntp.org maps to about 1000 low-stratum NTP servers.  Your server will
# pick a different set every time it starts up.  Please consider joining the
# pool: <http://www.pool.ntp.org/join.html>
#server 0.debian.pool.ntp.org iburst
#server 1.debian.pool.ntp.org iburst
#server 2.debian.pool.ntp.org iburst
#server 3.debian.pool.ntp.org iburst
# serveur ntp local
server 10.xxx.yyy.zzz iburst dynamic

# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
# details.  The web page <http://support.ntp.org/bin/view/Support/AccessRestrictions>
# might also be helpful.
#
# Note that "restrict" applies to both servers and clients, so a configuration
# that might be intended to block requests from certain clients could also end
# up blocking replies from your own upstream servers.

# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery

# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1

# Clients from this (example!) subnet have unlimited access, but only if
# cryptographically authenticated.
#restrict 192.168.123.0 mask 255.255.255.0 notrust

# If you want to provide time to your local subnet, change the next line.
# (Again, the address is an example only.)
#broadcast 192.168.123.255

# If you want to listen to time broadcasts on your local subnet, de-comment the
# next lines.  Please do this only if you trust everybody on the network!
#disable auth
#broadcastclient

Le contenu de *etc/cron.hourly/fake-hwclock :

#!/bin/sh
#
# Simple cron script - save the current clock periodically in case of
# a power failure or other crash

if (command -v fake-hwclock >/dev/null 2>&1) ; then
  fake-hwclock save
fi

Quand je mets la carte SD et que je branche l’alimentation de mon Raspberry, j’arrive sur ces messages :

Starting fake hwclock: loading system time.
Thu Oct 29 15:30:47 UTC 2015
(...)
/dev/mmcblk0p2: Superblock last mount time (Wed Mar 16 13:38:04 2016, now = Thu Oct 29 16:30:49 2015) is in the future.
/dev/mmcblk0p2: UNEXPECTED INCONSISTENCY: RUN fsck MANUALLY. (i.e., without -a or -p options)

Mais après ça, il ne me rend pas la main pour lancer fsck… Donc je voulais accéder au fichier dans lequel fake-hwclock écrit et lit son “heure” ( *etc/fake-hwclock.data ) mais les modifications que j’y fais ne s’enregistrent pas comme je l’ai expliqué au premier message.

[Edit: J’ai utilisé la fonction “répondre à un message” pour essayer que ce soit clair mais je ne sais pas si c’est la meilleure manière de faire… (Faut un peu de temps pour s’habituer à Discourse. :slight_smile: