# error retrieving current directory: getcwd:

## funkoolow

salve a tutti,

improvvisamente ricevo questo output praticamente per ogni servizio che provo a manipolare, nell'esempio c'è l'output che ottengo riavviando apache.

```

funkserver # /etc/init.d/apache2 restart

shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

 * Stopping apache2 ...

job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory                          [ ok ]

job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

 * Starting apache2 ...

job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory                          [ ok ]

job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

chdir: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

```

passato l'infarto, ho notato che cmq il servizio e tutto il resto sembra funzionare normalmente (nell'esempio sopra, apache si è correttamente riavviato).

cosa può essere? di recente non mi sembra di aver aggiornato niente di fondamentale.

----------

## Ic3M4n

mmm, questo te lo fa sempre? o ti è successo una volta sola? L'errore "impossibile ottenere la dir corrente" può essere dato dal fatto che una volta entrato in una directory l'hai rinominata o eliminata. Nel tal caso ti basta cambiare la dir...

scusa, lo so che ho detto una cosa banale ma una volta mi è successa la stessa cosa e mi sono dato dell'idiota 5 minuti dopo quando ho ripensato con calma alle cose che avevo fatto.

----------

## djinnZ

revdep-rebuild && etc-update

----------

## funkoolow

mah, non so che dire, il problema è svanito ed ora i servizi si riavviano più silenziosamente.

Il revdep non segnalava niente da riemergere, così come l'etc-update niente da aggiornare.

riguardo ad eventuale cambiamento di cartelle, non ricordo di aver cambiato assolutamente niente, al massimo avrò smontato un disco che uso per fare i backup, ma non ero nella cartella pertinente (altrimenti non mi avrebbe fatto smontare).

questo getcwd tirato in ballo che cos'è?

----------

## djinnZ

 :Razz:   :Razz:   :Razz:  

```
man getcwd
```

----------

## mattylux

il motivo e che si trova in una directory cancellata.... da un altra konsole

prova a spostarti un altra vedi che il problema sparisce...

----------

## Peach

 *djinnZ wrote:*   

>    
> 
> ```
> man getcwd
> ```
> ...

 

io sotto GNU/Linux, non ho quel comando

qui me la da solo come system call, quindi - sinceramente - non capisco com'è che uno script di avvio spari fuori quella roba lì

tra l'altro ho fatto una prova

```
~ # mkdir temp

~ # cd temp/

temp # pwd

/root/temp
```

da un'altra parte ho dato:

```
~ # rmdir temp
```

tornando di là:

```
temp # /etc/init.d/apache2 restart

* Stopping apache2...[ ok ]

* Starting apache2...[ ok ]

temp # pwd

/root/temp

temp # ls -la

totale 0

temp # ls -la ../temp

ls: impossibile accedere a ../temp: No such file or directory
```

 :Very Happy: 

qui niente pax grsec o robe hard del genere...

però rimane comunque possibile che un programma c che usa getcwd() possa sparare fuori un po' di errori. Non capisco perché dovrebbe farlo apache, tramite initscript (al massimo lo fa l'eseguibile di apache e il suo output dovrebbe essere gestito da syslog... TEORICAMENTE)

----------

