rackerlabs / kthresher

Tool to remove unused kernels in Debian/Ubuntu
Apache License 2.0
17 stars 12 forks source link

kthresher assumes there is always a socket for logging #76

Closed tonyskapunk closed 5 years ago

tonyskapunk commented 5 years ago

It was reported[1] that when running kthresher in a container the lack of system log causes a failure:

>   root@9a7817d2b17c:/debian# kthresher                                                                                     
>   INFO: No kernel packages available for autoremoval.                                                                      
>   --- Logging error ---                                                                                                    
>   Traceback (most recent call last):                                                                                       
>     File "/usr/lib/python3.7/logging/handlers.py", line 933, in emit                                                       
>       self.socket.send(msg)                                                                                                
>   OSError: [Errno 9] Bad file descriptor                                                                                   
>                                                                                                                            
>   During handling of the above exception, another exception occurred:                                                      
>                                                                                                                            
>   Traceback (most recent call last):                                                                                       
>     File "/usr/lib/python3.7/logging/handlers.py", line 854, in _connect_unixsocket                                        
>       self.socket.connect(address)                                                                                         
>   FileNotFoundError: [Errno 2] No such file or directory   

This is due to the assumption that /dev/log is always available: https://github.com/rackerlabs/kthresher/blob/master/kthresher.py#L433

[1] https://groups.google.com/forum/#!topic/kthresher-dev/XVZkhvtnXfA